Bug 1283818 - Clean up BufferTextureData YCbCr format handling r=nical
authorSotaro Ikeda <sotaro.ikeda.g@gmail.com>
Fri, 01 Jul 2016 09:06:57 -0700
changeset 303427 9f30d4101964f632a8f0c4cfe133fbfe337954c1
parent 303426 a36da0eea7af1bdb7e51b69d5aa9454b98689ac3
child 303428 2c507a30066761d77392a3ca3e73ce62b081feb1
push id30388
push usercbook@mozilla.com
push dateSat, 02 Jul 2016 09:15:23 +0000
treeherdermozilla-central@39dffbba7642 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical
bugs1283818
milestone50.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 1283818 - Clean up BufferTextureData YCbCr format handling r=nical
gfx/layers/BufferTexture.cpp
gfx/layers/BufferTexture.h
gfx/layers/client/TextureClient.cpp
gfx/layers/client/TextureClient.h
gfx/layers/ipc/SharedPlanarYCbCrImage.cpp
--- a/gfx/layers/BufferTexture.cpp
+++ b/gfx/layers/BufferTexture.cpp
@@ -98,18 +98,17 @@ static bool UsingX11Compositor()
 }
 
 static bool ComputeHasIntermediateBuffer(gfx::SurfaceFormat aFormat,
                                          LayersBackend aLayersBackend)
 {
   return aLayersBackend != LayersBackend::LAYERS_BASIC
       || UsingX11Compositor()
       || aFormat == gfx::SurfaceFormat::UNKNOWN
-      || aFormat == gfx::SurfaceFormat::YUV
-      || aFormat == gfx::SurfaceFormat::NV12;
+      || aFormat == gfx::SurfaceFormat::YUV;
 }
 
 BufferTextureData*
 BufferTextureData::Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
                           gfx::BackendType aMoz2DBackend, TextureFlags aFlags,
                           TextureAllocationFlags aAllocFlags,
                           ClientIPCAllocator* aAllocator)
 {
@@ -147,17 +146,16 @@ BufferTextureData::CreateInternal(Client
 
     return new ShmemTextureData(aDesc, aMoz2DBackend, shm);
   }
   return nullptr;
 }
 
 BufferTextureData*
 BufferTextureData::CreateForYCbCrWithBufferSize(ClientIPCAllocator* aAllocator,
-                                                gfx::SurfaceFormat aFormat,
                                                 int32_t aBufferSize,
                                                 TextureFlags aTextureFlags)
 {
   if (aBufferSize == 0 || !gfx::Factory::CheckBufferSize(aBufferSize)) {
     return nullptr;
   }
 
   // Initialize the metadata with something, even if it will have to be rewritten
@@ -206,17 +204,16 @@ BufferTextureData::FillInfo(TextureData:
   if (mDescriptor.type() == BufferDescriptor::TYCbCrDescriptor) {
     aInfo.hasIntermediateBuffer = true;
   } else {
     aInfo.hasIntermediateBuffer = mDescriptor.get_RGBDescriptor().hasIntermediateBuffer();
   }
 
   switch (aInfo.format) {
     case gfx::SurfaceFormat::YUV:
-    case gfx::SurfaceFormat::NV12:
     case gfx::SurfaceFormat::UNKNOWN:
       aInfo.supportsMoz2D = false;
       break;
     default:
       aInfo.supportsMoz2D = true;
   }
 }
 
--- a/gfx/layers/BufferTexture.h
+++ b/gfx/layers/BufferTexture.h
@@ -28,17 +28,16 @@ public:
                                            gfx::IntSize aCbCrSize,
                                            StereoMode aStereoMode,
                                            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(ClientIPCAllocator* aAllocator,
-                                                         gfx::SurfaceFormat aFormat,
                                                          int32_t aSize,
                                                          TextureFlags aTextureFlags);
 
   virtual bool Lock(OpenMode aMode, FenceHandle*) override { return true; }
 
   virtual void Unlock() override {}
 
   virtual void FillInfo(TextureData::Info& aInfo) const override;
--- a/gfx/layers/client/TextureClient.cpp
+++ b/gfx/layers/client/TextureClient.cpp
@@ -1121,28 +1121,27 @@ TextureClient::CreateForYCbCr(ClientIPCA
   }
 
   return MakeAndAddRef<TextureClient>(data, aTextureFlags, aAllocator);
 }
 
 // static
 already_AddRefed<TextureClient>
 TextureClient::CreateForYCbCrWithBufferSize(ClientIPCAllocator* aAllocator,
-                                            gfx::SurfaceFormat aFormat,
                                             size_t aSize,
                                             TextureFlags aTextureFlags)
 {
   // also test the validity of aAllocator
   MOZ_ASSERT(aAllocator && aAllocator->IPCOpen());
   if (!aAllocator || !aAllocator->IPCOpen()) {
     return nullptr;
   }
 
   TextureData* data =
-    BufferTextureData::CreateForYCbCrWithBufferSize(aAllocator, aFormat, aSize,
+    BufferTextureData::CreateForYCbCrWithBufferSize(aAllocator, aSize,
                                                     aTextureFlags);
   if (!data) {
     return nullptr;
   }
 
   return MakeAndAddRef<TextureClient>(data, aTextureFlags, aAllocator);
 }
 
--- a/gfx/layers/client/TextureClient.h
+++ b/gfx/layers/client/TextureClient.h
@@ -375,17 +375,16 @@ public:
                            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(ClientIPCAllocator* aAllocator,
-                               gfx::SurfaceFormat aFormat,
                                size_t aSize,
                                TextureFlags aTextureFlags);
 
   // Creates and allocates a TextureClient of the same type.
   already_AddRefed<TextureClient>
   CreateSimilar(TextureFlags aFlags = TextureFlags::DEFAULT,
                 TextureAllocationFlags aAllocFlags = ALLOC_DEFAULT) const;
 
--- a/gfx/layers/ipc/SharedPlanarYCbCrImage.cpp
+++ b/gfx/layers/ipc/SharedPlanarYCbCrImage.cpp
@@ -114,17 +114,17 @@ SharedPlanarYCbCrImage::AllocateAndGetNe
 {
   MOZ_ASSERT(!mTextureClient, "This image already has allocated data");
   size_t size = ImageDataSerializer::ComputeYCbCrBufferSize(aSize);
   if (!size) {
     return nullptr;
   }
 
   mTextureClient = TextureClient::CreateForYCbCrWithBufferSize(mCompositable->GetForwarder(),
-                                                               gfx::SurfaceFormat::YUV, size,
+                                                               size,
                                                                mCompositable->GetTextureFlags());
 
   // get new buffer _without_ setting mBuffer.
   if (!mTextureClient) {
     return nullptr;
   }
 
   // update buffer size