From 155fa3a56a72697d652a1788503de2f459e9b42b Mon Sep 17 00:00:00 2001 From: Philipp Zabel Date: Fri, 7 Jul 2023 20:04:29 +0200 Subject: [PATCH] libweston: Add output parameter to weston_renderer::flush_damage() When flush_damage() is called, the output to be repainted next is already known. Pass it along into the renderer, which can make use of this information: The GL renderer can get a better idea which SHM surface textures actually have to be updated, in case a surface can be put on a plane on one output, but not another. A future Vulkan renderer could record texture uploads into an output specific command buffer. Signed-off-by: Philipp Zabel --- libweston/compositor.c | 3 ++- libweston/libweston-internal.h | 3 ++- libweston/noop-renderer.c | 3 ++- libweston/pixman-renderer.c | 3 ++- libweston/renderer-gl/gl-renderer.c | 8 +++++--- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/libweston/compositor.c b/libweston/compositor.c index 7885eb97..2d864463 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -2972,7 +2972,8 @@ surface_flush_damage(struct weston_surface *surface, struct weston_output *outpu struct weston_paint_node *node; if (buffer->type == WESTON_BUFFER_SHM) - surface->compositor->renderer->flush_damage(surface, buffer); + surface->compositor->renderer->flush_damage(surface, buffer, + output); if (!pixman_region32_not_empty(&surface->damage)) return; diff --git a/libweston/libweston-internal.h b/libweston/libweston-internal.h index aa5e03fe..c153a72e 100644 --- a/libweston/libweston-internal.h +++ b/libweston/libweston-internal.h @@ -80,7 +80,8 @@ struct weston_renderer { const struct weston_geometry *area); void (*flush_damage)(struct weston_surface *surface, - struct weston_buffer *buffer); + struct weston_buffer *buffer, + struct weston_output *output); void (*attach)(struct weston_surface *es, struct weston_buffer *buffer); void (*destroy)(struct weston_compositor *ec); diff --git a/libweston/noop-renderer.c b/libweston/noop-renderer.c index 7a07fb10..11c72311 100644 --- a/libweston/noop-renderer.c +++ b/libweston/noop-renderer.c @@ -63,7 +63,8 @@ noop_renderer_resize_output(struct weston_output *output, static void noop_renderer_flush_damage(struct weston_surface *surface, - struct weston_buffer *buffer) + struct weston_buffer *buffer, + struct weston_output *output) { } diff --git a/libweston/pixman-renderer.c b/libweston/pixman-renderer.c index 2cd27d25..00670320 100644 --- a/libweston/pixman-renderer.c +++ b/libweston/pixman-renderer.c @@ -690,7 +690,8 @@ pixman_renderer_repaint_output(struct weston_output *output, static void pixman_renderer_flush_damage(struct weston_surface *surface, - struct weston_buffer *buffer) + struct weston_buffer *buffer, + struct weston_output *output) { /* No-op for pixman renderer */ } diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c index e0bd015f..3719bdec 100644 --- a/libweston/renderer-gl/gl-renderer.c +++ b/libweston/renderer-gl/gl-renderer.c @@ -2068,7 +2068,8 @@ gl_format_from_internal(GLenum internal_format) static void gl_renderer_flush_damage(struct weston_surface *surface, - struct weston_buffer *buffer) + struct weston_buffer *buffer, + struct weston_output *output) { const struct weston_testsuite_quirks *quirks = &surface->compositor->test_data.test_quirks; @@ -3297,7 +3298,7 @@ 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(surface, buffer); + gl_renderer_flush_damage(surface, buffer, NULL); /* fall through */ case WESTON_BUFFER_DMABUF: case WESTON_BUFFER_RENDERER_OPAQUE: @@ -3442,7 +3443,8 @@ gl_renderer_create_surface(struct weston_surface *surface) gl_renderer_attach(surface, surface->buffer_ref.buffer); if (surface->buffer_ref.buffer->type == WESTON_BUFFER_SHM) { gl_renderer_flush_damage(surface, - surface->buffer_ref.buffer); + surface->buffer_ref.buffer, + NULL); } }