Title: [221584] releases/WebKitGTK/webkit-2.18/Source/WebKit
Revision
221584
Author
[email protected]
Date
2017-09-04 02:24:43 -0700 (Mon, 04 Sep 2017)

Log Message

Merge r221574 - [Threaded Compositor] Deadlock in ThreadedDisplayRefreshMonitor
https://bugs.webkit.org/show_bug.cgi?id=176296

Reviewed by Žan Doberšek.

The main thread tries to schedule a display refresh monitor from RAF, requestDisplayRefreshMonitorUpdate() tries
to take the attributes lock to update coordinateUpdateCompletionWithClient. The compositing thread has finished
a frame and sceneUpdateFinished() takes the attributes lock to update clientRendersNextFrame and then asks the
display refresh monitor if it requires a new callback. ThreadedDisplayRefreshMonitor::requiresDisplayRefreshCallback()
takes its lock to check the state, and requestDisplayRefreshMonitorUpdate() was called by
ThreadedDisplayRefreshMonitor::requestRefreshCallback() with the display refresh monitor lock taken. So,
the compositing thread has the attributes lock and wants the display refresh monitor one, and main thread has the
display refresh monitor lock and wants the attributes one.

* Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp:
(WebKit::ThreadedDisplayRefreshMonitor::requestRefreshCallback): Release the mutex before calling
ThreadedCompositor::requestDisplayRefreshMonitorUpdate().

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.18/Source/WebKit/ChangeLog (221583 => 221584)


--- releases/WebKitGTK/webkit-2.18/Source/WebKit/ChangeLog	2017-09-04 09:24:21 UTC (rev 221583)
+++ releases/WebKitGTK/webkit-2.18/Source/WebKit/ChangeLog	2017-09-04 09:24:43 UTC (rev 221584)
@@ -1,3 +1,23 @@
+2017-09-03  Carlos Garcia Campos  <[email protected]>
+
+        [Threaded Compositor] Deadlock in ThreadedDisplayRefreshMonitor
+        https://bugs.webkit.org/show_bug.cgi?id=176296
+
+        Reviewed by Žan Doberšek.
+
+        The main thread tries to schedule a display refresh monitor from RAF, requestDisplayRefreshMonitorUpdate() tries
+        to take the attributes lock to update coordinateUpdateCompletionWithClient. The compositing thread has finished
+        a frame and sceneUpdateFinished() takes the attributes lock to update clientRendersNextFrame and then asks the
+        display refresh monitor if it requires a new callback. ThreadedDisplayRefreshMonitor::requiresDisplayRefreshCallback()
+        takes its lock to check the state, and requestDisplayRefreshMonitorUpdate() was called by
+        ThreadedDisplayRefreshMonitor::requestRefreshCallback() with the display refresh monitor lock taken. So,
+        the compositing thread has the attributes lock and wants the display refresh monitor one, and main thread has the
+        display refresh monitor lock and wants the attributes one.
+
+        * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp:
+        (WebKit::ThreadedDisplayRefreshMonitor::requestRefreshCallback): Release the mutex before calling
+        ThreadedCompositor::requestDisplayRefreshMonitorUpdate().
+
 2017-09-03  Zan Dobersek  <[email protected]>
 
         [GTK] Libgcrypt warning: missing initialization - please fix the application

Modified: releases/WebKitGTK/webkit-2.18/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp (221583 => 221584)


--- releases/WebKitGTK/webkit-2.18/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp	2017-09-04 09:24:21 UTC (rev 221583)
+++ releases/WebKitGTK/webkit-2.18/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp	2017-09-04 09:24:43 UTC (rev 221584)
@@ -50,13 +50,17 @@
     if (!m_compositor)
         return false;
 
-    LockHolder locker(mutex());
-    setIsScheduled(true);
+    bool previousFrameDone { false };
+    {
+        LockHolder locker(mutex());
+        setIsScheduled(true);
+        previousFrameDone = isPreviousFrameDone();
+    }
 
     // Only request an update in case we're not currently handling the display
     // refresh notifications under ThreadedDisplayRefreshMonitor::displayRefreshCallback().
     // Any such schedule request is handled in that method after the notifications.
-    if (isPreviousFrameDone())
+    if (previousFrameDone)
         m_compositor->requestDisplayRefreshMonitorUpdate();
 
     return true;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to