-
Notifications
You must be signed in to change notification settings - Fork 341
Allow compositors to actually access the surface->buffer on unmap #1065
Comments
The more general issue is that |
We could also add a |
I didn't know that was done, but it seems like a good thing. I expect that all compositors will do this anyway, so adding it here makes life easier for the compositor. |
Yeah, but it's a lie, and makes some things more complicated. For instance, the damage region can have extents bigger than the buffer size - so we need to crop it back when updating wl_shm textures. Also, it's unclear how the buffer position is handled - in fact I don't think it's supported at all right now. Luckily nobody seems to be using it. All in all, we should probably keep states as the client set them - and maybe add |
Your arguments make sense, so my initial claim isn't true. There might also be compositors doing even more complicated transforms than me, so for them this damage tracking won't actually work (for example if you do 3D transform of subsurfaces individually) and we'd have polluted their damage. However I still think that this is common enough, so it'd be nice to have a |
So to fix this I originally wanted to add a So we just want to be able to access the old buffer during a NULL commit. I don't see a solution better than adding a special case. This could be done either:
|
Okay, as I make progress in #1076 I think I can reconsider how we should fix this issue. I think we have two solutions:
void (*wlr_surface_apply_damage_func_t)(struct wlr_surface *surface); It would have a sensible default, say void custom_surface_apply_damage(struct wlr_surface *surface) {
if (surface->current.buffer == NULL) {
// NULL commit
struct wlr_buffer *buf = wlr_buffer_ref(surface->buffer);
// … And store the buffer somewhere
}
wlr_surface_apply_damage(surface);
} |
This sounds better, or a second precommit signal like @ammen99 mentioned. |
I'm still trying to figure out what's the best solution. From purely an API point of view, triggering So I'm considering again the role precommit thing. Or maybe we just need a |
You're overthinking this. Just add a precommit signal. |
Once #1062 is done, compositors will again be able to keep the buffer/texture of a
wlr_surface
longer than thewlr_surface
itself, of course if this is possible at all. One of the use cases for that is window closing animation. However, currently compositors can't access the buffer on unmap, if the given app unmaps by committing aNULL
buffer, because the pending state is applied before emitting the map/unmap signals (these come from therole_committed
callback of the various shells). An example of such clients are many Xwayland apps.Now, to let users access the previous
surface->buffer
on unmap when aNULL
buffer is committed, there must be a way to signal the different shells before committing the new buffer, so that they can emit the unmap event on time. A possible solution could be to add a newrole_precommit
callback or somehow pass the old state to the existingrole_commit
.The text was updated successfully, but these errors were encountered: