-
Notifications
You must be signed in to change notification settings - Fork 341
Conversation
Otherwise this approach seems good to me. |
For wl_shm, For wl_drm and dma-buf, the texture is shared with the client, so if the client destroys it early (before we send the release event) we loose access to the data. In general, this should not happen. This may happen when a client exits for instance (if you still have a reference to the Additional note: if you reference a |
@emersion, fair enough, I'd also be interested in a way to be able to check whether the texture will survive (e.g wl_shm) or it can be destroyed at any time (dma-buf), because for some reason I might decide I really need the texture so I'd want to copy it manually if it is necessary. |
That's easy, just check |
include/wlr/types/wlr_buffer.h
Outdated
/** | ||
* Reference the buffer. | ||
*/ | ||
void wlr_buffer_ref(struct wlr_buffer *buffer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wlr_buffer_ref should return a wlr_buffer *, since that's what API users will do - ref, create a new wlr_buffer struct and copy the contents of the original wlr_buffer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. I don't get the last part though:
create a new wlr_buffer struct and copy the contents of the original wlr_buffer.
This would duplicate the ref counter?
Ping @ascent12 |
Thanks! |
This PR introduces
wlr_buffer
, as discussed in #1046 (comment).wlr_buffer
s are ref-counted and hold a texture. When they are destroyed, thewl_buffer
is released and the texture is destroyed.A compositor can reference the buffer when it needs to:
@ammen99 Can you provide some feedback? Would this approach work for you?
wlr_surface.texture
Fixes #1046