Bug 1331761 - Don't send stale GPUVideoTextures to in-process compositors. r=mattwoodrow, a=lizzard
authorDavid Anderson <danderson@mozilla.com>
Wed, 01 Feb 2017 23:46:17 -0800
changeset 379366 c92e96316678cd89053d4016e5428274a7315d4d
parent 379365 5dad3edd4df47ba7b1e42ea481df410ee2733756
child 379367 91ca571410f212407aa7abacef30d753d31e3821
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow, lizzard
bugs1331761
milestone53.0
Bug 1331761 - Don't send stale GPUVideoTextures to in-process compositors. r=mattwoodrow, a=lizzard
gfx/layers/client/ImageClient.cpp
--- a/gfx/layers/client/ImageClient.cpp
+++ b/gfx/layers/client/ImageClient.cpp
@@ -220,20 +220,30 @@ ImageClientSingle::UpdateImage(ImageCont
     }
 
     if (!texture) {
       // Slow path, we should not be hitting it very often and if we do it means
       // we are using an Image class that is not backed by textureClient and we
       // should fix it.
       texture = CreateTextureClientForImage(image, GetForwarder());
     }
-    if (!texture || !AddTextureClient(texture)) {
+
+    if (!texture) {
       return false;
     }
 
+    // We check if the texture's allocator is still open, since in between media
+    // decoding a frame and adding it to the compositable, we could have
+    // restarted the GPU process.
+    if (!texture->GetAllocator()->IPCOpen()) {
+      continue;
+    }
+    if (!AddTextureClient(texture)) {
+      return false;
+    }
 
     CompositableForwarder::TimedTextureClient* t = textures.AppendElement();
     t->mTextureClient = texture;
     t->mTimeStamp = img.mTimeStamp;
     t->mPictureRect = image->GetPictureRect();
     t->mFrameID = img.mFrameID;
     t->mProducerID = img.mProducerID;