mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
scaled-scene-buffer: allow multiple wlr_buffer_drops()
This allows implementations of the interface to share a single wlr_buffer for multiple wlr_scene_buffer nodes and still make the scaled-scene-buffer handle the buffer drops. wlr_scene_buffer holds an implicit lock while using a wlr_buffer and scaled-scene-buffer.c holds additional locks for as long as a buffer is within its internal cache. This should ensure that a shared wlr_buffer never gets actually dropped even if wlr_buffer_drop() has been called by another scaled-scene-buffer instance using the same wlr_buffer.
This commit is contained in:
parent
2df6628490
commit
71b4277852
1 changed files with 4 additions and 4 deletions
|
|
@ -41,10 +41,10 @@ _cache_entry_destroy(struct scaled_scene_buffer_cache_entry *cache_entry, bool d
|
|||
wl_list_remove(&cache_entry->link);
|
||||
if (cache_entry->buffer) {
|
||||
/* Allow the buffer to get dropped if there are no further consumers */
|
||||
wlr_buffer_unlock(cache_entry->buffer);
|
||||
if (drop_buffer) {
|
||||
if (drop_buffer && !cache_entry->buffer->dropped) {
|
||||
wlr_buffer_drop(cache_entry->buffer);
|
||||
}
|
||||
wlr_buffer_unlock(cache_entry->buffer);
|
||||
}
|
||||
free(cache_entry);
|
||||
}
|
||||
|
|
@ -82,10 +82,10 @@ _update_buffer(struct scaled_scene_buffer *self, double scale)
|
|||
cache_entry = wl_container_of(self->cache.prev, cache_entry, link);
|
||||
if (cache_entry->buffer) {
|
||||
/* Allow the old buffer to get dropped if there are no further consumers */
|
||||
wlr_buffer_unlock(cache_entry->buffer);
|
||||
if (self->drop_buffer) {
|
||||
if (self->drop_buffer && !cache_entry->buffer->dropped) {
|
||||
wlr_buffer_drop(cache_entry->buffer);
|
||||
}
|
||||
wlr_buffer_unlock(cache_entry->buffer);
|
||||
}
|
||||
wl_list_remove(&cache_entry->link);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue