Bug 1060114 - Fix partial surface uploading through BufferTextureClient. r=Bas, a=lmandel
💩💩 backed out by c3ecb4c952ec 💩 💩
authorMatt Woodrow <mwoodrow@mozilla.com>
Fri, 29 Aug 2014 15:06:26 +1200
changeset 216666 09d840603713
parent 216665 872fe12f9214
child 216667 957e1ef7f769
push id3868
push userryanvm@gmail.com
push date2014-09-08 17:05 +0000
treeherdermozilla-beta@f9e4f36ba116 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBas, lmandel
bugs1060114
milestone33.0
Bug 1060114 - Fix partial surface uploading through BufferTextureClient. r=Bas, a=lmandel
gfx/layers/composite/TextureHost.cpp
gfx/layers/composite/TextureHost.h
--- a/gfx/layers/composite/TextureHost.cpp
+++ b/gfx/layers/composite/TextureHost.cpp
@@ -343,37 +343,35 @@ TextureSource::~TextureSource()
 
 BufferTextureHost::BufferTextureHost(gfx::SurfaceFormat aFormat,
                                      TextureFlags aFlags)
 : TextureHost(aFlags)
 , mCompositor(nullptr)
 , mFormat(aFormat)
 , mUpdateSerial(1)
 , mLocked(false)
-, mPartialUpdate(false)
+, mNeedsFullUpdate(false)
 {}
 
 BufferTextureHost::~BufferTextureHost()
 {}
 
 void
 BufferTextureHost::Updated(const nsIntRegion* aRegion)
 {
   ++mUpdateSerial;
   // If the last frame wasn't uploaded yet, and we -don't- have a partial update,
   // we still need to update the full surface.
-  // XXX - Clean this up a little bit, this is a little confusing.
-  if (aRegion && ((mFirstSource && mFirstSource->GetUpdateSerial() == mUpdateSerial) || mPartialUpdate)) {
-    mPartialUpdate = true;
+  if (aRegion && !mNeedsFullUpdate) {
     mMaybeUpdatedRegion = mMaybeUpdatedRegion.Or(mMaybeUpdatedRegion, *aRegion);
   } else {
-    mPartialUpdate = false;
+    mNeedsFullUpdate = true;
   }
   if (GetFlags() & TextureFlags::IMMEDIATE_UPLOAD) {
-    DebugOnly<bool> result = MaybeUpload(mPartialUpdate ? &mMaybeUpdatedRegion : nullptr);
+    DebugOnly<bool> result = MaybeUpload(!mNeedsFullUpdate ? &mMaybeUpdatedRegion : nullptr);
     NS_WARN_IF_FALSE(result, "Failed to upload a texture");
   }
 }
 
 void
 BufferTextureHost::SetCompositor(Compositor* aCompositor)
 {
   if (mCompositor == aCompositor) {
@@ -442,17 +440,17 @@ BufferTextureHost::MaybeUpload(nsIntRegi
   if (mFirstSource && mFirstSource->GetUpdateSerial() == mUpdateSerial) {
     return true;
   }
   if (!Upload(aRegion)) {
     return false;
   }
 
   // We no longer have an invalid region.
-  mPartialUpdate = false;
+  mNeedsFullUpdate = false;
   mMaybeUpdatedRegion.SetEmpty();
 
   // If upload returns true we know mFirstSource is not null
   mFirstSource->SetUpdateSerial(mUpdateSerial);
   return true;
 }
 
 bool
--- a/gfx/layers/composite/TextureHost.h
+++ b/gfx/layers/composite/TextureHost.h
@@ -531,17 +531,17 @@ protected:
   Compositor* mCompositor;
   RefPtr<DataTextureSource> mFirstSource;
   nsIntRegion mMaybeUpdatedRegion;
   gfx::IntSize mSize;
   // format of the data that is shared with the content process.
   gfx::SurfaceFormat mFormat;
   uint32_t mUpdateSerial;
   bool mLocked;
-  bool mPartialUpdate;
+  bool mNeedsFullUpdate;
 };
 
 /**
  * TextureHost that wraps shared memory.
  * the corresponding texture on the client side is ShmemTextureClient.
  * This TextureHost is backend-independent.
  */
 class ShmemTextureHost : public BufferTextureHost