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 <philipp.zabel@gmail.com>
This commit is contained in:
Philipp Zabel 2023-07-07 20:04:29 +02:00 committed by Daniel Stone
parent 1ffcc535ef
commit 155fa3a56a
5 changed files with 13 additions and 7 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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)
{
}

View File

@ -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 */
}

View File

@ -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);
}
}