Bug 869696 - Use an alternative method to unlock gralloc textures on Adreno (TM) 205. r=bjacob
authorChris Lord <chrislord.net@gmail.com>
Wed, 15 May 2013 16:45:08 +0100
changeset 132755 e0e9b99639f82c956a6eaf2d2195dc61e97a0faf
parent 132754 1caf7322f9189b287a2a7cf917ea332226cf846c
child 132761 1919510d5436179ca5a9f2c087a1d0e83a1bfabe
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersbjacob
bugs869696
milestone24.0a1
Bug 869696 - Use an alternative method to unlock gralloc textures on Adreno (TM) 205. r=bjacob Targeting the NULL EGLImage causes slowness on the Geeksphone Peak, and assumedly, other "Adreno (TM) 205" devices. Achieve the same effect by deleting the GL texture instead.
gfx/layers/opengl/TextureHostOGL.cpp
--- a/gfx/layers/opengl/TextureHostOGL.cpp
+++ b/gfx/layers/opengl/TextureHostOGL.cpp
@@ -834,16 +834,29 @@ GrallocTextureHostOGL::Unlock()
    * The job of this function is to ensure that we release any read lock placed on
    * our android::GraphicBuffer by any drawing code that sourced it via this TextureHost.
    *
    * Indeed, as soon as we draw with a texture that's tied to a android::GraphicBuffer,
    * the GL may place read locks on it. We must ensure that we release them early enough,
    * i.e. before the next time that we will try to acquire a write lock on the same buffer,
    * because read and write locks on gralloc buffers are mutually exclusive.
    */
+  if (mGL->Renderer() == GLContext::RendererAdrenoTM205) {
+    /* XXX This is working around a driver bug exhibited on at least the
+     * Geeksphone Peak, where retargeting to a different EGL image is very
+     * slow. See Bug 869696.
+     */
+    if (mGLTexture) {
+      mGL->MakeCurrent();
+      mGL->fDeleteTextures(1, &mGLTexture);
+      mGLTexture = 0;
+    }
+    return;
+  }
+
   mGL->MakeCurrent();
   mGL->fActiveTexture(LOCAL_GL_TEXTURE0);
   mGL->fBindTexture(mTextureTarget, mGLTexture);
   mGL->fEGLImageTargetTexture2D(mTextureTarget, mGL->GetNullEGLImage());
 }
 
 gfx::SurfaceFormat
 GrallocTextureHostOGL::GetFormat() const