| OLD | NEW |
| 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', | 16 '--gpu-testing-secondary-vendor-ids', |
| 17 '--gpu-testing-secondary-device-ids', | 17 '--gpu-testing-secondary-device-ids', |
| 18 '--gpu-testing-driver-date', |
| 18 '--gpu-testing-gl-vendor', | 19 '--gpu-testing-gl-vendor', |
| 19 '--gpu-testing-gl-renderer', | 20 '--gpu-testing-gl-renderer', |
| 20 '--gpu-testing-gl-version'] | 21 '--gpu-testing-gl-version'] |
| 21 | 22 |
| 22 def __init__(self, test, finder_options, story_set): | 23 def __init__(self, test, finder_options, story_set): |
| 23 super(GpuProcessSharedPageState, self).__init__( | 24 super(GpuProcessSharedPageState, self).__init__( |
| 24 test, finder_options, story_set) | 25 test, finder_options, story_set) |
| 25 options = finder_options.browser_options.extra_browser_args | 26 options = finder_options.browser_options.extra_browser_args |
| 26 | 27 |
| 27 # Clear all existing gpu testing switches. | 28 # Clear all existing gpu testing switches. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 inactive_gpus.append(value) | 62 inactive_gpus.append(value) |
| 62 index += 1 | 63 index += 1 |
| 63 | 64 |
| 64 if active_gpu != self.active_gpu: | 65 if active_gpu != self.active_gpu: |
| 65 raise page_test.Failure('Active GPU field is wrong %s' % active_gpu) | 66 raise page_test.Failure('Active GPU field is wrong %s' % active_gpu) |
| 66 | 67 |
| 67 if inactive_gpus != self.inactive_gpus: | 68 if inactive_gpus != self.inactive_gpus: |
| 68 raise page_test.Failure('Inactive GPU field is wrong %s' % inactive_gpus) | 69 raise page_test.Failure('Inactive GPU field is wrong %s' % inactive_gpus) |
| 69 | 70 |
| 70 | 71 |
| 72 class DriverBugWorkaroundsTestsPage(gpu_test_base.PageBase): |
| 73 def __init__(self, page_set=None, name='', |
| 74 shared_page_state_class=None, |
| 75 expectations=None, |
| 76 expected_workaround=None, |
| 77 unexpected_workaround=None): |
| 78 super(DriverBugWorkaroundsTestsPage, self).__init__( |
| 79 url='chrome:gpu', |
| 80 page_set=page_set, |
| 81 name=name, |
| 82 shared_page_state_class=shared_page_state_class, |
| 83 expectations=expectations) |
| 84 self.expected_workaround = expected_workaround |
| 85 self.unexpected_workaround = unexpected_workaround |
| 86 |
| 87 def _Validate(self, tab, process_kind, is_expected, workaround_name): |
| 88 if process_kind == "browser_process": |
| 89 gpu_driver_bug_workarounds = tab.EvaluateJavaScript( \ |
| 90 'GetDriverBugWorkarounds()') |
| 91 elif process_kind == "gpu_process": |
| 92 gpu_driver_bug_workarounds = tab.EvaluateJavaScript( \ |
| 93 'chrome.gpuBenchmarking.getGpuDriverBugWorkarounds()') |
| 94 |
| 95 is_present = workaround_name in gpu_driver_bug_workarounds |
| 96 |
| 97 failure = False |
| 98 if is_expected and not is_present: |
| 99 failure = True |
| 100 error_message = "is missing" |
| 101 elif not is_expected and is_present: |
| 102 failure = True |
| 103 error_message = "is not expected" |
| 104 |
| 105 if failure: |
| 106 print 'Test failed. Printing page contents:' |
| 107 print tab.EvaluateJavaScript('document.body.innerHTML') |
| 108 raise page_test.Failure('%s %s in Browser process workarounds: %s' \ |
| 109 % (workaround_name, error_message, gpu_driver_bug_workarounds)) |
| 110 |
| 111 def Validate(self, tab, results): |
| 112 if not self.expected_workaround and not self.unexpected_workaround: |
| 113 return |
| 114 |
| 115 if self.expected_workaround: |
| 116 self._Validate(tab, "browser_process", True, self.expected_workaround) |
| 117 self._Validate(tab, "gpu_process", True, self.expected_workaround) |
| 118 |
| 119 if self.unexpected_workaround: |
| 120 self._Validate(tab, "browser_process", False, self.unexpected_workaround) |
| 121 self._Validate(tab, "gpu_process", False, self.unexpected_workaround) |
| 122 |
| 71 class GpuProcessTestsPage(gpu_test_base.PageBase): | 123 class GpuProcessTestsPage(gpu_test_base.PageBase): |
| 72 def __init__(self, url, name, story_set, expectations): | 124 def __init__(self, url, name, story_set, expectations): |
| 73 super(GpuProcessTestsPage, self).__init__(url=url, | 125 super(GpuProcessTestsPage, self).__init__(url=url, |
| 74 shared_page_state_class=gpu_test_base.GpuSharedPageState, | 126 shared_page_state_class=gpu_test_base.GpuSharedPageState, |
| 75 page_set=story_set, | 127 page_set=story_set, |
| 76 name=name, | 128 name=name, |
| 77 expectations=expectations) | 129 expectations=expectations) |
| 78 | 130 |
| 79 | 131 |
| 80 class FunctionalVideoPage(GpuProcessTestsPage): | 132 class FunctionalVideoPage(GpuProcessTestsPage): |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 shared_page_state_class=SkipGpuProcessSharedPageState, | 253 shared_page_state_class=SkipGpuProcessSharedPageState, |
| 202 expectations=expectations) | 254 expectations=expectations) |
| 203 | 255 |
| 204 def Validate(self, tab, results): | 256 def Validate(self, tab, results): |
| 205 has_gpu_process_js = 'chrome.gpuBenchmarking.hasGpuProcess()' | 257 has_gpu_process_js = 'chrome.gpuBenchmarking.hasGpuProcess()' |
| 206 has_gpu_process = tab.EvaluateJavaScript(has_gpu_process_js) | 258 has_gpu_process = tab.EvaluateJavaScript(has_gpu_process_js) |
| 207 if has_gpu_process: | 259 if has_gpu_process: |
| 208 raise page_test.Failure('GPU process detected') | 260 raise page_test.Failure('GPU process detected') |
| 209 | 261 |
| 210 | 262 |
| 211 class DriverBugWorkaroundsSharedPageState(GpuProcessSharedPageState): | 263 class DriverBugWorkaroundsShared(GpuProcessSharedPageState): |
| 212 def __init__(self, test, finder_options, story_set): | 264 def __init__(self, test, finder_options, story_set): |
| 213 super(DriverBugWorkaroundsSharedPageState, self).__init__( | 265 super(DriverBugWorkaroundsShared, self).__init__( |
| 214 test, finder_options, story_set) | 266 test, finder_options, story_set) |
| 215 options = finder_options.browser_options | 267 options = finder_options.browser_options |
| 216 options.AppendExtraBrowserArgs('--use_gpu_driver_workaround_for_testing') | 268 options.AppendExtraBrowserArgs('--use_gpu_driver_workaround_for_testing') |
| 217 | 269 |
| 218 | 270 |
| 219 class DriverBugWorkaroundsInGpuProcessPage(gpu_test_base.PageBase): | 271 class DriverBugWorkaroundsInGpuProcessPage(DriverBugWorkaroundsTestsPage): |
| 220 def __init__(self, story_set, expectations): | 272 def __init__(self, story_set, expectations): |
| 221 super(DriverBugWorkaroundsInGpuProcessPage, self).__init__( | 273 super(DriverBugWorkaroundsInGpuProcessPage, self).__init__( |
| 222 url='chrome:gpu', | |
| 223 name='GpuProcess.driver_bug_workarounds_in_gpu_process', | 274 name='GpuProcess.driver_bug_workarounds_in_gpu_process', |
| 224 page_set=story_set, | 275 page_set=story_set, |
| 225 shared_page_state_class=DriverBugWorkaroundsSharedPageState, | 276 shared_page_state_class=DriverBugWorkaroundsShared, |
| 226 expectations=expectations) | 277 expectations=expectations, |
| 278 expected_workaround='use_gpu_driver_workaround_for_testing') |
| 227 | 279 |
| 228 def Validate(self, tab, results): | 280 def Validate(self, tab, results): |
| 229 workaround = 'use_gpu_driver_workaround_for_testing' | 281 super(DriverBugWorkaroundsInGpuProcessPage, self).Validate(tab, results) |
| 230 | 282 |
| 231 browser_list = tab.EvaluateJavaScript('GetDriverBugWorkarounds()') | |
| 232 if not workaround in browser_list: | |
| 233 print 'Test failed. Printing page contents:' | |
| 234 print tab.EvaluateJavaScript('document.body.innerHTML') | |
| 235 raise page_test.Failure('%s missing in Browser process workarounds: %s' \ | |
| 236 % (workaround, browser_list)) | |
| 237 | 283 |
| 238 gpu_list = tab.EvaluateJavaScript( \ | 284 class DriverBugWorkaroundsUponGLRendererShared(GpuProcessSharedPageState): |
| 239 'chrome.gpuBenchmarking.getGpuDriverBugWorkarounds()') | 285 def __init__(self, test, finder_options, story_set): |
| 240 if not workaround in gpu_list: | 286 super(DriverBugWorkaroundsUponGLRendererShared, self).__init__( |
| 241 print 'Test failed. Printing page contents:' | 287 test, finder_options, story_set) |
| 242 print tab.EvaluateJavaScript('document.body.innerHTML') | 288 options = finder_options.browser_options |
| 243 raise page_test.Failure('%s missing in GPU process workarounds: %s' \ | 289 if sys.platform in ('cygwin', 'win32'): |
| 244 % (workaround, gpu_list)) | 290 # Hit id 51 and 87 from kGpuDriverBugListJson. |
| 291 options.AppendExtraBrowserArgs('--gpu-testing-vendor-id=0x1002') |
| 292 options.AppendExtraBrowserArgs('--gpu-testing-device-id=0x6779') |
| 293 options.AppendExtraBrowserArgs('--gpu-testing-driver-date=11-20-2014') |
| 294 options.AppendExtraBrowserArgs('--gpu-testing-gl-vendor=Google Inc.') |
| 295 options.AppendExtraBrowserArgs('--gpu-testing-gl-renderer=ANGLE ' \ |
| 296 '(AMD Radeon HD 6450 Direct3D11 vs_5_0 ps_5_0)') |
| 297 options.AppendExtraBrowserArgs('--gpu-testing-gl-version=OpenGL ES 2.0 ' \ |
| 298 '(ANGLE 2.1.0.0c0d8006a9dd)') |
| 299 elif sys.platform.startswith('linux'): |
| 300 # Hit id 153 from kGpuDriverBugListJson. |
| 301 options.AppendExtraBrowserArgs('--gpu-testing-vendor-id=0x0101') |
| 302 options.AppendExtraBrowserArgs('--gpu-testing-device-id=0x0102') |
| 303 options.AppendExtraBrowserArgs('--gpu-testing-gl-vendor=Vivante ' \ |
| 304 'Corporation') |
| 305 options.AppendExtraBrowserArgs('--gpu-testing-gl-renderer=Vivante GC1000') |
| 306 elif sys.platform == 'darwin': |
| 307 # Currently on osx no workaround relies on gl-renderer. |
| 308 pass |
| 309 |
| 310 |
| 311 class DriverBugWorkaroundsUponGLRendererPage(DriverBugWorkaroundsTestsPage): |
| 312 def __init__(self, story_set, expectations): |
| 313 self.expected_workaround = None |
| 314 self.unexpected_workaround = None |
| 315 |
| 316 if sys.platform in ('cygwin', 'win32'): |
| 317 self.expected_workaround = "texsubimage_faster_than_teximage" |
| 318 self.unexpected_workaround = "disable_d3d11" |
| 319 elif sys.platform.startswith('linux'): |
| 320 self.expected_workaround = "disable_multisampled_render_to_texture" |
| 321 elif sys.platform == 'darwin': |
| 322 pass |
| 323 super(DriverBugWorkaroundsUponGLRendererPage, self).__init__( |
| 324 name='GpuProcess.driver_bug_workarounds_upon_gl_renderer', |
| 325 page_set=story_set, |
| 326 shared_page_state_class=DriverBugWorkaroundsUponGLRendererShared, |
| 327 expectations=expectations, |
| 328 expected_workaround=self.expected_workaround, |
| 329 unexpected_workaround=self.unexpected_workaround) |
| 330 |
| 331 def Validate(self, tab, results): |
| 332 super(DriverBugWorkaroundsUponGLRendererPage, self).Validate(tab, results) |
| 245 | 333 |
| 246 | 334 |
| 247 class IdentifyActiveGpuSharedPageState1(GpuProcessSharedPageState): | 335 class IdentifyActiveGpuSharedPageState1(GpuProcessSharedPageState): |
| 248 def __init__(self, test, finder_options, story_set): | 336 def __init__(self, test, finder_options, story_set): |
| 249 super(IdentifyActiveGpuSharedPageState1, self).__init__( | 337 super(IdentifyActiveGpuSharedPageState1, self).__init__( |
| 250 test, finder_options, story_set) | 338 test, finder_options, story_set) |
| 251 opts = finder_options.browser_options | 339 opts = finder_options.browser_options |
| 252 | 340 |
| 253 opts.AppendExtraBrowserArgs('--gpu-testing-vendor-id=0x8086') | 341 opts.AppendExtraBrowserArgs('--gpu-testing-vendor-id=0x8086') |
| 254 opts.AppendExtraBrowserArgs('--gpu-testing-device-id=0x040a') | 342 opts.AppendExtraBrowserArgs('--gpu-testing-device-id=0x040a') |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 self.AddStory(GpuInfoCompletePage(self, expectations)) | 522 self.AddStory(GpuInfoCompletePage(self, expectations)) |
| 435 self.AddStory(NoGpuProcessPage(self, expectations)) | 523 self.AddStory(NoGpuProcessPage(self, expectations)) |
| 436 self.AddStory(SoftwareGpuProcessPage(self, expectations)) | 524 self.AddStory(SoftwareGpuProcessPage(self, expectations)) |
| 437 self.AddStory(SkipGpuProcessPage(self, expectations)) | 525 self.AddStory(SkipGpuProcessPage(self, expectations)) |
| 438 self.AddStory(DriverBugWorkaroundsInGpuProcessPage(self, expectations)) | 526 self.AddStory(DriverBugWorkaroundsInGpuProcessPage(self, expectations)) |
| 439 self.AddStory(IdentifyActiveGpuPage1(self, expectations)) | 527 self.AddStory(IdentifyActiveGpuPage1(self, expectations)) |
| 440 self.AddStory(IdentifyActiveGpuPage2(self, expectations)) | 528 self.AddStory(IdentifyActiveGpuPage2(self, expectations)) |
| 441 self.AddStory(IdentifyActiveGpuPage3(self, expectations)) | 529 self.AddStory(IdentifyActiveGpuPage3(self, expectations)) |
| 442 self.AddStory(IdentifyActiveGpuPage4(self, expectations)) | 530 self.AddStory(IdentifyActiveGpuPage4(self, expectations)) |
| 443 self.AddStory(ReadbackWebGLGpuProcessPage(self, expectations)) | 531 self.AddStory(ReadbackWebGLGpuProcessPage(self, expectations)) |
| 532 self.AddStory(DriverBugWorkaroundsUponGLRendererPage(self, expectations)) |
| 444 | 533 |
| 445 @property | 534 @property |
| 446 def allow_mixed_story_states(self): | 535 def allow_mixed_story_states(self): |
| 447 # Return True here in order to be able to run pages with different browser | 536 # Return True here in order to be able to run pages with different browser |
| 448 # command line arguments. | 537 # command line arguments. |
| 449 return True | 538 return True |
| OLD | NEW |