Skip to content

Conversation

@ids1024
Copy link
Member

@ids1024 ids1024 commented Sep 17, 2025

Based on #1638.

It seems age_for_buffer shouldn't really be necessary; the client should accumulate damage, and send it with buffer_damage. Though trying to change just that revealed that additional_damage wasn't being handled properly; it was placed incorrectly in the z-order of the render elements, so it didn't work properly where it was occluded by render elements with opaque regions.

pop-os/cosmic-workspaces-epoch#217 updates cosmic-workspaces to accumulate damage, and send it in damage_buffer. xdg-desktop-portal-cosmic already does.

This appears to work, but may be worth testing a bit more.

I guess we also don't have anything to delay toplevel and workspace capture of a new frame until there is new damage? We probably want that, though hopefully if we track damage properly it won't add too much overhead to capture extra frames that are identical.

@Drakulix
Copy link
Member

I guess we also don't have anything to delay toplevel and workspace capture of a new frame until there is new damage? We probably want that, though hopefully if we track damage properly it won't add too much overhead to capture extra frames that are identical.

No we don't, but I guess it would be trivial to lock that to commits of any toplevel's surface?

The important change here is that we now apply the additional damage
first, instead of using `.extend()` to add it after other elements. This
is important since `OutputDamageTracker` will ignore our damage elements
if there are behind an element with an opaque region.

This also makes things a bit simpler, especially `take_screencopy_frames()`,
which no longer needs a mutable references to extend then truncate.

The implementation of `OutputDamageTracker` isn't entirely clear, but as
far as I can tell this is intended to work, and it seems to work in some
testing.
The logic `age_for_buffer` used seems to be a misinterpretation of the
protocol.

The wording is a little unclear, but it seems tracking buffer age is the
responsibility of the client, and the client is required to accumulate
damage and pass it in `damage_buffer`.

Our clients initially weren't doing that correctly. I updated
xdg-desktop-portal-cosmic to use `damage_buffer` after testing on
wlroots, and cosmic-workspaces was recently updated as well.
@ids1024 ids1024 force-pushed the screencopy-damage_noble branch from 197404f to 0cdb2b7 Compare September 24, 2025 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants