| OLD | NEW |
| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 8 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
| 9 #include "gpu/command_buffer/service/cmd_buffer_engine.h" | 9 #include "gpu/command_buffer/service/cmd_buffer_engine.h" |
| 10 #include "gpu/command_buffer/service/error_state_mock.h" | 10 #include "gpu/command_buffer/service/error_state_mock.h" |
| (...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 decoder_->GetGLContext()->CreateGPUTimingClient()->SetCpuTimeForTesting( | 807 decoder_->GetGLContext()->CreateGPUTimingClient()->SetCpuTimeForTesting( |
| 808 base::Bind(&gfx::GPUTimingFake::GetFakeCPUTime)); | 808 base::Bind(&gfx::GPUTimingFake::GetFakeCPUTime)); |
| 809 | 809 |
| 810 QueryManager::Query* query = manager_->CreateQuery( | 810 QueryManager::Query* query = manager_->CreateQuery( |
| 811 kTarget, kClient1Id, kSharedMemoryId, kSharedMemoryOffset); | 811 kTarget, kClient1Id, kSharedMemoryId, kSharedMemoryOffset); |
| 812 ASSERT_TRUE(query != NULL); | 812 ASSERT_TRUE(query != NULL); |
| 813 | 813 |
| 814 const uint64_t expected_result = | 814 const uint64_t expected_result = |
| 815 100u * base::Time::kNanosecondsPerMicrosecond; | 815 100u * base::Time::kNanosecondsPerMicrosecond; |
| 816 fake_timing_queries.SetCurrentGLTime(expected_result); | 816 fake_timing_queries.SetCurrentGLTime(expected_result); |
| 817 fake_timing_queries.ExpectGPUTimeStampQuery(*gl_, false); | 817 fake_timing_queries.ExpectGPUTimeStampQuery(*gl_, false, true); |
| 818 EXPECT_TRUE(manager_->QueryCounter(query, kSubmitCount)); | 818 EXPECT_TRUE(manager_->QueryCounter(query, kSubmitCount)); |
| 819 EXPECT_TRUE(manager_->ProcessPendingQueries(false)); | 819 EXPECT_TRUE(manager_->ProcessPendingQueries(false)); |
| 820 | 820 |
| 821 QuerySync* sync = decoder_->GetSharedMemoryAs<QuerySync*>( | 821 QuerySync* sync = decoder_->GetSharedMemoryAs<QuerySync*>( |
| 822 kSharedMemoryId, kSharedMemoryOffset, sizeof(*sync)); | 822 kSharedMemoryId, kSharedMemoryOffset, sizeof(*sync)); |
| 823 EXPECT_EQ(expected_result, sync->result); | 823 EXPECT_EQ(expected_result, sync->result); |
| 824 | 824 |
| 825 manager_->Destroy(false); | 825 manager_->Destroy(false); |
| 826 } | 826 } |
| 827 | 827 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 845 const GLenum kTarget = GL_TIMESTAMP_EXT; | 845 const GLenum kTarget = GL_TIMESTAMP_EXT; |
| 846 const base::subtle::Atomic32 kSubmitCount = 123; | 846 const base::subtle::Atomic32 kSubmitCount = 123; |
| 847 | 847 |
| 848 QueryManager::Query* query = manager_->CreateQuery( | 848 QueryManager::Query* query = manager_->CreateQuery( |
| 849 kTarget, kClient1Id, kSharedMemoryId, kSharedMemoryOffset); | 849 kTarget, kClient1Id, kSharedMemoryId, kSharedMemoryOffset); |
| 850 ASSERT_TRUE(query != NULL); | 850 ASSERT_TRUE(query != NULL); |
| 851 | 851 |
| 852 // Disjoint happening before the query should not trigger a disjoint event. | 852 // Disjoint happening before the query should not trigger a disjoint event. |
| 853 fake_timing_queries.SetDisjoint(); | 853 fake_timing_queries.SetDisjoint(); |
| 854 | 854 |
| 855 fake_timing_queries.ExpectGPUTimeStampQuery(*gl_, false); | 855 fake_timing_queries.ExpectGPUTimeStampQuery(*gl_, false, true); |
| 856 EXPECT_TRUE(manager_->QueryCounter(query, kSubmitCount)); | 856 EXPECT_TRUE(manager_->QueryCounter(query, kSubmitCount)); |
| 857 EXPECT_TRUE(manager_->ProcessPendingQueries(false)); | 857 EXPECT_TRUE(manager_->ProcessPendingQueries(false)); |
| 858 | 858 |
| 859 EXPECT_TRUE(query->IsFinished()); | 859 EXPECT_TRUE(query->IsFinished()); |
| 860 EXPECT_EQ(current_disjoint_value, disjoint_sync->GetDisjointCount()); | 860 EXPECT_EQ(current_disjoint_value, disjoint_sync->GetDisjointCount()); |
| 861 | 861 |
| 862 // Disjoint happening during query should trigger disjoint event. | 862 // Disjoint happening during query should trigger disjoint event. |
| 863 fake_timing_queries.ExpectGPUTimeStampQuery(*gl_, false); | 863 fake_timing_queries.ExpectGPUTimeStampQuery(*gl_, false, false); |
| 864 EXPECT_TRUE(manager_->QueryCounter(query, kSubmitCount)); | 864 EXPECT_TRUE(manager_->QueryCounter(query, kSubmitCount)); |
| 865 fake_timing_queries.SetDisjoint(); | 865 fake_timing_queries.SetDisjoint(); |
| 866 EXPECT_TRUE(manager_->ProcessPendingQueries(false)); | 866 EXPECT_TRUE(manager_->ProcessPendingQueries(false)); |
| 867 | 867 |
| 868 EXPECT_TRUE(query->IsFinished()); | 868 EXPECT_TRUE(query->IsFinished()); |
| 869 EXPECT_NE(current_disjoint_value, disjoint_sync->GetDisjointCount()); | 869 EXPECT_NE(current_disjoint_value, disjoint_sync->GetDisjointCount()); |
| 870 | 870 |
| 871 manager_->Destroy(false); | 871 manager_->Destroy(false); |
| 872 } | 872 } |
| 873 | 873 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 893 EXPECT_EQ(current_disjoint_value, disjoint_sync->GetDisjointCount()); | 893 EXPECT_EQ(current_disjoint_value, disjoint_sync->GetDisjointCount()); |
| 894 | 894 |
| 895 const GLuint kClient1Id = 1; | 895 const GLuint kClient1Id = 1; |
| 896 const GLenum kTarget = GL_TIMESTAMP_EXT; | 896 const GLenum kTarget = GL_TIMESTAMP_EXT; |
| 897 const base::subtle::Atomic32 kSubmitCount = 123; | 897 const base::subtle::Atomic32 kSubmitCount = 123; |
| 898 | 898 |
| 899 QueryManager::Query* query = manager_->CreateQuery( | 899 QueryManager::Query* query = manager_->CreateQuery( |
| 900 kTarget, kClient1Id, kSharedMemoryId, kSharedMemoryOffset); | 900 kTarget, kClient1Id, kSharedMemoryId, kSharedMemoryOffset); |
| 901 ASSERT_TRUE(query != NULL); | 901 ASSERT_TRUE(query != NULL); |
| 902 | 902 |
| 903 fake_timing_queries.ExpectGPUTimeStampQuery(*gl_, false); | 903 fake_timing_queries.ExpectGPUTimeStampQuery(*gl_, false, true); |
| 904 EXPECT_TRUE(manager_->QueryCounter(query, kSubmitCount)); | 904 EXPECT_TRUE(manager_->QueryCounter(query, kSubmitCount)); |
| 905 EXPECT_TRUE(manager_->ProcessPendingQueries(false)); | 905 EXPECT_TRUE(manager_->ProcessPendingQueries(false)); |
| 906 | 906 |
| 907 EXPECT_EQ(current_disjoint_value, disjoint_sync->GetDisjointCount()); | 907 EXPECT_EQ(current_disjoint_value, disjoint_sync->GetDisjointCount()); |
| 908 fake_timing_queries.SetDisjoint(); | 908 fake_timing_queries.SetDisjoint(); |
| 909 manager_->ProcessFrameBeginUpdates(); | 909 manager_->ProcessFrameBeginUpdates(); |
| 910 EXPECT_NE(current_disjoint_value, disjoint_sync->GetDisjointCount()); | 910 EXPECT_NE(current_disjoint_value, disjoint_sync->GetDisjointCount()); |
| 911 | 911 |
| 912 manager_->Destroy(false); | 912 manager_->Destroy(false); |
| 913 } | 913 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 947 | 947 |
| 948 EXPECT_EQ(static_cast<GLuint>(GL_INVALID_ENUM), sync->result); | 948 EXPECT_EQ(static_cast<GLuint>(GL_INVALID_ENUM), sync->result); |
| 949 | 949 |
| 950 manager->Destroy(false); | 950 manager->Destroy(false); |
| 951 } | 951 } |
| 952 | 952 |
| 953 } // namespace gles2 | 953 } // namespace gles2 |
| 954 } // namespace gpu | 954 } // namespace gpu |
| 955 | 955 |
| 956 | 956 |
| OLD | NEW |