Title: [203504] trunk/Source/WebKit2
Revision
203504
Author
[email protected]
Date
2016-07-21 09:02:52 -0700 (Thu, 21 Jul 2016)

Log Message

[GTK][Threaded Compositor] WTR generates fully white images for pixel tests most of the time
https://bugs.webkit.org/show_bug.cgi?id=160016

Reviewed by Žan Doberšek.

WTR sends a force repaint message to the web process before taking a snapshot of the web view. With the threaded
compositor, the UI process is notified about the force repaint callback before the contents have been actually
painted. We need to ensure that the contents are rendered before the UI process is notified.

* Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
(WebKit::ThreadedCompositor::forceRepaint): Synchronously render the layer tree.
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewRenderAcceleratedCompositingResults): Always mark the redirected window surface as dirty before
rendering, since it can be modified by the web process at any time.
* UIProcess/gtk/RedirectedXCompositeWindow.cpp:
(WebKit::XDamageNotifier::add):
(WebKit::RedirectedXCompositeWindow::RedirectedXCompositeWindow): Do not mark the surface as dirty on every
damage since the view will do it before rendering.
* WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
(WebKit::ThreadedCoordinatedLayerTreeHost::forceRepaint): Call ThreadedCompositor::forceRepaint().
* WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (203503 => 203504)


--- trunk/Source/WebKit2/ChangeLog	2016-07-21 16:01:20 UTC (rev 203503)
+++ trunk/Source/WebKit2/ChangeLog	2016-07-21 16:02:52 UTC (rev 203504)
@@ -1,5 +1,30 @@
 2016-07-21  Carlos Garcia Campos  <[email protected]>
 
+        [GTK][Threaded Compositor] WTR generates fully white images for pixel tests most of the time
+        https://bugs.webkit.org/show_bug.cgi?id=160016
+
+        Reviewed by Žan Doberšek.
+
+        WTR sends a force repaint message to the web process before taking a snapshot of the web view. With the threaded
+        compositor, the UI process is notified about the force repaint callback before the contents have been actually
+        painted. We need to ensure that the contents are rendered before the UI process is notified.
+
+        * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
+        (WebKit::ThreadedCompositor::forceRepaint): Synchronously render the layer tree.
+        * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
+        * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+        (webkitWebViewRenderAcceleratedCompositingResults): Always mark the redirected window surface as dirty before
+        rendering, since it can be modified by the web process at any time.
+        * UIProcess/gtk/RedirectedXCompositeWindow.cpp:
+        (WebKit::XDamageNotifier::add):
+        (WebKit::RedirectedXCompositeWindow::RedirectedXCompositeWindow): Do not mark the surface as dirty on every
+        damage since the view will do it before rendering.
+        * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
+        (WebKit::ThreadedCoordinatedLayerTreeHost::forceRepaint): Call ThreadedCompositor::forceRepaint().
+        * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
+
+2016-07-21  Carlos Garcia Campos  <[email protected]>
+
         [GTK] White page when loaded tab is visited until it's hovered when AC mode is always on
         https://bugs.webkit.org/show_bug.cgi?id=159512
 

Modified: trunk/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp (203503 => 203504)


--- trunk/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp	2016-07-21 16:01:20 UTC (rev 203503)
+++ trunk/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp	2016-07-21 16:02:52 UTC (rev 203504)
@@ -185,6 +185,13 @@
     m_compositingRunLoop->startUpdateTimer(CompositingRunLoop::Immediate);
 }
 
+void ThreadedCompositor::forceRepaint()
+{
+    m_compositingRunLoop->performTaskSync([this, protectedThis = makeRef(*this)] {
+        renderLayerTree();
+    });
+}
+
 void ThreadedCompositor::didChangeVisibleRect()
 {
     RunLoop::main().dispatch([this, protectedThis = makeRef(*this), visibleRect = m_viewportController->visibleContentsRect(), scale = m_viewportController->pageScaleFactor()] {

Modified: trunk/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h (203503 => 203504)


--- trunk/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h	2016-07-21 16:01:20 UTC (rev 203503)
+++ trunk/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h	2016-07-21 16:02:52 UTC (rev 203504)
@@ -78,6 +78,8 @@
 
     void invalidate();
 
+    void forceRepaint();
+
 private:
     ThreadedCompositor(Client*);
 

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp (203503 => 203504)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp	2016-07-21 16:01:20 UTC (rev 203503)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp	2016-07-21 16:02:52 UTC (rev 203504)
@@ -609,6 +609,9 @@
             }
         }
 
+        // The surface can be modified by the web process at any time, so we mark it
+        // as dirty to ensure we always render the updated contents as soon as possible.
+        cairo_surface_mark_dirty(surface);
         cairo_rectangle(cr, clipRect->x, clipRect->y, clipRect->width, clipRect->height);
         cairo_set_source_surface(cr, surface, 0, 0);
         cairo_set_operator(cr, CAIRO_OPERATOR_OVER);

Modified: trunk/Source/WebKit2/UIProcess/gtk/RedirectedXCompositeWindow.cpp (203503 => 203504)


--- trunk/Source/WebKit2/UIProcess/gtk/RedirectedXCompositeWindow.cpp	2016-07-21 16:01:20 UTC (rev 203503)
+++ trunk/Source/WebKit2/UIProcess/gtk/RedirectedXCompositeWindow.cpp	2016-07-21 16:02:52 UTC (rev 203504)
@@ -56,7 +56,7 @@
     {
     }
 
-    void add(Window window, std::function<void()> notifyFunction)
+    void add(Window window, std::function<void()>&& notifyFunction)
     {
         if (m_notifyFunctions.isEmpty())
             gdk_window_add_filter(nullptr, reinterpret_cast<GdkFilterFunc>(&filterXDamageEvent), this);
@@ -189,12 +189,7 @@
         &windowAttributes);
     XMapWindow(m_display, m_window.get());
 
-    xDamageNotifier().add(m_window.get(), [this, damageNotify = WTFMove(damageNotify)] {
-        // The surface has been modified by the web process, mark it as dirty.
-        if (m_surface)
-            cairo_surface_mark_dirty(m_surface.get());
-        damageNotify();
-    });
+    xDamageNotifier().add(m_window.get(), WTFMove(damageNotify));
 
     while (1) {
         XEvent event;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp (203503 => 203504)


--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp	2016-07-21 16:01:20 UTC (rev 203503)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp	2016-07-21 16:02:52 UTC (rev 203504)
@@ -60,6 +60,12 @@
     CoordinatedLayerTreeHost::invalidate();
 }
 
+void ThreadedCoordinatedLayerTreeHost::forceRepaint()
+{
+    CoordinatedLayerTreeHost::forceRepaint();
+    m_compositor->forceRepaint();
+}
+
 void ThreadedCoordinatedLayerTreeHost::scrollNonCompositedContents(const WebCore::IntRect& rect)
 {
     m_compositor->scrollTo(rect.location());

Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h (203503 => 203504)


--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h	2016-07-21 16:01:20 UTC (rev 203503)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h	2016-07-21 16:02:52 UTC (rev 203504)
@@ -61,6 +61,9 @@
 
     void invalidate() override;
 
+    void forceRepaint() override;
+    bool forceRepaintAsync(uint64_t callbackID) override { return false; }
+
 #if PLATFORM(GTK)
     void setNativeSurfaceHandleForCompositing(uint64_t) override;
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to