drm: transform plane damage to framebuffer-space for FB_DAMAGE_CLIPS#2048
Merged
Merged
Conversation
|
This fixed the issue we had on Quill OS with portrait mode not working. It was previously described here: niri-wm/niri#2741 Kind request: if everything passes your tests and requirements, please merge the PR when it's possible for you. Thanks! |
09cb0ec to
94a0d91
Compare
Contributor
Author
|
Ping @cmeissl, IIUC you're the one dealing with most of the DRM stuff. Do you mind having a look whenever you have some time? |
cmeissl
reviewed
Jun 19, 2026
cmeissl
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for working on this!
ee1ba14 to
c2dd531
Compare
c2dd531 to
4d859ad
Compare
4d859ad to
f09a88f
Compare
f09a88f to
2817914
Compare
cmeissl
reviewed
Jun 23, 2026
Right after rendering, DrmCompositor build a PlaneDamageClips object, which is used to populate the FB_DAMAGE_CLIPS plane property. This property may be used by drivers to repaint only the damaged part of the plane, and is expected to be a bunch of rectangles in framebuffer coordinate-space. Current implementation uses the render_damage directly, which are transformed following the output_transform. If the device driver respect the FB_DAMAGE_CLIPS and only repaint those areas, this breaks rendering for any transform but normal since the actual damage and the reported one are misaligned. For direct scan-out, we also need to perform a transform in case the element's underlying buffer has a rotation. Fix: apply the output inverted transform on the damage rectangle before passing them to PlaneDamageClips::from_damage. Fixes: Smithay#1651
2817914 to
8deb957
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.
Description
Right after rendering, DrmCompositor build a PlaneDamageClips object, which is used to populate the FB_DAMAGE_CLIPS plane property. This property may be used by drivers to repaint only the damaged part of the plane, and is expected to be a bunch of rectangles in framebuffer coordinate-space. Current implementation uses the render_damage directly, which are transformed following the output_transform. If the device driver respect the FB_DAMAGE_CLIPS and only repaint those areas, this breaks rendering for any transform but normal since the actual damage and the reported one are misaligned.
Fix: apply the output inverted transform on the damage rectangle before passing them to PlaneDamageClips::from_damage.
Fixes: #1651
Note for review
There are two things I'm not 100% sure about this PR:
Transforming the damage in
damage_bag.render_outputwould fix winit backend in anvil for free, but also introduce a lot of side effects (I don't think I've seen any code re-transforming the damages returned by that function), but I'd like to have someone else input on this.output_geometry.sizebecause that's what has been used in damage computation.I'm unsure if it's should be changed to
config.properties.dstwhich is the un-transformed output size (and would need an additional transform). As far as I can tell, the two are equal anyway, so output_geometry.size felt like a good fit.EDIT: There's a second call to
PlaneDamageClipsfor direct scanout, which might require some changes too. I haven't managed to hit that code while testing yet. I'll add a commit if I do and it's buggy.EDIT 2: Well, still haven't hit that code, but I think
element_config()does the right transformation before building thePlaneDamageClips.Checklist