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

Side by Side Diff: gpu/config/gpu_driver_bug_list_unittest.cc

Issue 2756793003: Move GPU blacklist and driver bug workaround list from json to data struct. (Closed)
Patch Set: pure rebase Created 3 years, 8 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
« no previous file with comments | « gpu/config/gpu_driver_bug_list_json.cc ('k') | gpu/config/gpu_driver_bug_workaround_type.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
6
7 #include <memory>
8
9 #include "base/command_line.h" 5 #include "base/command_line.h"
10 #include "base/logging.h"
11 #include "gpu/config/gpu_control_list_jsons.h"
12 #include "gpu/config/gpu_driver_bug_list.h" 6 #include "gpu/config/gpu_driver_bug_list.h"
13 #include "gpu/config/gpu_driver_bug_workaround_type.h" 7 #include "gpu/config/gpu_driver_bug_workaround_type.h"
14 #include "gpu/config/gpu_info.h" 8 #include "gpu/config/gpu_info.h"
15 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
16 10
17 #define LONG_STRING_CONST(...) #__VA_ARGS__
18
19 namespace gpu { 11 namespace gpu {
20 12
21 class GpuDriverBugListTest : public testing::Test { 13 class GpuDriverBugListTest : public testing::Test {
22 public: 14 public:
23 GpuDriverBugListTest() { } 15 GpuDriverBugListTest() {}
24
25 ~GpuDriverBugListTest() override {} 16 ~GpuDriverBugListTest() override {}
26
27 const GPUInfo& gpu_info() const {
28 return gpu_info_;
29 }
30
31 protected:
32 void SetUp() override {
33 gpu_info_.gpu.vendor_id = 0x10de;
34 gpu_info_.gpu.device_id = 0x0640;
35 gpu_info_.driver_vendor = "NVIDIA";
36 gpu_info_.driver_version = "1.6.18";
37 gpu_info_.driver_date = "7-14-2009";
38 gpu_info_.machine_model_name = "MacBookPro";
39 gpu_info_.machine_model_version = "7.1";
40 gpu_info_.gl_vendor = "NVIDIA Corporation";
41 gpu_info_.gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine";
42 }
43
44 void TearDown() override {}
45
46 private:
47 GPUInfo gpu_info_;
48 }; 17 };
49 18
50 TEST_F(GpuDriverBugListTest, CurrentDriverBugListValidation) {
51 std::unique_ptr<GpuDriverBugList> list(GpuDriverBugList::Create());
52 std::string json;
53 EXPECT_TRUE(list->LoadList(kGpuDriverBugListJson, GpuControlList::kAllOs));
54 }
55
56 TEST_F(GpuDriverBugListTest, CurrentListForARM) { 19 TEST_F(GpuDriverBugListTest, CurrentListForARM) {
57 std::unique_ptr<GpuDriverBugList> list(GpuDriverBugList::Create()); 20 std::unique_ptr<GpuDriverBugList> list = GpuDriverBugList::Create();
58 EXPECT_TRUE(list->LoadList(kGpuDriverBugListJson, GpuControlList::kAllOs));
59
60 GPUInfo gpu_info; 21 GPUInfo gpu_info;
61 gpu_info.gl_vendor = "ARM"; 22 gpu_info.gl_vendor = "ARM";
62 gpu_info.gl_renderer = "MALi_T604"; 23 gpu_info.gl_renderer = "MALi_T604";
63 std::set<int> bugs = list->MakeDecision( 24 std::set<int> bugs = list->MakeDecision(
64 GpuControlList::kOsAndroid, "4.1", gpu_info); 25 GpuControlList::kOsAndroid, "4.1", gpu_info);
65 EXPECT_EQ(1u, bugs.count(USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS)); 26 EXPECT_EQ(1u, bugs.count(USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS));
66 } 27 }
67 28
68 TEST_F(GpuDriverBugListTest, CurrentListForImagination) { 29 TEST_F(GpuDriverBugListTest, CurrentListForImagination) {
69 std::unique_ptr<GpuDriverBugList> list(GpuDriverBugList::Create()); 30 std::unique_ptr<GpuDriverBugList> list = GpuDriverBugList::Create();
70 EXPECT_TRUE(list->LoadList(kGpuDriverBugListJson, GpuControlList::kAllOs));
71
72 GPUInfo gpu_info; 31 GPUInfo gpu_info;
73 gpu_info.gl_vendor = "Imagination Technologies"; 32 gpu_info.gl_vendor = "Imagination Technologies";
74 gpu_info.gl_renderer = "PowerVR SGX 540"; 33 gpu_info.gl_renderer = "PowerVR SGX 540";
75 std::set<int> bugs = list->MakeDecision( 34 std::set<int> bugs = list->MakeDecision(
76 GpuControlList::kOsAndroid, "4.1", gpu_info); 35 GpuControlList::kOsAndroid, "4.1", gpu_info);
77 EXPECT_EQ(1u, bugs.count(USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS)); 36 EXPECT_EQ(1u, bugs.count(USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS));
78 } 37 }
79 38
80 TEST_F(GpuDriverBugListTest, GpuSwitching) {
81 const std::string json = LONG_STRING_CONST(
82 {
83 "name": "gpu driver bug list",
84 "version": "0.1",
85 "entries": [
86 {
87 "id": 1,
88 "os": {
89 "type": "macosx"
90 },
91 "features": [
92 "force_discrete_gpu"
93 ]
94 },
95 {
96 "id": 2,
97 "os": {
98 "type": "win"
99 },
100 "features": [
101 "force_integrated_gpu"
102 ]
103 }
104 ]
105 }
106 );
107 std::unique_ptr<GpuDriverBugList> driver_bug_list(GpuDriverBugList::Create());
108 EXPECT_TRUE(driver_bug_list->LoadList(json, GpuControlList::kAllOs));
109 std::set<int> switching = driver_bug_list->MakeDecision(
110 GpuControlList::kOsMacosx, "10.8", gpu_info());
111 EXPECT_EQ(1u, switching.size());
112 EXPECT_EQ(1u, switching.count(FORCE_DISCRETE_GPU));
113 std::vector<uint32_t> entries;
114 driver_bug_list->GetDecisionEntries(&entries, false);
115 ASSERT_EQ(1u, entries.size());
116 EXPECT_EQ(1u, entries[0]);
117
118 driver_bug_list.reset(GpuDriverBugList::Create());
119 EXPECT_TRUE(driver_bug_list->LoadList(json, GpuControlList::kAllOs));
120 switching = driver_bug_list->MakeDecision(
121 GpuControlList::kOsWin, "6.1", gpu_info());
122 EXPECT_EQ(1u, switching.size());
123 EXPECT_EQ(1u, switching.count(FORCE_INTEGRATED_GPU));
124 driver_bug_list->GetDecisionEntries(&entries, false);
125 ASSERT_EQ(1u, entries.size());
126 EXPECT_EQ(2u, entries[0]);
127 }
128
129 TEST_F(GpuDriverBugListTest, AppendSingleWorkaround) { 39 TEST_F(GpuDriverBugListTest, AppendSingleWorkaround) {
130 base::CommandLine command_line(0, NULL); 40 base::CommandLine command_line(0, NULL);
131 command_line.AppendSwitch(GpuDriverBugWorkaroundTypeToString( 41 command_line.AppendSwitch(GpuDriverBugWorkaroundTypeToString(
132 DISABLE_CHROMIUM_FRAMEBUFFER_MULTISAMPLE)); 42 DISABLE_CHROMIUM_FRAMEBUFFER_MULTISAMPLE));
133 std::set<int> workarounds; 43 std::set<int> workarounds;
134 workarounds.insert(EXIT_ON_CONTEXT_LOST); 44 workarounds.insert(EXIT_ON_CONTEXT_LOST);
135 workarounds.insert(INIT_VERTEX_ATTRIBUTES); 45 workarounds.insert(INIT_VERTEX_ATTRIBUTES);
136 EXPECT_EQ(2u, workarounds.size()); 46 EXPECT_EQ(2u, workarounds.size());
137 GpuDriverBugList::AppendWorkaroundsFromCommandLine( 47 GpuDriverBugList::AppendWorkaroundsFromCommandLine(
138 &workarounds, command_line); 48 &workarounds, command_line);
(...skipping 10 matching lines...) Expand all
149 workarounds.insert(FORCE_INTEGRATED_GPU); 59 workarounds.insert(FORCE_INTEGRATED_GPU);
150 EXPECT_EQ(2u, workarounds.size()); 60 EXPECT_EQ(2u, workarounds.size());
151 EXPECT_EQ(1u, workarounds.count(FORCE_INTEGRATED_GPU)); 61 EXPECT_EQ(1u, workarounds.count(FORCE_INTEGRATED_GPU));
152 GpuDriverBugList::AppendWorkaroundsFromCommandLine( 62 GpuDriverBugList::AppendWorkaroundsFromCommandLine(
153 &workarounds, command_line); 63 &workarounds, command_line);
154 EXPECT_EQ(2u, workarounds.size()); 64 EXPECT_EQ(2u, workarounds.size());
155 EXPECT_EQ(0u, workarounds.count(FORCE_INTEGRATED_GPU)); 65 EXPECT_EQ(0u, workarounds.count(FORCE_INTEGRATED_GPU));
156 EXPECT_EQ(1u, workarounds.count(FORCE_DISCRETE_GPU)); 66 EXPECT_EQ(1u, workarounds.count(FORCE_DISCRETE_GPU));
157 } 67 }
158 68
159 TEST_F(GpuDriverBugListTest, NVIDIANumberingScheme) {
160 const std::string json = LONG_STRING_CONST(
161 {
162 "name": "gpu driver bug list",
163 "version": "0.1",
164 "entries": [
165 {
166 "id": 1,
167 "os": {
168 "type": "win"
169 },
170 "vendor_id": "0x10de",
171 "driver_version": {
172 "op": "<=",
173 "value": "8.17.12.6973"
174 },
175 "features": [
176 "disable_d3d11"
177 ]
178 }
179 ]
180 }
181 );
182
183 std::unique_ptr<GpuDriverBugList> list(GpuDriverBugList::Create());
184 EXPECT_TRUE(list->LoadList(json, GpuControlList::kAllOs));
185
186 GPUInfo gpu_info;
187 gpu_info.gl_vendor = "NVIDIA";
188 gpu_info.gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine";
189 gpu_info.gpu.vendor_id = 0x10de;
190 gpu_info.gpu.device_id = 0x0640;
191
192 // test the same driver version number
193 gpu_info.driver_version = "8.17.12.6973";
194 std::set<int> bugs = list->MakeDecision(
195 GpuControlList::kOsWin, "7.0", gpu_info);
196 EXPECT_EQ(1u, bugs.count(DISABLE_D3D11));
197
198 // test a lower driver version number
199 gpu_info.driver_version = "8.15.11.8647";
200
201 bugs = list->MakeDecision(GpuControlList::kOsWin, "7.0", gpu_info);
202 EXPECT_EQ(1u, bugs.count(DISABLE_D3D11));
203
204 // test a higher driver version number
205 gpu_info.driver_version = "9.18.13.2723";
206 bugs = list->MakeDecision(GpuControlList::kOsWin, "7.0", gpu_info);
207 EXPECT_EQ(0u, bugs.count(DISABLE_D3D11));
208 }
209
210 TEST_F(GpuDriverBugListTest, DuplicatedBugIDValidation) {
211 std::unique_ptr<GpuDriverBugList> list(GpuDriverBugList::Create());
212 EXPECT_TRUE(list->LoadList(kGpuDriverBugListJson, GpuControlList::kAllOs));
213 EXPECT_FALSE(list->has_duplicated_entry_id());
214 }
215
216 } // namespace gpu 69 } // namespace gpu
217
OLDNEW
« no previous file with comments | « gpu/config/gpu_driver_bug_list_json.cc ('k') | gpu/config/gpu_driver_bug_workaround_type.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698