Bug 899583 - Disallow BigImage with YCbCr compositing. r=BenWa
authorNicolas Silva <nical@mozilla.com>
Fri, 02 Aug 2013 01:02:06 +0200
changeset 153300 a2ad91794485a6037136fbcafbb97a4eb94339ba
parent 153299 b25b3c93400fbc39eca2ed34bb1595d764c0ce4e
child 153301 25fa0d94a5073f5bf1890dc65c9d9c249e4ac4d1
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBenWa
bugs899583
milestone25.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 899583 - Disallow BigImage with YCbCr compositing. r=BenWa
gfx/gl/GLTextureImage.cpp
gfx/gl/GLTextureImage.h
gfx/layers/CompositorTypes.h
gfx/layers/ImageLayers.cpp
gfx/layers/ImageLayers.h
gfx/layers/LayersLogging.cpp
gfx/layers/client/ClientImageLayer.cpp
gfx/layers/composite/TextureHost.cpp
gfx/layers/opengl/CompositorOGL.cpp
gfx/layers/opengl/TextureHostOGL.cpp
gfx/layers/opengl/TextureHostOGL.h
layout/base/FrameLayerBuilder.cpp
--- a/gfx/gl/GLTextureImage.cpp
+++ b/gfx/gl/GLTextureImage.cpp
@@ -216,17 +216,17 @@ TiledTextureImage::TiledTextureImage(GLC
     , mCurrentImage(0)
     , mIterationCallback(nullptr)
     , mInUpdate(false)
     , mRows(0)
     , mColumns(0)
     , mGL(aGL)
     , mTextureState(Created)
 {
-    if (!(aFlags & TextureImage::ForceSingleTile) && mGL->WantsSmallTiles()) {
+    if (!(aFlags & TextureImage::DisallowBigImage) && mGL->WantsSmallTiles()) {
       mTileSize = 256;
     } else {
       mGL->fGetIntegerv(LOCAL_GL_MAX_TEXTURE_SIZE, (GLint*) &mTileSize);
     }
     if (aSize.width != 0 && aSize.height != 0) {
         Resize(aSize);
     }
 }
--- a/gfx/gl/GLTextureImage.h
+++ b/gfx/gl/GLTextureImage.h
@@ -52,17 +52,17 @@ public:
       Allocated,  // Texture memory exists, but contents are invalid.
       Valid  // Texture fully ready to use.
     };
 
     enum Flags {
         NoFlags          = 0x0,
         UseNearestFilter = 0x1,
         NeedsYFlip       = 0x2,
-        ForceSingleTile  = 0x4
+        DisallowBigImage = 0x4
     };
 
     typedef gfxASurface::gfxContentType ContentType;
 
     static already_AddRefed<TextureImage> Create(
                        GLContext* gl,
                        const nsIntSize& aSize,
                        TextureImage::ContentType aContentType,
--- a/gfx/layers/CompositorTypes.h
+++ b/gfx/layers/CompositorTypes.h
@@ -24,17 +24,17 @@ const SurfaceDescriptorType SURFACEDESCR
  */
 typedef uint32_t TextureFlags;
 // Use nearest-neighbour texture filtering (as opposed to linear filtering).
 const TextureFlags UseNearestFilter           = 1 << 0;
 // The texture should be flipped around the y-axis when composited.
 const TextureFlags NeedsYFlip                 = 1 << 1;
 // Force the texture to be represented using a single tile (note that this means
 // tiled textures, not tiled layers).
-const TextureFlags ForceSingleTile            = 1 << 2;
+const TextureFlags TEXTURE_DISALLOW_BIGIMAGE  = 1 << 2;
 // Allow using 'repeat' mode for wrapping.
 const TextureFlags AllowRepeat                = 1 << 3;
 // The texture represents a tile which is newly created.
 const TextureFlags NewTile                    = 1 << 4;
 // The texture is part of a component-alpha pair
 const TextureFlags ComponentAlpha             = 1 << 5;
 // The buffer will be treated as if the RB bytes are swapped.
 // This is useful for rendering using Cairo/Thebes, because there is no
--- a/gfx/layers/ImageLayers.cpp
+++ b/gfx/layers/ImageLayers.cpp
@@ -6,17 +6,17 @@
 #include "ImageLayers.h"
 #include "ImageContainer.h"
 
 namespace mozilla {
 namespace layers {
 
 ImageLayer::ImageLayer(LayerManager* aManager, void* aImplData)
 : Layer(aManager, aImplData), mFilter(gfxPattern::FILTER_GOOD)
-, mScaleMode(SCALE_NONE), mForceSingleTile(false) 
+, mScaleMode(SCALE_NONE), mDisallowBigImage(false)
 {}
 
 ImageLayer::~ImageLayer()
 {}
 
 void ImageLayer::SetContainer(ImageContainer* aContainer) 
 {
   mContainer = aContainer;
--- a/gfx/layers/ImageLayers.h
+++ b/gfx/layers/ImageLayers.h
@@ -70,34 +70,34 @@ public:
 
   MOZ_LAYER_DECL_NAME("ImageLayer", TYPE_IMAGE)
 
   virtual void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface);
 
   /**
    * if true, the image will only be backed by a single tile texture
    */
-  void SetForceSingleTile(bool aForceSingleTile)
+  void SetDisallowBigImage(bool aDisallowBigImage)
   {
-    if (mForceSingleTile != aForceSingleTile) {
-      MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) ForceSingleTile", this));
-      mForceSingleTile = aForceSingleTile;
+    if (mDisallowBigImage != aDisallowBigImage) {
+      MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) DisallowBigImage", this));
+      mDisallowBigImage = aDisallowBigImage;
       Mutated();
     }
   }
 
 protected:
   ImageLayer(LayerManager* aManager, void* aImplData);
   ~ImageLayer();
   virtual nsACString& PrintInfo(nsACString& aTo, const char* aPrefix);
 
 
   nsRefPtr<ImageContainer> mContainer;
   gfxPattern::GraphicsFilter mFilter;
   gfxIntSize mScaleToSize;
   ScaleMode mScaleMode;
-  bool mForceSingleTile;
+  bool mDisallowBigImage;
 };
 
 }
 }
 
 #endif /* GFX_IMAGELAYER_H */
--- a/gfx/layers/LayersLogging.cpp
+++ b/gfx/layers/LayersLogging.cpp
@@ -207,17 +207,17 @@ AppendToString(nsACString& s, TextureFla
     } \
     s += #test; \
     previous = true; \
   } \
 }
     bool previous = false;
     AppendFlag(UseNearestFilter);
     AppendFlag(NeedsYFlip);
-    AppendFlag(ForceSingleTile);
+    AppendFlag(TEXTURE_DISALLOW_BIGIMAGE);
     AppendFlag(AllowRepeat);
     AppendFlag(NewTile);
     AppendFlag(TEXTURE_DEALLOCATE_HOST);
 
 #undef AppendFlag
   }
   return s += sfx;
 }
--- a/gfx/layers/client/ClientImageLayer.cpp
+++ b/gfx/layers/client/ClientImageLayer.cpp
@@ -122,18 +122,18 @@ ClientImageLayer::RenderLayer()
   if (!mImageClient ||
       !mImageClient->UpdateImage(mContainer, GetContentFlags())) {
     CompositableType type = GetImageClientType();
     if (type == BUFFER_UNKNOWN) {
       return;
     }
     mImageClient = ImageClient::CreateImageClient(type,
                                                   ClientManager(),
-                                                  mForceSingleTile
-                                                    ? ForceSingleTile
+                                                  mDisallowBigImage
+                                                    ? TEXTURE_DISALLOW_BIGIMAGE
                                                     : 0);
     if (type == BUFFER_BRIDGE) {
       static_cast<ImageClientBridge*>(mImageClient.get())->SetLayer(this);
     }
 
     if (!mImageClient) {
       return;
     }
--- a/gfx/layers/composite/TextureHost.cpp
+++ b/gfx/layers/composite/TextureHost.cpp
@@ -311,19 +311,20 @@ BufferTextureHost::Upload(nsIntRegion *a
       mFirstSource->Update(surf, mFlags, aRegion);
       return true;
     }
 
     RefPtr<DataTextureSource> srcY;
     RefPtr<DataTextureSource> srcU;
     RefPtr<DataTextureSource> srcV;
     if (!mFirstSource) {
-      srcY = mCompositor->CreateDataTextureSource(mFlags);
-      srcU = mCompositor->CreateDataTextureSource(mFlags);
-      srcV = mCompositor->CreateDataTextureSource(mFlags);
+      // We don't support BigImages for YCbCr compositing.
+      srcY = mCompositor->CreateDataTextureSource(mFlags|TEXTURE_DISALLOW_BIGIMAGE);
+      srcU = mCompositor->CreateDataTextureSource(mFlags|TEXTURE_DISALLOW_BIGIMAGE);
+      srcV = mCompositor->CreateDataTextureSource(mFlags|TEXTURE_DISALLOW_BIGIMAGE);
       mFirstSource = srcY;
       srcY->SetNextSibling(srcU);
       srcU->SetNextSibling(srcV);
     } else {
       // mFormat never changes so if this was created as a YCbCr host and already
       // contains a source it should already have 3 sources.
       // BufferTextureHost only uses DataTextureSources so it is safe to assume
       // all 3 sources are DataTextureSource.
--- a/gfx/layers/opengl/CompositorOGL.cpp
+++ b/gfx/layers/opengl/CompositorOGL.cpp
@@ -1410,14 +1410,15 @@ CompositorOGL::Resume()
 #endif
   return true;
 }
 
 TemporaryRef<DataTextureSource>
 CompositorOGL::CreateDataTextureSource(TextureFlags aFlags)
 {
   RefPtr<DataTextureSource> result =
-    new TextureImageTextureSourceOGL(mGLContext, !(aFlags & ForceSingleTile));
+    new TextureImageTextureSourceOGL(mGLContext,
+                                     !(aFlags & TEXTURE_DISALLOW_BIGIMAGE));
   return result;
 }
 
 } /* layers */
 } /* mozilla */
--- a/gfx/layers/opengl/TextureHostOGL.cpp
+++ b/gfx/layers/opengl/TextureHostOGL.cpp
@@ -109,18 +109,18 @@ static gl::TextureImage::Flags
 FlagsToGLFlags(TextureFlags aFlags)
 {
   uint32_t result = TextureImage::NoFlags;
 
   if (aFlags & UseNearestFilter)
     result |= TextureImage::UseNearestFilter;
   if (aFlags & NeedsYFlip)
     result |= TextureImage::NeedsYFlip;
-  if (aFlags & ForceSingleTile)
-    result |= TextureImage::ForceSingleTile;
+  if (aFlags & TEXTURE_DISALLOW_BIGIMAGE)
+    result |= TextureImage::DisallowBigImage;
 
   return static_cast<gl::TextureImage::Flags>(result);
 }
 
 GLenum
 WrapMode(gl::GLContext *aGl, bool aAllowRepeat)
 {
   if (aAllowRepeat &&
@@ -143,17 +143,17 @@ TextureImageTextureSourceOGL::Update(gfx
     return false;
   }
   MOZ_ASSERT(aSurface);
 
   nsIntSize size = ThebesIntSize(aSurface->GetSize());
   if (!mTexImage ||
       mTexImage->GetSize() != size ||
       mTexImage->GetContentType() != gfx::ContentForFormat(aSurface->GetFormat())) {
-    if (mAllowTiling) {
+    if (mAllowBigImage) {
       // XXX - clarify the which size we want to use. Some use cases may
       // require the size of the destnation surface to be different from
       // the size of aSurface.
       mTexImage = mGL->CreateTextureImage(size,
                                           gfx::ContentForFormat(aSurface->GetFormat()),
                                           WrapMode(mGL, aFlags & AllowRepeat),
                                           FlagsToGLFlags(aFlags));
     } else {
--- a/gfx/layers/opengl/TextureHostOGL.h
+++ b/gfx/layers/opengl/TextureHostOGL.h
@@ -100,19 +100,19 @@ public:
  * This TextureSource can be used without a TextureHost and manage it's own
  * GL texture(s).
  */
 class TextureImageTextureSourceOGL : public DataTextureSource
                                    , public TextureSourceOGL
                                    , public TileIterator
 {
 public:
-  TextureImageTextureSourceOGL(gl::GLContext* aGL, bool aAllowTiling = true)
+  TextureImageTextureSourceOGL(gl::GLContext* aGL, bool aAllowBiImage = true)
     : mGL(aGL)
-    , mAllowTiling(aAllowTiling)
+    , mAllowBigImage(aAllowBiImage)
     , mIterating(false)
   {}
 
   // DataTextureSource
 
   virtual bool Update(gfx::DataSourceSurface* aSurface,
                       TextureFlags aFlags,
                       nsIntRegion* aDestRegion = nullptr,
@@ -174,17 +174,17 @@ public:
   virtual bool NextTile() MOZ_OVERRIDE
   {
     return mTexImage->NextTile();
   }
 
 protected:
   nsRefPtr<gl::TextureImage> mTexImage;
   gl::GLContext* mGL;
-  bool mAllowTiling;
+  bool mAllowBigImage;
   bool mIterating;
 };
 
 /**
  * A texture source meant for use with SharedTextureHostOGL.
  *
  * It does not own any GL texture, and attaches its shared handle to one of
  * the compositor's temporary textures when binding.
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -1225,17 +1225,17 @@ ContainerState::CreateOrRecycleMaskImage
     mRecycledMaskImageLayers.Remove(aLayer);
     // XXX if we use clip on mask layers, null it out here
   } else {
     // Create a new layer
     result = mManager->CreateImageLayer();
     if (!result)
       return nullptr;
     result->SetUserData(&gMaskLayerUserData, new MaskLayerUserData());
-    result->SetForceSingleTile(true);
+    result->SetDisallowBigImage(true);
   }
   
   return result.forget();
 }
 
 static const double SUBPIXEL_OFFSET_EPSILON = 0.02;
 
 /**