Bug 928804 - Always use an up-to-date texture transform when compositing SharedTextureSourceOGL. r=nical, a=bajaj
authorJames Willcox <jwillcox@mozilla.com>
Tue, 19 Nov 2013 08:41:57 -0600
changeset 166626 0902615834417d4619de07454b8e003b01a845a6
parent 166625 a231b9eade564f5c4524db8c2408a6fb106ff2aa
child 166627 0d728d9700dfd4bb917ddb27d0b32dc1b22feb35
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical, bajaj
bugs928804
milestone27.0a2
Bug 928804 - Always use an up-to-date texture transform when compositing SharedTextureSourceOGL. r=nical, a=bajaj
dom/plugins/base/android/ANPNativeWindow.cpp
gfx/layers/opengl/TextureHostOGL.cpp
gfx/layers/opengl/TextureHostOGL.h
--- a/dom/plugins/base/android/ANPNativeWindow.cpp
+++ b/dom/plugins/base/android/ANPNativeWindow.cpp
@@ -21,15 +21,16 @@ using namespace mozilla;
 static ANPNativeWindow anp_native_window_acquireNativeWindow(NPP instance) {
   nsNPAPIPluginInstance* pinst = static_cast<nsNPAPIPluginInstance*>(instance->ndata);
   return pinst->AcquireContentWindow();
 }
 
 static void anp_native_window_invertPluginContent(NPP instance, bool isContentInverted) {
   nsNPAPIPluginInstance* pinst = static_cast<nsNPAPIPluginInstance*>(instance->ndata);
   pinst->SetInverted(isContentInverted);
+  pinst->RedrawPlugin();
 }
 
 
 void InitNativeWindowInterface(ANPNativeWindowInterfaceV0* i) {
     ASSIGN(i, acquireNativeWindow);
     ASSIGN(i, invertPluginContent);
 }
--- a/gfx/layers/opengl/TextureHostOGL.cpp
+++ b/gfx/layers/opengl/TextureHostOGL.cpp
@@ -294,20 +294,18 @@ TextureImageTextureSourceOGL::BindTextur
 }
 
 SharedTextureSourceOGL::SharedTextureSourceOGL(CompositorOGL* aCompositor,
                                                gl::SharedTextureHandle aHandle,
                                                gfx::SurfaceFormat aFormat,
                                                GLenum aTarget,
                                                GLenum aWrapMode,
                                                SharedTextureShareType aShareType,
-                                               gfx::IntSize aSize,
-                                               const gfx3DMatrix& aTexTransform)
-  : mTextureTransform(aTexTransform)
-  , mSize(aSize)
+                                               gfx::IntSize aSize)
+  : mSize(aSize)
   , mCompositor(aCompositor)
   , mSharedHandle(aHandle)
   , mFormat(aFormat)
   , mShareType(aShareType)
   , mTextureTarget(aTarget)
   , mWrapMode(aWrapMode)
 {}
 
@@ -351,16 +349,28 @@ SharedTextureSourceOGL::IsValid() const
 }
 
 gl::GLContext*
 SharedTextureSourceOGL::gl() const
 {
   return mCompositor ? mCompositor->gl() : nullptr;
 }
 
+gfx3DMatrix
+SharedTextureSourceOGL::GetTextureTransform()
+{
+  GLContext::SharedHandleDetails handleDetails;
+  if (!gl()->GetSharedHandleDetails(mShareType, mSharedHandle, handleDetails)) {
+    NS_WARNING("Could not get shared handle details");
+    return gfx3DMatrix();
+  }
+
+  return handleDetails.mTextureTransform;
+}
+
 SharedTextureHostOGL::SharedTextureHostOGL(uint64_t aID,
                                            TextureFlags aFlags,
                                            gl::SharedTextureShareType aShareType,
                                            gl::SharedTextureHandle aSharedHandle,
                                            gfx::IntSize aSize,
                                            bool inverted)
   : TextureHost(aID, aFlags)
   , mSize(aSize)
@@ -400,18 +410,17 @@ SharedTextureHostOGL::Lock()
 
     GLenum wrapMode = LOCAL_GL_CLAMP_TO_EDGE;
     mTextureSource = new SharedTextureSourceOGL(mCompositor,
                                                 mSharedHandle,
                                                 handleDetails.mTextureFormat,
                                                 handleDetails.mTarget,
                                                 wrapMode,
                                                 mShareType,
-                                                mSize,
-                                                handleDetails.mTextureTransform);
+                                                mSize);
   }
   return true;
 }
 
 void
 SharedTextureHostOGL::Unlock()
 {
   if (!mTextureSource) {
--- a/gfx/layers/opengl/TextureHostOGL.h
+++ b/gfx/layers/opengl/TextureHostOGL.h
@@ -250,30 +250,29 @@ public:
   typedef gl::SharedTextureShareType SharedTextureShareType;
 
   SharedTextureSourceOGL(CompositorOGL* aCompositor,
                          gl::SharedTextureHandle aHandle,
                          gfx::SurfaceFormat aFormat,
                          GLenum aTarget,
                          GLenum aWrapMode,
                          SharedTextureShareType aShareType,
-                         gfx::IntSize aSize,
-                         const gfx3DMatrix& aTexTransform);
+                         gfx::IntSize aSize);
 
   virtual TextureSourceOGL* AsSourceOGL() { return this; }
 
   virtual void BindTexture(GLenum activetex) MOZ_OVERRIDE;
 
   virtual bool IsValid() const MOZ_OVERRIDE;
 
   virtual gfx::IntSize GetSize() const MOZ_OVERRIDE { return mSize; }
 
   virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE { return mFormat; }
 
-  virtual gfx3DMatrix GetTextureTransform() MOZ_OVERRIDE { return mTextureTransform; }
+  virtual gfx3DMatrix GetTextureTransform() MOZ_OVERRIDE;
 
   virtual GLenum GetTextureTarget() const { return mTextureTarget; }
 
   virtual GLenum GetWrapMode() const MOZ_OVERRIDE { return mWrapMode; }
 
   virtual void UnbindTexture() MOZ_OVERRIDE {}
 
   // SharedTextureSource doesn't own any gl texture
@@ -281,17 +280,16 @@ public:
 
   void DetachSharedHandle();
 
   void SetCompositor(CompositorOGL* aCompositor);
 
   gl::GLContext* gl() const;
 
 protected:
-  gfx3DMatrix mTextureTransform;
   gfx::IntSize mSize;
   CompositorOGL* mCompositor;
   gl::SharedTextureHandle mSharedHandle;
   gfx::SurfaceFormat mFormat;
   SharedTextureShareType mShareType;
   GLenum mTextureTarget;
   GLenum mWrapMode;
 };