Bug 1040187: Combine update regions properly when upload hasn't executed yet. r=nical
authorBas Schouten <bschouten@mozilla.com>
Tue, 26 Aug 2014 13:06:17 +0000
changeset 201658 57a02fe884d961f66524ef7e03239d66b53eed0b
parent 201657 21dcd9e1b6078839497f1f8b0bcc20ae5e3684b1
child 201659 a6832b6e110dd36c579d277835be5c6f9f5dddad
push id27375
push userryanvm@gmail.com
push dateTue, 26 Aug 2014 19:56:59 +0000
treeherdermozilla-central@f9bfe115fee5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical
bugs1040187
milestone34.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 1040187: Combine update regions properly when upload hasn't executed yet. r=nical
gfx/layers/composite/TextureHost.cpp
--- a/gfx/layers/composite/TextureHost.cpp
+++ b/gfx/layers/composite/TextureHost.cpp
@@ -353,19 +353,22 @@ BufferTextureHost::BufferTextureHost(gfx
 
 BufferTextureHost::~BufferTextureHost()
 {}
 
 void
 BufferTextureHost::Updated(const nsIntRegion* aRegion)
 {
   ++mUpdateSerial;
-  if (aRegion) {
+  // 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;
-    mMaybeUpdatedRegion = *aRegion;
+    mMaybeUpdatedRegion = mMaybeUpdatedRegion.Or(mMaybeUpdatedRegion, *aRegion);
   } else {
     mPartialUpdate = false;
   }
   if (GetFlags() & TextureFlags::IMMEDIATE_UPLOAD) {
     DebugOnly<bool> result = MaybeUpload(mPartialUpdate ? &mMaybeUpdatedRegion : nullptr);
     NS_WARN_IF_FALSE(result, "Failed to upload a texture");
   }
 }
@@ -440,16 +443,21 @@ bool
 BufferTextureHost::MaybeUpload(nsIntRegion *aRegion)
 {
   if (mFirstSource && mFirstSource->GetUpdateSerial() == mUpdateSerial) {
     return true;
   }
   if (!Upload(aRegion)) {
     return false;
   }
+
+  // We no longer have an invalid region.
+  mPartialUpdate = false;
+  mMaybeUpdatedRegion.SetEmpty();
+
   // If upload returns true we know mFirstSource is not null
   mFirstSource->SetUpdateSerial(mUpdateSerial);
   return true;
 }
 
 bool
 BufferTextureHost::Upload(nsIntRegion *aRegion)
 {