OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
| 7 #include <memory> |
| 8 |
7 #include "base/command_line.h" | 9 #include "base/command_line.h" |
8 #include "base/logging.h" | 10 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "gpu/config/gpu_control_list_jsons.h" | 11 #include "gpu/config/gpu_control_list_jsons.h" |
11 #include "gpu/config/gpu_driver_bug_list.h" | 12 #include "gpu/config/gpu_driver_bug_list.h" |
12 #include "gpu/config/gpu_driver_bug_workaround_type.h" | 13 #include "gpu/config/gpu_driver_bug_workaround_type.h" |
13 #include "gpu/config/gpu_info.h" | 14 #include "gpu/config/gpu_info.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
15 | 16 |
16 #define LONG_STRING_CONST(...) #__VA_ARGS__ | 17 #define LONG_STRING_CONST(...) #__VA_ARGS__ |
17 | 18 |
18 namespace gpu { | 19 namespace gpu { |
19 | 20 |
(...skipping 20 matching lines...) Expand all Loading... |
40 gpu_info_.gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine"; | 41 gpu_info_.gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine"; |
41 } | 42 } |
42 | 43 |
43 void TearDown() override {} | 44 void TearDown() override {} |
44 | 45 |
45 private: | 46 private: |
46 GPUInfo gpu_info_; | 47 GPUInfo gpu_info_; |
47 }; | 48 }; |
48 | 49 |
49 TEST_F(GpuDriverBugListTest, CurrentDriverBugListValidation) { | 50 TEST_F(GpuDriverBugListTest, CurrentDriverBugListValidation) { |
50 scoped_ptr<GpuDriverBugList> list(GpuDriverBugList::Create()); | 51 std::unique_ptr<GpuDriverBugList> list(GpuDriverBugList::Create()); |
51 std::string json; | 52 std::string json; |
52 EXPECT_TRUE(list->LoadList(kGpuDriverBugListJson, GpuControlList::kAllOs)); | 53 EXPECT_TRUE(list->LoadList(kGpuDriverBugListJson, GpuControlList::kAllOs)); |
53 } | 54 } |
54 | 55 |
55 TEST_F(GpuDriverBugListTest, CurrentListForARM) { | 56 TEST_F(GpuDriverBugListTest, CurrentListForARM) { |
56 scoped_ptr<GpuDriverBugList> list(GpuDriverBugList::Create()); | 57 std::unique_ptr<GpuDriverBugList> list(GpuDriverBugList::Create()); |
57 EXPECT_TRUE(list->LoadList(kGpuDriverBugListJson, GpuControlList::kAllOs)); | 58 EXPECT_TRUE(list->LoadList(kGpuDriverBugListJson, GpuControlList::kAllOs)); |
58 | 59 |
59 GPUInfo gpu_info; | 60 GPUInfo gpu_info; |
60 gpu_info.gl_vendor = "ARM"; | 61 gpu_info.gl_vendor = "ARM"; |
61 gpu_info.gl_renderer = "MALi_T604"; | 62 gpu_info.gl_renderer = "MALi_T604"; |
62 std::set<int> bugs = list->MakeDecision( | 63 std::set<int> bugs = list->MakeDecision( |
63 GpuControlList::kOsAndroid, "4.1", gpu_info); | 64 GpuControlList::kOsAndroid, "4.1", gpu_info); |
64 EXPECT_EQ(1u, bugs.count(USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS)); | 65 EXPECT_EQ(1u, bugs.count(USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS)); |
65 } | 66 } |
66 | 67 |
67 TEST_F(GpuDriverBugListTest, CurrentListForImagination) { | 68 TEST_F(GpuDriverBugListTest, CurrentListForImagination) { |
68 scoped_ptr<GpuDriverBugList> list(GpuDriverBugList::Create()); | 69 std::unique_ptr<GpuDriverBugList> list(GpuDriverBugList::Create()); |
69 EXPECT_TRUE(list->LoadList(kGpuDriverBugListJson, GpuControlList::kAllOs)); | 70 EXPECT_TRUE(list->LoadList(kGpuDriverBugListJson, GpuControlList::kAllOs)); |
70 | 71 |
71 GPUInfo gpu_info; | 72 GPUInfo gpu_info; |
72 gpu_info.gl_vendor = "Imagination Technologies"; | 73 gpu_info.gl_vendor = "Imagination Technologies"; |
73 gpu_info.gl_renderer = "PowerVR SGX 540"; | 74 gpu_info.gl_renderer = "PowerVR SGX 540"; |
74 std::set<int> bugs = list->MakeDecision( | 75 std::set<int> bugs = list->MakeDecision( |
75 GpuControlList::kOsAndroid, "4.1", gpu_info); | 76 GpuControlList::kOsAndroid, "4.1", gpu_info); |
76 EXPECT_EQ(1u, bugs.count(USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS)); | 77 EXPECT_EQ(1u, bugs.count(USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS)); |
77 } | 78 } |
78 | 79 |
(...skipping 17 matching lines...) Expand all Loading... |
96 "os": { | 97 "os": { |
97 "type": "win" | 98 "type": "win" |
98 }, | 99 }, |
99 "features": [ | 100 "features": [ |
100 "force_integrated_gpu" | 101 "force_integrated_gpu" |
101 ] | 102 ] |
102 } | 103 } |
103 ] | 104 ] |
104 } | 105 } |
105 ); | 106 ); |
106 scoped_ptr<GpuDriverBugList> driver_bug_list(GpuDriverBugList::Create()); | 107 std::unique_ptr<GpuDriverBugList> driver_bug_list(GpuDriverBugList::Create()); |
107 EXPECT_TRUE(driver_bug_list->LoadList(json, GpuControlList::kAllOs)); | 108 EXPECT_TRUE(driver_bug_list->LoadList(json, GpuControlList::kAllOs)); |
108 std::set<int> switching = driver_bug_list->MakeDecision( | 109 std::set<int> switching = driver_bug_list->MakeDecision( |
109 GpuControlList::kOsMacosx, "10.8", gpu_info()); | 110 GpuControlList::kOsMacosx, "10.8", gpu_info()); |
110 EXPECT_EQ(1u, switching.size()); | 111 EXPECT_EQ(1u, switching.size()); |
111 EXPECT_EQ(1u, switching.count(FORCE_DISCRETE_GPU)); | 112 EXPECT_EQ(1u, switching.count(FORCE_DISCRETE_GPU)); |
112 std::vector<uint32_t> entries; | 113 std::vector<uint32_t> entries; |
113 driver_bug_list->GetDecisionEntries(&entries, false); | 114 driver_bug_list->GetDecisionEntries(&entries, false); |
114 ASSERT_EQ(1u, entries.size()); | 115 ASSERT_EQ(1u, entries.size()); |
115 EXPECT_EQ(1u, entries[0]); | 116 EXPECT_EQ(1u, entries[0]); |
116 | 117 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 "value": "8.17.12.6973" | 173 "value": "8.17.12.6973" |
173 }, | 174 }, |
174 "features": [ | 175 "features": [ |
175 "disable_d3d11" | 176 "disable_d3d11" |
176 ] | 177 ] |
177 } | 178 } |
178 ] | 179 ] |
179 } | 180 } |
180 ); | 181 ); |
181 | 182 |
182 scoped_ptr<GpuDriverBugList> list(GpuDriverBugList::Create()); | 183 std::unique_ptr<GpuDriverBugList> list(GpuDriverBugList::Create()); |
183 EXPECT_TRUE(list->LoadList(json, GpuControlList::kAllOs)); | 184 EXPECT_TRUE(list->LoadList(json, GpuControlList::kAllOs)); |
184 | 185 |
185 GPUInfo gpu_info; | 186 GPUInfo gpu_info; |
186 gpu_info.gl_vendor = "NVIDIA"; | 187 gpu_info.gl_vendor = "NVIDIA"; |
187 gpu_info.gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine"; | 188 gpu_info.gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine"; |
188 gpu_info.gpu.vendor_id = 0x10de; | 189 gpu_info.gpu.vendor_id = 0x10de; |
189 gpu_info.gpu.device_id = 0x0640; | 190 gpu_info.gpu.device_id = 0x0640; |
190 | 191 |
191 // test the same driver version number | 192 // test the same driver version number |
192 gpu_info.driver_version = "8.17.12.6973"; | 193 gpu_info.driver_version = "8.17.12.6973"; |
193 std::set<int> bugs = list->MakeDecision( | 194 std::set<int> bugs = list->MakeDecision( |
194 GpuControlList::kOsWin, "7.0", gpu_info); | 195 GpuControlList::kOsWin, "7.0", gpu_info); |
195 EXPECT_EQ(1u, bugs.count(DISABLE_D3D11)); | 196 EXPECT_EQ(1u, bugs.count(DISABLE_D3D11)); |
196 | 197 |
197 // test a lower driver version number | 198 // test a lower driver version number |
198 gpu_info.driver_version = "8.15.11.8647"; | 199 gpu_info.driver_version = "8.15.11.8647"; |
199 | 200 |
200 bugs = list->MakeDecision(GpuControlList::kOsWin, "7.0", gpu_info); | 201 bugs = list->MakeDecision(GpuControlList::kOsWin, "7.0", gpu_info); |
201 EXPECT_EQ(1u, bugs.count(DISABLE_D3D11)); | 202 EXPECT_EQ(1u, bugs.count(DISABLE_D3D11)); |
202 | 203 |
203 // test a higher driver version number | 204 // test a higher driver version number |
204 gpu_info.driver_version = "9.18.13.2723"; | 205 gpu_info.driver_version = "9.18.13.2723"; |
205 bugs = list->MakeDecision(GpuControlList::kOsWin, "7.0", gpu_info); | 206 bugs = list->MakeDecision(GpuControlList::kOsWin, "7.0", gpu_info); |
206 EXPECT_EQ(0u, bugs.count(DISABLE_D3D11)); | 207 EXPECT_EQ(0u, bugs.count(DISABLE_D3D11)); |
207 } | 208 } |
208 | 209 |
209 } // namespace gpu | 210 } // namespace gpu |
210 | 211 |
OLD | NEW |