Bug 1102895 - Remove unused TextureFlags. r=sotaro
authorNicolas Silva <nsilva@mozilla.com>
Tue, 25 Nov 2014 20:19:04 +0100
changeset 217543 6505045340525921f3844daab41a74a8400d5eec
parent 217542 5f28d281511713e1cd14ac21a3f3d3e0b371faf8
child 217544 5ee35646d120a81b04167f392878a8bd8c85504a
push id27886
push userryanvm@gmail.com
push dateThu, 27 Nov 2014 01:34:27 +0000
treeherdermozilla-central@159a0ec99a6d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssotaro
bugs1102895
milestone36.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 1102895 - Remove unused TextureFlags. r=sotaro
gfx/layers/CompositorTypes.h
gfx/layers/LayersLogging.cpp
gfx/layers/RotatedBuffer.cpp
gfx/layers/RotatedBuffer.h
gfx/layers/client/ClientImageLayer.cpp
gfx/layers/client/ContentClient.cpp
--- a/gfx/layers/CompositorTypes.h
+++ b/gfx/layers/CompositorTypes.h
@@ -14,99 +14,74 @@
 #include "mozilla/EnumSet.h"
 
 #include "mozilla/TypedEnum.h"
 #include "mozilla/TypedEnumBits.h"
 
 namespace mozilla {
 namespace layers {
 
-typedef int32_t SurfaceDescriptorType;
-const SurfaceDescriptorType SURFACEDESCRIPTOR_UNKNOWN = 0;
-
 /**
  * Flags used by texture clients and texture hosts. These are passed from client
  * side to host side when textures and compositables are created. Usually set
  * by the compositableCient, they may be modified by either the compositable or
  * texture clients.
- *
- * XXX - switch to all caps constant names which seems to be the standard in gecko
  */
 MOZ_BEGIN_ENUM_CLASS(TextureFlags, uint32_t)
   NO_FLAGS           = 0,
   // Use nearest-neighbour texture filtering (as opposed to linear filtering).
   USE_NEAREST_FILTER = 1 << 0,
-  // The texture should be flipped around the y-axis when composited.
+  // The texture should be flipped along the y-axis when composited.
   NEEDS_Y_FLIP       = 1 << 1,
   // Force the texture to be represented using a single tile (note that this means
   // tiled textures, not tiled layers).
   DISALLOW_BIGIMAGE  = 1 << 2,
-  // Allow using 'repeat' mode for wrapping.
-  ALLOW_REPEAT       = 1 << 3,
-  // The texture represents a tile which is newly created.
-  NEW_TILE           = 1 << 4,
-  // The texture is part of a component-alpha pair
-  COMPONENT_ALPHA    = 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
   // BGRX Android pixel format, and so we have to do byte swapping.
   //
   // For example, if the GraphicBuffer has an Android pixel format of
   // PIXEL_FORMAT_RGBA_8888 and isRBSwapped is true, when it is sampled
   // (for example, with GL), a BGRA shader should be used.
-  RB_SWAPPED         = 1 << 6,
-
-  FRONT              = 1 << 7,
-  // A texture host on white for component alpha
-  ON_WHITE           = 1 << 8,
-  // A texture host on black for component alpha
-  ON_BLACK           = 1 << 9,
-  // A texture host that supports tiling
-  TILE               = 1 << 10,
-  // A texture should be recycled when no longer in used
-  RECYCLE            = 1 << 11,
-  // Texture contents should be initialized
-  // from the previous texture.
-  COPY_PREVIOUS      = 1 << 12,
-  // Who is responsible for deallocating the shared data.
-  // if DEALLOCATE_CLIENT is set, the shared data is deallocated on the
+  RB_SWAPPED         = 1 << 3,
+  // Data in this texture has not been alpha-premultiplied.
+  // XXX - Apparently only used with ImageClient/Host
+  NON_PREMULTIPLIED  = 1 << 4,
+  // The texture should be recycled when no longer in used
+  RECYCLE            = 1 << 5,
+  // If DEALLOCATE_CLIENT is set, the shared data is deallocated on the
   // client side and requires some extra synchronizaion to ensure race-free
   // deallocation.
   // The default behaviour is to deallocate on the host side.
-  DEALLOCATE_CLIENT  = 1 << 13,
+  DEALLOCATE_CLIENT  = 1 << 6,
   // After being shared ith the compositor side, an immutable texture is never
   // modified, it can only be read. It is safe to not Lock/Unlock immutable
   // textures.
-  IMMUTABLE          = 1 << 14,
+  IMMUTABLE          = 1 << 7,
   // The contents of the texture must be uploaded or copied immediately
   // during the transaction, because the producer may want to write
   // to it again.
-  IMMEDIATE_UPLOAD   = 1 << 15,
-  // The texture is going to be used as part of a double
-  // buffered pair, and so we can guarantee that the producer/consumer
-  // won't be racing to access its contents.
-  DOUBLE_BUFFERED    = 1 << 16,
-  // Data in this texture has not been alpha-premultiplied.
-  NON_PREMULTIPLIED  = 1 << 18,
+  IMMEDIATE_UPLOAD   = 1 << 8,
+  // The texture is part of a component-alpha pair
+  COMPONENT_ALPHA    = 1 << 9,
 
   // OR union of all valid bits
-  ALL_BITS           = (1 << 19) - 1,
+  ALL_BITS           = (1 << 10) - 1,
   // the default flags
-  DEFAULT = FRONT
+  DEFAULT = NO_FLAGS
 MOZ_END_ENUM_CLASS(TextureFlags)
 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(TextureFlags)
 
 static inline bool
 TextureRequiresLocking(TextureFlags aFlags)
 {
   // If we're not double buffered, or uploading
   // within a transaction, then we need to support
   // locking correctly.
   return !(aFlags & (TextureFlags::IMMEDIATE_UPLOAD |
-                     TextureFlags::DOUBLE_BUFFERED |
                      TextureFlags::IMMUTABLE));
 }
 
 /**
  * The type of debug diagnostic to enable.
  */
 MOZ_BEGIN_ENUM_CLASS(DiagnosticTypes, uint8_t)
   NO_DIAGNOSTIC    = 0,
@@ -171,16 +146,17 @@ MOZ_BEGIN_ENUM_CLASS(CompositableType, u
   IMAGE_BRIDGE,    // ImageBridge protocol
   CONTENT_SINGLE,  // painted layer interface, single buffering
   CONTENT_DOUBLE,  // painted layer interface, double buffering
   BUFFER_COUNT
 MOZ_END_ENUM_CLASS(CompositableType)
 
 /**
  * How the texture host is used for composition,
+ * XXX - Only used by ContentClientIncremental
  */
 MOZ_BEGIN_ENUM_CLASS(DeprecatedTextureHostFlags, uint8_t)
   DEFAULT = 0,       // The default texture host for the given SurfaceDescriptor
   TILED = 1 << 0,    // A texture host that supports tiling
   COPY_PREVIOUS = 1 << 1, // Texture contents should be initialized
                                       // from the previous texture.
   ALL_BITS = (1 << 2) - 1
 MOZ_END_ENUM_CLASS(DeprecatedTextureHostFlags)
@@ -212,18 +188,18 @@ struct TextureFactoryIdentifier
     , mSupportsTextureBlitting(aSupportsTextureBlitting)
     , mSupportsPartialUploads(aSupportsPartialUploads)
   {}
 };
 
 /**
  * Identify a texture to a compositable. Many textures can have the same id, but
  * the id is unique for any texture owned by a particular compositable.
- * XXX - This is now redundant with TextureFlags. it ill be removed along with
- * deprecated texture classes.
+ * XXX - We don't really need this, it will be removed along with the incremental
+ * ContentClient/Host.
  */
 MOZ_BEGIN_ENUM_CLASS(TextureIdentifier, uint8_t)
   Front = 1,
   Back = 2,
   OnWhiteFront = 3,
   OnWhiteBack = 4,
   HighBound
 MOZ_END_ENUM_CLASS(TextureIdentifier)
@@ -233,16 +209,17 @@ MOZ_END_ENUM_CLASS(TextureIdentifier)
  * using compositables and textures.
  * XXX - TextureInfo is a bad name: this information is useful for the compositable,
  * not the Texture. And ith new Textures, only the compositable type is really
  * useful. This may (should) be removed in the near future.
  */
 struct TextureInfo
 {
   CompositableType mCompositableType;
+  // XXX - only used by ContentClientIncremental
   DeprecatedTextureHostFlags mDeprecatedTextureHostFlags;
   TextureFlags mTextureFlags;
 
   TextureInfo()
     : mCompositableType(CompositableType::BUFFER_UNKNOWN)
     , mDeprecatedTextureHostFlags(DeprecatedTextureHostFlags::DEFAULT)
     , mTextureFlags(TextureFlags::NO_FLAGS)
   {}
--- a/gfx/layers/LayersLogging.cpp
+++ b/gfx/layers/LayersLogging.cpp
@@ -286,18 +286,16 @@ AppendToString(std::stringstream& aStrea
     aStream << #test; \
     previous = true; \
   } \
 }
     bool previous = false;
     AppendFlag(TextureFlags::USE_NEAREST_FILTER);
     AppendFlag(TextureFlags::NEEDS_Y_FLIP);
     AppendFlag(TextureFlags::DISALLOW_BIGIMAGE);
-    AppendFlag(TextureFlags::ALLOW_REPEAT);
-    AppendFlag(TextureFlags::NEW_TILE);
 
 #undef AppendFlag
   }
   aStream << sfx;
 }
 
 void
 AppendToString(std::stringstream& aStream, mozilla::gfx::SurfaceFormat format,
--- a/gfx/layers/RotatedBuffer.cpp
+++ b/gfx/layers/RotatedBuffer.cpp
@@ -532,17 +532,17 @@ RotatedContentBuffer::BeginPaint(Painted
     // Do not modify mBufferRect, mBufferRotation, or mDidSelfCopy,
     // or call CreateBuffer before this call.
     FinalizeFrame(result.mRegionToDraw);
   }
 
   nsIntRect drawBounds = result.mRegionToDraw.GetBounds();
   RefPtr<DrawTarget> destDTBuffer;
   RefPtr<DrawTarget> destDTBufferOnWhite;
-  uint32_t bufferFlags = canHaveRotation ? ALLOW_REPEAT : 0;
+  uint32_t bufferFlags = 0;
   if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
     bufferFlags |= BUFFER_COMPONENT_ALPHA;
   }
   if (canReuseBuffer) {
     if (!EnsureBuffer()) {
       return result;
     }
     nsIntRect keepArea;
--- a/gfx/layers/RotatedBuffer.h
+++ b/gfx/layers/RotatedBuffer.h
@@ -297,24 +297,22 @@ public:
    * @param aPaintState Paint state data returned by a call to BeginPaint
    * @param aIter Paint state iterator. Only required if PAINT_CAN_DRAW_ROTATED
    * was specified to BeginPaint.
    */
   gfx::DrawTarget* BorrowDrawTargetForPainting(PaintState& aPaintState,
                                                DrawIterator* aIter = nullptr);
 
   enum {
-    ALLOW_REPEAT = 0x01,
     BUFFER_COMPONENT_ALPHA = 0x02 // Dual buffers should be created for drawing with
                                   // component alpha.
   };
   /**
    * Return a new surface of |aSize| and |aType|.
-   * @param aFlags if ALLOW_REPEAT is set, then the buffer should be configured
-   * to allow repeat-mode, otherwise it should be in pad (clamp) mode
+   *
    * If the created buffer supports azure content, then the result(s) will
    * be returned in aBlackDT/aWhiteDT, otherwise aBlackSurface/aWhiteSurface
    * will be used.
    */
   virtual void
   CreateBuffer(ContentType aType, const nsIntRect& aRect, uint32_t aFlags,
                RefPtr<gfx::DrawTarget>* aBlackDT, RefPtr<gfx::DrawTarget>* aWhiteDT) = 0;
 
--- a/gfx/layers/client/ClientImageLayer.cpp
+++ b/gfx/layers/client/ClientImageLayer.cpp
@@ -140,17 +140,17 @@ ClientImageLayer::RenderLayer()
   }
 
   if (!mImageClient ||
       !mImageClient->UpdateImage(mContainer, GetContentFlags())) {
     CompositableType type = GetImageClientType();
     if (type == CompositableType::BUFFER_UNKNOWN) {
       return;
     }
-    TextureFlags flags = TextureFlags::FRONT;
+    TextureFlags flags = TextureFlags::DEFAULT;
     if (mDisallowBigImage) {
       flags |= TextureFlags::DISALLOW_BIGIMAGE;
     }
     mImageClient = ImageClient::CreateImageClient(type,
                                                   ClientManager()->AsShadowForwarder(),
                                                   flags);
     if (type == CompositableType::IMAGE_BRIDGE) {
       static_cast<ImageClientBridge*>(mImageClient.get())->SetLayer(this);
--- a/gfx/layers/client/ContentClient.cpp
+++ b/gfx/layers/client/ContentClient.cpp
@@ -51,20 +51,16 @@ namespace layers {
 static TextureFlags TextureFlagsForRotatedContentBufferFlags(uint32_t aBufferFlags)
 {
   TextureFlags result = TextureFlags::NO_FLAGS;
 
   if (aBufferFlags & RotatedContentBuffer::BUFFER_COMPONENT_ALPHA) {
     result |= TextureFlags::COMPONENT_ALPHA;
   }
 
-  if (aBufferFlags & RotatedContentBuffer::ALLOW_REPEAT) {
-    result |= TextureFlags::ALLOW_REPEAT;
-  }
-
   return result;
 }
 
 /* static */ TemporaryRef<ContentClient>
 ContentClient::CreateContentClient(CompositableForwarder* aForwarder)
 {
   LayersBackend backend = aForwarder->GetCompositorBackendType();
   if (backend != LayersBackend::LAYERS_OPENGL &&
@@ -697,19 +693,17 @@ ContentClientIncremental::BeginPaintBuff
   bool canReuseBuffer;
   nsIntRect destBufferRect;
 
   while (true) {
     mode = aLayer->GetSurfaceMode();
     neededRegion = aLayer->GetVisibleRegion();
     // If we're going to resample, we need a buffer that's in clamp mode.
     canReuseBuffer = neededRegion.GetBounds().Size() <= mBufferRect.Size() &&
-      mHasBuffer &&
-      (!(aFlags & RotatedContentBuffer::PAINT_WILL_RESAMPLE) ||
-       !(mTextureInfo.mTextureFlags & TextureFlags::ALLOW_REPEAT));
+      mHasBuffer && !(aFlags & RotatedContentBuffer::PAINT_WILL_RESAMPLE);
 
     if (canReuseBuffer) {
       if (mBufferRect.Contains(neededRegion.GetBounds())) {
         // We don't need to adjust mBufferRect.
         destBufferRect = mBufferRect;
       } else {
         // The buffer's big enough but doesn't contain everything that's
         // going to be visible. We'll move it.
@@ -795,19 +789,16 @@ ContentClientIncremental::BeginPaintBuff
     mBufferRotation.MoveTo(0, 0);
     canReuseBuffer = false;
   }
 
   nsIntRect drawBounds = result.mRegionToDraw.GetBounds();
   bool createdBuffer = false;
 
   TextureFlags bufferFlags = TextureFlags::NO_FLAGS;
-  if (canHaveRotation) {
-    bufferFlags |= TextureFlags::ALLOW_REPEAT;
-  }
   if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
     bufferFlags |= TextureFlags::COMPONENT_ALPHA;
   }
   if (canReuseBuffer) {
     nsIntRect keepArea;
     if (keepArea.IntersectRect(destBufferRect, mBufferRect)) {
       // Set mBufferRotation so that the pixels currently in mBuffer
       // will still be rendered in the right place when mBufferRect