diff options
author | epenner@chromium.org <epenner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-20 00:54:24 +0000 |
---|---|---|
committer | epenner@chromium.org <epenner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-20 00:54:24 +0000 |
commit | 85cb468fe17f6449a387e11795b200a815c720f2 (patch) | |
tree | d6a14c298ee2940fe39fe8bee4291b0f26ad413d /gpu/command_buffer/service | |
parent | 4e2876a49c504657cc0cc77fe590ea6dc0238346 (diff) | |
download | chromium_src-85cb468fe17f6449a387e11795b200a815c720f2.zip chromium_src-85cb468fe17f6449a387e11795b200a815c720f2.tar.gz chromium_src-85cb468fe17f6449a387e11795b200a815c720f2.tar.bz2 |
Reland "gpu: Fix Vivante's "hisilicon" GPUs"
This fixes "Hisilicon" GPUs, which is an instance of a
Vivante's GPU design. This involves enabling virtual
contexts, since they don't support share-groups, and further
adds a work-around for switching surfaces. Without the work-
around the view surface "inherits" the size of the last
bound surface (which for Chrome tends to be a 1x1 pbuffer)
resulting in a black screen. The following steps "repair"
the view surface every time it is made current:
- Make it current.
- Bind the default frame-buffer.
- Make it not current.
- Destroy/recreate it from the native handle.
- Make it current again.
NOTE: The "Recreate" function is added to surface because
the Destroy/Initialize may be intercepted or modified by
wrapper surface classes. Recreate is similar to resize,
which after being forwarded by a wrapper can call
Destroy/Initialize on the 'real' surface.
BUG=179250
NOTRY=true
No-try, as all the relevant bots are already green.
Review URL: https://chromiumcodereview.appspot.com/13852023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195349 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer/service')
5 files changed, 18 insertions, 0 deletions
diff --git a/gpu/command_buffer/service/feature_info.cc b/gpu/command_buffer/service/feature_info.cc index d9df6f6..aad133e 100644 --- a/gpu/command_buffer/service/feature_info.cc +++ b/gpu/command_buffer/service/feature_info.cc @@ -191,6 +191,7 @@ void FeatureInfo::AddFeatures(const CommandLine& command_line) { bool is_qualcomm = false; bool is_imagination = false; bool is_arm = false; + bool is_hisilicon = false; const char* gl_strings[2]; gl_strings[0] = reinterpret_cast<const char*>(glGetString(GL_VENDOR)); gl_strings[1] = reinterpret_cast<const char*>(glGetString(GL_RENDERER)); @@ -208,6 +209,7 @@ void FeatureInfo::AddFeatures(const CommandLine& command_line) { is_qualcomm |= string_set.Contains("qualcomm"); is_imagination |= string_set.Contains("imagination"); is_arm |= string_set.Contains("arm"); + is_hisilicon |= string_set.Contains("hisilicon"); } } @@ -221,6 +223,9 @@ void FeatureInfo::AddFeatures(const CommandLine& command_line) { workarounds_.flush_on_context_switch = true; workarounds_.delete_instead_of_resize_fbo = true; } + if (is_hisilicon) { + workarounds_.makecurrent_recreates_surfaces = true; + } #if defined(OS_MACOSX) workarounds_.needs_offscreen_buffer_workaround = is_nvidia; workarounds_.needs_glsl_built_in_function_emulation = is_amd; diff --git a/gpu/command_buffer/service/gl_context_virtual.cc b/gpu/command_buffer/service/gl_context_virtual.cc index bc8c820..71c4762 100644 --- a/gpu/command_buffer/service/gl_context_virtual.cc +++ b/gpu/command_buffer/service/gl_context_virtual.cc @@ -103,6 +103,10 @@ bool GLContextVirtual::WasAllocatedUsingRobustnessExtension() { return shared_context_->WasAllocatedUsingRobustnessExtension(); } +void GLContextVirtual::SetRecreateSurfaceOnMakeCurrent() { + shared_context_->SetRecreateSurfaceOnMakeCurrent(); +} + GLContextVirtual::~GLContextVirtual() { Destroy(); } diff --git a/gpu/command_buffer/service/gl_context_virtual.h b/gpu/command_buffer/service/gl_context_virtual.h index 9013a5f..026aca0 100644 --- a/gpu/command_buffer/service/gl_context_virtual.h +++ b/gpu/command_buffer/service/gl_context_virtual.h @@ -48,6 +48,7 @@ class GPU_EXPORT GLContextVirtual : public gfx::GLContext { virtual bool GetTotalGpuMemory(size_t* bytes) OVERRIDE; virtual void SetSafeToForceGpuSwitch() OVERRIDE; virtual bool WasAllocatedUsingRobustnessExtension() OVERRIDE; + virtual void SetRecreateSurfaceOnMakeCurrent() OVERRIDE; protected: virtual ~GLContextVirtual(); diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index 38be722..b50437a 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -2532,6 +2532,12 @@ bool GLES2DecoderImpl::Initialize( glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT); } +#if defined(OS_ANDROID) + if (feature_info_->workarounds().makecurrent_recreates_surfaces) { + context_->SetRecreateSurfaceOnMakeCurrent(); + } +#endif + // Only compositor contexts are known to use only the subset of GL // that can be safely migrated between the iGPU and the dGPU. Mark // those contexts as safe to forcibly transition between the GPUs. diff --git a/gpu/command_buffer/service/gpu_driver_bug_workaround_type.h b/gpu/command_buffer/service/gpu_driver_bug_workaround_type.h index 0478b28..fa71504 100644 --- a/gpu/command_buffer/service/gpu_driver_bug_workaround_type.h +++ b/gpu/command_buffer/service/gpu_driver_bug_workaround_type.h @@ -28,6 +28,8 @@ exit_on_context_lost) \ GPU_OP(FLUSH_ON_CONTEXT_SWITCH, \ flush_on_context_switch) \ + GPU_OP(MAKECURRENT_RECREATES_SURFACES, \ + makecurrent_recreates_surfaces) \ GPU_OP(MAX_CUBE_MAP_TEXTURE_SIZE_LIMIT_1024, \ max_cube_map_texture_size_limit_1024) \ GPU_OP(MAX_CUBE_MAP_TEXTURE_SIZE_LIMIT_4096, \ |