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 296497 db7756e6f76f47ab7e06ca4736501328377e781d
parent 296496 fd7effbe6559f60601e22b6846c52f004bbbb328
child 296498 c615a2e6b269c268e62e08460c42fa3e00cde229
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical, sylvestre
bugs1211615
milestone43.0a2
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
@@ -591,31 +591,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
@@ -847,22 +847,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;