renderer-gl: Set SHMbufs to dirty to avoid garbage

Mark all the SHM buffer as dirty to avoid garbage caused by original
damage information in GPU recovery.

Signed-off-by: Trigger Huang <Trigger.Huang@amd.com>
This commit is contained in:
Trigger Huang 2026-04-24 13:53:33 +08:00
parent 9730192811
commit 10d8c02fec

View file

@ -5301,6 +5301,7 @@ gl_renderer_recover_resources(struct weston_compositor *ec)
{
struct gl_renderer *gr = get_renderer(ec);
struct gl_buffer_state *gb, *tmp;
struct weston_output *output;
struct wl_list tmp_gb_list;
wl_list_init(&tmp_gb_list);
@ -5349,6 +5350,32 @@ gl_renderer_recover_resources(struct weston_compositor *ec)
/* Manually add the new gbs to shm_bufs. */
wl_list_insert_list(&gr->shm_bufs, &tmp_gb_list);
/*
* Since all the buffer states have been recreated, mark them all as
* dirty to avoid garbage caused by original damage information.
*/
wl_list_for_each(output, &ec->output_list, link) {
struct weston_paint_node *pnode;
wl_list_for_each(pnode, &output->paint_node_z_order_list,
z_order_link) {
struct weston_surface *surface = pnode->surface;
struct weston_buffer *buffer = surface->buffer_ref.buffer;
if (!buffer || buffer->type != WESTON_BUFFER_SHM)
continue;
pixman_region32_t region;
pixman_region32_init_rect(&region, 0, 0,
buffer->width,
buffer->height);
pixman_region32_copy(&surface->damage, &region);
ec->renderer->flush_damage(pnode);
pixman_region32_fini(&region);
}
}
return 0;
}