From a401a1b247c7f0fbdb31bb4d380968196017fb70 Mon Sep 17 00:00:00 2001 From: Philipp Zabel Date: Wed, 12 Jul 2023 09:44:36 +0200 Subject: [PATCH] renderer-gl: only flush damage for surfaces used in the next output repaint Stop flushing surfaces that are put on an overlay plane on the output to be repainted next, but that have to be painted into another output's primary_plane. Now that each output has its own primary_plane, and flush_damage() knows the output that is going to be repainted, texture_used can be limited to surfaces that will actually be used by the renderer during the following repaint_output(). Always upload when called from gl_renderer_surface_copy_content() or gl_renderer_create_surface() with the output parameter set to NULL. Signed-off-by: Philipp Zabel --- libweston/renderer-gl/gl-renderer.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c index 3719bdec..0ca8b85f 100644 --- a/libweston/renderer-gl/gl-renderer.c +++ b/libweston/renderer-gl/gl-renderer.c @@ -2096,10 +2096,14 @@ gl_renderer_flush_damage(struct weston_surface *surface, * We still accumulate the damage in texture_damage, and * hold the reference to the buffer, in case the surface * migrates back to the primary plane. + * + * When called from gl_renderer_surface_copy_content() + * or gl_renderer_create_surface(), output is NULL. + * In that case, always upload. */ texture_used = false; wl_list_for_each(pnode, &surface->paint_node_list, surface_link) { - if (pnode->plane == &pnode->output->primary_plane) { + if (!output || pnode->plane == &output->primary_plane) { texture_used = true; break; }