OLD | NEW |
---|---|
1 # Copyright 2017 The Chromium Authors. All rights reserved. | 1 # Copyright 2017 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 import logging | 5 import logging |
6 import os | 6 import os |
7 import sys | 7 import sys |
8 | 8 |
9 from gpu_tests import gpu_integration_test | 9 from gpu_tests import gpu_integration_test |
10 from gpu_tests import gpu_process_expectations | 10 from gpu_tests import gpu_process_expectations |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
292 options = self.__class__._original_finder_options.browser_options | 292 options = self.__class__._original_finder_options.browser_options |
293 if options.browser_type.startswith('android'): | 293 if options.browser_type.startswith('android'): |
294 # Android doesn't support starting up the browser without any | 294 # Android doesn't support starting up the browser without any |
295 # GPU process. This test is skipped on Android in | 295 # GPU process. This test is skipped on Android in |
296 # gpu_process_expectations.py, but we must at least be able to | 296 # gpu_process_expectations.py, but we must at least be able to |
297 # bring up the browser in order to detect that the test | 297 # bring up the browser in order to detect that the test |
298 # shouldn't run. Faking a vendor and device ID can get the | 298 # shouldn't run. Faking a vendor and device ID can get the |
299 # browser into a state where it won't launch. | 299 # browser into a state where it won't launch. |
300 return | 300 return |
301 elif sys.platform in ('cygwin', 'win32'): | 301 elif sys.platform in ('cygwin', 'win32'): |
302 # Hit id 34 from kSoftwareRenderingListJson. | 302 # Hit id 34 from kSoftwareRenderingListEntries. |
303 self.RestartBrowserIfNecessaryWithArgs([ | 303 self.RestartBrowserIfNecessaryWithArgs([ |
304 '--gpu-testing-vendor-id=0x5333', | 304 '--gpu-testing-vendor-id=0x5333', |
305 '--gpu-testing-device-id=0x8811']) | 305 '--gpu-testing-device-id=0x8811']) |
306 elif sys.platform.startswith('linux'): | 306 elif sys.platform.startswith('linux'): |
307 # Hit id 50 from kSoftwareRenderingListJson. | 307 # Hit id 50 from kSoftwareRenderingListEntries. |
308 self.RestartBrowserIfNecessaryWithArgs([ | 308 self.RestartBrowserIfNecessaryWithArgs([ |
309 '--gpu-no-complete-info-collection', | 309 '--gpu-no-complete-info-collection', |
310 '--gpu-testing-vendor-id=0x10de', | 310 '--gpu-testing-vendor-id=0x10de', |
311 '--gpu-testing-device-id=0x0de1', | 311 '--gpu-testing-device-id=0x0de1', |
312 '--gpu-testing-gl-vendor=VMware', | 312 '--gpu-testing-gl-vendor=VMware', |
313 '--gpu-testing-gl-renderer=softpipe', | 313 '--gpu-testing-gl-renderer=softpipe', |
314 '--gpu-testing-gl-version="2.1 Mesa 10.1"']) | 314 '--gpu-testing-gl-version="2.1 Mesa 10.1"']) |
315 elif sys.platform == 'darwin': | 315 elif sys.platform == 'darwin': |
316 # Hit id 112 from kSoftwareRenderingListJson. | 316 # Hit id 112 from kSoftwareRenderingListEntries. |
317 self.RestartBrowserIfNecessaryWithArgs([ | 317 self.RestartBrowserIfNecessaryWithArgs([ |
318 '--gpu-testing-vendor-id=0x8086', | 318 '--gpu-testing-vendor-id=0x8086', |
319 '--gpu-testing-device-id=0x0116']) | 319 '--gpu-testing-device-id=0x0116']) |
320 self._Navigate(test_path) | 320 self._Navigate(test_path) |
321 if self.tab.EvaluateJavaScript('chrome.gpuBenchmarking.hasGpuProcess()'): | 321 if self.tab.EvaluateJavaScript('chrome.gpuBenchmarking.hasGpuProcess()'): |
322 self.fail('GPU process detected') | 322 self.fail('GPU process detected') |
323 | 323 |
324 def _GpuProcess_driver_bug_workarounds_in_gpu_process(self, test_path): | 324 def _GpuProcess_driver_bug_workarounds_in_gpu_process(self, test_path): |
325 self.RestartBrowserIfNecessaryWithArgs([ | 325 self.RestartBrowserIfNecessaryWithArgs([ |
326 '--use_gpu_driver_workaround_for_testing']) | 326 '--use_gpu_driver_workaround_for_testing']) |
327 self._Navigate(test_path) | 327 self._Navigate(test_path) |
328 self._ValidateDriverBugWorkarounds( | 328 self._ValidateDriverBugWorkarounds( |
329 'use_gpu_driver_workaround_for_testing', None) | 329 'use_gpu_driver_workaround_for_testing', None) |
330 | 330 |
331 def _GpuProcess_readback_webgl_gpu_process(self, test_path): | 331 def _GpuProcess_readback_webgl_gpu_process(self, test_path): |
332 # This test was designed to only run on desktop Linux. | 332 # This test was designed to only run on desktop Linux. |
333 options = self.__class__._original_finder_options.browser_options | 333 options = self.__class__._original_finder_options.browser_options |
334 is_platform_android = options.browser_type.startswith('android') | 334 is_platform_android = options.browser_type.startswith('android') |
335 if sys.platform.startswith('linux') and not is_platform_android: | 335 if sys.platform.startswith('linux') and not is_platform_android: |
336 # Hit id 110 from kSoftwareRenderingListJson. | 336 # Hit id 110 from kSoftwareRenderingListEntries. |
337 self.RestartBrowserIfNecessaryWithArgs([ | 337 self.RestartBrowserIfNecessaryWithArgs([ |
338 '--gpu-testing-vendor-id=0x10de', | 338 '--gpu-testing-vendor-id=0x10de', |
339 '--gpu-testing-device-id=0x0de1', | 339 '--gpu-testing-device-id=0x0de1', |
340 '--gpu-testing-gl-vendor=VMware', | 340 '--gpu-testing-gl-vendor=VMware', |
341 '--gpu-testing-gl-renderer=Gallium 0.4 ' \ | 341 '--gpu-testing-gl-renderer=Gallium 0.4 ' \ |
342 'on llvmpipe (LLVM 3.4, 256 bits)', | 342 'on llvmpipe (LLVM 3.4, 256 bits)', |
343 '--gpu-testing-gl-version="3.0 Mesa 11.2"']) | 343 '--gpu-testing-gl-version="3.0 Mesa 11.2"']) |
344 self._Navigate(test_path) | 344 self._Navigate(test_path) |
345 feature_status_list = self.tab.EvaluateJavaScript( | 345 feature_status_list = self.tab.EvaluateJavaScript( |
346 'browserBridge.gpuInfo.featureStatus.featureStatus') | 346 'browserBridge.gpuInfo.featureStatus.featureStatus') |
347 result = True | 347 result = True |
348 for name, status in feature_status_list.items(): | 348 for name, status in feature_status_list.items(): |
349 if name == 'multiple_raster_threads': | 349 if name == 'multiple_raster_threads': |
350 result = result and status == 'enabled_on' | 350 result = result and status == 'enabled_on' |
351 elif name == 'native_gpu_memory_buffers': | 351 elif name == 'native_gpu_memory_buffers': |
352 result = result and status == 'disabled_software' | 352 result = result and status == 'disabled_software' |
353 elif name == 'webgl': | 353 elif name == 'webgl': |
354 result = result and status == 'enabled_readback' | 354 result = result and status == 'enabled_readback' |
355 elif name == 'webgl2': | 355 elif name == 'webgl2': |
356 result = result and status == 'unavailable_off' | 356 result = result and status == 'unavailable_off' |
357 else: | 357 else: |
358 result = result and status == 'unavailable_software' | 358 result = result and status == 'unavailable_software' |
359 if not result: | 359 if not result: |
360 self.fail('WebGL readback setup failed: %s' % feature_status_list) | 360 self.fail('WebGL readback setup failed: %s' % feature_status_list) |
361 | 361 |
362 def _GpuProcess_driver_bug_workarounds_upon_gl_renderer(self, test_path): | 362 def _GpuProcess_driver_bug_workarounds_upon_gl_renderer(self, test_path): |
363 is_platform_android = self._RunningOnAndroid() | 363 is_platform_android = self._RunningOnAndroid() |
364 if is_platform_android: | 364 if is_platform_android: |
365 # Hit id 108 from kGpuDriverBugListJson. | 365 # Hit id 108 from kGpuDriverBugListEntries. |
366 self.RestartBrowserIfNecessaryWithArgs([ | 366 self.RestartBrowserIfNecessaryWithArgs([ |
367 '--gpu-testing-gl-vendor=NVIDIA Corporation', | 367 '--gpu-testing-gl-vendor=NVIDIA Corporation', |
368 '--gpu-testing-gl-renderer=NVIDIA Tegra', | 368 '--gpu-testing-gl-renderer=NVIDIA Tegra', |
369 '--gpu-testing-gl-version=OpenGL ES 3.1 NVIDIA 343.00']) | 369 '--gpu-testing-gl-version=OpenGL ES 3.1 NVIDIA 343.00']) |
370 elif sys.platform in ('cygwin', 'win32'): | 370 elif sys.platform in ('cygwin', 'win32'): |
371 # Hit id 51 and 87 from kGpuDriverBugListJson. | 371 # Hit id 51 and 87 from kGpuDriverBugListEntries. |
372 self.RestartBrowserIfNecessaryWithArgs([ | 372 self.RestartBrowserIfNecessaryWithArgs([ |
373 '--gpu-testing-vendor-id=0x1002', | 373 '--gpu-testing-vendor-id=0x1002', |
374 '--gpu-testing-device-id=0x6779', | 374 '--gpu-testing-device-id=0x6779', |
375 '--gpu-testing-driver-date=11-20-2014', | 375 '--gpu-testing-driver-date=11-20-2014', |
376 '--gpu-testing-gl-vendor=Google Inc.', | 376 '--gpu-testing-gl-vendor=Google Inc.', |
377 '--gpu-testing-gl-renderer=ANGLE ' \ | 377 '--gpu-testing-gl-renderer=ANGLE ' \ |
378 '(AMD Radeon HD 6450 Direct3D11 vs_5_0 ps_5_0)', | 378 '(AMD Radeon HD 6450 Direct3D11 vs_5_0 ps_5_0)', |
379 '--gpu-testing-gl-version=OpenGL ES 2.0 (ANGLE 2.1.0.0c0d8006a9dd)']) | 379 '--gpu-testing-gl-version=OpenGL ES 2.0 (ANGLE 2.1.0.0c0d8006a9dd)']) |
380 elif sys.platform.startswith('linux'): | 380 elif sys.platform.startswith('linux'): |
381 # Hit id 40 from kGpuDriverBugListJson. | 381 # Hit id 40 from kGpuDriverBugListEntries. |
382 self.RestartBrowserIfNecessaryWithArgs([ | 382 self.RestartBrowserIfNecessaryWithArgs([ |
383 '--gpu-testing-vendor-id=0x0101', | 383 '--gpu-testing-vendor-id=0x0101', |
384 '--gpu-testing-device-id=0x0102', | 384 '--gpu-testing-device-id=0x0102', |
385 '--gpu-testing-gl-vendor=ARM', | 385 '--gpu-testing-gl-vendor=ARM', |
386 '--gpu-testing-gl-renderer=Mali-400 MP']) | 386 '--gpu-testing-gl-renderer=Mali-400 MP']) |
387 elif sys.platform == 'darwin': | 387 elif sys.platform == 'darwin': |
388 # Currently on osx no workaround relies on gl-renderer. | 388 # Currently on osx no workaround relies on gl-renderer. |
389 return | 389 return |
390 self._Navigate(test_path) | 390 self._Navigate(test_path) |
391 if is_platform_android: | 391 if is_platform_android: |
(...skipping 15 matching lines...) Expand all Loading... | |
407 self._VerifyGpuProcessPresent() | 407 self._VerifyGpuProcessPresent() |
408 recorded_workarounds, recorded_disabled_gl_extensions = ( | 408 recorded_workarounds, recorded_disabled_gl_extensions = ( |
409 self._CompareAndCaptureDriverBugWorkarounds()) | 409 self._CompareAndCaptureDriverBugWorkarounds()) |
410 # Add the testing workaround to the recorded workarounds. | 410 # Add the testing workaround to the recorded workarounds. |
411 recorded_workarounds.append('use_gpu_driver_workaround_for_testing') | 411 recorded_workarounds.append('use_gpu_driver_workaround_for_testing') |
412 # Relaunch the browser with OS-specific command line arguments. | 412 # Relaunch the browser with OS-specific command line arguments. |
413 browser_args = ['--use_gpu_driver_workaround_for_testing', | 413 browser_args = ['--use_gpu_driver_workaround_for_testing', |
414 '--disable-gpu-driver-bug-workarounds'] | 414 '--disable-gpu-driver-bug-workarounds'] |
415 # Inject some info to make sure the flags above are effective. | 415 # Inject some info to make sure the flags above are effective. |
416 if sys.platform == 'darwin': | 416 if sys.platform == 'darwin': |
417 # Hit id 33 from kGpuDriverBugListJson. | 417 # Hit id 33 from kGpuDriverBugListEntries. |
418 browser_args.extend(['--gpu-testing-gl-vendor=Imagination']) | 418 browser_args.extend(['--gpu-testing-gl-vendor=Imagination']) |
419 else: | 419 else: |
420 # Hit id 5 from kGpuDriverBugListJson. | 420 # Hit id 5 from kGpuDriverBugListEntries. |
421 browser_args.extend(['--gpu-testing-vendor-id=0x10de', | 421 browser_args.extend(['--gpu-testing-vendor-id=0x10de', |
422 '--gpu-testing-device-id=0x0001']) | 422 '--gpu-testing-device-id=0x0001']) |
423 # no multi gpu on Android. | 423 # no multi gpu on Android. |
424 if not self._RunningOnAndroid(): | 424 if not self._RunningOnAndroid(): |
425 browser_args.extend(['--gpu-testing-secondary-vendor-ids=', | 425 browser_args.extend(['--gpu-testing-secondary-vendor-ids=', |
426 '--gpu-testing-secondary-device-ids=']) | 426 '--gpu-testing-secondary-device-ids=']) |
427 for workaround in recorded_workarounds: | 427 for workaround in recorded_workarounds: |
428 browser_args.append('--' + workaround) | 428 browser_args.append('--' + workaround) |
429 browser_args.append('--disable-gl-extensions=' + | 429 browser_args.append('--disable-gl-extensions=' + |
430 recorded_disabled_gl_extensions) | 430 recorded_disabled_gl_extensions) |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
511 '--gpu-testing-secondary-vendor-ids=', | 511 '--gpu-testing-secondary-vendor-ids=', |
512 '--gpu-testing-secondary-device-ids=', | 512 '--gpu-testing-secondary-device-ids=', |
513 '--gpu-testing-gl-vendor=nouveau', | 513 '--gpu-testing-gl-vendor=nouveau', |
514 '--disable-software-rasterizer']) | 514 '--disable-software-rasterizer']) |
515 self._Navigate(test_path) | 515 self._Navigate(test_path) |
516 self._VerifyActiveAndInactiveGPUs( | 516 self._VerifyActiveAndInactiveGPUs( |
517 ['VENDOR = 0x10de, DEVICE= 0x0de1 *ACTIVE*'], | 517 ['VENDOR = 0x10de, DEVICE= 0x0de1 *ACTIVE*'], |
518 []) | 518 []) |
519 | 519 |
520 def _GpuProcess_disabling_workarounds_works(self, test_path): | 520 def _GpuProcess_disabling_workarounds_works(self, test_path): |
521 # Hit exception from id 215 from kGpuDriverBugListJson. | 521 # Hit exception from id 215 from kGpuDriverBugListEntries. |
522 self.RestartBrowserIfNecessaryWithArgs([ | 522 self.RestartBrowserIfNecessaryWithArgs([ |
523 '--gpu-testing-vendor-id=0xbad9', | 523 '--gpu-testing-vendor-id=0xbad9', |
524 '--gpu-testing-device-id=0xbad9', | 524 '--gpu-testing-device-id=0xbad9', |
525 '--gpu-testing-secondary-vendor-ids=', | 525 '--gpu-testing-secondary-vendor-ids=', |
526 '--gpu-testing-secondary-device-ids=', | 526 '--gpu-testing-secondary-device-ids=', |
527 '--gpu-testing-gl-vendor=FakeVendor', | 527 '--gpu-testing-gl-vendor=FakeVendor', |
528 '--gpu-testing-gl-renderer=FakeRenderer', | 528 '--gpu-testing-gl-renderer=FakeRenderer', |
529 '--use_gpu_driver_workaround_for_testing=0']) | 529 '--use_gpu_driver_workaround_for_testing=0']) |
530 self._Navigate(test_path) | 530 self._Navigate(test_path) |
531 workarounds, _ = ( | 531 workarounds, _ = ( |
532 self._CompareAndCaptureDriverBugWorkarounds()) | 532 self._CompareAndCaptureDriverBugWorkarounds()) |
533 if 'use_gpu_driver_workaround_for_testing' in workarounds: | 533 if 'use_gpu_driver_workaround_for_testing' in workarounds: |
534 self.fail('use_gpu_driver_workaround_for_testing erroneously present') | 534 self.fail('use_gpu_driver_workaround_for_testing erroneously present') |
535 | 535 |
536 def _GpuProcess_swiftshader_for_webgl(self, test_path): | 536 def _GpuProcess_swiftshader_for_webgl(self, test_path): |
537 # This test loads functional_webgl.html so that there is a | 537 # This test loads functional_webgl.html so that there is a |
538 # deliberate attempt to use an API which would start the GPU | 538 # deliberate attempt to use an API which would start the GPU |
539 # process. On Windows, and eventually on other platforms where | 539 # process. On Windows, and eventually on other platforms where |
540 # SwiftShader is used, this test should pass. | 540 # SwiftShader is used, this test should pass. |
541 # | 541 # |
542 # TODO(kbr): figure out a better way than --disable-gpu to | 542 args_list = ([ |
543 # reliably trigger SwiftShader. | 543 # Hit id 4 from kSoftwareRenderingListEntries. |
544 self.RestartBrowserIfNecessaryWithArgs(['--disable-gpu']) | 544 '--gpu-testing-vendor-id=0x8086', |
545 self._NavigateAndWait(test_path) | 545 '--gpu-testing-device-id=0x27A2'], |
Ken Russell (switch to Gerrit)
2017/04/14 22:11:07
We should start adding some fake entries to the so
| |
546 # It looks like when SwiftShader is in use (via --disable-gpu), | 546 # Explicitly disable GPU access. |
547 # that GPU information collection doesn't yet contain what's | 547 ['--disable-gpu']) |
548 # expected (the system_info.gpu.aux_attributes['gl_renderer'] | 548 for args in args_list: |
549 # looks like it'll be null). Verified locally that we can fetch | 549 self.RestartBrowserIfNecessaryWithArgs(args) |
550 # the desired information via WebGL. | 550 self._NavigateAndWait(test_path) |
551 renderer = self.tab.EvaluateJavaScript('gl_renderer') | 551 # Validate the WebGL unmasked renderer string. |
552 if not renderer: | 552 renderer = self.tab.EvaluateJavaScript('gl_renderer') |
553 self.fail('getParameter(UNMASKED_RENDERER_WEBGL) was null') | 553 if not renderer: |
554 if 'SwiftShader' not in renderer: | 554 self.fail('getParameter(UNMASKED_RENDERER_WEBGL) was null') |
555 self.fail('Expected SwiftShader renderer; instead got ' + renderer) | 555 if 'SwiftShader' not in renderer: |
556 if not self.browser.supports_system_info: | 556 self.fail('Expected SwiftShader renderer; instead got ' + renderer) |
557 self.fail("Browser doesn't support GetSystemInfo") | 557 # Validate GPU info. |
558 gpu = self.browser.GetSystemInfo().gpu | 558 if not self.browser.supports_system_info: |
559 if not gpu: | 559 self.fail("Browser doesn't support GetSystemInfo") |
560 self.fail('Target machine must have a GPU') | 560 gpu = self.browser.GetSystemInfo().gpu |
561 if not gpu.aux_attributes: | 561 if not gpu: |
562 self.fail('Browser must support GPU aux attributes') | 562 self.fail('Target machine must have a GPU') |
563 if not gpu.aux_attributes['software_rendering']: | 563 if not gpu.aux_attributes: |
564 self.fail("Software rendering was disabled") | 564 self.fail('Browser must support GPU aux attributes') |
565 device = gpu.devices[0] | 565 if not gpu.aux_attributes['software_rendering']: |
566 if not device: | 566 self.fail("Software rendering was disabled") |
567 self.fail("System Info doesn't have a device") | 567 if 'SwiftShader' not in gpu.aux_attributes['gl_renderer']: |
568 self.fail("Expected 'SwiftShader' in GPU info GL renderer string") | |
569 if 'Google' not in gpu.aux_attributes['gl_vendor']: | |
570 self.fail("Expected 'Google' in GPU info GL vendor string") | |
571 device = gpu.devices[0] | |
572 if not device: | |
573 self.fail("System Info doesn't have a device") | |
568 | 574 |
569 def load_tests(loader, tests, pattern): | 575 def load_tests(loader, tests, pattern): |
570 del loader, tests, pattern # Unused. | 576 del loader, tests, pattern # Unused. |
571 return gpu_integration_test.LoadAllTestsInModule(sys.modules[__name__]) | 577 return gpu_integration_test.LoadAllTestsInModule(sys.modules[__name__]) |
OLD | NEW |