mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-18 06:47:31 -04:00
Merge branch 'cached-lock' into 'master'
compositor: wrap cached lock seq in struct See merge request wlroots/wlroots!4501
This commit is contained in:
commit
b37404a42e
4 changed files with 22 additions and 16 deletions
|
|
@ -957,13 +957,13 @@ static void surface_destroy_role_object(struct wlr_surface *surface) {
|
|||
wl_list_init(&surface->role_resource_destroy.link);
|
||||
}
|
||||
|
||||
uint32_t wlr_surface_lock_pending(struct wlr_surface *surface) {
|
||||
struct wlr_surface_cached_lock wlr_surface_lock_pending(struct wlr_surface *surface) {
|
||||
surface->pending.cached_state_locks++;
|
||||
return surface->pending.seq;
|
||||
return (struct wlr_surface_cached_lock){surface->pending.seq};
|
||||
}
|
||||
|
||||
void wlr_surface_unlock_cached(struct wlr_surface *surface, uint32_t seq) {
|
||||
if (surface->pending.seq == seq) {
|
||||
void wlr_surface_unlock_cached(struct wlr_surface *surface, struct wlr_surface_cached_lock lock) {
|
||||
if (surface->pending.seq == lock.seq) {
|
||||
assert(surface->pending.cached_state_locks > 0);
|
||||
surface->pending.cached_state_locks--;
|
||||
return;
|
||||
|
|
@ -972,7 +972,7 @@ void wlr_surface_unlock_cached(struct wlr_surface *surface, uint32_t seq) {
|
|||
bool found = false;
|
||||
struct wlr_surface_state *cached;
|
||||
wl_list_for_each(cached, &surface->cached, cached_state_link) {
|
||||
if (cached->seq == seq) {
|
||||
if (cached->seq == lock.seq) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ static const struct wl_subsurface_interface subsurface_implementation;
|
|||
|
||||
static void subsurface_destroy(struct wlr_subsurface *subsurface) {
|
||||
if (subsurface->has_cache) {
|
||||
wlr_surface_unlock_cached(subsurface->surface, subsurface->cached_seq);
|
||||
wlr_surface_unlock_cached(subsurface->surface, subsurface->cached_lock);
|
||||
}
|
||||
|
||||
wlr_surface_unmap(subsurface->surface);
|
||||
|
|
@ -177,7 +177,7 @@ static void subsurface_handle_set_desync(struct wl_client *client,
|
|||
if (!subsurface_is_synchronized(subsurface) &&
|
||||
subsurface->has_cache) {
|
||||
wlr_surface_unlock_cached(subsurface->surface,
|
||||
subsurface->cached_seq);
|
||||
subsurface->cached_lock);
|
||||
subsurface->has_cache = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -274,9 +274,9 @@ static void subsurface_handle_surface_client_commit(
|
|||
return;
|
||||
}
|
||||
subsurface->has_cache = true;
|
||||
subsurface->cached_seq = wlr_surface_lock_pending(surface);
|
||||
subsurface->cached_lock = wlr_surface_lock_pending(surface);
|
||||
} else if (subsurface->has_cache) {
|
||||
wlr_surface_unlock_cached(surface, subsurface->cached_seq);
|
||||
wlr_surface_unlock_cached(surface, subsurface->cached_lock);
|
||||
subsurface->has_cache = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -302,7 +302,7 @@ void subsurface_handle_parent_commit(struct wlr_subsurface *subsurface) {
|
|||
}
|
||||
|
||||
if (subsurface->synchronized && subsurface->has_cache) {
|
||||
wlr_surface_unlock_cached(surface, subsurface->cached_seq);
|
||||
wlr_surface_unlock_cached(surface, subsurface->cached_lock);
|
||||
subsurface->has_cache = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue