libweston: Don't change surface state in weston_surface_copy_content

Instead of attaching and flushing damage when performing
weston_surface_copy_content, just return the contents as the renderer
currently knows them.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2024-07-08 07:04:19 -05:00
parent ae53d196db
commit 0f8bd8dbc5
3 changed files with 3 additions and 5 deletions

View File

@ -5522,6 +5522,9 @@ weston_surface_get_bounding_box(struct weston_surface *surface)
* - the machine must be little-endian due to Pixman formats.
*
* NOTE: Pixman formats are premultiplied.
*
* FURTHER NOTE: Surface contents will be in the state they were last
* rendered, even if a new buffer has been attached since that time.
*/
WL_EXPORT int
weston_surface_copy_content(struct weston_surface *surface,

View File

@ -912,8 +912,6 @@ pixman_renderer_surface_copy_content(struct weston_surface *surface,
if (!ps->image)
return -1;
pixman_renderer_attach_internal(surface, surface->buffer_ref.buffer);
out_buf = pixman_image_create_bits(format, width, height,
target, width * bytespp);

View File

@ -3755,7 +3755,6 @@ gl_renderer_surface_copy_content(struct weston_surface *surface,
GLenum status;
int ret = -1;
gl_renderer_attach_internal(surface, surface->buffer_ref.buffer, NULL);
gs = get_surface_state(surface);
gb = gs->buffer;
buffer = gs->buffer_ref.buffer;
@ -3771,8 +3770,6 @@ gl_renderer_surface_copy_content(struct weston_surface *surface,
*(uint32_t *)target = pack_color(format, gb->color);
return 0;
case WESTON_BUFFER_SHM:
gl_renderer_flush_damage_internal(surface, false);
/* fall through */
case WESTON_BUFFER_DMABUF:
case WESTON_BUFFER_RENDERER_OPAQUE:
break;