Title: [154914] trunk/Source/WebCore
Revision
154914
Author
[email protected]
Date
2013-08-30 15:37:51 -0700 (Fri, 30 Aug 2013)

Log Message

[Windows] Vide element in page always uses non-hw accelerated mode.
https://bugs.webkit.org/show_bug.cgi?id=120448

Reviewed by Darin Adler

This patch is unfortunately larger than my original idea, but seems to make the
layout system happier. Instead of switching into composited mode when building
the media player, we now build the original layout tree with compositing active
if the underlying media element requires it. The AVFoundationCF player needs to
have the compositor available at construction time so it can attach to the
rendering device. Otherwise it falls back to CPU-only mode.

* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::requiresImmediateCompositing): Added
* platform/graphics/MediaPlayer.h:
* platform/graphics/MediaPlayerPrivate.h:
(WebCore::MediaPlayerPrivateInterface::requiresImmediateCompositing): Added
* platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
(WebCore::MediaPlayerPrivateAVFoundationCF::createAVPlayer): Added
* platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.h:
(WebCore::MediaPlayerPrivateAVFoundationCF::requiresImmediateCompositing):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::requiresCompositingForVideo): Uses new
'requiresImmediateCompositing' to short-circuit check for whether a
compositor is required.
* rendering/RenderVideo.cpp:
(WebCore::RenderVideo::requiresImmediateCompositing):
* rendering/RenderVideo.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (154913 => 154914)


--- trunk/Source/WebCore/ChangeLog	2013-08-30 22:12:28 UTC (rev 154913)
+++ trunk/Source/WebCore/ChangeLog	2013-08-30 22:37:51 UTC (rev 154914)
@@ -1,3 +1,34 @@
+2013-08-30  Brent Fulgham  <[email protected]>
+
+        [Windows] Vide element in page always uses non-hw accelerated mode.
+        https://bugs.webkit.org/show_bug.cgi?id=120448
+
+        Reviewed by Darin Adler
+
+        This patch is unfortunately larger than my original idea, but seems to make the
+        layout system happier. Instead of switching into composited mode when building
+        the media player, we now build the original layout tree with compositing active
+        if the underlying media element requires it. The AVFoundationCF player needs to
+        have the compositor available at construction time so it can attach to the
+        rendering device. Otherwise it falls back to CPU-only mode.
+
+        * platform/graphics/MediaPlayer.cpp:
+        (WebCore::MediaPlayer::requiresImmediateCompositing): Added
+        * platform/graphics/MediaPlayer.h:
+        * platform/graphics/MediaPlayerPrivate.h:
+        (WebCore::MediaPlayerPrivateInterface::requiresImmediateCompositing): Added
+        * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
+        (WebCore::MediaPlayerPrivateAVFoundationCF::createAVPlayer): Added
+        * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.h:
+        (WebCore::MediaPlayerPrivateAVFoundationCF::requiresImmediateCompositing):
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::requiresCompositingForVideo): Uses new
+        'requiresImmediateCompositing' to short-circuit check for whether a
+        compositor is required.
+        * rendering/RenderVideo.cpp:
+        (WebCore::RenderVideo::requiresImmediateCompositing):
+        * rendering/RenderVideo.h:
+
 2013-08-30  Joseph Pecoraro  <[email protected]>
 
         Web Inspector: Breakpoints should have Automatically Continue Option

Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp (154913 => 154914)


--- trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp	2013-08-30 22:12:28 UTC (rev 154913)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp	2013-08-30 22:37:51 UTC (rev 154914)
@@ -562,6 +562,11 @@
     return m_private->supportsScanning();
 }
 
+bool MediaPlayer::requiresImmediateCompositing() const
+{
+    return m_private->requiresImmediateCompositing();
+}
+
 IntSize MediaPlayer::naturalSize()
 {
     return m_private->naturalSize();

Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.h (154913 => 154914)


--- trunk/Source/WebCore/platform/graphics/MediaPlayer.h	2013-08-30 22:12:28 UTC (rev 154913)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.h	2013-08-30 22:37:51 UTC (rev 154914)
@@ -262,6 +262,7 @@
     bool supportsFullscreen() const;
     bool supportsSave() const;
     bool supportsScanning() const;
+    bool requiresImmediateCompositing() const;
     PlatformMedia platformMedia() const;
 #if USE(ACCELERATED_COMPOSITING)
     PlatformLayer* platformLayer() const;

Modified: trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h (154913 => 154914)


--- trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h	2013-08-30 22:12:28 UTC (rev 154913)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h	2013-08-30 22:37:51 UTC (rev 154914)
@@ -62,6 +62,7 @@
     virtual bool supportsFullscreen() const { return false; }
     virtual bool supportsSave() const { return false; }
     virtual bool supportsScanning() const { return false; }
+    virtual bool requiresImmediateCompositing() const { return false; }
 
     virtual IntSize naturalSize() const = 0;
 

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp (154913 => 154914)


--- trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp	2013-08-30 22:12:28 UTC (rev 154913)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp	2013-08-30 22:37:51 UTC (rev 154914)
@@ -409,15 +409,7 @@
     ASSERT(m_avfWrapper);
     
     setDelayCallbacks(true);
-
-    IDirect3DDevice9* device = reinterpret_cast<IDirect3DDevice9*>(player()->graphicsDeviceAdapter());
-    if (!device) {
-        player()->frameView()->enterCompositingMode();
-        player()->mediaPlayerClient()->mediaPlayerRenderingModeChanged(player());
-        device = reinterpret_cast<IDirect3DDevice9*>(player()->graphicsDeviceAdapter());
-    }
-
-    m_avfWrapper->createPlayer(device);
+    m_avfWrapper->createPlayer(reinterpret_cast<IDirect3DDevice9*>(player()->graphicsDeviceAdapter()));
     setDelayCallbacks(false);
 }
 

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.h (154913 => 154914)


--- trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.h	2013-08-30 22:12:28 UTC (rev 154913)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.h	2013-08-30 22:37:51 UTC (rev 154914)
@@ -85,6 +85,7 @@
     virtual float platformMaxTimeLoaded() const;
     virtual void beginLoadingMetadata();
     virtual void sizeChanged();
+    virtual bool requiresImmediateCompositing() const { return true; }
 
     virtual bool hasAvailableVideoFrame() const;
 

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (154913 => 154914)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2013-08-30 22:12:28 UTC (rev 154913)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2013-08-30 22:37:51 UTC (rev 154914)
@@ -2073,7 +2073,7 @@
 #if ENABLE(VIDEO)
     if (renderer->isVideo()) {
         RenderVideo* video = toRenderVideo(renderer);
-        return video->shouldDisplayVideo() && canAccelerateVideoRendering(video);
+        return (video->requiresImmediateCompositing() || video->shouldDisplayVideo()) && canAccelerateVideoRendering(video);
     }
 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
     else if (renderer->isRenderPart()) {

Modified: trunk/Source/WebCore/rendering/RenderVideo.cpp (154913 => 154914)


--- trunk/Source/WebCore/rendering/RenderVideo.cpp	2013-08-30 22:12:28 UTC (rev 154913)
+++ trunk/Source/WebCore/rendering/RenderVideo.cpp	2013-08-30 22:37:51 UTC (rev 154914)
@@ -281,6 +281,12 @@
 }
 #endif  // USE(ACCELERATED_COMPOSITING)
 
+bool RenderVideo::requiresImmediateCompositing() const
+{
+    MediaPlayer* p = mediaElement()->player();
+    return p ? p->requiresImmediateCompositing() : false;
+}
+
 #if ENABLE(FULLSCREEN_API)
 static const RenderBlock* rendererPlaceholder(const RenderObject* renderer)
 {

Modified: trunk/Source/WebCore/rendering/RenderVideo.h (154913 => 154914)


--- trunk/Source/WebCore/rendering/RenderVideo.h	2013-08-30 22:12:28 UTC (rev 154913)
+++ trunk/Source/WebCore/rendering/RenderVideo.h	2013-08-30 22:37:51 UTC (rev 154914)
@@ -49,6 +49,8 @@
     void acceleratedRenderingStateChanged();
 #endif
 
+    bool requiresImmediateCompositing() const;
+
     virtual bool shouldDisplayVideo() const;
 
 private:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to