Bug 1265824 - Remove CreateForYCbCrWithBufferSize r?mattwoodrow draft
authorDoug Thayer <dothayer@mozilla.com>
Sun, 22 Jul 2018 20:22:12 -0700
changeset 821700 76bd11fe76b670609d977a6644a1096fcfa468cb
parent 821699 94842d63285801705881e545b7564b6c883f0639
child 821701 ec066ec5fcbfc9f13da5208f05d04b9a36b69833
push id117175
push userbmo:dothayer@mozilla.com
push dateMon, 23 Jul 2018 21:16:55 +0000
reviewersmattwoodrow
bugs1265824
milestone63.0a1
Bug 1265824 - Remove CreateForYCbCrWithBufferSize r?mattwoodrow This seems to be unused. Not sure if it's still left in here for a reason or not. MozReview-Commit-ID: 3wxaCDI7eCO
gfx/layers/BufferTexture.cpp
gfx/layers/BufferTexture.h
gfx/layers/client/TextureClient.cpp
gfx/layers/client/TextureClient.h
--- a/gfx/layers/BufferTexture.cpp
+++ b/gfx/layers/BufferTexture.cpp
@@ -157,44 +157,16 @@ BufferTextureData::CreateInternal(Layers
       return nullptr;
     }
 
     return new ShmemTextureData(aDesc, aMoz2DBackend, shm);
   }
 }
 
 BufferTextureData*
-BufferTextureData::CreateForYCbCrWithBufferSize(KnowsCompositor* aAllocator,
-                                                int32_t aBufferSize,
-                                                YUVColorSpace aYUVColorSpace,
-                                                uint32_t aBitDepth,
-                                                TextureFlags aTextureFlags)
-{
-  if (aBufferSize == 0 || !gfx::Factory::CheckBufferSize(aBufferSize)) {
-    return nullptr;
-  }
-
-  bool hasIntermediateBuffer = aAllocator ? ComputeHasIntermediateBuffer(gfx::SurfaceFormat::YUV,
-                                                                         aAllocator->GetCompositorBackendType(),
-                                                                         aAllocator->SupportsTextureDirectMapping())
-                                          : true;
-
-  // Initialize the metadata with something, even if it will have to be rewritten
-  // afterwards since we don't know the dimensions of the texture at this point.
-  BufferDescriptor desc = YCbCrDescriptor(gfx::IntSize(), 0, gfx::IntSize(), 0,
-                                          0, 0, 0, StereoMode::MONO,
-                                          aYUVColorSpace,
-                                          aBitDepth,
-                                          hasIntermediateBuffer);
-
-  return CreateInternal(aAllocator ? aAllocator->GetTextureForwarder() : nullptr,
-                       desc, gfx::BackendType::NONE, aBufferSize, aTextureFlags);
-}
-
-BufferTextureData*
 BufferTextureData::CreateForYCbCr(KnowsCompositor* aAllocator,
                                   gfx::IntSize aYSize,
                                   uint32_t aYStride,
                                   gfx::IntSize aCbCrSize,
                                   uint32_t aCbCrStride,
                                   StereoMode aStereoMode,
                                   YUVColorSpace aYUVColorSpace,
                                   uint32_t aBitDepth,
--- a/gfx/layers/BufferTexture.h
+++ b/gfx/layers/BufferTexture.h
@@ -35,25 +35,16 @@ public:
                                            uint32_t aYStride,
                                            gfx::IntSize aCbCrSize,
                                            uint32_t aCbCrStride,
                                            StereoMode aStereoMode,
                                            YUVColorSpace aYUVColorSpace,
                                            uint32_t aBitDepth,
                                            TextureFlags aTextureFlags);
 
-  // It is generally better to use CreateForYCbCr instead.
-  // This creates a half-initialized texture since we don't know the sizes and
-  // offsets in the buffer.
-  static BufferTextureData* CreateForYCbCrWithBufferSize(KnowsCompositor* aAllocator,
-                                                         int32_t aSize,
-                                                         YUVColorSpace aYUVColorSpace,
-                                                         uint32_t aBitDepth,
-                                                         TextureFlags aTextureFlags);
-
   virtual bool Lock(OpenMode aMode) override { return true; }
 
   virtual void Unlock() override {}
 
   virtual void FillInfo(TextureData::Info& aInfo) const override;
 
   virtual already_AddRefed<gfx::DrawTarget> BorrowDrawTarget() override;
 
--- a/gfx/layers/client/TextureClient.cpp
+++ b/gfx/layers/client/TextureClient.cpp
@@ -1325,38 +1325,16 @@ TextureClient::CreateForYCbCr(KnowsCompo
   if (!data) {
     return nullptr;
   }
 
   return MakeAndAddRef<TextureClient>(data, aTextureFlags,
                                       aAllocator->GetTextureForwarder());
 }
 
-// static
-already_AddRefed<TextureClient>
-TextureClient::CreateForYCbCrWithBufferSize(KnowsCompositor* aAllocator,
-                                            size_t aSize,
-                                            YUVColorSpace aYUVColorSpace,
-                                            uint32_t aBitDepth,
-                                            TextureFlags aTextureFlags)
-{
-  if (!aAllocator || !aAllocator->GetLayersIPCActor()->IPCOpen()) {
-    return nullptr;
-  }
-
-  TextureData* data = BufferTextureData::CreateForYCbCrWithBufferSize(
-    aAllocator, aSize, aYUVColorSpace, aBitDepth, aTextureFlags);
-  if (!data) {
-    return nullptr;
-  }
-
-  return MakeAndAddRef<TextureClient>(data, aTextureFlags,
-                                      aAllocator->GetTextureForwarder());
-}
-
 TextureClient::TextureClient(TextureData* aData,
                              TextureFlags aFlags,
                              LayersIPCChannel* aAllocator)
   : AtomicRefCountedWithFinalize("TextureClient")
   , mAllocator(aAllocator)
   , mActor(nullptr)
   , mData(aData)
   , mFlags(aFlags)
--- a/gfx/layers/client/TextureClient.h
+++ b/gfx/layers/client/TextureClient.h
@@ -374,26 +374,16 @@ public:
   static already_AddRefed<TextureClient>
   CreateForRawBufferAccess(KnowsCompositor* aAllocator,
                            gfx::SurfaceFormat aFormat,
                            gfx::IntSize aSize,
                            gfx::BackendType aMoz2dBackend,
                            TextureFlags aTextureFlags,
                            TextureAllocationFlags flags = ALLOC_DEFAULT);
 
-  // Creates and allocates a TextureClient (can beaccessed through raw
-  // pointers) with a certain buffer size. It's unfortunate that we need this.
-  // providing format and sizes could let us do more optimization.
-  static already_AddRefed<TextureClient>
-  CreateForYCbCrWithBufferSize(KnowsCompositor* aAllocator,
-                               size_t aSize,
-                               YUVColorSpace aYUVColorSpace,
-                               uint32_t aBitDepth,
-                               TextureFlags aTextureFlags);
-
   // Creates and allocates a TextureClient of the same type.
   already_AddRefed<TextureClient>
   CreateSimilar(LayersBackend aLayersBackend = LayersBackend::LAYERS_NONE,
                 TextureFlags aFlags = TextureFlags::DEFAULT,
                 TextureAllocationFlags aAllocFlags = ALLOC_DEFAULT) const;
 
   /**
    * Locks the shared data, allowing the caller to get access to it.