Bug 1211615: Upload the full texture on the first upload for component alpha textures. r=nical a=sylvestre
authorBas Schouten <bschouten@mozilla.com>
Fri, 16 Oct 2015 18:37:00 +0200
changeset 289579 2c138fbc9513
parent 289578 135164c79784
child 289580 2bfd512a01af
push id5197
push usernsilva@mozilla.com
push date2015-10-19 09:21 +0000
treeherdermozilla-beta@2c138fbc9513 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical, sylvestre
bugs1211615
milestone42.0
Bug 1211615: Upload the full texture on the first upload for component alpha textures. r=nical a=sylvestre
gfx/layers/composite/TextureHost.cpp
gfx/layers/d3d9/TextureD3D9.cpp
--- a/gfx/layers/composite/TextureHost.cpp
+++ b/gfx/layers/composite/TextureHost.cpp
@@ -588,31 +588,36 @@ BufferTextureHost::Upload(nsIntRegion *a
         !srcY->Update(tempY) ||
         !srcU->Update(tempCb) ||
         !srcV->Update(tempCr)) {
       NS_WARNING("failed to update the DataTextureSource");
       return false;
     }
   } else {
     // non-YCbCr case
+    nsIntRegion* regionToUpdate = aRegion;
     if (!mFirstSource) {
       mFirstSource = mCompositor->CreateDataTextureSource();
+      if (mFlags & TextureFlags::COMPONENT_ALPHA) {
+        // Update the full region the first time for component alpha textures.
+        regionToUpdate = nullptr;
+      }
     }
     ImageDataDeserializer deserializer(GetBuffer(), GetBufferSize());
     if (!deserializer.IsValid()) {
       NS_ERROR("Failed to deserialize image!");
       return false;
     }
 
     RefPtr<gfx::DataSourceSurface> surf = deserializer.GetAsSurface();
     if (!surf) {
       return false;
     }
 
-    if (!mFirstSource->Update(surf.get(), aRegion)) {
+    if (!mFirstSource->Update(surf.get(), regionToUpdate)) {
       NS_WARNING("failed to update the DataTextureSource");
       return false;
     }
   }
   MOZ_ASSERT(mFirstSource);
   return true;
 }
 
--- a/gfx/layers/d3d9/TextureD3D9.cpp
+++ b/gfx/layers/d3d9/TextureD3D9.cpp
@@ -819,22 +819,27 @@ DataTextureSourceD3D9::UpdateFromTexture
 void
 TextureHostD3D9::UpdatedInternal(const nsIntRegion* aRegion)
 {
   MOZ_ASSERT(mTexture);
   if (!mTexture) {
     return;
   }
 
+  const nsIntRegion* regionToUpdate = aRegion;
   if (!mTextureSource) {
     mTextureSource = new DataTextureSourceD3D9(mFormat, mSize, mCompositor,
                                                nullptr, mFlags);
+    if (mFlags & TextureFlags::COMPONENT_ALPHA) {
+      // Update the full region the first time for component alpha textures.
+      regionToUpdate = nullptr;
+    }
   }
 
-  if (!mTextureSource->UpdateFromTexture(mTexture, aRegion)) {
+  if (!mTextureSource->UpdateFromTexture(mTexture, regionToUpdate)) {
     gfxCriticalError() << "[D3D9] DataTextureSourceD3D9::UpdateFromTexture failed";
   }
 }
 
 IDirect3DDevice9*
 TextureHostD3D9::GetDevice()
 {
   return mCompositor ? mCompositor->device() : nullptr;