From c75c330cdb4274d86f4c311a8f67167c88222ab2 Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Wed, 8 May 2013 18:04:59 -0400 Subject: [PATCH] Bug 863498. Get the SurfaceTexture transform every draw. r=nical ShadowImageLayerOGL::RenderLayer used to call gl()->GetSharedHandleDetails() directly and uses that result. This makes us do something similar. As a concequence we also drop the mTextureTransform member because we are not caching it anymore. I do wonder if it would make more sense for the content thread to send the transform along with the update to make sure that it always matches. This would also make it so that we have no chance of causing a GC in the compositor to get the transform by calling through java. --HG-- extra : rebase_source : 7520870d8f0f0bb81c4acbb3b2011f8b0056d53f --- gfx/layers/opengl/TextureHostOGL.cpp | 15 ++++++++++++++- gfx/layers/opengl/TextureHostOGL.h | 8 ++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/gfx/layers/opengl/TextureHostOGL.cpp b/gfx/layers/opengl/TextureHostOGL.cpp index becec3e1b8d..0dbd5dde3d6 100644 --- a/gfx/layers/opengl/TextureHostOGL.cpp +++ b/gfx/layers/opengl/TextureHostOGL.cpp @@ -263,7 +263,6 @@ SharedTextureHostOGL::SwapTexturesImpl(const SurfaceDescriptor& aImage, mTextureTarget = handleDetails.mTarget; mShaderProgram = handleDetails.mProgramType; mFormat = FormatFromShaderType(mShaderProgram); - mTextureTransform = handleDetails.mTextureTransform; } } @@ -289,6 +288,20 @@ SharedTextureHostOGL::Unlock() mGL->fBindTexture(LOCAL_GL_TEXTURE_2D, 0); } + +gfx3DMatrix +SharedTextureHostOGL::GetTextureTransform() +{ + GLContext::SharedHandleDetails handleDetails; + // GetSharedHandleDetails can call into Java which we'd + // rather not do from the compositor + if (mSharedHandle) { + mGL->GetSharedHandleDetails(mShareType, mSharedHandle, handleDetails); + } + return handleDetails.mTextureTransform; +} + + void SurfaceStreamHostOGL::SetCompositor(Compositor* aCompositor) { diff --git a/gfx/layers/opengl/TextureHostOGL.h b/gfx/layers/opengl/TextureHostOGL.h index 73f61cf6ce9..4bd5c3bc4fa 100644 --- a/gfx/layers/opengl/TextureHostOGL.h +++ b/gfx/layers/opengl/TextureHostOGL.h @@ -51,7 +51,7 @@ public: // TODO: Noone's implementing this anymore, should see if we need this. virtual GLenum GetTextureTarget() const { return LOCAL_GL_TEXTURE_2D; } virtual GLenum GetWrapMode() const = 0;// { return LOCAL_GL_CLAMP_TO_EDGE; } // default - virtual gfx3DMatrix GetTextureTransform() const { return gfx3DMatrix(); } + virtual gfx3DMatrix GetTextureTransform() { return gfx3DMatrix(); } }; inline gl::ShaderProgramType @@ -360,10 +360,7 @@ public: gfxASurface::CONTENT_COLOR; } - virtual gfx3DMatrix GetTextureTransform() const MOZ_OVERRIDE - { - return mTextureTransform; - } + virtual gfx3DMatrix GetTextureTransform() MOZ_OVERRIDE; #ifdef MOZ_LAYERS_HAVE_LOG virtual const char* Name() { return "SharedTextureHostOGL"; } @@ -380,7 +377,6 @@ protected: gl::SharedTextureHandle mSharedHandle; gl::ShaderProgramType mShaderProgram; gl::GLContext::SharedTextureShareType mShareType; - gfx3DMatrix mTextureTransform; }; class SurfaceStreamHostOGL : public TextureHost