Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: a6a10cdfb8baf3512b99b36741595efa8c6feb06 https://github.com/WebKit/WebKit/commit/a6a10cdfb8baf3512b99b36741595efa8c6feb06 Author: Adrian Perez de Castro <ape...@igalia.com> Date: 2024-06-20 (Thu, 20 Jun 2024)
Changed paths: M Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml M Source/WebCore/Headers.cmake A Source/WebCore/platform/graphics/Damage.h M Source/WebCore/platform/graphics/GraphicsLayer.h M Source/WebCore/platform/graphics/nicosia/NicosiaCompositionLayer.h M Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp M Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h M Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp M Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h M Source/WebCore/rendering/RenderLayerBacking.cpp M Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp M Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h M Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp M Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h M Source/WebKit/UIProcess/dmabuf/AcceleratedBackingStoreDMABuf.messages.in M Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreDMABuf.cpp M Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreDMABuf.h M Source/WebKit/UIProcess/wpe/AcceleratedBackingStoreDMABuf.cpp M Source/WebKit/UIProcess/wpe/AcceleratedBackingStoreDMABuf.h M Source/WebKit/WPEPlatform/wpe/WPEView.cpp M Source/WebKit/WPEPlatform/wpe/WPEView.h M Source/WebKit/WPEPlatform/wpe/drm/WPEViewDRM.cpp M Source/WebKit/WPEPlatform/wpe/headless/WPEViewHeadless.cpp M Source/WebKit/WPEPlatform/wpe/wayland/WPEViewWayland.cpp M Source/WebKit/WebProcess/WebPage/AcceleratedSurface.h M Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp M Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h M Source/WebKit/WebProcess/WebPage/dmabuf/AcceleratedSurfaceDMABuf.cpp M Source/WebKit/WebProcess/WebPage/dmabuf/AcceleratedSurfaceDMABuf.h M Source/WebKit/WebProcess/WebPage/libwpe/AcceleratedSurfaceLibWPE.cpp M Source/WebKit/WebProcess/WebPage/libwpe/AcceleratedSurfaceLibWPE.h Log Message: ----------- [WPE] Generate damage region information https://bugs.webkit.org/show_bug.cgi?id=265777 Reviewed by Carlos Garcia Campos. Includes code and ideas from Lauro Moura, Pawel Lampe, Carlos Garcia Campos, and Miguel Gomez. Implement tracking which part of a frame change since the previous one. This may be used to let display systems optimize presentation of the rendered frames by updating only the parts that have been "damaged". While usually negligible on desktops, this can result in significant savings on embedded devices, particularly in memory bandwith and GPU usage. Information about damaged frames is collected mainly from repainted rectangles (from CoordinatedGraphicsLayer) and animated layers (from TextureMapperLayer), and recorded in a new helper Damage class. This is a first pass that only propagates the recorded Damage along with DMA-BUF buffers, and forwards the information to the Wayland compositor support in WPEPlatform. It should be possible to propagate the information through EGL where the EGL_{KHR,EXT}_swap_buffers_with_damage extension is present, which would work when the WPEPlatform API is not being used; gdk_dmabuf_texture_builder_set_update_region() could be used for the GTK port; and the optional FB_DAMAGE_CLIPS property for the DRM platform. These are left to be implemented later on. The intention for now is to lay out the foundations, and hence the feature is gated behind a runtime flag. Being an initial implementation, there are number of shortcomings that may be addressed as follow-ups. There is an attempt at detecting whether 3D transforms are used, with the intention of invalidating the whole frame; this mostly works but it would be better to properly handle these instead of causing full-frame damage. There is a pre-existing issue which manifests itself more obviously with damage tracking enabled: while animating, the renderer content may not be as crisp as static; typically WebKit would repaint the crisper version of the content after animations have completed, but if some parts have not changed since the last frame, they will show up fuzzy because they are not considered as damaged. This is independent from damage tracking. Enabling damage tracking seems add negligible CPU usage: enabling it is neutral on Speedometer and MotionMark, which for the WPE port are CPU bound due to rasterization through Cairo being CPU bound. * Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml: Add feature flags to enable damage tracking, and to produce a single rectangle with the bounds of the damaged region instead of multiple rectangles. * Source/WebCore/Headers.cmake: * Source/WebCore/platform/graphics/Damage.h: Added. (WebCore::Damage::invalid): (WebCore::Damage::region const): (WebCore::Damage::bounds const): (WebCore::Damage::rects const): (WebCore::Damage::isEmpty const): (WebCore::Damage::isInvalid const): (WebCore::Damage::invalidate): (WebCore::Damage::add): (WebCore::Damage::mergeIfNeeded): (WebCore::Damage::Damage): (WebCore::operator<<): * Source/WebCore/platform/graphics/GraphicsLayer.h: (WebCore::GraphicsLayer::markDamageRectsUnreliable): * Source/WebCore/platform/graphics/nicosia/NicosiaCompositionLayer.h: * Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp: (WebCore::TextureMapperLayer::TextureMapperLayer): (WebCore::TextureMapperLayer::paintSelf): (WebCore::TextureMapperLayer::addChild): (WebCore::TextureMapperLayer::removeFromParent): (WebCore::TextureMapperLayer::removeAllChildren): (WebCore::TextureMapperLayer::applyAnimationsRecursively): (WebCore::TextureMapperLayer::acceptDamageVisitor): (WebCore::TextureMapperLayer::dismissDamageVisitor): (WebCore::TextureMapperLayer::recordDamage): * Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h: (WebCore::TextureMapperLayer::clearDamage): (WebCore::TextureMapperLayer::invalidateDamage): (WebCore::TextureMapperLayer::addDamage): * Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: (WebCore::CoordinatedGraphicsLayer::setContentsOpaque): (WebCore::CoordinatedGraphicsLayer::markDamageRectsUnreliable): (WebCore::CoordinatedGraphicsLayer::setNeedsDisplay): (WebCore::CoordinatedGraphicsLayer::setNeedsDisplayInRect): (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly): (WebCore::CoordinatedGraphicsLayer::computeTransformedVisibleRect): * Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h: * Source/WebCore/rendering/RenderLayerBacking.cpp: (WebCore::layerRendererStyleHas3DTransformOperation): (WebCore::RenderLayerBacking::updateAfterDescendants): * Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp: (WebKit::CoordinatedGraphicsScene::CoordinatedGraphicsScene): (WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext): (WebKit::texmapLayer): (WebKit::CoordinatedGraphicsScene::updateSceneState): (WebKit::CoordinatedGraphicsScene::ensureRootLayer): (WebKit::CoordinatedGraphicsScene::purgeGLResources): (WebKit::CoordinatedGraphicsScene::recordDamage): * Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h: (WebKit::CoordinatedGraphicsScene::lastDamage const): * Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp: (WebKit::ThreadedCompositor::create): (WebKit::ThreadedCompositor::ThreadedCompositor): (WebKit::ThreadedCompositor::renderLayerTree): * Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h: * Source/WebKit/UIProcess/dmabuf/AcceleratedBackingStoreDMABuf.messages.in: * Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreDMABuf.cpp: (WebKit::AcceleratedBackingStoreDMABuf::frame): * Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreDMABuf.h: * Source/WebKit/UIProcess/wpe/AcceleratedBackingStoreDMABuf.cpp: (WebKit::AcceleratedBackingStoreDMABuf::frame): * Source/WebKit/UIProcess/wpe/AcceleratedBackingStoreDMABuf.h: * Source/WebKit/WPEPlatform/wpe/WPEView.cpp: (wpe_view_render_buffer): * Source/WebKit/WPEPlatform/wpe/WPEView.h: * Source/WebKit/WPEPlatform/wpe/drm/WPEViewDRM.cpp: (wpeViewDRMRenderBuffer): * Source/WebKit/WPEPlatform/wpe/headless/WPEViewHeadless.cpp: (wpeViewHeadlessRenderBuffer): * Source/WebKit/WPEPlatform/wpe/wayland/WPEViewWayland.cpp: * Source/WebKit/WebProcess/WebPage/AcceleratedSurface.h: (WebKit::AcceleratedSurface::didRenderFrame): * Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp: (WebKit::LayerTreeHost::LayerTreeHost): (WebKit::LayerTreeHost::scrollNonCompositedContents): (WebKit::LayerTreeHost::didChangeViewport): (WebKit::LayerTreeHost::didRenderFrame): * Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h: * Source/WebKit/WebProcess/WebPage/dmabuf/AcceleratedSurfaceDMABuf.cpp: (WebKit::AcceleratedSurfaceDMABuf::didRenderFrame): * Source/WebKit/WebProcess/WebPage/dmabuf/AcceleratedSurfaceDMABuf.h: * Source/WebKit/WebProcess/WebPage/libwpe/AcceleratedSurfaceLibWPE.cpp: (WebKit::AcceleratedSurfaceLibWPE::didRenderFrame): * Source/WebKit/WebProcess/WebPage/libwpe/AcceleratedSurfaceLibWPE.h: Canonical link: https://commits.webkit.org/280193@main To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes