[webkit-changes] [WebKit/WebKit] 57d42a: [GTK] Improve force repaint implementation to redu...

Carlos Garcia Campos noreply at github.com
Thu Dec 26 23:08:09 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 57d42a4b3757962b89cc88e7da3ae63ac38eba32
      https://github.com/WebKit/WebKit/commit/57d42a4b3757962b89cc88e7da3ae63ac38eba32
  Author: Carlos Garcia Campos <cgarcia at igalia.com>
  Date:   2024-12-26 (Thu, 26 Dec 2024)

  Changed paths:
    A LayoutTests/platform/glib/printing/print-with-media-query-destory-expected.txt
    R LayoutTests/platform/gtk/printing/print-with-media-query-destory-expected.txt
    M LayoutTests/platform/wpe/TestExpectations
    M Source/WTF/wtf/glib/RunLoopSourcePriority.h
    M Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedBackingStoreProxy.cpp
    M Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedBackingStoreProxy.h
    M Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedBackingStoreTile.cpp
    M Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedPlatformLayer.cpp
    M Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedPlatformLayer.h
    M Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedTileBuffer.cpp
    M Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedTileBuffer.h
    M Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp
    M Source/WebKit/UIProcess/API/gtk/WebKitWebViewBaseInternal.h
    M Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp
    M Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h
    M Source/WebKit/UIProcess/gtk/AcceleratedBackingStore.h
    M Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreDMABuf.cpp
    M Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreDMABuf.h
    M Source/WebKit/UIProcess/gtk/WebPageProxyGtk.cpp
    M Source/WebKit/UIProcess/wpe/WebPageProxyWPE.cpp
    M Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedSceneState.cpp
    M Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedSceneState.h
    M Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp
    M Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h
    M Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp
    M Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h
    M Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCompositor.cpp
    M Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCompositor.h
    M Source/WebKit/WebProcess/WebPage/DrawingArea.h
    M Source/WebKit/WebProcess/WebPage/DrawingArea.messages.in
    M Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp

  Log Message:
  -----------
  [GTK] Improve force repaint implementation to reduce the amount of flaky ref tests
https://bugs.webkit.org/show_bug.cgi?id=284524

Reviewed by Nikolas Zimmermann.

Many ref tests are flaky because we are not properly taking the snapshot
of either the reference or test. This patch reworks the force repaint
implementation of the GTK port, with some parts also shared with WPE.

This patch includes the following changes:

 - For GTK we try to take the snapshot by using the last committed
   buffer, instead of using GTK API to get the web view rendered
   contents. When not possible for whatever reason, we fall back to
   getting web view rendered contents.
 - Send the DispatchAfterEnsuringDrawing message to the web process to
   make sure we get another frame in the UI process with the frame we
   want. This also allows as to remove the timer in GTK port to wait for
   multiple frames, since now we know the next one is the one we want.
 - To make sure we use the new rendered frame the paint/snapshot
   methods return a bool indicating whether buffers were swapped in that
   paint.
 - In the web process force repaint has been reworked to follow what
   other ports do, calling Page::forceRepaintAllFrames() and then doing
   a synchronous layer flush where a composition is forced. In case of
   async force repaint, we wait for the composition triggered by the
   force repaint (using the composition request ID) to notify back the
   UI process.
 - Resize no longer uses force repaint, it either schedules a new layer
   flush if waiting for the renderer, or does a sync layer flush
   otherwise.
 - We don't really need a sync composition, so ThreadedCompositor::forceRepaint()
   has been removed, since it has always been unimplemented and we don't
   plan to implement it either.
 - GTK run loop priority for accelerated compositing timers (LayerFlush,
   CompositingThreadUpdate and DisplayRefreshMonitor) has been changed
   to be the same as WebCore timers to make sure a WebCore timer can't
   prevent a layer flush. This caused a timeout in one test in GTK port.
   This was not a problem in WPE because it already uses the same
   priority for those timers.

* LayoutTests/platform/glib/printing/print-with-media-query-destory-expected.txt: Renamed from LayoutTests/platform/gtk/printing/print-with-media-query-destory-expected.txt.
* LayoutTests/platform/wpe/TestExpectations:
* Source/WTF/wtf/glib/RunLoopSourcePriority.h:
* Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedBackingStoreProxy.cpp:
(WebCore::CoordinatedBackingStoreProxy::Update::waitUntilPaintingComplete):
(WebCore::CoordinatedBackingStoreProxy::waitUntilPaintingComplete):
* Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedBackingStoreProxy.h:
* Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedBackingStoreTile.cpp:
(WebCore::CoordinatedBackingStoreTile::processPendingUpdates):
* Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedPlatformLayer.cpp:
(WebCore::CoordinatedPlatformLayer::waitUntilPaintingComplete):
* Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedPlatformLayer.h:
* Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedTileBuffer.cpp:
(WebCore::CoordinatedAcceleratedTileBuffer::serverWait):
(WebCore::CoordinatedAcceleratedTileBuffer::waitUntilPaintingComplete): Deleted.
* Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedTileBuffer.h:
* Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp:
(_WebKitWebViewBasePrivate::_WebKitWebViewBasePrivate):
(webkitWebViewBaseNextPresentationUpdateFrame):
(webkitWebViewBaseDispose):
(webkitWebViewBaseSnapshot):
(webkitWebViewBaseDraw):
(webkitWebViewBaseCallAfterNextPresentationUpdate):
(createSkImageFromCairoSurface):
(webkitWebViewBaseSnapshotFromWidget):
(webkitWebViewBaseSnapshotForTesting):
(_WebKitWebViewBasePrivate::nextPresentationUpdateTimerFired): Deleted.
(webkitWebViewBaseNextPresentationUpdateMonitorStart): Deleted.
(webkitWebViewBaseNextPresentationUpdateMonitorStop): Deleted.
* Source/WebKit/UIProcess/API/gtk/WebKitWebViewBaseInternal.h:
* Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp:
(WebKit::DrawingAreaProxyCoordinatedGraphics::dispatchPresentationCallbacksAfterFlushingLayers):
* Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h:
* Source/WebKit/UIProcess/gtk/AcceleratedBackingStore.h:
* Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreDMABuf.cpp:
(WebKit::AcceleratedBackingStoreDMABuf::rendererBufferMode):
(WebKit::nativeImageFromGdkTexture):
(WebKit::AcceleratedBackingStoreDMABuf::BufferDMABuf::asNativeImageForTesting const):
(WebKit::AcceleratedBackingStoreDMABuf::BufferEGLImage::asNativeImageForTesting const):
(WebKit::AcceleratedBackingStoreDMABuf::BufferGBM::asNativeImageForTesting const):
(WebKit::AcceleratedBackingStoreDMABuf::BufferSHM::asNativeImageForTesting const):
(WebKit::AcceleratedBackingStoreDMABuf::snapshot):
(WebKit::AcceleratedBackingStoreDMABuf::paint):
(WebKit::AcceleratedBackingStoreDMABuf::bufferAsNativeImageForTesting const):
* Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreDMABuf.h:
* Source/WebKit/UIProcess/gtk/WebPageProxyGtk.cpp:
(WebKit::WebPageProxy::callAfterNextPresentationUpdate):
* Source/WebKit/UIProcess/wpe/WebPageProxyWPE.cpp:
(WebKit::WebPageProxy::callAfterNextPresentationUpdate):
* Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
(WebKit::DrawingAreaCoordinatedGraphics::updateRenderingWithForcedRepaint):
(WebKit::DrawingAreaCoordinatedGraphics::updateRenderingWithForcedRepaintAsync):
(WebKit::DrawingAreaCoordinatedGraphics::updateGeometry):
(WebKit::DrawingAreaCoordinatedGraphics::dispatchAfterEnsuringDrawing):
(WebKit::DrawingAreaCoordinatedGraphics::dispatchPendingCallbacksAfterEnsuringDrawing):
(WebKit::DrawingAreaCoordinatedGraphics::display):
* Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h:
* Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
(WebKit::LayerTreeHost::flushLayers):
(WebKit::LayerTreeHost::layerFlushTimerFired):
(WebKit::LayerTreeHost::forceRepaint):
(WebKit::LayerTreeHost::forceRepaintAsync):
(WebKit::LayerTreeHost::ensureDrawing):
(WebKit::LayerTreeHost::sizeDidChange):
(WebKit::LayerTreeHost::didComposite):
* Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h:
* Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCompositor.cpp:
(WebKit::ThreadedCompositor::forceRepaint): Deleted.
* Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCompositor.h:
* Source/WebKit/WebProcess/WebPage/DrawingArea.h:
* Source/WebKit/WebProcess/WebPage/DrawingArea.messages.in:
* Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp:
(WTR::PlatformWebView::windowSnapshotImage):
(WTR::viewSnapshot): Deleted.

Canonical link: https://commits.webkit.org/288306@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list