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

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

Issue 2195743005: Fix ineffective --disable-gpu-driver-bug-workarounds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: record and re-apply disabled gl extensions to avoid known gpu driver crashes Created 4 years, 4 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 | « content/browser/gpu/gpu_process_host.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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):
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 return 113 return
114 114
115 if self.expected_workaround: 115 if self.expected_workaround:
116 self._Validate(tab, "browser_process", True, self.expected_workaround) 116 self._Validate(tab, "browser_process", True, self.expected_workaround)
117 self._Validate(tab, "gpu_process", True, self.expected_workaround) 117 self._Validate(tab, "gpu_process", True, self.expected_workaround)
118 118
119 if self.unexpected_workaround: 119 if self.unexpected_workaround:
120 self._Validate(tab, "browser_process", False, self.unexpected_workaround) 120 self._Validate(tab, "browser_process", False, self.unexpected_workaround)
121 self._Validate(tab, "gpu_process", False, self.unexpected_workaround) 121 self._Validate(tab, "gpu_process", False, self.unexpected_workaround)
122 122
123
124 class EqualBugWorkaroundsBasePage(gpu_test_base.PageBase):
125 def __init__(self, name=None, page_set=None, shared_page_state_class=None,
126 expectations=None):
127 super(EqualBugWorkaroundsBasePage, self).__init__(
128 url='chrome:gpu',
129 name=name,
130 page_set=page_set,
131 shared_page_state_class=shared_page_state_class,
132 expectations=expectations)
133
134 def Validate(self, tab, results):
135 has_gpu_process_js = 'chrome.gpuBenchmarking.hasGpuProcess()'
136 if not tab.EvaluateJavaScript(has_gpu_process_js):
137 raise page_test.Failure('No GPU process detected')
138
139 has_gpu_channel_js = 'chrome.gpuBenchmarking.hasGpuChannel()'
140 if not tab.EvaluateJavaScript(has_gpu_channel_js):
141 raise page_test.Failure('No GPU channel detected')
142
143 browser_list = tab.EvaluateJavaScript('GetDriverBugWorkarounds()')
144 gpu_list = tab.EvaluateJavaScript( \
145 'chrome.gpuBenchmarking.getGpuDriverBugWorkarounds()')
146
147 diff = set(browser_list).symmetric_difference(set(gpu_list))
148 if len(diff) > 0:
149 print 'Test failed. Printing page contents:'
150 print tab.EvaluateJavaScript('document.body.innerHTML')
151 raise page_test.Failure('Browser and GPU process list of driver bug' \
152 'workarounds are not equal: %s != %s, diff: %s' % \
153 (browser_list, gpu_list, list(diff)))
154
155 basic_infos = tab.EvaluateJavaScript('browserBridge.gpuInfo.basic_info')
156 disabled_gl_extensions = None
157 for info in basic_infos:
158 if info['description'].startswith('Disabled Extensions'):
159 disabled_gl_extensions = info['value']
160 break
161
162 return gpu_list, disabled_gl_extensions
163
164
123 class GpuProcessTestsPage(gpu_test_base.PageBase): 165 class GpuProcessTestsPage(gpu_test_base.PageBase):
124 def __init__(self, url, name, story_set, expectations): 166 def __init__(self, url, name, story_set, expectations):
125 super(GpuProcessTestsPage, self).__init__(url=url, 167 super(GpuProcessTestsPage, self).__init__(url=url,
126 shared_page_state_class=gpu_test_base.GpuSharedPageState, 168 shared_page_state_class=gpu_test_base.GpuSharedPageState,
127 page_set=story_set, 169 page_set=story_set,
128 name=name, 170 name=name,
129 expectations=expectations) 171 expectations=expectations)
130 172
131 173
132 class FunctionalVideoPage(GpuProcessTestsPage): 174 class FunctionalVideoPage(GpuProcessTestsPage):
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 result = result and status == 'disabled_software' 551 result = result and status == 'disabled_software'
510 elif name == 'webgl': 552 elif name == 'webgl':
511 result = result and status == 'enabled_readback' 553 result = result and status == 'enabled_readback'
512 else: 554 else:
513 result = result and status == 'unavailable_software' 555 result = result and status == 'unavailable_software'
514 if not result: 556 if not result:
515 raise page_test.Failure('WebGL readback setup failed: %s' \ 557 raise page_test.Failure('WebGL readback setup failed: %s' \
516 % feature_status_list) 558 % feature_status_list)
517 559
518 560
519 class EqualBugWorkaroundsInBrowserAndGpuProcessPage(gpu_test_base.PageBase):
520 def __init__(self, story_set, expectations):
521 super(EqualBugWorkaroundsInBrowserAndGpuProcessPage, self).__init__(
522 url='chrome:gpu',
523 name='GpuProcess.equal_bug_workarounds_in_browser_and_gpu_process',
524 page_set=story_set,
525 shared_page_state_class=GpuProcessSharedPageState,
526 expectations=expectations)
527
528 def Validate(self, tab, results):
529 browser_list = tab.EvaluateJavaScript('GetDriverBugWorkarounds()')
530 gpu_list = tab.EvaluateJavaScript( \
531 'chrome.gpuBenchmarking.getGpuDriverBugWorkarounds()')
532
533 diff = set(browser_list).symmetric_difference(set(gpu_list))
534 if len(diff) > 0:
535 print 'Test failed. Printing page contents:'
536 print tab.EvaluateJavaScript('document.body.innerHTML')
537 raise page_test.Failure('Browser and GPU process list of driver bug' \
538 'workarounds are not equal: %s != %s, diff: %s' % \
539 (browser_list, gpu_list, list(diff)))
540
541
542 class HasTransparentVisualsShared(GpuProcessSharedPageState): 561 class HasTransparentVisualsShared(GpuProcessSharedPageState):
543 def __init__(self, test, finder_options, story_set): 562 def __init__(self, test, finder_options, story_set):
544 super(HasTransparentVisualsShared, self).__init__( 563 super(HasTransparentVisualsShared, self).__init__(
545 test, finder_options, story_set) 564 test, finder_options, story_set)
546 options = finder_options.browser_options 565 options = finder_options.browser_options
547 if sys.platform.startswith('linux'): 566 if sys.platform.startswith('linux'):
548 # Hit id 173 from kGpuDriverBugListJson. 567 # Hit id 173 from kGpuDriverBugListJson.
549 options.AppendExtraBrowserArgs('--gpu-testing-gl-version=3.0 Mesa ' \ 568 options.AppendExtraBrowserArgs('--gpu-testing-gl-version=3.0 Mesa ' \
550 '12.1') 569 '12.1')
551 570
(...skipping 28 matching lines...) Expand all
580 shared_page_state_class=NoTransparentVisualsShared, 599 shared_page_state_class=NoTransparentVisualsShared,
581 expectations=expectations, 600 expectations=expectations,
582 expected_workaround='disable_transparent_visuals', 601 expected_workaround='disable_transparent_visuals',
583 unexpected_workaround=None) 602 unexpected_workaround=None)
584 603
585 def Validate(self, tab, results): 604 def Validate(self, tab, results):
586 if sys.platform.startswith('linux'): 605 if sys.platform.startswith('linux'):
587 super(NoTransparentVisualsGpuProcessPage, self).Validate(tab, results) 606 super(NoTransparentVisualsGpuProcessPage, self).Validate(tab, results)
588 607
589 608
609 class TransferWorkaroundSharedPageState(GpuProcessSharedPageState):
610 def __init__(self, test, finder_options, story_set):
611 super(TransferWorkaroundSharedPageState, self).__init__(
612 test, finder_options, story_set)
613
614 # Extra browser args need to be added here. Adding them in RunStory would be
615 # too late.
616 def WillRunStory(self, results):
617 if self.WarmUpDone():
618 options = self._finder_options.browser_options
619 options.AppendExtraBrowserArgs('--use_gpu_driver_workaround_for_testing')
620 options.AppendExtraBrowserArgs('--disable-gpu-driver-bug-workarounds')
621
622 # Inject some info to make sure the flag above is effective.
623 if sys.platform == 'darwin':
624 # Hit id 33 from kGpuDriverBugListJson.
625 options.AppendExtraBrowserArgs('--gpu-testing-gl-vendor=Imagination')
626 else:
627 # Hit id 5 from kGpuDriverBugListJson.
628 options.AppendExtraBrowserArgs('--gpu-testing-vendor-id=0x10de')
629 options.AppendExtraBrowserArgs('--gpu-testing-device-id=0x0001')
630 # no multi gpu on Android.
631 if not options.browser_type.startswith('android'):
632 options.AppendExtraBrowserArgs('--gpu-testing-secondary-vendor-ids=')
633 options.AppendExtraBrowserArgs('--gpu-testing-secondary-device-ids=')
634
635 for workaround in self.RecordedWorkarounds():
636 options.AppendExtraBrowserArgs('--' + workaround)
637 options.AppendExtraBrowserArgs('--disable-gl-extensions=' + \
638 self.DisabledGLExts())
639 super(TransferWorkaroundSharedPageState, self).WillRunStory(results)
640
641 # self._current_page is None in WillRunStory so do the transfer here.
642 def RunStory(self, results):
643 if self.WarmUpDone():
644 self._current_page.expected_workarounds = self.RecordedWorkarounds()
645 self._current_page.expected_disabled_exts = self.DisabledGLExts()
646 self.AddTestingWorkaround(self._current_page.expected_workarounds)
647 super(TransferWorkaroundSharedPageState, self).RunStory(results)
648
649 def WarmUpDone(self):
650 return self._previous_page is not None and \
651 self.RecordedWorkarounds() is not None
652
653 def RecordedWorkarounds(self):
654 return self._previous_page.recorded_workarounds
655
656 def DisabledGLExts(self):
657 return self._previous_page.recorded_disabled_exts
658
659 def AddTestingWorkaround(self, workarounds):
660 if workarounds is not None:
661 workarounds.append('use_gpu_driver_workaround_for_testing')
662
663
664 class EqualBugWorkaroundsPage(EqualBugWorkaroundsBasePage):
665 def __init__(self, story_set, expectations):
666 super(EqualBugWorkaroundsPage, self).__init__(
667 name='GpuProcess.equal_bug_workarounds_in_browser_and_gpu_process',
668 page_set=story_set,
669 shared_page_state_class=TransferWorkaroundSharedPageState,
670 expectations=expectations)
671 self.recorded_workarounds = None
672 self.recorded_disabled_exts = None
673
674 def Validate(self, tab, results):
675 recorded_info = super(EqualBugWorkaroundsPage, self).Validate(tab, results)
676 gpu_list, disabled_gl_extensions = recorded_info
677
678 self.recorded_workarounds = gpu_list
679 self.recorded_disabled_exts = disabled_gl_extensions
680
681
682 class OnlyOneWorkaroundPage(EqualBugWorkaroundsBasePage):
683 def __init__(self, story_set, expectations):
684 super(OnlyOneWorkaroundPage, self).__init__(
685 name='GpuProcess.only_one_workaround',
686 page_set=story_set,
687 shared_page_state_class=TransferWorkaroundSharedPageState,
688 expectations=expectations)
689 self.expected_workarounds = None
690 self.expected_disabled_exts = None
691
692 def Validate(self, tab, results):
693 # Requires EqualBugWorkaroundsPage to succeed. If it has failed then just
694 # pass to not overload the logs.
695 if self.expected_workarounds is None:
696 return
697
698 recorded_info = super(OnlyOneWorkaroundPage, self).Validate(tab, results)
699 gpu_list, disabled_gl_extensions = recorded_info
700
701 diff = set(self.expected_workarounds).symmetric_difference(set(gpu_list))
702 if len(diff) > 0:
703 print 'Test failed. Printing page contents:'
704 print tab.EvaluateJavaScript('document.body.innerHTML')
705 raise page_test.Failure('GPU process and expected list of driver bug' \
706 'workarounds are not equal: %s != %s, diff: %s' % \
707 (self.expected_workarounds, gpu_list, list(diff)))
708
709 if self.expected_disabled_exts != disabled_gl_extensions:
710 print 'Test failed. Printing page contents:'
711 print tab.EvaluateJavaScript('document.body.innerHTML')
712 raise page_test.Failure('The expected disabled gl extensions are ' \
713 'incorrect: %s != %s:' % \
714 (self.expected_disabled_exts, disabled_gl_extensions))
715
716
590 class GpuProcessTestsStorySet(story_set_module.StorySet): 717 class GpuProcessTestsStorySet(story_set_module.StorySet):
591 718
592 """ Tests that accelerated content triggers the creation of a GPU process """ 719 """ Tests that accelerated content triggers the creation of a GPU process """
593 720
594 def __init__(self, expectations, is_platform_android): 721 def __init__(self, expectations, is_platform_android):
595 super(GpuProcessTestsStorySet, self).__init__( 722 super(GpuProcessTestsStorySet, self).__init__(
596 serving_dirs=set(['../../../../content/test/data'])) 723 serving_dirs=set(['../../../../content/test/data']))
597 724
598 urls_and_names_list = [ 725 urls_and_names_list = [
599 ('file://../../data/gpu/functional_canvas_demo.html', 726 ('file://../../data/gpu/functional_canvas_demo.html',
600 'GpuProcess.canvas2d'), 727 'GpuProcess.canvas2d'),
601 ('file://../../data/gpu/functional_3d_css.html', 728 ('file://../../data/gpu/functional_3d_css.html',
602 'GpuProcess.css3d'), 729 'GpuProcess.css3d'),
603 ('file://../../data/gpu/functional_webgl.html', 730 ('file://../../data/gpu/functional_webgl.html',
604 'GpuProcess.webgl') 731 'GpuProcess.webgl')
605 ] 732 ]
606 733
607 for url, name in urls_and_names_list: 734 for url, name in urls_and_names_list:
608 self.AddStory(GpuProcessTestsPage(url, name, self, expectations)) 735 self.AddStory(GpuProcessTestsPage(url, name, self, expectations))
609 736
610 self.AddStory(FunctionalVideoPage(self, expectations)) 737 self.AddStory(FunctionalVideoPage(self, expectations))
611 self.AddStory(GpuInfoCompletePage(self, expectations)) 738 self.AddStory(GpuInfoCompletePage(self, expectations))
612 self.AddStory(NoGpuProcessPage(self, expectations)) 739 self.AddStory(NoGpuProcessPage(self, expectations))
613 self.AddStory(DriverBugWorkaroundsInGpuProcessPage(self, expectations)) 740 self.AddStory(DriverBugWorkaroundsInGpuProcessPage(self, expectations))
614 self.AddStory(ReadbackWebGLGpuProcessPage(self, expectations, 741 self.AddStory(ReadbackWebGLGpuProcessPage(self, expectations,
615 is_platform_android)) 742 is_platform_android))
616 self.AddStory(DriverBugWorkaroundsUponGLRendererPage(self, expectations, 743 self.AddStory(DriverBugWorkaroundsUponGLRendererPage(self, expectations,
617 is_platform_android)) 744 is_platform_android))
618 self.AddStory(EqualBugWorkaroundsInBrowserAndGpuProcessPage(self, 745 self.AddStory(EqualBugWorkaroundsPage(self, expectations))
619 expectations)) 746 self.AddStory(OnlyOneWorkaroundPage(self, expectations))
747
620 if not is_platform_android: 748 if not is_platform_android:
621 self.AddStory(SkipGpuProcessPage(self, expectations)) 749 self.AddStory(SkipGpuProcessPage(self, expectations))
622 self.AddStory(HasTransparentVisualsGpuProcessPage(self, expectations)) 750 self.AddStory(HasTransparentVisualsGpuProcessPage(self, expectations))
623 self.AddStory(NoTransparentVisualsGpuProcessPage(self, expectations)) 751 self.AddStory(NoTransparentVisualsGpuProcessPage(self, expectations))
624 752
625 # There is no Android multi-gpu configuration and the helper 753 # There is no Android multi-gpu configuration and the helper
626 # gpu_info_collector.cc::IdentifyActiveGPU is not even called. 754 # gpu_info_collector.cc::IdentifyActiveGPU is not even called.
627 self.AddStory(IdentifyActiveGpuPage1(self, expectations)) 755 self.AddStory(IdentifyActiveGpuPage1(self, expectations))
628 self.AddStory(IdentifyActiveGpuPage2(self, expectations)) 756 self.AddStory(IdentifyActiveGpuPage2(self, expectations))
629 self.AddStory(IdentifyActiveGpuPage3(self, expectations)) 757 self.AddStory(IdentifyActiveGpuPage3(self, expectations))
630 self.AddStory(IdentifyActiveGpuPage4(self, expectations)) 758 self.AddStory(IdentifyActiveGpuPage4(self, expectations))
631 759
632 # There is currently no entry in kSoftwareRenderingListJson that enables 760 # There is currently no entry in kSoftwareRenderingListJson that enables
633 # a software GL driver on Android. 761 # a software GL driver on Android.
634 self.AddStory(SoftwareGpuProcessPage(self, expectations)) 762 self.AddStory(SoftwareGpuProcessPage(self, expectations))
635 763
636 @property 764 @property
637 def allow_mixed_story_states(self): 765 def allow_mixed_story_states(self):
638 # Return True here in order to be able to run pages with different browser 766 # Return True here in order to be able to run pages with different browser
639 # command line arguments. 767 # command line arguments.
640 return True 768 return True
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_process_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698