Repository navigation
Conversation
wisewirus
approved these changes
Nov 6, 2026
bbedward
force-pushed
the
render-control
branch
from
November 6, 2026 17:48
b9783c8 to
5334d9d
Compare
This file contains hidden or 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
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.
Describe your changes
Adds an opt-in
RenderControlpragma that renders windows throughQQuickRenderControlinstead of Qt's render loop. This is Wayland and OpenGL only, and lets quickshell own presentation when enabled.Details and descisions
There are two parts:
RenderControl: each Wayland window gets a
QQuickRenderControlinstead of Qt's loop. Quickshell drives polish, sync, and render itself. Renders into a dmabuf-backed texture and commits the buffer to thewl_surfacedirectly with explicit damaged rectangles. If dmabuf or OpenGL is unavailable then the window falls back to Qt's render loop.Damage tracker: A
QSGAbstractRendereris attached to the scene graph as a second renderer. It receives node change notifications but doesn't draw anything. It caches subtrees and measures geometry (that it understands) including textures, frag shader effects, and glyphas. Geometry it doesnt understand falls back to full surface damage.Why a damage tracker?
Since I've seen before in quickshell discussions things like "QT already tracks the damage but doesnt report it". In my research into the QT renderer, that isn't exactly accurate in the hardware path.
QT tracks dirty nodes and computes geometry bounds for things like overlap checks. It does not maintain a surface damage region that tracks what changed since the last frame. So there isnt an existing region we can just forward to the compositor or
eglSwapBuffersWithDamageKHRThe software renderer does support partial updates, but not ShaderEffect .
Qt's own EGL path calls
eglSwapBuffersinstead ofeglSwapBuffersWithDamageKHR(so no damage passed). Owning the frame commits lets us submit the region ourselves.Without the tracker we would own the frame presentation but still not be able to report partial damage which is more or less the entire point of this change
Why not eglSwapBuffersWithDamageKHR
My initial approach used it. Quickshell exported its own eglSwapBuffers symbol to intercept Qt's calls, using symbol interposition. The wrapper passed the tracker's damage to
eglSwapBuffersWithDamageKHR.That kept Qt's render loop, but the hook only ran at presentation, after Qt had already rendered the frame. With
QQuickRenderControl, we can also skip rendering when there's no damage and nothing else requires a render, then submit the buffer and damage together when there is.Open concerns
These ABIs havent changed in a very, very long time. So hopefully there's minimal risk of backwards incompatible changes anytime soon.
It only works with the OpenGL backend, not Vulkan. I think the render control approach makes adding Vulkan fairly straight forward, but since OpenGL is default I'd rather try to land this first and do Vulkan as a follow up (if wanted)
View3D has a vertical mirroring issue with RenderControl enabled. This looks related to how Qt Quick 3D sets up its viewport. Since it's opt-in and most quickshell projects are probably not using View3D my personal opinion is to accept the gap for now. It is visible in the manual QML test.
Metrics
Measured with
rendercontrol-qt.qmlandrendercontrol-enabled.qml, niri, AMD 890m. Each run was 140s.Since the test is large windows animating every frame, it isn't exactly indicative of typical use - but of a more extreme scene example.
This is the script I ran to test, it's basic but demonstrates there is some improvement
Participation
I researched, planned, implemented, and tested 2 different approaches before this one (3 total)
transientParentto create subsurfaces within windows. This requires a QML component likeSubsurface {}and just didn't work that nicely - it created way too many surfaces for something like a simple bar.eglSwapBuffersas mentioned aboveQQuickRenderControlbacked windowsLLM Disclosure
I designed and wrote the base implementation myself, so I have a thorough understanding of the code and accept responsibility for it.
LLMs were used to help write the code as it is in this PR. My initial work had gaps, certain things wrong, etc. Also used LLMs to help with CPU and GPU profiling, and to implement some of the manual QML test cases.
I've been working on this for over a month, I left my local commit tree in tact instead of squashing it just to show the general process and bugs fixed along the way. Have been using with DMS basically exclusively for the entire month, havent ran into any problems for awhile so felt confident to open the PR.