diff --git a/gfx/layers/opengl/GrallocTextureHost.cpp b/gfx/layers/opengl/GrallocTextureHost.cpp index ddb00f8e728..c15e8f4da8f 100644 --- a/gfx/layers/opengl/GrallocTextureHost.cpp +++ b/gfx/layers/opengl/GrallocTextureHost.cpp @@ -122,6 +122,10 @@ void GrallocTextureSourceOGL::BindTexture(GLenum aTextureUnit) gl()->fActiveTexture(aTextureUnit); gl()->fBindTexture(textureTarget, tex); + if (!mEGLImage) { + mEGLImage = EGLImageCreateFromNativeBuffer(gl(), mGraphicBuffer->getNativeBuffer()); + } + gl()->fEGLImageTargetTexture2D(textureTarget, mEGLImage); gl()->fActiveTexture(LOCAL_GL_TEXTURE0); } @@ -173,6 +177,13 @@ GrallocTextureSourceOGL::SetCompositableBackendSpecificData(CompositableBackendS } if (!mNeedsReset) { + // Update binding to the EGLImage + gl()->MakeCurrent(); + GLuint tex = GetGLTexture(); + GLuint textureTarget = GetTextureTarget(); + gl()->fActiveTexture(LOCAL_GL_TEXTURE0); + gl()->fBindTexture(textureTarget, tex); + gl()->fEGLImageTargetTexture2D(textureTarget, mEGLImage); return; } diff --git a/gfx/layers/opengl/TextureHostOGL.cpp b/gfx/layers/opengl/TextureHostOGL.cpp index 02d256fb793..e29840226b4 100644 --- a/gfx/layers/opengl/TextureHostOGL.cpp +++ b/gfx/layers/opengl/TextureHostOGL.cpp @@ -225,6 +225,7 @@ CompositableDataGonkOGL::DeleteTextureIfPresent() if (gl()->MakeCurrent()) { gl()->fDeleteTextures(1, &mTexture); } + mTexture = 0; } }