Title: [194446] trunk/Source/WebCore
Revision
194446
Author
[email protected]
Date
2015-12-30 01:48:34 -0800 (Wed, 30 Dec 2015)

Log Message

[CoordinatedGraphics] VideoRenderRequestScheduler shouldn't dispatch to main thread in threaded compositor
https://bugs.webkit.org/show_bug.cgi?id=152584

Reviewed by Carlos Garcia Campos.

The VideoRenderRequestScheduler class should only send the repaint-requested
signal dispatch to the main thread when not using the threaded compositor.
In case that is used (guarded via WTF_USE_COORDINATED_GRAPHICS_THREADED), the
signal dispatch can be done on the current thread (normally a GStreamer thread)
since the actual GL texture update will be then dispatched to the compositor
thread (unlike when gstreamer-gl is used, when the update can be done on the
very same thread).

When that is the case we don't need the RunLoop::Timer, Condition and the
video sink GRefPtr protector that are otherwise used by this class, so these
can just be guarded with the USE(...) flag.

* platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
(VideoRenderRequestScheduler::VideoRenderRequestScheduler):
(VideoRenderRequestScheduler::stop):
(VideoRenderRequestScheduler::requestRender):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (194445 => 194446)


--- trunk/Source/WebCore/ChangeLog	2015-12-30 09:47:21 UTC (rev 194445)
+++ trunk/Source/WebCore/ChangeLog	2015-12-30 09:48:34 UTC (rev 194446)
@@ -1,5 +1,29 @@
 2015-12-30  Zan Dobersek  <[email protected]>
 
+        [CoordinatedGraphics] VideoRenderRequestScheduler shouldn't dispatch to main thread in threaded compositor
+        https://bugs.webkit.org/show_bug.cgi?id=152584
+
+        Reviewed by Carlos Garcia Campos.
+
+        The VideoRenderRequestScheduler class should only send the repaint-requested
+        signal dispatch to the main thread when not using the threaded compositor.
+        In case that is used (guarded via WTF_USE_COORDINATED_GRAPHICS_THREADED), the
+        signal dispatch can be done on the current thread (normally a GStreamer thread)
+        since the actual GL texture update will be then dispatched to the compositor
+        thread (unlike when gstreamer-gl is used, when the update can be done on the
+        very same thread).
+
+        When that is the case we don't need the RunLoop::Timer, Condition and the
+        video sink GRefPtr protector that are otherwise used by this class, so these
+        can just be guarded with the USE(...) flag.
+
+        * platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
+        (VideoRenderRequestScheduler::VideoRenderRequestScheduler):
+        (VideoRenderRequestScheduler::stop):
+        (VideoRenderRequestScheduler::requestRender):
+
+2015-12-30  Zan Dobersek  <[email protected]>
+
         [TexMap] Clean up TextureMapperAnimation, TextureMapperAnimations
         https://bugs.webkit.org/show_bug.cgi?id=152112
 

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp (194445 => 194446)


--- trunk/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp	2015-12-30 09:47:21 UTC (rev 194445)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp	2015-12-30 09:48:34 UTC (rev 194446)
@@ -73,9 +73,11 @@
 class VideoRenderRequestScheduler {
 public:
     VideoRenderRequestScheduler()
+#if !USE(COORDINATED_GRAPHICS_THREADED)
         : m_timer(RunLoop::main(), this, &VideoRenderRequestScheduler::render)
+#endif
     {
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) && !USE(COORDINATED_GRAPHICS_THREADED)
         // Use a higher priority than WebCore timers (G_PRIORITY_HIGH_IDLE + 20).
         m_timer.setPriority(G_PRIORITY_HIGH_IDLE + 19);
 #endif
@@ -90,10 +92,12 @@
     void stop()
     {
         LockHolder locker(m_sampleMutex);
-        m_timer.stop();
         m_sample = nullptr;
         m_unlocked = true;
+#if !USE(COORDINATED_GRAPHICS_THREADED)
+        m_timer.stop();
         m_dataCondition.notifyOne();
+#endif
     }
 
     bool requestRender(WebKitVideoSink* sink, GstBuffer* buffer)
@@ -106,14 +110,21 @@
         if (!m_sample)
             return false;
 
+#if USE(COORDINATED_GRAPHICS_THREADED)
+        if (LIKELY(GST_IS_SAMPLE(m_sample.get())))
+            webkitVideoSinkRepaintRequested(sink, m_sample.get());
+        m_sample = nullptr;
+#else
         m_sink = sink;
         m_timer.startOneShot(0);
         m_dataCondition.wait(m_sampleMutex);
+#endif
         return true;
     }
 
 private:
 
+#if !USE(COORDINATED_GRAPHICS_THREADED)
     void render()
     {
         LockHolder locker(m_sampleMutex);
@@ -123,12 +134,16 @@
             webkitVideoSinkRepaintRequested(sink.get(), sample.get());
         m_dataCondition.notifyOne();
     }
+#endif
 
+    Lock m_sampleMutex;
+    GRefPtr<GstSample> m_sample;
+
+#if !USE(COORDINATED_GRAPHICS_THREADED)
     RunLoop::Timer<VideoRenderRequestScheduler> m_timer;
-    Lock m_sampleMutex;
     Condition m_dataCondition;
-    GRefPtr<GstSample> m_sample;
     GRefPtr<WebKitVideoSink> m_sink;
+#endif
 
     // If this is true all processing should finish ASAP
     // This is necessary because there could be a race between
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to