-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ws: Save and expose damage buffer information #184
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The wl_surface.damage_buffer request can be used by clients to inform that a given region (in buffer coordinates) is damaged. This request is used by eglSwapBuffersWithDamage[EXT|KHR], with one call for each rect. For more info: https://wayland-book.com/surfaces-in-depth/damaging-surfaces.html This commit stores this information and exposes it to exported EGL image clients. It also bumps the nested compositor interface to version 4, which provides the damage_buffer support.
lauromoura
added a commit
to lauromoura/WebKit
that referenced
this pull request
Mar 19, 2024
https://bugs.webkit.org/show_bug.cgi?id=265777 Reviewed by NOBODY (OOPS!). Allows the WPE to report what parts of the new frame changed since the last frame. This allows the compositor to optimize the drawing by updating a smaller region. While usually negligible on the desktop, this behavior can bring benefits in less capable systems like embedded boards by copying less memory around. Note that currently the entire frame is still composited inside WebKit, only the difference rects are reported. In the future, the composition might be optimized to compose only the changed regions of the screen. This works by collecting the damage information from various sources like CoordinatedGraphicsLayer::setNeedsDisplay[InRect] and TextureMapperLayer animation code and agreggating them in the CoordinatedGraphicsScene when composing the frame. This information is forwarded to the ThreadingCompositor, which uses it with eglSwapBuffersWithDamage. In the current WPEBackend-fdo architecture, this information is passed to its nested Wayland compositor and made available in the backend API. Support in the new WPE API will be added in https://bugs.webkit.org/show_bug.cgi?id=265653 Use -DENABLE_BUFFER_DAMAGE_TRACKING cmake option to enable the feature at compile time. Related to WPEBackend-fdo Igalia/WPEBackend-fdo#184 * Source/WebCore/platform/SourcesNicosia.txt: * Source/WebCore/platform/TextureMapper.cmake: * Source/WebCore/platform/graphics/egl/GLContext.cpp: (WebCore::GLContext::GLContext): (WebCore::GLContext::swapBuffersWithDamage): * Source/WebCore/platform/graphics/egl/GLContext.h: (WebCore::GLContext::m_eglSwapBuffersWithDamage): * Source/WebCore/platform/graphics/nicosia/NicosiaBufferDamage.cpp: Added. (Nicosia::checkDamageBufUnifiedRegion): (Nicosia::bufDamageUnifiedRegion): * Source/WebCore/platform/graphics/nicosia/NicosiaBufferDamage.h: Added. * Source/WebCore/platform/graphics/nicosia/NicosiaCompositionLayer.h: * Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp: (WebCore::TextureMapperLayer::paintSelf): (WebCore::TextureMapperLayer::addChild): (WebCore::TextureMapperLayer::removeFromParent): (WebCore::TextureMapperLayer::removeAllChildren): (WebCore::TextureMapperLayer::applyAnimationsRecursively): (WebCore::TextureMapperLayer::acceptDamageVisitor): (WebCore::TextureMapperLayer::dismissDamageVisitor): (WebCore::TextureMapperLayer::markDamaged): (WebCore::TextureMapperLayer::clearDamaged): (WebCore::TextureMapperLayer::recordDamage): * Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h: * Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: (WebCore::CoordinatedGraphicsLayer::setContentsOpaque): (WebCore::CoordinatedGraphicsLayer::setContentsNeedsDisplay): (WebCore::CoordinatedGraphicsLayer::addDamageRegion): (WebCore::CoordinatedGraphicsLayer::setNeedsDisplay): (WebCore::CoordinatedGraphicsLayer::setNeedsDisplayInRect): (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly): (WebCore::CoordinatedGraphicsLayer::computeTransformedVisibleRect): * Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h: * Source/WebKit/Platform/Logging.h: * Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp: (WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext): (WebKit::CoordinatedGraphicsScene::updateSceneState): (WebKit::CoordinatedGraphicsScene::ensureRootLayer): (WebKit::CoordinatedGraphicsScene::purgeGLResources): (WebKit::CoordinatedGraphicsScene::recordDamage): * Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h: (WebKit::CoordinatedGraphicsScene::lastDamagedRects const): * Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp: (WebKit::ThreadedCompositor::renderLayerTree): * Source/cmake/WebKitFeatures.cmake: * Tools/wpe/backends/fdo/WindowViewBackend.cpp: (WPEToolingBackends::WindowViewBackend::displayBuffer):
Superseded by #188 |
Scony
pushed a commit
to Scony/WebKit
that referenced
this pull request
Mar 20, 2024
https://bugs.webkit.org/show_bug.cgi?id=265777 Reviewed by NOBODY (OOPS!). Allows the WPE to report what parts of the new frame changed since the last frame. This allows the compositor to optimize the drawing by updating a smaller region. While usually negligible on the desktop, this behavior can bring benefits in less capable systems like embedded boards by copying less memory around. Note that currently the entire frame is still composited inside WebKit, only the difference rects are reported. In the future, the composition might be optimized to compose only the changed regions of the screen. This works by collecting the damage information from various sources like CoordinatedGraphicsLayer::setNeedsDisplay[InRect] and TextureMapperLayer animation code and agreggating them in the CoordinatedGraphicsScene when composing the frame. This information is forwarded to the ThreadingCompositor, which uses it with eglSwapBuffersWithDamage. In the current WPEBackend-fdo architecture, this information is passed to its nested Wayland compositor and made available in the backend API. Support in the new WPE API will be added in https://bugs.webkit.org/show_bug.cgi?id=265653 Use -DENABLE_BUFFER_DAMAGE_TRACKING cmake option to enable the feature at compile time. Related to WPEBackend-fdo Igalia/WPEBackend-fdo#184 * Source/WebCore/platform/SourcesNicosia.txt: * Source/WebCore/platform/TextureMapper.cmake: * Source/WebCore/platform/graphics/egl/GLContext.cpp: (WebCore::GLContext::GLContext): (WebCore::GLContext::swapBuffersWithDamage): * Source/WebCore/platform/graphics/egl/GLContext.h: (WebCore::GLContext::m_eglSwapBuffersWithDamage): * Source/WebCore/platform/graphics/nicosia/NicosiaBufferDamage.cpp: Added. (Nicosia::checkDamageBufUnifiedRegion): (Nicosia::bufDamageUnifiedRegion): * Source/WebCore/platform/graphics/nicosia/NicosiaBufferDamage.h: Added. * Source/WebCore/platform/graphics/nicosia/NicosiaCompositionLayer.h: * Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp: (WebCore::TextureMapperLayer::paintSelf): (WebCore::TextureMapperLayer::addChild): (WebCore::TextureMapperLayer::removeFromParent): (WebCore::TextureMapperLayer::removeAllChildren): (WebCore::TextureMapperLayer::applyAnimationsRecursively): (WebCore::TextureMapperLayer::acceptDamageVisitor): (WebCore::TextureMapperLayer::dismissDamageVisitor): (WebCore::TextureMapperLayer::markDamaged): (WebCore::TextureMapperLayer::clearDamaged): (WebCore::TextureMapperLayer::recordDamage): * Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h: * Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: (WebCore::CoordinatedGraphicsLayer::setContentsOpaque): (WebCore::CoordinatedGraphicsLayer::setContentsNeedsDisplay): (WebCore::CoordinatedGraphicsLayer::addDamageRegion): (WebCore::CoordinatedGraphicsLayer::setNeedsDisplay): (WebCore::CoordinatedGraphicsLayer::setNeedsDisplayInRect): (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly): (WebCore::CoordinatedGraphicsLayer::computeTransformedVisibleRect): * Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h: * Source/WebKit/Platform/Logging.h: * Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp: (WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext): (WebKit::CoordinatedGraphicsScene::updateSceneState): (WebKit::CoordinatedGraphicsScene::ensureRootLayer): (WebKit::CoordinatedGraphicsScene::purgeGLResources): (WebKit::CoordinatedGraphicsScene::recordDamage): * Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h: (WebKit::CoordinatedGraphicsScene::lastDamagedRects const): * Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp: (WebKit::ThreadedCompositor::renderLayerTree): * Source/cmake/WebKitFeatures.cmake: * Tools/wpe/backends/fdo/WindowViewBackend.cpp: (WPEToolingBackends::WindowViewBackend::displayBuffer):
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The wl_surface.damage_buffer request can be used by clients to inform that a given region (in buffer coordinates) is damaged. This request is used by eglSwapBuffersWithDamage[EXT|KHR], with one call for each rect.
For more info: https://wayland-book.com/surfaces-in-depth/damaging-surfaces.html
This commit stores this information and exposes it to exported EGL image clients.
It also bumps the nested compositor interface to version 4, which provides the damage_buffer support.