Skip to content

Commit

Permalink
Fix a few gpu tests on Android
Browse files Browse the repository at this point in the history
Make GpuProcess.driver_bug_workarounds_upon_gl_renderer and
GpuProcess.no_gpu_process work on Android.

For other tests it does not make sense to run them on Android because
there is either no entry in kSoftwareRenderingListJson to trigger
or no multi gpu configuration.

About GpuProcess.skip_gpu_process, I could not reproduce the failure on
Nexus 4.

BUG=611930

R=kbr@chromium.org

TEST=./content/test/gpu/run_gpu_test.py gpu_process --browser android-content-shell
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Committed: https://crrev.com/a2c5030470e9cee3ae35dc849c680530c2acf06a
Review-Url: https://codereview.chromium.org/2227893005
Cr-Original-Commit-Position: refs/heads/master@{#410998}
Cr-Commit-Position: refs/heads/master@{#411213}
  • Loading branch information
JulienIsorce authored and Commit bot committed Aug 11, 2016
1 parent 29029b8 commit b34180e
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 33 deletions.
16 changes: 0 additions & 16 deletions content/test/gpu/gpu_tests/gpu_process_expectations.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,6 @@ def SetExpectations(self):

self.Fail('GpuProcess.video', ['linux'], bug=257109)

# Android
self.Fail('GpuProcess.no_gpu_process',
['android'], bug=611930)
self.Fail('GpuProcess.identify_active_gpu1',
['android'], bug=611930)
self.Fail('GpuProcess.identify_active_gpu2',
['android'], bug=611930)
self.Fail('GpuProcess.identify_active_gpu3',
['android'], bug=611930)
self.Fail('GpuProcess.identify_active_gpu4',
['android'], bug=611930)
self.Fail('GpuProcess.readback_webgl_gpu_process',
['android'], bug=611930)
self.Fail('GpuProcess.driver_bug_workarounds_upon_gl_renderer',
['android'], bug=611930)

# Nexus 5X
# Skip this test because expecting it to fail will still run it.
self.Skip('GpuProcess.skip_gpu_process',
Expand Down
59 changes: 42 additions & 17 deletions content/test/gpu/page_sets/gpu_process_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,11 @@ def __init__(self, test, finder_options, story_set):
test, finder_options, story_set)
options = finder_options.browser_options

if sys.platform in ('cygwin', 'win32'):
if options.browser_type.startswith('android'):
# Hit id 8 from kSoftwareRenderingListJson, which applies to any platform.
options.AppendExtraBrowserArgs('--gpu-testing-vendor-id=0x10de')
options.AppendExtraBrowserArgs('--gpu-testing-device-id=0x0324')
elif sys.platform in ('cygwin', 'win32'):
# Hit id 34 from kSoftwareRenderingListJson.
options.AppendExtraBrowserArgs('--gpu-testing-vendor-id=0x5333')
options.AppendExtraBrowserArgs('--gpu-testing-device-id=0x8811')
Expand All @@ -195,15 +199,19 @@ def __init__(self, test, finder_options, story_set):

class NoGpuProcessPage(gpu_test_base.PageBase):

def __init__(self, story_set, expectations):
def __init__(self, story_set, expectations, is_platform_android):
super(NoGpuProcessPage, self).__init__(
url='about:blank',
name='GpuProcess.no_gpu_process',
page_set=story_set,
shared_page_state_class=NoGpuProcessSharedPageState,
expectations=expectations)
self.is_platform_android = is_platform_android

def Validate(self, tab, results):
if self.is_platform_android:
return

has_gpu_process_js = 'chrome.gpuBenchmarking.hasGpuProcess()'
has_gpu_process = tab.EvaluateJavaScript(has_gpu_process_js)
if has_gpu_process:
Expand All @@ -215,11 +223,13 @@ def __init__(self, test, finder_options, story_set):
super(SoftwareGpuProcessSharedPageState, self).__init__(
test, finder_options, story_set)
options = finder_options.browser_options

# Hit exception from id 50 from kSoftwareRenderingListJson.
options.AppendExtraBrowserArgs('--gpu-testing-vendor-id=0x10de')
options.AppendExtraBrowserArgs('--gpu-testing-device-id=0x0de1')
options.AppendExtraBrowserArgs('--gpu-testing-gl-vendor=VMware')
options.AppendExtraBrowserArgs('--gpu-testing-gl-renderer=SVGA3D')
options.AppendExtraBrowserArgs('--gpu-testing-gl-version="2.1 Mesa 10.1"')
options.AppendExtraBrowserArgs('--gpu-testing-gl-version=2.1 Mesa 10.1')


class SoftwareGpuProcessPage(gpu_test_base.PageBase):
Expand Down Expand Up @@ -286,7 +296,10 @@ def __init__(self, test, finder_options, story_set):
super(DriverBugWorkaroundsUponGLRendererShared, self).__init__(
test, finder_options, story_set)
options = finder_options.browser_options
if sys.platform in ('cygwin', 'win32'):
if options.browser_type.startswith('android'):
# Hit id 108 from kGpuDriverBugListJson.
options.AppendExtraBrowserArgs('--gpu-testing-gl-vendor=Qualcomm')
elif sys.platform in ('cygwin', 'win32'):
# Hit id 51 and 87 from kGpuDriverBugListJson.
options.AppendExtraBrowserArgs('--gpu-testing-vendor-id=0x1002')
options.AppendExtraBrowserArgs('--gpu-testing-device-id=0x6779')
Expand All @@ -309,11 +322,13 @@ def __init__(self, test, finder_options, story_set):


class DriverBugWorkaroundsUponGLRendererPage(DriverBugWorkaroundsTestsPage):
def __init__(self, story_set, expectations):
def __init__(self, story_set, expectations, is_platform_android):
self.expected_workaround = None
self.unexpected_workaround = None

if sys.platform in ('cygwin', 'win32'):
if is_platform_android:
self.expected_workaround = "wake_up_gpu_before_drawing"
elif sys.platform in ('cygwin', 'win32'):
self.expected_workaround = "texsubimage_faster_than_teximage"
self.unexpected_workaround = "disable_d3d11"
elif sys.platform.startswith('linux'):
Expand Down Expand Up @@ -461,8 +476,9 @@ def __init__(self, test, finder_options, story_set):
super(ReadbackWebGLGpuProcessSharedPageState, self).__init__(
test, finder_options, story_set)
options = finder_options.browser_options
is_platform_android = options.browser_type.startswith('android')

if sys.platform.startswith('linux'):
if sys.platform.startswith('linux') and not is_platform_android:
# Hit id 110 from kSoftwareRenderingListJson.
options.AppendExtraBrowserArgs('--gpu-testing-vendor-id=0x10de')
options.AppendExtraBrowserArgs('--gpu-testing-device-id=0x0de1')
Expand All @@ -472,16 +488,17 @@ def __init__(self, test, finder_options, story_set):
options.AppendExtraBrowserArgs('--gpu-testing-gl-version="3.0 Mesa 11.2"')

class ReadbackWebGLGpuProcessPage(gpu_test_base.PageBase):
def __init__(self, story_set, expectations):
def __init__(self, story_set, expectations, is_platform_android):
super(ReadbackWebGLGpuProcessPage, self).__init__(
url='chrome:gpu',
name='GpuProcess.readback_webgl_gpu_process',
page_set=story_set,
shared_page_state_class=ReadbackWebGLGpuProcessSharedPageState,
expectations=expectations)
self.is_platform_android = is_platform_android

def Validate(self, tab, results):
if sys.platform.startswith('linux'):
if sys.platform.startswith('linux') and not self.is_platform_android:
feature_status_js = 'browserBridge.gpuInfo.featureStatus.featureStatus'
feature_status_list = tab.EvaluateJavaScript(feature_status_js)
result = True
Expand Down Expand Up @@ -592,22 +609,30 @@ def __init__(self, expectations, is_platform_android):

self.AddStory(FunctionalVideoPage(self, expectations))
self.AddStory(GpuInfoCompletePage(self, expectations))
self.AddStory(NoGpuProcessPage(self, expectations))
self.AddStory(SoftwareGpuProcessPage(self, expectations))
self.AddStory(NoGpuProcessPage(self, expectations, is_platform_android))
self.AddStory(DriverBugWorkaroundsInGpuProcessPage(self, expectations))
self.AddStory(IdentifyActiveGpuPage1(self, expectations))
self.AddStory(IdentifyActiveGpuPage2(self, expectations))
self.AddStory(IdentifyActiveGpuPage3(self, expectations))
self.AddStory(IdentifyActiveGpuPage4(self, expectations))
self.AddStory(ReadbackWebGLGpuProcessPage(self, expectations))
self.AddStory(DriverBugWorkaroundsUponGLRendererPage(self, expectations))
self.AddStory(ReadbackWebGLGpuProcessPage(self, expectations,
is_platform_android))
self.AddStory(DriverBugWorkaroundsUponGLRendererPage(self, expectations,
is_platform_android))
self.AddStory(EqualBugWorkaroundsInBrowserAndGpuProcessPage(self,
expectations))
if not is_platform_android:
self.AddStory(SkipGpuProcessPage(self, expectations))
self.AddStory(HasTransparentVisualsGpuProcessPage(self, expectations))
self.AddStory(NoTransparentVisualsGpuProcessPage(self, expectations))

# There is no Android multi-gpu configuration and the helper
# gpu_info_collector.cc::IdentifyActiveGPU is not even called.
self.AddStory(IdentifyActiveGpuPage1(self, expectations))
self.AddStory(IdentifyActiveGpuPage2(self, expectations))
self.AddStory(IdentifyActiveGpuPage3(self, expectations))
self.AddStory(IdentifyActiveGpuPage4(self, expectations))

# There is currently no entry in kSoftwareRenderingListJson that enables
# a software GL driver on Android.
self.AddStory(SoftwareGpuProcessPage(self, expectations))

@property
def allow_mixed_story_states(self):
# Return True here in order to be able to run pages with different browser
Expand Down
15 changes: 15 additions & 0 deletions gpu/config/gpu_info_collector_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "gpu/config/gpu_switches.h"
#include "ui/gl/egl_util.h"
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_context.h"
Expand Down Expand Up @@ -205,6 +206,20 @@ gpu::CollectInfoResult CollectDriverInfo(gpu::GPUInfo* gpu_info) {
gpu_info->gl_extensions =
reinterpret_cast<const char*>(glGetStringFn(GL_EXTENSIONS));

base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kGpuTestingGLVendor)) {
gpu_info->gl_vendor =
command_line->GetSwitchValueASCII(switches::kGpuTestingGLVendor);
}
if (command_line->HasSwitch(switches::kGpuTestingGLRenderer)) {
gpu_info->gl_renderer =
command_line->GetSwitchValueASCII(switches::kGpuTestingGLRenderer);
}
if (command_line->HasSwitch(switches::kGpuTestingGLVersion)) {
gpu_info->gl_version =
command_line->GetSwitchValueASCII(switches::kGpuTestingGLVersion);
}

GLint max_samples = 0;
glGetIntegervFn(GL_MAX_SAMPLES, &max_samples);
gpu_info->max_msaa_samples = base::IntToString(max_samples);
Expand Down

0 comments on commit b34180e

Please sign in to comment.