Changeset 206294 in webkit


Ignore:
Timestamp:
Sep 23, 2016 1:02:59 AM (8 years ago)
Author:
Carlos Garcia Campos
Message:

[GTK] Improve performance when resizing a window with multiple web views in X11
https://bugs.webkit.org/show_bug.cgi?id=162413

Reviewed by Michael Catanzaro.

Resizing a window with a single way view performs good enough, but when adding more tabs, the performance
decreases a lot. This is because resize is a sync operation, and the UI process waits for the web process to
have a new update for the new size, while still draws the previous frame. This is needed for the visible web
view, to avoid flickering and artifacts while resizing, but for all other hidden web views, we don't really need
to block the UI process. This doesn't happen in Wayland, because in Wayland we never block the UI process while
waiting for web process update after a resize.

  • UIProcess/AcceleratedDrawingAreaProxy.cpp:

(WebKit::AcceleratedDrawingAreaProxy::waitForAndDispatchDidUpdateBackingStoreState): Return early if the web
view is not visible.

  • UIProcess/gtk/AcceleratedBackingStoreX11.cpp:

(WebKit::AcceleratedBackingStoreX11::update): Only schedule a redraw on a damage event when the view is visible.

  • WebProcess/WebPage/gtk/AcceleratedSurfaceX11.cpp:

(WebKit::AcceleratedSurfaceX11::AcceleratedSurfaceX11): Do a XSync right after creating the new pixmap.
(WebKit::AcceleratedSurfaceX11::resize): Ditto.

Location:
trunk/Source/WebKit2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r206275 r206294  
     12016-09-23  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] Improve performance when resizing a window with multiple web views in X11
     4        https://bugs.webkit.org/show_bug.cgi?id=162413
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        Resizing a window with a single way view performs good enough, but when adding more tabs, the performance
     9        decreases a lot. This is because resize is a sync operation, and the UI process waits for the web process to
     10        have a new update for the new size, while still draws the previous frame. This is needed for the visible web
     11        view, to avoid flickering and artifacts while resizing, but for all other hidden web views, we don't really need
     12        to block the UI process. This doesn't happen in Wayland, because in Wayland we never block the UI process while
     13        waiting for web process update after a resize.
     14
     15        * UIProcess/AcceleratedDrawingAreaProxy.cpp:
     16        (WebKit::AcceleratedDrawingAreaProxy::waitForAndDispatchDidUpdateBackingStoreState): Return early if the web
     17        view is not visible.
     18        * UIProcess/gtk/AcceleratedBackingStoreX11.cpp:
     19        (WebKit::AcceleratedBackingStoreX11::update): Only schedule a redraw on a damage event when the view is visible.
     20        * WebProcess/WebPage/gtk/AcceleratedSurfaceX11.cpp:
     21        (WebKit::AcceleratedSurfaceX11::AcceleratedSurfaceX11): Do a XSync right after creating the new pixmap.
     22        (WebKit::AcceleratedSurfaceX11::resize): Ditto.
     23
    1242016-09-22  Daniel Bates  <dabates@apple.com>
    225
  • trunk/Source/WebKit2/UIProcess/AcceleratedDrawingAreaProxy.cpp

    r205431 r206294  
    221221    if (m_webPageProxy.process().state() == WebProcessProxy::State::Launching)
    222222        return;
     223    if (!m_webPageProxy.isViewVisible())
     224        return;
    223225
    224226#if PLATFORM(WAYLAND)
  • trunk/Source/WebKit2/UIProcess/gtk/AcceleratedBackingStoreX11.cpp

    r205116 r206294  
    156156    m_damage = XDamageCreate(display, pixmap, XDamageReportNonEmpty);
    157157    XDamageNotifier::singleton().add(m_damage.get(), [this] {
    158         gtk_widget_queue_draw(m_webPage.viewWidget());
     158        if (m_webPage.isViewVisible())
     159            gtk_widget_queue_draw(m_webPage.viewWidget());
    159160    });
    160161}
  • trunk/Source/WebKit2/WebProcess/WebPage/gtk/AcceleratedSurfaceX11.cpp

    r205116 r206294  
    105105    XCompositeRedirectWindow(m_display, m_window.get(), CompositeRedirectManual);
    106106    m_pixmap = XCompositeNameWindowPixmap(m_display, m_window.get());
     107    XSync(m_display, False);
    107108}
    108109
     
    130131    RunLoop::main().dispatchAfter(std::chrono::seconds(5), [pixmap = WTFMove(m_pixmap)] { });
    131132    m_pixmap = XCompositeNameWindowPixmap(m_display, m_window.get());
     133    XSync(m_display, False);
    132134    return true;
    133135}
Note: See TracChangeset for help on using the changeset viewer.