Title: [207095] releases/WebKitGTK/webkit-2.14/Source/WebKit2
Revision
207095
Author
[email protected]
Date
2016-10-11 04:52:19 -0700 (Tue, 11 Oct 2016)

Log Message

Merge r206294 - [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.

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.14/Source/WebKit2/ChangeLog (207094 => 207095)


--- releases/WebKitGTK/webkit-2.14/Source/WebKit2/ChangeLog	2016-10-11 11:51:16 UTC (rev 207094)
+++ releases/WebKitGTK/webkit-2.14/Source/WebKit2/ChangeLog	2016-10-11 11:52:19 UTC (rev 207095)
@@ -1,3 +1,26 @@
+2016-09-23  Carlos Garcia Campos  <[email protected]>
+
+        [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.
+
 2016-09-22  Carlos Garcia Campos  <[email protected]>
 
         [GTK] Rename DataObjectGtk as SelectionData

Modified: releases/WebKitGTK/webkit-2.14/Source/WebKit2/UIProcess/AcceleratedDrawingAreaProxy.cpp (207094 => 207095)


--- releases/WebKitGTK/webkit-2.14/Source/WebKit2/UIProcess/AcceleratedDrawingAreaProxy.cpp	2016-10-11 11:51:16 UTC (rev 207094)
+++ releases/WebKitGTK/webkit-2.14/Source/WebKit2/UIProcess/AcceleratedDrawingAreaProxy.cpp	2016-10-11 11:52:19 UTC (rev 207095)
@@ -220,6 +220,8 @@
         return;
     if (m_webPageProxy.process().state() == WebProcessProxy::State::Launching)
         return;
+    if (!m_webPageProxy.isViewVisible())
+        return;
 
 #if PLATFORM(WAYLAND)
     // Never block the UI process in Wayland when waiting for DidUpdateBackingStoreState after a resize,

Modified: releases/WebKitGTK/webkit-2.14/Source/WebKit2/UIProcess/gtk/AcceleratedBackingStoreX11.cpp (207094 => 207095)


--- releases/WebKitGTK/webkit-2.14/Source/WebKit2/UIProcess/gtk/AcceleratedBackingStoreX11.cpp	2016-10-11 11:51:16 UTC (rev 207094)
+++ releases/WebKitGTK/webkit-2.14/Source/WebKit2/UIProcess/gtk/AcceleratedBackingStoreX11.cpp	2016-10-11 11:52:19 UTC (rev 207095)
@@ -155,7 +155,8 @@
     cairoSurfaceSetDeviceScale(m_surface.get(), deviceScaleFactor, deviceScaleFactor);
     m_damage = XDamageCreate(display, pixmap, XDamageReportNonEmpty);
     XDamageNotifier::singleton().add(m_damage.get(), [this] {
-        gtk_widget_queue_draw(m_webPage.viewWidget());
+        if (m_webPage.isViewVisible())
+            gtk_widget_queue_draw(m_webPage.viewWidget());
     });
 }
 

Modified: releases/WebKitGTK/webkit-2.14/Source/WebKit2/WebProcess/WebPage/gtk/AcceleratedSurfaceX11.cpp (207094 => 207095)


--- releases/WebKitGTK/webkit-2.14/Source/WebKit2/WebProcess/WebPage/gtk/AcceleratedSurfaceX11.cpp	2016-10-11 11:51:16 UTC (rev 207094)
+++ releases/WebKitGTK/webkit-2.14/Source/WebKit2/WebProcess/WebPage/gtk/AcceleratedSurfaceX11.cpp	2016-10-11 11:52:19 UTC (rev 207095)
@@ -104,6 +104,7 @@
     XSelectInput(m_display, m_window.get(), NoEventMask);
     XCompositeRedirectWindow(m_display, m_window.get(), CompositeRedirectManual);
     m_pixmap = XCompositeNameWindowPixmap(m_display, m_window.get());
+    XSync(m_display, False);
 }
 
 AcceleratedSurfaceX11::~AcceleratedSurfaceX11()
@@ -129,6 +130,7 @@
     // Release the previous pixmap later to give some time to the UI process to update.
     RunLoop::main().dispatchAfter(std::chrono::seconds(5), [pixmap = WTFMove(m_pixmap)] { });
     m_pixmap = XCompositeNameWindowPixmap(m_display, m_window.get());
+    XSync(m_display, False);
     return true;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to