Backed out 2 changesets (bug 1167799) for crashes a=backout
authorWes Kocher <wkocher@mozilla.com>
Thu, 23 Jul 2015 15:42:19 -0700
changeset 238732 4cff5605633b00ecc0ff84334badcad4e9d76240
parent 238731 0ba9636b385462b27748d50ce01432e95b83b1e0
child 238733 d57ad75ce3dd12289677232c3f8777c4354b7655
push id751
push userkwierso@gmail.com
push dateThu, 23 Jul 2015 22:42:26 +0000
treeherdermozilla-b2g37_v2_2@4cff5605633b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1167799
milestone37.0
backs out0ba9636b385462b27748d50ce01432e95b83b1e0
5981fda08dea3c5c1d8e69d208cd4b90b734cca5
Backed out 2 changesets (bug 1167799) for crashes a=backout Backed out changeset 0ba9636b3854 (bug 1167799) Backed out changeset 5981fda08dea (bug 1167799)
gfx/gl/GLDefs.h
gfx/gl/GLLibraryEGL.cpp
gfx/gl/GLLibraryEGL.h
gfx/layers/client/ImageClient.cpp
gfx/layers/composite/ImageHost.cpp
gfx/layers/composite/TextureHost.h
gfx/layers/ipc/LayersSurfaces.ipdlh
gfx/layers/opengl/EGLImageHelpers.cpp
gfx/layers/opengl/EGLImageHelpers.h
gfx/layers/opengl/GrallocTextureClient.cpp
gfx/layers/opengl/GrallocTextureClient.h
gfx/layers/opengl/GrallocTextureHost.cpp
gfx/layers/opengl/GrallocTextureHost.h
--- a/gfx/gl/GLDefs.h
+++ b/gfx/gl/GLDefs.h
@@ -39,22 +39,16 @@
 // EGL_KHR_image_base (not supplied by EGL_KHR_image!)
 #define LOCAL_EGL_IMAGE_PRESERVED                       0x30D2
 
 // AMD_compressed_ATC_texture
 #define LOCAL_GL_ATC_RGB                                0x8C92
 #define LOCAL_GL_ATC_RGBA_EXPLICIT_ALPHA                0x8C93
 #define LOCAL_GL_ATC_RGBA_INTERPOLATED_ALPHA            0x87EE
 
-// EGL_ANDROID_image_crop
-#define LOCAL_EGL_IMAGE_CROP_LEFT_ANDROID               0x3148
-#define LOCAL_EGL_IMAGE_CROP_TOP_ANDROID                0x3149
-#define LOCAL_EGL_IMAGE_CROP_RIGHT_ANDROID              0x314A
-#define LOCAL_EGL_IMAGE_CROP_BOTTOM_ANDROID             0x314B
-
 // Others
 #define LOCAL_EGL_PRESERVED_RESOURCES                   0x3030
 #define LOCAL_EGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_EXT 0x3138
 
 #define LOCAL_GL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
 #define LOCAL_GL_CONTEXT_LOST                           0x9242
 #define LOCAL_GL_CONTEXT_FLAGS_ARB                      0x2094
 #define LOCAL_GL_CONTEXT_CORE_PROFILE_BIT_ARB           0x00000001
--- a/gfx/gl/GLLibraryEGL.cpp
+++ b/gfx/gl/GLLibraryEGL.cpp
@@ -31,17 +31,16 @@ static const char *sEGLExtensionNames[] 
     "EGL_KHR_image_pixmap",
     "EGL_KHR_gl_texture_2D_image",
     "EGL_KHR_lock_surface",
     "EGL_ANGLE_surface_d3d_texture_2d_share_handle",
     "EGL_EXT_create_context_robustness",
     "EGL_KHR_image",
     "EGL_KHR_fence_sync",
     "EGL_ANDROID_native_fence_sync",
-    "EGL_ANDROID_image_crop",
     nullptr
 };
 
 #if defined(ANDROID)
 
 static PRLibrary* LoadApitraceLibrary()
 {
     if (!gfxPrefs::UseApitrace()) {
--- a/gfx/gl/GLLibraryEGL.h
+++ b/gfx/gl/GLLibraryEGL.h
@@ -125,17 +125,16 @@ public:
         KHR_image_pixmap,
         KHR_gl_texture_2D_image,
         KHR_lock_surface,
         ANGLE_surface_d3d_texture_2d_share_handle,
         EXT_create_context_robustness,
         KHR_image,
         KHR_fence_sync,
         ANDROID_native_fence_sync,
-        EGL_ANDROID_image_crop,
         Extensions_Max
     };
 
     bool IsExtensionSupported(EGLExtensions aKnownExtension) const {
         return mAvailableExtensions[aKnownExtension];
     }
 
     void MarkExtensionUnsupported(EGLExtensions aKnownExtension) {
--- a/gfx/layers/client/ImageClient.cpp
+++ b/gfx/layers/client/ImageClient.cpp
@@ -237,20 +237,21 @@ ImageClientSingle::UpdateImage(ImageCont
       texture->Unlock();
     }
   }
   if (!texture || !AddTextureClient(texture)) {
     return false;
   }
 
   mFrontBuffer = texture;
-  UpdatePictureRect(image->GetPictureRect());
   GetForwarder()->UpdatedTexture(this, texture, nullptr);
   GetForwarder()->UseTexture(this, texture);
 
+  UpdatePictureRect(image->GetPictureRect());
+
   mLastPaintedImageSerial = image->GetSerial();
   aContainer->NotifyPaintedImage(image);
 
   texture->SyncWithObject(GetForwarder()->GetSyncObject());
 
   return true;
 }
 
--- a/gfx/layers/composite/ImageHost.cpp
+++ b/gfx/layers/composite/ImageHost.cpp
@@ -38,19 +38,16 @@ ImageHost::~ImageHost()
 }
 
 void
 ImageHost::UseTextureHost(TextureHost* aTexture)
 {
   CompositableHost::UseTextureHost(aTexture);
   mFrontBuffer = aTexture;
   if (mFrontBuffer) {
-    // SetCropRect() affects only on a specific platform.
-    // If it is not implemented, it does nothing.
-    mFrontBuffer->SetCropRect(mPictureRect);
     mFrontBuffer->PrepareTextureSource(mTextureSource);
   }
 }
 
 void
 ImageHost::RemoveTextureHost(TextureHost* aTexture)
 {
   CompositableHost::RemoveTextureHost(aTexture);
--- a/gfx/layers/composite/TextureHost.h
+++ b/gfx/layers/composite/TextureHost.h
@@ -444,21 +444,16 @@ public:
    *
    * This is important to ensure the correctness of the deallocation protocol.
    */
   virtual void ForgetSharedData() {}
 
   virtual gfx::IntSize GetSize() const = 0;
 
   /**
-   * Should be overridden if TextureHost supports crop rect.
-   */
-  virtual void SetCropRect(nsIntRect aCropRect) {}
-
-  /**
    * Debug facility.
    * XXX - cool kids use Moz2D. See bug 882113.
    */
   virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() = 0;
 
   /**
    * XXX - Flags should only be set at creation time, this will be removed.
    */
--- a/gfx/layers/ipc/LayersSurfaces.ipdlh
+++ b/gfx/layers/ipc/LayersSurfaces.ipdlh
@@ -64,16 +64,22 @@ struct SurfaceTextureDescriptor {
 struct EGLImageDescriptor {
   uintptr_t image; // `EGLImage` is a `void*`.
   uintptr_t fence;
   IntSize size;
 };
 
 struct NewSurfaceDescriptorGralloc {
   MaybeMagicGrallocBufferHandle buffer;
+  /**
+   * android::GraphicBuffer has a size information. But there are cases
+   * that GraphicBuffer's size and actual video's size are different.
+   * Extra size member is necessary. See Bug 850566.
+   */
+  IntSize size;
   bool isOpaque;
 };
 
 struct SharedSurfaceDescriptor {
   uintptr_t surf;
 };
 
 /**
--- a/gfx/layers/opengl/EGLImageHelpers.cpp
+++ b/gfx/layers/opengl/EGLImageHelpers.cpp
@@ -10,42 +10,27 @@
 
 namespace mozilla
 {
 namespace layers {
 
 using namespace gl;
 
 EGLImage
-EGLImageCreateFromNativeBuffer(GLContext* aGL, void* aBuffer, const gfx::IntSize& aCropSize)
+EGLImageCreateFromNativeBuffer(GLContext* aGL, void* aBuffer)
 {
     EGLint attrs[] = {
         LOCAL_EGL_IMAGE_PRESERVED, LOCAL_EGL_TRUE,
-        LOCAL_EGL_NONE, LOCAL_EGL_NONE,
+        LOCAL_EGL_NONE, LOCAL_EGL_NONE
     };
 
-    EGLint cropAttrs[] = {
-        LOCAL_EGL_IMAGE_PRESERVED, LOCAL_EGL_TRUE,
-        LOCAL_EGL_IMAGE_CROP_LEFT_ANDROID, 0,
-        LOCAL_EGL_IMAGE_CROP_TOP_ANDROID, 0,
-        LOCAL_EGL_IMAGE_CROP_RIGHT_ANDROID, aCropSize.width,
-        LOCAL_EGL_IMAGE_CROP_BOTTOM_ANDROID, aCropSize.height,
-        LOCAL_EGL_NONE, LOCAL_EGL_NONE,
-    };
-
-    bool hasCropRect = (aCropSize.width != 0 && aCropSize.height != 0);
-    EGLint* usedAttrs = attrs;
-    if (hasCropRect && sEGLLibrary.IsExtensionSupported(GLLibraryEGL::EGL_ANDROID_image_crop)) {
-        usedAttrs = cropAttrs;
-    }
-
     return sEGLLibrary.fCreateImage(sEGLLibrary.Display(),
                                      EGL_NO_CONTEXT,
                                      LOCAL_EGL_NATIVE_BUFFER_ANDROID,
-                                     aBuffer, usedAttrs);
+                                     aBuffer, attrs);
 }
 
 void
 EGLImageDestroy(GLContext* aGL, EGLImage aImage)
 {
     sEGLLibrary.fDestroyImage(sEGLLibrary.Display(), aImage);
 }
 
--- a/gfx/layers/opengl/EGLImageHelpers.h
+++ b/gfx/layers/opengl/EGLImageHelpers.h
@@ -2,26 +2,24 @@
 /* vim: set ts=8 sts=4 et sw=4 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef EGLIMAGEHELPERS_H_
 #define EGLIMAGEHELPERS_H_
 
-#include "mozilla/gfx/Point.h"
-
 typedef void* EGLImage;
 
 namespace mozilla {
 namespace gl {
     class GLContext;
 }
 
 namespace layers {
 
-EGLImage EGLImageCreateFromNativeBuffer(gl::GLContext* aGL, void* aBuffer, const gfx::IntSize& aCropSize);
+EGLImage EGLImageCreateFromNativeBuffer(gl::GLContext* aGL, void* aBuffer);
 void EGLImageDestroy(gl::GLContext* aGL, EGLImage aImage);
 
 } // namespace layers
 } // namespace mozilla
 
 #endif // EGLIMAGEHELPERS_H_
--- a/gfx/layers/opengl/GrallocTextureClient.cpp
+++ b/gfx/layers/opengl/GrallocTextureClient.cpp
@@ -72,17 +72,17 @@ GrallocTextureClientOGL::InitWith(MaybeM
 bool
 GrallocTextureClientOGL::ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor)
 {
   MOZ_ASSERT(IsValid());
   if (!IsAllocated()) {
     return false;
   }
 
-  aOutDescriptor = NewSurfaceDescriptorGralloc(mGrallocHandle, mIsOpaque);
+  aOutDescriptor = NewSurfaceDescriptorGralloc(mGrallocHandle, mSize, mIsOpaque);
   return true;
 }
 
 void
 GrallocTextureClientOGL::SetRemoveFromCompositableTracker(AsyncTransactionTracker* aTracker)
 {
   mRemoveFromCompositableTracker = aTracker;
 }
--- a/gfx/layers/opengl/GrallocTextureClient.h
+++ b/gfx/layers/opengl/GrallocTextureClient.h
@@ -132,16 +132,23 @@ protected:
   /**
    * Points to a mapped gralloc buffer between calls to lock and unlock.
    * Should be null outside of the lock-unlock pair.
    */
   uint8_t* mMappedBuffer;
 
   RefPtr<gfx::DrawTarget> mDrawTarget;
 
+  /**
+   * android::GraphicBuffer has a size information. But there are cases
+   * that GraphicBuffer's size and actual video's size are different.
+   * Extra size member is necessary. See Bug 850566.
+   */
+  gfx::IntSize mSize;
+
   android::MediaBuffer* mMediaBuffer;
 
   bool mIsOpaque;
 };
 
 } // namespace layers
 } // namespace mozilla
 
--- a/gfx/layers/opengl/GrallocTextureHost.cpp
+++ b/gfx/layers/opengl/GrallocTextureHost.cpp
@@ -96,30 +96,29 @@ TextureTargetForAndroidPixelFormat(andro
   }
 }
 
 GrallocTextureHostOGL::GrallocTextureHostOGL(TextureFlags aFlags,
                                              const NewSurfaceDescriptorGralloc& aDescriptor)
   : TextureHost(aFlags)
   , mGrallocHandle(aDescriptor)
   , mSize(0, 0)
-  , mCropSize(0, 0)
+  , mDescriptorSize(aDescriptor.size())
   , mFormat(gfx::SurfaceFormat::UNKNOWN)
   , mEGLImage(EGL_NO_IMAGE)
   , mIsOpaque(aDescriptor.isOpaque())
 {
   android::GraphicBuffer* graphicBuffer = GetGraphicBufferFromDesc(mGrallocHandle).get();
   MOZ_ASSERT(graphicBuffer);
 
   if (graphicBuffer) {
     mFormat =
       SurfaceFormatForAndroidPixelFormat(graphicBuffer->getPixelFormat(),
                                          aFlags & TextureFlags::RB_SWAPPED);
     mSize = gfx::IntSize(graphicBuffer->getWidth(), graphicBuffer->getHeight());
-    mCropSize = mSize;
   } else {
     printf_stderr("gralloc buffer is nullptr");
   }
 }
 
 GrallocTextureHostOGL::~GrallocTextureHostOGL()
 {
   DestroyEGLImage();
@@ -215,17 +214,17 @@ GrallocTextureHostOGL::GetRenderState()
     }
     if (mFlags & TextureFlags::ORIGIN_BOTTOM_LEFT) {
       flags |= LayerRenderStateFlags::ORIGIN_BOTTOM_LEFT;
     }
     if (mFlags & TextureFlags::RB_SWAPPED) {
       flags |= LayerRenderStateFlags::FORMAT_RB_SWAP;
     }
     return LayerRenderState(graphicBuffer,
-                            gfx::ThebesIntSize(mCropSize),
+                            gfx::ThebesIntSize(mDescriptorSize),
                             flags,
                             this);
   }
 
   return LayerRenderState();
 }
 
 TemporaryRef<gfx::DataSourceSurface>
@@ -343,22 +342,18 @@ GrallocTextureHostOGL::PrepareTextureSou
 
   gl::GLContext* gl = GetGLContext();
   if (!gl || !gl->MakeCurrent()) {
     mGLTextureSource = nullptr;
     return;
   }
 
   if (mEGLImage == EGL_NO_IMAGE) {
-    gfx::IntSize cropSize(0, 0);
-    if (mCropSize != mSize) {
-      cropSize = mCropSize;
-    }
     // Should only happen the first time.
-    mEGLImage = EGLImageCreateFromNativeBuffer(gl, graphicBuffer->getNativeBuffer(), cropSize);
+    mEGLImage = EGLImageCreateFromNativeBuffer(gl, graphicBuffer->getNativeBuffer());
   }
 
   GLenum textureTarget = GetTextureTarget(gl, graphicBuffer->getPixelFormat());
 
   GLTextureSource* glSource = aTextureSource.get() ?
     aTextureSource->AsSourceOGL()->AsGLTextureSource() : nullptr;
 
   bool shouldCreateTextureSource = !glSource  || !glSource->IsValid()
@@ -381,33 +376,16 @@ GrallocTextureHostOGL::PrepareTextureSou
 
     gl->fEGLImageTargetTexture2D(textureTarget, mEGLImage);
     glSource->SetSize(mSize);
     glSource->SetFormat(mFormat);
     mGLTextureSource = glSource;
   }
 }
 
-void
-GrallocTextureHostOGL::SetCropRect(nsIntRect aCropRect)
-{
-  MOZ_ASSERT(aCropRect.TopLeft() == nsIntPoint(0, 0));
-  MOZ_ASSERT(!aCropRect.IsEmpty());
-  MOZ_ASSERT(aCropRect.width <= mSize.width);
-  MOZ_ASSERT(aCropRect.height <= mSize.height);
-
-  gfx::IntSize cropSize(aCropRect.width, aCropRect.height);
-  if (mCropSize == cropSize) {
-    return;
-  }
-
-  mCropSize = cropSize;
-  mGLTextureSource = nullptr;
-}
-
 bool
 GrallocTextureHostOGL::BindTextureSource(CompositableTextureSourceRef& aTextureSource)
 {
   // This happens at composition time.
 
   // If mGLTextureSource is null it means PrepareTextureSource failed.
   if (!mGLTextureSource) {
     return false;
--- a/gfx/layers/opengl/GrallocTextureHost.h
+++ b/gfx/layers/opengl/GrallocTextureHost.h
@@ -38,17 +38,17 @@ public:
   virtual void DeallocateSharedData() MOZ_OVERRIDE;
 
   virtual void ForgetSharedData() MOZ_OVERRIDE;
 
   virtual void DeallocateDeviceData() MOZ_OVERRIDE;
 
   virtual gfx::SurfaceFormat GetFormat() const;
 
-  virtual gfx::IntSize GetSize() const MOZ_OVERRIDE { return mCropSize; }
+  virtual gfx::IntSize GetSize() const MOZ_OVERRIDE { return mDescriptorSize; }
 
   virtual LayerRenderState GetRenderState() MOZ_OVERRIDE;
 
   virtual void PrepareTextureSource(CompositableTextureSourceRef& aTextureSource) MOZ_OVERRIDE;
 
   virtual bool BindTextureSource(CompositableTextureSourceRef& aTextureSource) MOZ_OVERRIDE;
 
   virtual void UnbindTextureSource() MOZ_OVERRIDE;
@@ -59,35 +59,33 @@ public:
   virtual TextureHostOGL* AsHostOGL() MOZ_OVERRIDE
   {
     return this;
   }
 #endif
 
   virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE;
 
-  virtual void SetCropRect(nsIntRect aCropRect) MOZ_OVERRIDE;
-
   bool IsValid() const;
 
   virtual const char* Name() MOZ_OVERRIDE { return "GrallocTextureHostOGL"; }
 
   gl::GLContext* GetGLContext() const { return mCompositor ? mCompositor->gl() : nullptr; }
 
 private:
   void DestroyEGLImage();
 
   NewSurfaceDescriptorGralloc mGrallocHandle;
   RefPtr<GLTextureSource> mGLTextureSource;
   RefPtr<CompositorOGL> mCompositor;
   // Size reported by the GraphicBuffer
   gfx::IntSize mSize;
   // Size reported by TextureClient, can be different in some cases (video?),
   // used by LayerRenderState.
-  gfx::IntSize mCropSize;
+  gfx::IntSize mDescriptorSize;
   gfx::SurfaceFormat mFormat;
   EGLImage mEGLImage;
   bool mIsOpaque;
 };
 
 } // namespace layers
 } // namespace mozilla