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

Side by Side Diff: content/test/gpu/page_sets/gpu_process_tests.py

Issue 1874643003: Do not lose secondary gpus and make sure to have an active gpu on multiple gpu configurations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add utility function gpu::ParseSecondaryGpuDevicesFromCommandLine (and rebase) Created 4 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
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 import sys 4 import sys
5 from telemetry.story import story_set as story_set_module 5 from telemetry.story import story_set as story_set_module
6 from telemetry.page import page_test 6 from telemetry.page import page_test
7 7
8 from gpu_tests import gpu_test_base 8 from gpu_tests import gpu_test_base
9 9
10 class GpuProcessSharedPageState(gpu_test_base.GpuSharedPageState): 10 class GpuProcessSharedPageState(gpu_test_base.GpuSharedPageState):
11 11
12 gpu_switches = ['--gpu-no-complete-info-collection', 12 gpu_switches = ['--gpu-no-complete-info-collection',
13 '--gpu-testing-os-version', 13 '--gpu-testing-os-version',
14 '--gpu-testing-vendor-id', 14 '--gpu-testing-vendor-id',
15 '--gpu-testing-device-id', 15 '--gpu-testing-device-id',
16 '--gpu-testing-secondary-vendor-ids',
17 '--gpu-testing-secondary-device-ids',
16 '--gpu-testing-gl-vendor', 18 '--gpu-testing-gl-vendor',
17 '--gpu-testing-gl-renderer', 19 '--gpu-testing-gl-renderer',
18 '--gpu-testing-gl-version'] 20 '--gpu-testing-gl-version']
19 21
20 def __init__(self, test, finder_options, story_set): 22 def __init__(self, test, finder_options, story_set):
21 super(GpuProcessSharedPageState, self).__init__( 23 super(GpuProcessSharedPageState, self).__init__(
22 test, finder_options, story_set) 24 test, finder_options, story_set)
23 options = finder_options.browser_options.extra_browser_args 25 options = finder_options.browser_options.extra_browser_args
24 26
25 # Clear all existing gpu testing switches. 27 # Clear all existing gpu testing switches.
26 old_gpu_switches = [] 28 old_gpu_switches = []
27 for opt in options: 29 for opt in options:
28 for gpu_switch in self.gpu_switches: 30 for gpu_switch in self.gpu_switches:
29 if opt.startswith(gpu_switch): 31 if opt.startswith(gpu_switch):
30 old_gpu_switches.append(opt) 32 old_gpu_switches.append(opt)
31 options.difference_update(old_gpu_switches) 33 options.difference_update(old_gpu_switches)
32 34
35
36 class IdentifyActiveGpuPageBase(gpu_test_base.PageBase):
37
38 def __init__(self, name=None, page_set=None, shared_page_state_class=None,
39 expectations=None, active_gpu=None, inactive_gpus=None):
40 super(IdentifyActiveGpuPageBase, self).__init__(
41 url='chrome:gpu',
42 name=name,
43 page_set=page_set,
44 shared_page_state_class=shared_page_state_class,
45 expectations=expectations)
46 self.active_gpu = active_gpu
47 self.inactive_gpus = inactive_gpus
48
49 def Validate(self, tab, results):
50 basic_infos = tab.EvaluateJavaScript('browserBridge.gpuInfo.basic_info')
51 active_gpu = []
52 inactive_gpus = []
53 index = 0
54 for info in basic_infos:
55 description = info['description']
56 value = info['value']
57 if description.startswith('GPU%d' % index) and value.startswith('VENDOR'):
58 if value.endswith('*ACTIVE*'):
59 active_gpu.append(value)
60 else:
61 inactive_gpus.append(value)
62 index += 1
63
64 if active_gpu != self.active_gpu:
65 raise page_test.Failure('Active GPU field is wrong %s' % active_gpu)
66
67 if inactive_gpus != self.inactive_gpus:
68 raise page_test.Failure('Inactive GPU field is wrong %s' % inactive_gpus)
69
70
33 class GpuProcessTestsPage(gpu_test_base.PageBase): 71 class GpuProcessTestsPage(gpu_test_base.PageBase):
34 def __init__(self, url, name, story_set, expectations): 72 def __init__(self, url, name, story_set, expectations):
35 super(GpuProcessTestsPage, self).__init__(url=url, 73 super(GpuProcessTestsPage, self).__init__(url=url,
36 shared_page_state_class=gpu_test_base.GpuSharedPageState, 74 shared_page_state_class=gpu_test_base.GpuSharedPageState,
37 page_set=story_set, 75 page_set=story_set,
38 name=name, 76 name=name,
39 expectations=expectations) 77 expectations=expectations)
40 78
41 79
42 class FunctionalVideoPage(GpuProcessTestsPage): 80 class FunctionalVideoPage(GpuProcessTestsPage):
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 % (workaround, browser_list)) 236 % (workaround, browser_list))
199 237
200 gpu_list = tab.EvaluateJavaScript( \ 238 gpu_list = tab.EvaluateJavaScript( \
201 'chrome.gpuBenchmarking.getGpuDriverBugWorkarounds()') 239 'chrome.gpuBenchmarking.getGpuDriverBugWorkarounds()')
202 if not workaround in gpu_list: 240 if not workaround in gpu_list:
203 print 'Test failed. Printing page contents:' 241 print 'Test failed. Printing page contents:'
204 print tab.EvaluateJavaScript('document.body.innerHTML') 242 print tab.EvaluateJavaScript('document.body.innerHTML')
205 raise page_test.Failure('%s missing in GPU process workarounds: %s' \ 243 raise page_test.Failure('%s missing in GPU process workarounds: %s' \
206 % (workaround, gpu_list)) 244 % (workaround, gpu_list))
207 245
246
247 class IdentifyActiveGpuSharedPageState1(GpuProcessSharedPageState):
248 def __init__(self, test, finder_options, story_set):
249 super(IdentifyActiveGpuSharedPageState1, self).__init__(
250 test, finder_options, story_set)
251 opts = finder_options.browser_options
252
253 if sys.platform in ('cygwin', 'win32') or sys.platform.startswith('linux'):
254 opts.AppendExtraBrowserArgs('--gpu-testing-vendor-id=0x8086')
255 opts.AppendExtraBrowserArgs('--gpu-testing-device-id=0x040a')
256 opts.AppendExtraBrowserArgs('--gpu-testing-secondary-vendor-ids=0x10de')
257 opts.AppendExtraBrowserArgs('--gpu-testing-secondary-device-ids=0x0de1')
258 opts.AppendExtraBrowserArgs('--gpu-testing-gl-vendor=nouveau')
259
260
261 class IdentifyActiveGpuPage1(IdentifyActiveGpuPageBase):
262 def __init__(self, story_set, expectations):
263 active_gpu = ['VENDOR = 0x10de, DEVICE= 0x0de1 *ACTIVE*']
264 inactive_gpus = ['VENDOR = 0x8086, DEVICE= 0x040a']
265
266 super(IdentifyActiveGpuPage1, self).__init__(
267 name='GpuProcess.identify_active_gpu1',
268 page_set=story_set,
269 shared_page_state_class=IdentifyActiveGpuSharedPageState1,
270 expectations=expectations,
271 active_gpu=active_gpu,
272 inactive_gpus=inactive_gpus)
273
274 def Validate(self, tab, results):
275 super(IdentifyActiveGpuPage1, self).Validate(tab, results)
276
277
278 class IdentifyActiveGpuSharedPageState2(GpuProcessSharedPageState):
279 def __init__(self, test, finder_options, story_set):
280 super(IdentifyActiveGpuSharedPageState2, self).__init__(
281 test, finder_options, story_set)
282 opts = finder_options.browser_options
283
284 if sys.platform in ('cygwin', 'win32') or sys.platform.startswith('linux'):
285 opts.AppendExtraBrowserArgs('--gpu-testing-vendor-id=0x8086')
286 opts.AppendExtraBrowserArgs('--gpu-testing-device-id=0x040a')
287 opts.AppendExtraBrowserArgs('--gpu-testing-secondary-vendor-ids=0x10de')
288 opts.AppendExtraBrowserArgs('--gpu-testing-secondary-device-ids=0x0de1')
289 opts.AppendExtraBrowserArgs('--gpu-testing-gl-vendor=Intel')
290
291
292 class IdentifyActiveGpuPage2(IdentifyActiveGpuPageBase):
293 def __init__(self, story_set, expectations):
294 active_gpu = ['VENDOR = 0x8086, DEVICE= 0x040a *ACTIVE*']
295 inactive_gpus = ['VENDOR = 0x10de, DEVICE= 0x0de1']
296
297 super(IdentifyActiveGpuPage2, self).__init__(
298 name='GpuProcess.identify_active_gpu2',
299 page_set=story_set,
300 shared_page_state_class=IdentifyActiveGpuSharedPageState2,
301 expectations=expectations,
302 active_gpu=active_gpu,
303 inactive_gpus=inactive_gpus)
304
305 def Validate(self, tab, results):
306 super(IdentifyActiveGpuPage2, self).Validate(tab, results)
307
308
309 class IdentifyActiveGpuSharedPageState3(GpuProcessSharedPageState):
310 def __init__(self, test, finder_options, story_set):
311 super(IdentifyActiveGpuSharedPageState3, self).__init__(
312 test, finder_options, story_set)
313 opts = finder_options.browser_options
314
315 if sys.platform in ('cygwin', 'win32') or sys.platform.startswith('linux'):
316 opts.AppendExtraBrowserArgs('--gpu-testing-vendor-id=0x8086')
317 opts.AppendExtraBrowserArgs('--gpu-testing-device-id=0x040a')
318 opts.AppendExtraBrowserArgs('--gpu-testing-secondary-vendor-ids= \
319 0x10de;0x1002')
320 opts.AppendExtraBrowserArgs('--gpu-testing-secondary-device-ids= \
321 0x0de1;0x6779')
322 opts.AppendExtraBrowserArgs('--gpu-testing-gl-vendor=radeon')
323
324
325 class IdentifyActiveGpuPage3(IdentifyActiveGpuPageBase):
326 def __init__(self, story_set, expectations):
327 active_gpu = ['VENDOR = 0x1002, DEVICE= 0x6779 *ACTIVE*']
328 inactive_gpus = ['VENDOR = 0x8086, DEVICE= 0x040a', \
329 'VENDOR = 0x10de, DEVICE= 0x0de1']
330
331 super(IdentifyActiveGpuPage3, self).__init__(
332 name='GpuProcess.identify_active_gpu3',
333 page_set=story_set,
334 shared_page_state_class=IdentifyActiveGpuSharedPageState3,
335 expectations=expectations,
336 active_gpu=active_gpu,
337 inactive_gpus=inactive_gpus)
338
339 def Validate(self, tab, results):
340 super(IdentifyActiveGpuPage3, self).Validate(tab, results)
341
208 class GpuProcessTestsStorySet(story_set_module.StorySet): 342 class GpuProcessTestsStorySet(story_set_module.StorySet):
209 343
210 """ Tests that accelerated content triggers the creation of a GPU process """ 344 """ Tests that accelerated content triggers the creation of a GPU process """
211 345
212 def __init__(self, expectations): 346 def __init__(self, expectations):
213 super(GpuProcessTestsStorySet, self).__init__( 347 super(GpuProcessTestsStorySet, self).__init__(
214 serving_dirs=set(['../../../../content/test/data'])) 348 serving_dirs=set(['../../../../content/test/data']))
215 349
216 urls_and_names_list = [ 350 urls_and_names_list = [
217 ('file://../../data/gpu/functional_canvas_demo.html', 351 ('file://../../data/gpu/functional_canvas_demo.html',
218 'GpuProcess.canvas2d'), 352 'GpuProcess.canvas2d'),
219 ('file://../../data/gpu/functional_3d_css.html', 353 ('file://../../data/gpu/functional_3d_css.html',
220 'GpuProcess.css3d'), 354 'GpuProcess.css3d'),
221 ('file://../../data/gpu/functional_webgl.html', 355 ('file://../../data/gpu/functional_webgl.html',
222 'GpuProcess.webgl') 356 'GpuProcess.webgl')
223 ] 357 ]
224 358
225 for url, name in urls_and_names_list: 359 for url, name in urls_and_names_list:
226 self.AddStory(GpuProcessTestsPage(url, name, self, expectations)) 360 self.AddStory(GpuProcessTestsPage(url, name, self, expectations))
227 361
228 self.AddStory(FunctionalVideoPage(self, expectations)) 362 self.AddStory(FunctionalVideoPage(self, expectations))
229 self.AddStory(GpuInfoCompletePage(self, expectations)) 363 self.AddStory(GpuInfoCompletePage(self, expectations))
230 self.AddStory(NoGpuProcessPage(self, expectations)) 364 self.AddStory(NoGpuProcessPage(self, expectations))
231 self.AddStory(SoftwareGpuProcessPage(self, expectations)) 365 self.AddStory(SoftwareGpuProcessPage(self, expectations))
232 self.AddStory(SkipGpuProcessPage(self, expectations)) 366 self.AddStory(SkipGpuProcessPage(self, expectations))
233 self.AddStory(DriverBugWorkaroundsInGpuProcessPage(self, expectations)) 367 self.AddStory(DriverBugWorkaroundsInGpuProcessPage(self, expectations))
368 self.AddStory(IdentifyActiveGpuPage1(self, expectations))
369 self.AddStory(IdentifyActiveGpuPage2(self, expectations))
370 self.AddStory(IdentifyActiveGpuPage3(self, expectations))
234 371
235 @property 372 @property
236 def allow_mixed_story_states(self): 373 def allow_mixed_story_states(self):
237 # Return True here in order to be able to run pages with different browser 374 # Return True here in order to be able to run pages with different browser
238 # command line arguments. 375 # command line arguments.
239 return True 376 return True
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698