Changeset 63723 in webkit


Ignore:
Timestamp:
Jul 19, 2010 11:28:51 PM (14 years ago)
Author:
commit-queue@webkit.org
Message:

2010-07-19 Victoria Kirst <vrk@google.com>

Reviewed by David Levin.

Added a simple implementation of VideoLayerChromium. Uses the
LayerChromium::updateTextureRect() to send video frames to the
GPU.
https://bugs.webkit.org/show_bug.cgi?id=42234

  • WebCore.gypi: Added include for VideoLayerChromium.
  • platform/graphics/chromium/GraphicsLayerChromium.cpp: (WebCore::GraphicsLayerChromium::setContentsToMedia): Implemented setContentsToMedia, though it does not seem to trigger a repaint correctly.
  • platform/graphics/chromium/GraphicsLayerChromium.h:
  • platform/graphics/chromium/VideoLayerChromium.cpp: Added. (WebCore::VideoLayerChromium::create): (WebCore::VideoLayerChromium::VideoLayerChromium): (WebCore::VideoLayerChromium::updateTextureContents):
  • platform/graphics/chromium/VideoLayerChromium.h: Added. (WebCore::VideoLayerChromium::drawsContent):

2010-07-19 Victoria Kirst <vrk@google.com>

Reviewed by David Levin.

Updated WebMediaPlayer to support accelerated rendering and to
create and return a VideoChromiumLayer as its platform layer.
https://bugs.webkit.org/show_bug.cgi?id=42234

  • src/WebMediaPlayerClientImpl.cpp: (WebKit::WebMediaPlayerClientImpl::platformLayer): (WebKit::WebMediaPlayerClientImpl::create):
  • src/WebMediaPlayerClientImpl.h: (WebKit::WebMediaPlayerClientImpl::supportsAcceleratedRendering):
Location:
trunk
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r63721 r63723  
     12010-07-19  Victoria Kirst  <vrk@google.com>
     2
     3        Reviewed by David Levin.
     4
     5        Added a simple implementation of VideoLayerChromium. Uses the
     6        LayerChromium::updateTextureRect() to send video frames to the
     7        GPU.
     8        https://bugs.webkit.org/show_bug.cgi?id=42234
     9
     10        * WebCore.gypi: Added include for VideoLayerChromium.
     11        * platform/graphics/chromium/GraphicsLayerChromium.cpp:
     12        (WebCore::GraphicsLayerChromium::setContentsToMedia): Implemented
     13        setContentsToMedia, though it does not seem to trigger a repaint
     14        correctly.
     15        * platform/graphics/chromium/GraphicsLayerChromium.h:
     16        * platform/graphics/chromium/VideoLayerChromium.cpp: Added.
     17        (WebCore::VideoLayerChromium::create):
     18        (WebCore::VideoLayerChromium::VideoLayerChromium):
     19        (WebCore::VideoLayerChromium::updateTextureContents):
     20        * platform/graphics/chromium/VideoLayerChromium.h: Added.
     21        (WebCore::VideoLayerChromium::drawsContent):
     22
    1232010-07-19  Dirk Schulze  <krit@webkit.org>
    224
  • trunk/WebCore/WebCore.gypi

    r63721 r63723  
    22112211            'platform/graphics/chromium/UniscribeHelperTextRun.cpp',
    22122212            'platform/graphics/chromium/UniscribeHelperTextRun.h',
     2213            'platform/graphics/chromium/VideoLayerChromium.cpp',
     2214            'platform/graphics/chromium/VideoLayerChromium.h',
    22132215            'platform/graphics/chromium/WebGLLayerChromium.cpp',
    22142216            'platform/graphics/chromium/WebGLLayerChromium.h',
  • trunk/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp

    r62130 r63723  
    364364#endif
    365365
    366 void GraphicsLayerChromium::setContentsToVideo(PlatformLayer* videoLayer)
    367 {
    368     // FIXME: Implement
     366void GraphicsLayerChromium::setContentsToMedia(PlatformLayer* layer)
     367{
     368    bool childrenChanged = false;
     369    if (layer) {
     370        if (!m_contentsLayer.get() || m_contentsLayerPurpose != ContentsLayerForVideo) {
     371            setupContentsLayer(layer);
     372            m_contentsLayer = layer;
     373            m_contentsLayerPurpose = ContentsLayerForVideo;
     374            childrenChanged = true;
     375        }
     376        layer->setOwner(this);
     377        layer->setNeedsDisplay();
     378        updateContentsRect();
     379    } else {
     380        if (m_contentsLayer) {
     381            childrenChanged = true;
     382 
     383            // The old contents layer will be removed via updateSublayerList.
     384            m_contentsLayer = 0;
     385        }
     386    }
     387 
     388    if (childrenChanged)
     389        updateSublayerList();
    369390}
    370391
  • trunk/WebCore/platform/graphics/chromium/GraphicsLayerChromium.h

    r62130 r63723  
    8686
    8787    virtual void setContentsToImage(Image*);
    88     virtual void setContentsToVideo(PlatformLayer*);
     88    virtual void setContentsToMedia(PlatformLayer*);
    8989    virtual void setContentsToWebGL(PlatformLayer*);
    9090
  • trunk/WebKit/chromium/ChangeLog

    r63705 r63723  
     12010-07-19  Victoria Kirst  <vrk@google.com>
     2
     3        Reviewed by David Levin.
     4
     5        Updated WebMediaPlayer to support accelerated rendering and to
     6        create and return a VideoChromiumLayer as its platform layer.
     7        https://bugs.webkit.org/show_bug.cgi?id=42234
     8
     9        * src/WebMediaPlayerClientImpl.cpp:
     10        (WebKit::WebMediaPlayerClientImpl::platformLayer):
     11        (WebKit::WebMediaPlayerClientImpl::create):
     12        * src/WebMediaPlayerClientImpl.h:
     13        (WebKit::WebMediaPlayerClientImpl::supportsAcceleratedRendering):
     14
    1152010-07-19  Kenneth Russell  <kbr@google.com>
    216
  • trunk/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp

    r59466 r63723  
    1515#include "MediaPlayer.h"
    1616#include "NotImplemented.h"
     17#include "RenderView.h"
    1718#include "TimeRanges.h"
     19#include "VideoLayerChromium.h"
     20
     21#if USE(ACCELERATED_COMPOSITING)
     22#include "RenderLayerCompositor.h"
     23#endif
    1824
    1925#include "WebCanvas.h"
     
    2935#include "WebString.h"
    3036#include "WebURL.h"
     37#include "WebViewImpl.h"
    3138
    3239// WebCommon.h defines WEBKIT_USING_SKIA so this has to be included last.
     
    4653{
    4754    WebFrameImpl* webFrame = WebFrameImpl::fromFrame(frame);
     55
    4856    if (!webFrame->client())
    4957        return 0;
     
    147155    Frame* frame = static_cast<HTMLMediaElement*>(
    148156        m_mediaPlayer->mediaPlayerClient())->document()->frame();
     157
    149158    m_webMediaPlayer.set(createWebMediaPlayer(this, frame));
    150159    if (m_webMediaPlayer.get())
     
    157166        m_webMediaPlayer->cancelLoad();
    158167}
     168
     169#if USE(ACCELERATED_COMPOSITING)
     170WebCore::PlatformLayer* WebMediaPlayerClientImpl::platformLayer() const
     171{
     172    ASSERT(m_supportsAcceleratedCompositing);
     173    return m_videoLayer.get();
     174}
     175#endif
    159176
    160177void WebMediaPlayerClientImpl::play()
     
    361378}
    362379
     380#if USE(ACCELERATED_COMPOSITING)
     381bool WebMediaPlayerClientImpl::supportsAcceleratedRendering() const
     382{
     383    return m_supportsAcceleratedCompositing;
     384}
     385#endif
     386
    363387MediaPlayer::MovieLoadType WebMediaPlayerClientImpl::movieLoadType() const
    364388{
     
    373397    WebMediaPlayerClientImpl* client = new WebMediaPlayerClientImpl();
    374398    client->m_mediaPlayer = player;
     399
     400#if USE(ACCELERATED_COMPOSITING)
     401    Frame* frame = static_cast<HTMLMediaElement*>(
     402        client->m_mediaPlayer->mediaPlayerClient())->document()->frame();
     403
     404    // This does not actually check whether the hardware can support accelerated
     405    // compositing, but only if the flag is set. However, this is checked lazily
     406    // in WebViewImpl::setIsAcceleratedCompositingActive() and will fail there
     407    // if necessary.
     408    client->m_supportsAcceleratedCompositing =
     409        frame->contentRenderer()->compositor()->hasAcceleratedCompositing();
     410
     411    if (client->m_supportsAcceleratedCompositing)
     412        client->m_videoLayer = VideoLayerChromium::create(0);
     413#endif
     414
    375415    return client;
    376416}
     
    403443WebMediaPlayerClientImpl::WebMediaPlayerClientImpl()
    404444    : m_mediaPlayer(0)
     445#if USE(ACCELERATED_COMPOSITING)
     446    , m_videoLayer(0)
     447    , m_supportsAcceleratedCompositing(false)
     448#endif
    405449{
    406450}
  • trunk/WebKit/chromium/src/WebMediaPlayerClientImpl.h

    r59466 r63723  
    6767    virtual void load(const WebCore::String& url);
    6868    virtual void cancelLoad();
     69#if USE(ACCELERATED_COMPOSITING)
     70    virtual WebCore::PlatformLayer* platformLayer() const;
     71#endif
    6972    virtual void play();
    7073    virtual void pause();
     
    9598    virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect&);
    9699    virtual bool hasSingleSecurityOrigin() const;
     100#if USE(ACCELERATED_COMPOSITING)
     101    virtual bool supportsAcceleratedRendering() const;
     102#endif
     103
    97104    virtual WebCore::MediaPlayer::MovieLoadType movieLoadType() const;
    98105
     
    107114    WebCore::MediaPlayer* m_mediaPlayer;
    108115    OwnPtr<WebMediaPlayer> m_webMediaPlayer;
     116#if USE(ACCELERATED_COMPOSITING)
     117    RefPtr<WebCore::PlatformLayer> m_videoLayer;
     118    bool m_supportsAcceleratedCompositing;
     119#endif
    109120    static bool m_isEnabled;
    110121};
Note: See TracChangeset for help on using the changeset viewer.