diff options
author | epenner@chromium.org <epenner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-27 02:04:41 +0000 |
---|---|---|
committer | epenner@chromium.org <epenner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-27 02:04:41 +0000 |
commit | 9b753995f049e3c59cf69e6b4cab9caef561992f (patch) | |
tree | f9f9c20f4b9d3eb51eed536bcbcaba596c5739e0 /ui/gl/gl_context_egl.cc | |
parent | 64ee67e315213b5a76fafd7eed0d349e26652464 (diff) | |
download | chromium_src-9b753995f049e3c59cf69e6b4cab9caef561992f.zip chromium_src-9b753995f049e3c59cf69e6b4cab9caef561992f.tar.gz chromium_src-9b753995f049e3c59cf69e6b4cab9caef561992f.tar.bz2 |
gpu: Cleanup 'black-screen on Huawei' work-around.
We got a response from their driver team. The surface
is only corrupted if an FBO is bound when it is first
made-current. So we can avoid re-creating the surface
and just unbind the Fbo instead.
The work-around is still needed in the context itself
for two reasons:
- Virtual context indirections
- The first make-current for new surfaces
is not in the decoder.
BUG=235935
NOTRY=true
No try, since this doesn't run on mac, so mac_asan bot isn't relevant.
Review URL: https://chromiumcodereview.appspot.com/14021014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@196915 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gl/gl_context_egl.cc')
-rw-r--r-- | ui/gl/gl_context_egl.cc | 50 |
1 files changed, 6 insertions, 44 deletions
diff --git a/ui/gl/gl_context_egl.cc b/ui/gl/gl_context_egl.cc index 196438c..620649e 100644 --- a/ui/gl/gl_context_egl.cc +++ b/ui/gl/gl_context_egl.cc @@ -29,7 +29,7 @@ GLContextEGL::GLContextEGL(GLShareGroup* share_group) context_(NULL), display_(NULL), config_(NULL), - recreate_surface_on_makecurrent_(false) { + unbind_fbo_on_makecurrent_(false) { } bool GLContextEGL::Initialize( @@ -98,6 +98,9 @@ bool GLContextEGL::MakeCurrent(GLSurface* surface) { "context", context_, "surface", surface); + if (unbind_fbo_on_makecurrent_) + glBindFramebufferEXT(GL_FRAMEBUFFER, 0); + if (!eglMakeCurrent(display_, surface->GetHandle(), surface->GetHandle(), @@ -113,11 +116,6 @@ bool GLContextEGL::MakeCurrent(GLSurface* surface) { return false; } -#if defined(OS_ANDROID) - if (!RecreateSurfaceIfNeeded(surface)) - return false; -#endif - if (!surface->OnMakeCurrent(this)) { LOG(ERROR) << "Could not make current."; return false; @@ -127,44 +125,8 @@ bool GLContextEGL::MakeCurrent(GLSurface* surface) { return true; } -void GLContextEGL::SetRecreateSurfaceOnMakeCurrent() { - recreate_surface_on_makecurrent_ = true; -} - -bool GLContextEGL::RecreateSurfaceIfNeeded(GLSurface* surface) { - if (!recreate_surface_on_makecurrent_ || - !surface || - surface->IsOffscreen() || - surface->GetBackingFrameBufferObject()) - return true; - - // This is specifically needed for Vivante GPU's on Android. - // A native view surface will not be configured correctly - // unless we do all of the following steps after making the - // surface current. - GLint fbo = 0; - glGetIntegerv(GL_FRAMEBUFFER_BINDING, &fbo); - glBindFramebufferEXT(GL_FRAMEBUFFER, 0); - - eglMakeCurrent(display_, - EGL_NO_SURFACE, - EGL_NO_SURFACE, - EGL_NO_CONTEXT); - if (!surface->Recreate()) { - LOG(ERROR) << "Failed to recreate surface"; - return false; - } - if (!eglMakeCurrent(display_, - surface->GetHandle(), - surface->GetHandle(), - context_)) { - LOG(ERROR) << "eglMakeCurrent failed with error " - << GetLastEGLErrorString(); - return false; - } - - glBindFramebufferEXT(GL_FRAMEBUFFER, fbo); - return true; +void GLContextEGL::SetUnbindFboOnMakeCurrent() { + unbind_fbo_on_makecurrent_ = true; } void GLContextEGL::ReleaseCurrent(GLSurface* surface) { |