From 7dfbd877718b3ac00ecd226c0157d6d028d5432c Mon Sep 17 00:00:00 2001 From: Kirill Primak Date: Wed, 10 Jan 2024 22:47:12 +0300 Subject: compositor: drop wlr_surface.external_damage --- include/wlr/types/wlr_compositor.h | 10 +--------- include/wlr/types/wlr_subcompositor.h | 1 - types/wlr_compositor.c | 13 ------------- types/wlr_subcompositor.c | 31 +------------------------------ 4 files changed, 2 insertions(+), 53 deletions(-) diff --git a/include/wlr/types/wlr_compositor.h b/include/wlr/types/wlr_compositor.h index 39bc3e21..dc95b303 100644 --- a/include/wlr/types/wlr_compositor.h +++ b/include/wlr/types/wlr_compositor.h @@ -141,11 +141,6 @@ struct wlr_surface { * positions need to be damaged. */ pixman_region32_t buffer_damage; - /** - * The last commit's damage caused by surface and its subsurfaces' - * movement, in surface-local coordinates. - */ - pixman_region32_t external_damage; /** * The current opaque region, in surface-local coordinates. It is clipped to * the surface bounds. If the surface's buffer is using a fully opaque @@ -404,10 +399,7 @@ void wlr_surface_for_each_surface(struct wlr_surface *surface, wlr_surface_iterator_func_t iterator, void *user_data); /** - * Get the effective surface damage in surface-local coordinate space. Besides - * buffer damage, this includes damage induced by resizing and moving the - * surface and its subsurfaces. The resulting damage is not expected to be - * bounded by the surface itself. + * Get the effective surface damage in surface-local coordinate space. */ void wlr_surface_get_effective_damage(struct wlr_surface *surface, pixman_region32_t *damage); diff --git a/include/wlr/types/wlr_subcompositor.h b/include/wlr/types/wlr_subcompositor.h index 63323da6..bd3899b8 100644 --- a/include/wlr/types/wlr_subcompositor.h +++ b/include/wlr/types/wlr_subcompositor.h @@ -39,7 +39,6 @@ struct wlr_subsurface { bool has_cache; bool synchronized; - bool reordered; bool added; struct wl_listener surface_client_commit; diff --git a/types/wlr_compositor.c b/types/wlr_compositor.c index b2978775..93d7e8cd 100644 --- a/types/wlr_compositor.c +++ b/types/wlr_compositor.c @@ -531,15 +531,6 @@ static void surface_commit_state(struct wlr_surface *surface, surface_update_damage(&surface->buffer_damage, &surface->current, next); - pixman_region32_clear(&surface->external_damage); - if (surface->current.width > next->width || - surface->current.height > next->height || - next->dx != 0 || next->dy != 0) { - pixman_region32_union_rect(&surface->external_damage, - &surface->external_damage, -next->dx, -next->dy, - surface->current.width, surface->current.height); - } - surface->previous.scale = surface->current.scale; surface->previous.transform = surface->current.transform; surface->previous.width = surface->current.width; @@ -761,7 +752,6 @@ static void surface_handle_resource_destroy(struct wl_resource *resource) { surface_state_finish(&surface->pending); surface_state_finish(&surface->current); pixman_region32_fini(&surface->buffer_damage); - pixman_region32_fini(&surface->external_damage); pixman_region32_fini(&surface->opaque_region); pixman_region32_fini(&surface->input_region); if (surface->buffer != NULL) { @@ -811,7 +801,6 @@ static struct wlr_surface *surface_create(struct wl_client *client, wl_list_init(&surface->current_outputs); wl_list_init(&surface->cached); pixman_region32_init(&surface->buffer_damage); - pixman_region32_init(&surface->external_damage); pixman_region32_init(&surface->opaque_region); pixman_region32_init(&surface->input_region); wlr_addon_set_init(&surface->addons); @@ -1259,8 +1248,6 @@ void wlr_surface_get_effective_damage(struct wlr_surface *surface, float scale_y = (float)surface->current.viewport.dst_height / src_height; wlr_region_scale_xy(damage, damage, scale_x, scale_y); } - - pixman_region32_union(damage, damage, &surface->external_damage); } void wlr_surface_get_buffer_source_box(struct wlr_surface *surface, diff --git a/types/wlr_subcompositor.c b/types/wlr_subcompositor.c index 07ff2b27..771b9873 100644 --- a/types/wlr_subcompositor.c +++ b/types/wlr_subcompositor.c @@ -118,8 +118,6 @@ static void subsurface_handle_place_above(struct wl_client *client, wl_list_remove(&subsurface->pending.link); wl_list_insert(node, &subsurface->pending.link); - - subsurface->reordered = true; } static void subsurface_handle_place_below(struct wl_client *client, @@ -150,8 +148,6 @@ static void subsurface_handle_place_below(struct wl_client *client, wl_list_remove(&subsurface->pending.link); wl_list_insert(node->prev, &subsurface->pending.link); - - subsurface->reordered = true; } static void subsurface_handle_set_sync(struct wl_client *client, @@ -281,37 +277,12 @@ static void subsurface_handle_surface_client_commit( } } -static void collect_damage_iter(struct wlr_surface *surface, - int sx, int sy, void *data) { - struct wlr_subsurface *subsurface = data; - pixman_region32_t *damage = &subsurface->parent->external_damage; - pixman_region32_union_rect(damage, damage, - subsurface->current.x + sx, - subsurface->current.y + sy, - surface->current.width, surface->current.height); -} - void subsurface_handle_parent_commit(struct wlr_subsurface *subsurface) { - struct wlr_surface *surface = subsurface->surface; - - bool moved = subsurface->current.x != subsurface->previous.x || - subsurface->current.y != subsurface->previous.y; - if (subsurface->surface->mapped && moved) { - wlr_surface_for_each_surface(surface, - collect_damage_iter, subsurface); - } - if (subsurface->synchronized && subsurface->has_cache) { - wlr_surface_unlock_cached(surface, subsurface->cached_seq); + wlr_surface_unlock_cached(subsurface->surface, subsurface->cached_seq); subsurface->has_cache = false; } - if (subsurface->surface->mapped && (moved || subsurface->reordered)) { - subsurface->reordered = false; - wlr_surface_for_each_surface(surface, - collect_damage_iter, subsurface); - } - if (!subsurface->added) { subsurface->added = true; wl_signal_emit_mutable(&subsurface->parent->events.new_subsurface, -- cgit v1.2.3