⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 203504 in webkit


Ignore:
Timestamp:
Jul 21, 2016, 9:02:52 AM (10 years ago)
Author:
Carlos Garcia Campos
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:
Location:
trunk/Source/WebKit2
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r203500 r203504  
     12016-07-21  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK][Threaded Compositor] WTR generates fully white images for pixel tests most of the time
     4        https://bugs.webkit.org/show_bug.cgi?id=160016
     5
     6        Reviewed by Žan Doberšek.
     7
     8        WTR sends a force repaint message to the web process before taking a snapshot of the web view. With the threaded
     9        compositor, the UI process is notified about the force repaint callback before the contents have been actually
     10        painted. We need to ensure that the contents are rendered before the UI process is notified.
     11
     12        * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
     13        (WebKit::ThreadedCompositor::forceRepaint): Synchronously render the layer tree.
     14        * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
     15        * UIProcess/API/gtk/WebKitWebViewBase.cpp:
     16        (webkitWebViewRenderAcceleratedCompositingResults): Always mark the redirected window surface as dirty before
     17        rendering, since it can be modified by the web process at any time.
     18        * UIProcess/gtk/RedirectedXCompositeWindow.cpp:
     19        (WebKit::XDamageNotifier::add):
     20        (WebKit::RedirectedXCompositeWindow::RedirectedXCompositeWindow): Do not mark the surface as dirty on every
     21        damage since the view will do it before rendering.
     22        * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
     23        (WebKit::ThreadedCoordinatedLayerTreeHost::forceRepaint): Call ThreadedCompositor::forceRepaint().
     24        * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
     25
    1262016-07-21  Carlos Garcia Campos  <cgarcia@igalia.com>
    227
  • trunk/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp

    r203497 r203504  
    186186}
    187187
     188void ThreadedCompositor::forceRepaint()
     189{
     190    m_compositingRunLoop->performTaskSync([this, protectedThis = makeRef(*this)] {
     191        renderLayerTree();
     192    });
     193}
     194
    188195void ThreadedCompositor::didChangeVisibleRect()
    189196{
  • trunk/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h

    r203497 r203504  
    7979    void invalidate();
    8080
     81    void forceRepaint();
     82
    8183private:
    8284    ThreadedCompositor(Client*);
  • trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp

    r203496 r203504  
    610610        }
    611611
     612        // The surface can be modified by the web process at any time, so we mark it
     613        // as dirty to ensure we always render the updated contents as soon as possible.
     614        cairo_surface_mark_dirty(surface);
    612615        cairo_rectangle(cr, clipRect->x, clipRect->y, clipRect->width, clipRect->height);
    613616        cairo_set_source_surface(cr, surface, 0, 0);
  • trunk/Source/WebKit2/UIProcess/gtk/RedirectedXCompositeWindow.cpp

    r203500 r203504  
    5757    }
    5858
    59     void add(Window window, std::function<void()> notifyFunction)
     59    void add(Window window, std::function<void()>&& notifyFunction)
    6060    {
    6161        if (m_notifyFunctions.isEmpty())
    … …  
    190190    XMapWindow(m_display, m_window.get());
    191191
    192     xDamageNotifier().add(m_window.get(), [this, damageNotify = WTFMove(damageNotify)] {
    193         // The surface has been modified by the web process, mark it as dirty.
    194         if (m_surface)
    195             cairo_surface_mark_dirty(m_surface.get());
    196         damageNotify();
    197     });
     192    xDamageNotifier().add(m_window.get(), WTFMove(damageNotify));
    198193
    199194    while (1) {
  • trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp

    r203497 r203504  
    5959    m_compositor->invalidate();
    6060    CoordinatedLayerTreeHost::invalidate();
     61}
     62
     63void ThreadedCoordinatedLayerTreeHost::forceRepaint()
     64{
     65    CoordinatedLayerTreeHost::forceRepaint();
     66    m_compositor->forceRepaint();
    6167}
    6268
  • trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h

    r203497 r203504  
    6262    void invalidate() override;
    6363
     64    void forceRepaint() override;
     65    bool forceRepaintAsync(uint64_t callbackID) override { return false; }
     66
    6467#if PLATFORM(GTK)
    6568    void setNativeSurfaceHandleForCompositing(uint64_t) override;
Note: See TracChangeset for help on using the changeset viewer.