Title: [106992] trunk/Source/WebCore
Revision
106992
Author
jam...@google.com
Date
2012-02-07 14:20:25 -0800 (Tue, 07 Feb 2012)

Log Message

[chromium] Allow retaining texture across frames in composited video playback and correctly handle lost context
https://bugs.webkit.org/show_bug.cgi?id=77923

Reviewed by Kenneth Russell.

Thanks to r106840, we can improve the video playback mode a bit. Instead of creating a new texture on every
frame, this attempts to reuse the texture from the previous frame unless the context is lost. Also improves
error checking in case the TextureManager cannot successfully reserve memory for the texture.

Tested manually by killing the GPU process with an html5 video playing and verifying that the video playback
continues and that we don't create a new set of textures for each plane on each frame.

* platform/graphics/chromium/cc/CCVideoLayerImpl.cpp:
(WebCore::CCVideoLayerImpl::draw):
(WebCore::CCVideoLayerImpl::reserveTextures):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (106991 => 106992)


--- trunk/Source/WebCore/ChangeLog	2012-02-07 22:18:29 UTC (rev 106991)
+++ trunk/Source/WebCore/ChangeLog	2012-02-07 22:20:25 UTC (rev 106992)
@@ -1,3 +1,21 @@
+2012-02-07  James Robinson  <jam...@chromium.org>
+
+        [chromium] Allow retaining texture across frames in composited video playback and correctly handle lost context
+        https://bugs.webkit.org/show_bug.cgi?id=77923
+
+        Reviewed by Kenneth Russell.
+
+        Thanks to r106840, we can improve the video playback mode a bit. Instead of creating a new texture on every
+        frame, this attempts to reuse the texture from the previous frame unless the context is lost. Also improves
+        error checking in case the TextureManager cannot successfully reserve memory for the texture.
+
+        Tested manually by killing the GPU process with an html5 video playing and verifying that the video playback
+        continues and that we don't create a new set of textures for each plane on each frame.
+
+        * platform/graphics/chromium/cc/CCVideoLayerImpl.cpp:
+        (WebCore::CCVideoLayerImpl::draw):
+        (WebCore::CCVideoLayerImpl::reserveTextures):
+
 2012-02-07  Matthew Delaney  <mdela...@apple.com>
 
         https://bugs.webkit.org/show_bug.cgi?id=77912

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp (106991 => 106992)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp	2012-02-07 22:18:29 UTC (rev 106991)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp	2012-02-07 22:20:25 UTC (rev 106992)
@@ -150,17 +150,8 @@
         CRASH(); // Someone updated convertVFCFormatToGC3DFormat above but update this!
     }
 
-    for (unsigned plane = 0; plane < frame->planes(); ++plane) {
+    for (unsigned plane = 0; plane < frame->planes(); ++plane)
         m_textures[plane].m_texture->unreserve();
-        // FIXME: ManagedTexture's store a raw pointer to their TextureManager,
-        // and the textures we create use layerRenderer->renderSurfaceTextureManager().
-        // Since there is no guarantee layerRenderer will still be alive the
-        // next time we are called, we clear the texture reference. It would
-        // be nice if instead we could rely on textures being invalidated when
-        // their manager was deleted so that new textures didn't always have to
-        // be recreated for each frame.
-        m_textures[plane].m_texture.clear();
-    }
     m_provider->putCurrentFrame(frame);
 }
 
@@ -255,10 +246,15 @@
             if (!m_textures[plane].m_texture)
                 return false;
             m_textures[plane].m_visibleSize = IntSize();
+        } else {
+            // The renderSurfaceTextureManager may have been destroyed and recreated since the last frame, so pass the new one.
+            // This is a no-op if the TextureManager is still around.
+            m_textures[plane].m_texture->setTextureManager(layerRenderer->renderSurfaceTextureManager());
         }
         if (m_textures[plane].m_texture->size() != requiredTextureSize)
             m_textures[plane].m_visibleSize = computeVisibleSize(frame, plane);
-        m_textures[plane].m_texture->reserve(requiredTextureSize, format);
+        if (!m_textures[plane].m_texture->reserve(requiredTextureSize, format))
+            return false;
     }
     return true;
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to