Changeset 106992 in webkit


Ignore:
Timestamp:
Feb 7, 2012 2:20:25 PM (12 years ago)
Author:
jamesr@google.com
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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r106988 r106992  
     12012-02-07  James Robinson  <jamesr@chromium.org>
     2
     3        [chromium] Allow retaining texture across frames in composited video playback and correctly handle lost context
     4        https://bugs.webkit.org/show_bug.cgi?id=77923
     5
     6        Reviewed by Kenneth Russell.
     7
     8        Thanks to r106840, we can improve the video playback mode a bit. Instead of creating a new texture on every
     9        frame, this attempts to reuse the texture from the previous frame unless the context is lost. Also improves
     10        error checking in case the TextureManager cannot successfully reserve memory for the texture.
     11
     12        Tested manually by killing the GPU process with an html5 video playing and verifying that the video playback
     13        continues and that we don't create a new set of textures for each plane on each frame.
     14
     15        * platform/graphics/chromium/cc/CCVideoLayerImpl.cpp:
     16        (WebCore::CCVideoLayerImpl::draw):
     17        (WebCore::CCVideoLayerImpl::reserveTextures):
     18
    1192012-02-07  Matthew Delaney  <mdelaney@apple.com>
    220
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp

    r106610 r106992  
    151151    }
    152152
    153     for (unsigned plane = 0; plane < frame->planes(); ++plane) {
     153    for (unsigned plane = 0; plane < frame->planes(); ++plane)
    154154        m_textures[plane].m_texture->unreserve();
    155         // FIXME: ManagedTexture's store a raw pointer to their TextureManager,
    156         // and the textures we create use layerRenderer->renderSurfaceTextureManager().
    157         // Since there is no guarantee layerRenderer will still be alive the
    158         // next time we are called, we clear the texture reference. It would
    159         // be nice if instead we could rely on textures being invalidated when
    160         // their manager was deleted so that new textures didn't always have to
    161         // be recreated for each frame.
    162         m_textures[plane].m_texture.clear();
    163     }
    164155    m_provider->putCurrentFrame(frame);
    165156}
     
    256247                return false;
    257248            m_textures[plane].m_visibleSize = IntSize();
     249        } else {
     250            // The renderSurfaceTextureManager may have been destroyed and recreated since the last frame, so pass the new one.
     251            // This is a no-op if the TextureManager is still around.
     252            m_textures[plane].m_texture->setTextureManager(layerRenderer->renderSurfaceTextureManager());
    258253        }
    259254        if (m_textures[plane].m_texture->size() != requiredTextureSize)
    260255            m_textures[plane].m_visibleSize = computeVisibleSize(frame, plane);
    261         m_textures[plane].m_texture->reserve(requiredTextureSize, format);
     256        if (!m_textures[plane].m_texture->reserve(requiredTextureSize, format))
     257            return false;
    262258    }
    263259    return true;
Note: See TracChangeset for help on using the changeset viewer.