Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc

Issue 1687353002: Force time elapsed queries on certain drivers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add bug to commit message Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 EXPECT_CALL(*gl, IsSync(kGlSync)) 621 EXPECT_CALL(*gl, IsSync(kGlSync))
622 .WillRepeatedly(Return(GL_TRUE)); 622 .WillRepeatedly(Return(GL_TRUE));
623 #endif 623 #endif
624 } 624 }
625 625
626 EndQueryEXT end_cmd; 626 EndQueryEXT end_cmd;
627 end_cmd.Init(target, submit_count); 627 end_cmd.Init(target, submit_count);
628 return test->ExecuteCmd(end_cmd); 628 return test->ExecuteCmd(end_cmd);
629 } 629 }
630 630
631 // Note: If the extensions GL_ARB_timer_query or GL_EXT_disjoint_timer_query are
632 // loaded, timestamp queries do an implicit call of glGetQueryiv() to determine
633 // if a fallback to elapsed time queries is needed. The fake timer query
634 // emulates this call and returns a value such that a fallback is not needed. If
635 // this method is being called with either of those extensions enabled (and not
636 // GL_EXT_timer_query), set check_timestamp_bits to true on the first call and
637 // set it to false on ALL subsequent calls. If using GL_EXT_timer_query,
638 // check_timestamp_bits should always be false
631 static error::Error ExecuteQueryCounterCmd(GLES2DecoderTestBase* test, 639 static error::Error ExecuteQueryCounterCmd(GLES2DecoderTestBase* test,
632 ::gfx::MockGLInterface* gl, 640 ::gfx::MockGLInterface* gl,
633 ::gfx::GPUTimingFake* timing_queries, 641 ::gfx::GPUTimingFake* timing_queries,
634 GLenum target, 642 GLenum target,
635 GLuint client_id, 643 GLuint client_id,
636 GLuint service_id, 644 GLuint service_id,
637 int32_t shm_id, 645 int32_t shm_id,
638 uint32_t shm_offset, 646 uint32_t shm_offset,
639 uint32_t submit_count) { 647 uint32_t submit_count,
648 bool check_timestamp_bits) {
640 if (GL_TIMESTAMP == target) { 649 if (GL_TIMESTAMP == target) {
641 timing_queries->ExpectGPUTimeStampQuery(*gl, false); 650 timing_queries->ExpectGPUTimeStampQuery(*gl, false, check_timestamp_bits);
642 } 651 }
643 652
644 QueryCounterEXT query_counter_cmd; 653 QueryCounterEXT query_counter_cmd;
645 query_counter_cmd.Init(client_id, 654 query_counter_cmd.Init(client_id,
646 target, 655 target,
647 shm_id, 656 shm_id,
648 shm_offset, 657 shm_offset,
649 submit_count); 658 submit_count);
650 return test->ExecuteCmd(query_counter_cmd); 659 return test->ExecuteCmd(query_counter_cmd);
651 } 660 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 ::gfx::GPUTimingFake gpu_timing_queries; 707 ::gfx::GPUTimingFake gpu_timing_queries;
699 708
700 ExecuteGenerateQueryCmd(test, gl, query_type.type, 709 ExecuteGenerateQueryCmd(test, gl, query_type.type,
701 client_id, service_id); 710 client_id, service_id);
702 711
703 // Test bad shared memory fails 712 // Test bad shared memory fails
704 error::Error error1 = error::kNoError; 713 error::Error error1 = error::kNoError;
705 error::Error error2 = error::kNoError; 714 error::Error error2 = error::kNoError;
706 if (query_type.is_counter) { 715 if (query_type.is_counter) {
707 error1 = ExecuteQueryCounterCmd(test, gl, &gpu_timing_queries, 716 error1 = ExecuteQueryCounterCmd(test, gl, &gpu_timing_queries,
708 query_type.type, 717 query_type.type, client_id, service_id,
709 client_id, service_id, 718 shm_id, shm_offset, 1, true);
710 shm_id, shm_offset, 1);
711 } else { 719 } else {
712 error1 = ExecuteBeginQueryCmd(test, gl, &gpu_timing_queries, 720 error1 = ExecuteBeginQueryCmd(test, gl, &gpu_timing_queries,
713 query_type.type, 721 query_type.type,
714 client_id, service_id, 722 client_id, service_id,
715 shm_id, shm_offset); 723 shm_id, shm_offset);
716 error2 = ExecuteEndQueryCmd(test, gl, query_type.type, 1); 724 error2 = ExecuteEndQueryCmd(test, gl, query_type.type, 1);
717 } 725 }
718 726
719 bool process_success = ProcessQuery(test, gl, query_type.type, service_id); 727 bool process_success = ProcessQuery(test, gl, query_type.type, service_id);
720 728
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 init.bind_generates_resource = true; 778 init.bind_generates_resource = true;
771 InitDecoder(init); 779 InitDecoder(init);
772 ::testing::StrictMock< ::gfx::MockGLInterface>* gl = GetGLMock(); 780 ::testing::StrictMock< ::gfx::MockGLInterface>* gl = GetGLMock();
773 ::gfx::GPUTimingFake gpu_timing_queries; 781 ::gfx::GPUTimingFake gpu_timing_queries;
774 782
775 ExecuteGenerateQueryCmd(this, gl, query_type.type, 783 ExecuteGenerateQueryCmd(this, gl, query_type.type,
776 kNewClientId, kNewServiceId); 784 kNewClientId, kNewServiceId);
777 785
778 // Query once. 786 // Query once.
779 if (query_type.is_counter) { 787 if (query_type.is_counter) {
780 EXPECT_EQ(error::kNoError, ExecuteQueryCounterCmd(this, gl, 788 EXPECT_EQ(
781 &gpu_timing_queries, 789 error::kNoError,
782 query_type.type, 790 ExecuteQueryCounterCmd(this, gl, &gpu_timing_queries, query_type.type,
783 kNewClientId, 791 kNewClientId, kNewServiceId, kSharedMemoryId,
784 kNewServiceId, 792 kSharedMemoryOffset, 1, true));
785 kSharedMemoryId,
786 kSharedMemoryOffset,
787 1));
788 } else { 793 } else {
789 EXPECT_EQ(error::kNoError, ExecuteBeginQueryCmd(this, gl, 794 EXPECT_EQ(error::kNoError, ExecuteBeginQueryCmd(this, gl,
790 &gpu_timing_queries, 795 &gpu_timing_queries,
791 query_type.type, 796 query_type.type,
792 kNewClientId, 797 kNewClientId,
793 kNewServiceId, 798 kNewServiceId,
794 kSharedMemoryId, 799 kSharedMemoryId,
795 kSharedMemoryOffset)); 800 kSharedMemoryOffset));
796 EXPECT_EQ(error::kNoError, ExecuteEndQueryCmd(this, gl, 801 EXPECT_EQ(error::kNoError, ExecuteEndQueryCmd(this, gl,
797 query_type.type, 1)); 802 query_type.type, 1));
798 } 803 }
799 804
800 EXPECT_TRUE(ProcessQuery(this, gl, query_type.type, kNewServiceId)); 805 EXPECT_TRUE(ProcessQuery(this, gl, query_type.type, kNewServiceId));
801 806
802 // Reuse query. 807 // Reuse query.
803 if (query_type.is_counter) { 808 if (query_type.is_counter) {
804 EXPECT_EQ(error::kNoError, ExecuteQueryCounterCmd(this, gl, 809 EXPECT_EQ(
805 &gpu_timing_queries, 810 error::kNoError,
806 query_type.type, 811 ExecuteQueryCounterCmd(this, gl, &gpu_timing_queries, query_type.type,
807 kNewClientId, 812 kNewClientId, kNewServiceId, kSharedMemoryId,
808 kNewServiceId, 813 kSharedMemoryOffset, 2, false));
809 kSharedMemoryId,
810 kSharedMemoryOffset,
811 2));
812 } else { 814 } else {
813 EXPECT_EQ(error::kNoError, ExecuteBeginQueryCmd(this, gl, 815 EXPECT_EQ(error::kNoError, ExecuteBeginQueryCmd(this, gl,
814 &gpu_timing_queries, 816 &gpu_timing_queries,
815 query_type.type, 817 query_type.type,
816 kNewClientId, 818 kNewClientId,
817 kNewServiceId, 819 kNewServiceId,
818 kSharedMemoryId, 820 kSharedMemoryId,
819 kSharedMemoryOffset)); 821 kSharedMemoryOffset));
820 EXPECT_EQ(error::kNoError, ExecuteEndQueryCmd(this, gl, 822 EXPECT_EQ(error::kNoError, ExecuteEndQueryCmd(this, gl,
821 query_type.type, 2)); 823 query_type.type, 2));
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1022 init.has_alpha = true; 1024 init.has_alpha = true;
1023 init.request_alpha = true; 1025 init.request_alpha = true;
1024 init.bind_generates_resource = true; 1026 init.bind_generates_resource = true;
1025 InitDecoder(init); 1027 InitDecoder(init);
1026 1028
1027 GenHelper<GenQueriesEXTImmediate>(kNewClientId); 1029 GenHelper<GenQueriesEXTImmediate>(kNewClientId);
1028 1030
1029 EXPECT_CALL(*gl_, GenQueries(1, _)) 1031 EXPECT_CALL(*gl_, GenQueries(1, _))
1030 .WillOnce(SetArgPointee<1>(kNewServiceId)) 1032 .WillOnce(SetArgPointee<1>(kNewServiceId))
1031 .RetiresOnSaturation(); 1033 .RetiresOnSaturation();
1034 EXPECT_CALL(*gl_, GetQueryiv(GL_TIMESTAMP, GL_QUERY_COUNTER_BITS, _))
1035 .WillOnce(SetArgPointee<2>(64))
1036 .RetiresOnSaturation();
1032 EXPECT_CALL(*gl_, QueryCounter(kNewServiceId, GL_TIMESTAMP)) 1037 EXPECT_CALL(*gl_, QueryCounter(kNewServiceId, GL_TIMESTAMP))
1033 .Times(1) 1038 .Times(1)
1034 .RetiresOnSaturation(); 1039 .RetiresOnSaturation();
1035 QueryCounterEXT query_counter_cmd; 1040 QueryCounterEXT query_counter_cmd;
1036 query_counter_cmd.Init(kNewClientId, 1041 query_counter_cmd.Init(kNewClientId,
1037 GL_TIMESTAMP, 1042 GL_TIMESTAMP,
1038 kSharedMemoryId, 1043 kSharedMemoryId,
1039 kSharedMemoryOffset, 1044 kSharedMemoryOffset,
1040 1); 1045 1);
1041 EXPECT_EQ(error::kNoError, ExecuteCmd(query_counter_cmd)); 1046 EXPECT_EQ(error::kNoError, ExecuteCmd(query_counter_cmd));
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
1548 INSTANTIATE_TEST_CASE_P(Service, GLES2DecoderDoCommandsTest, ::testing::Bool()); 1553 INSTANTIATE_TEST_CASE_P(Service, GLES2DecoderDoCommandsTest, ::testing::Bool());
1549 1554
1550 INSTANTIATE_TEST_CASE_P(Service, GLES3DecoderTest, ::testing::Bool()); 1555 INSTANTIATE_TEST_CASE_P(Service, GLES3DecoderTest, ::testing::Bool());
1551 1556
1552 INSTANTIATE_TEST_CASE_P(Service, 1557 INSTANTIATE_TEST_CASE_P(Service,
1553 GLES3DecoderWithESSL3ShaderTest, 1558 GLES3DecoderWithESSL3ShaderTest,
1554 ::testing::Bool()); 1559 ::testing::Bool());
1555 1560
1556 } // namespace gles2 1561 } // namespace gles2
1557 } // namespace gpu 1562 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/service/gpu_tracer_unittest.cc » ('j') | ui/gl/gpu_timing_fake.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698