pixman-renderer: set renderbuffer via new repaint_output parameter

Add a struct weston_renderbuffer parameter to repaint_output and make
backends set the pixman image renderbuffer through this parameter
instead of using pixman_renderer_output_set_buffer()

Turn pixman_renderer_output_set_buffer() static.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
This commit is contained in:
Philipp Zabel 2023-01-11 23:01:15 +01:00 committed by Daniel Stone
parent 89e1831cd7
commit 6757bae0f3
12 changed files with 37 additions and 29 deletions

View File

@ -296,7 +296,7 @@ drm_output_render_gl(struct drm_output_state *state, pixman_region32_t *damage)
struct drm_fb *ret;
output->base.compositor->renderer->repaint_output(&output->base,
damage);
damage, NULL);
bo = gbm_surface_lock_front_buffer(output->gbm_surface);
if (!bo) {

View File

@ -343,12 +343,11 @@ drm_output_render_pixman(struct drm_output_state *state,
output->current_image ^= 1;
pixman_renderer_output_set_buffer(&output->base,
output->renderbuffer[output->current_image]->image);
pixman_renderer_output_set_hw_extra_damage(&output->base,
&output->previous_damage);
ec->renderer->repaint_output(&output->base, damage);
ec->renderer->repaint_output(&output->base, damage,
output->renderbuffer[output->current_image]);
pixman_region32_copy(&output->previous_damage, damage);

View File

@ -47,6 +47,7 @@
#include "shared/weston-egl-ext.h"
#include "shared/cairo-util.h"
#include "linux-dmabuf.h"
#include "output-capture.h"
#include "presentation-time-server-protocol.h"
#include <libweston/windowed-output-api.h>
@ -159,7 +160,8 @@ headless_output_repaint(struct weston_output *output_base,
headless_output_update_gl_border(output);
ec->renderer->repaint_output(&output->base, damage);
ec->renderer->repaint_output(&output->base, damage,
output->renderbuffer);
pixman_region32_subtract(&ec->primary_plane.damage,
&ec->primary_plane.damage, damage);
@ -315,8 +317,11 @@ headless_output_enable_pixman(struct headless_output *output)
if (pixman->output_create(&output->base, &options) < 0)
goto err_renderer;
pixman_renderer_output_set_buffer(&output->base,
output->renderbuffer->image);
weston_output_update_capture_info(&output->base,
WESTON_OUTPUT_CAPTURE_SOURCE_FRAMEBUFFER,
output->base.current_mode->width,
output->base.current_mode->height,
pfmt);
return 0;

View File

@ -295,9 +295,8 @@ rdp_output_repaint(struct weston_output *output_base, pixman_region32_t *damage)
assert(output);
pixman_renderer_output_set_buffer(output_base,
output->renderbuffer->image);
ec->renderer->repaint_output(&output->base, damage);
ec->renderer->repaint_output(&output->base, damage,
output->renderbuffer);
if (pixman_region32_not_empty(damage)) {
pixman_region32_t transformed_damage;

View File

@ -527,10 +527,8 @@ vnc_update_buffer(struct nvnc_display *display, struct pixman_region32 *damage)
wl_list_insert(&output->fb_side_data_list, &fb_side_data->link);
}
pixman_renderer_output_set_buffer(&output->base,
fb_side_data->renderbuffer->image);
ec->renderer->repaint_output(&output->base, &fb_side_data->damage);
ec->renderer->repaint_output(&output->base, &fb_side_data->damage,
fb_side_data->renderbuffer);
/* Convert to local coordinates before clearing accumulated damage */
pixman_region_init(&local_damage);

View File

@ -515,7 +515,7 @@ wayland_output_repaint_gl(struct weston_output *output_base,
wayland_output_update_gl_border(output);
ec->renderer->repaint_output(&output->base, damage);
ec->renderer->repaint_output(&output->base, damage, NULL);
pixman_region32_subtract(&ec->primary_plane.damage,
&ec->primary_plane.damage, damage);
@ -630,8 +630,8 @@ wayland_output_repaint_pixman(struct weston_output *output_base,
sb = wayland_output_get_shm_buffer(output);
wayland_output_update_shm_border(sb);
pixman_renderer_output_set_buffer(output_base, sb->renderbuffer->image);
b->compositor->renderer->repaint_output(output_base, &sb->damage);
b->compositor->renderer->repaint_output(output_base, &sb->damage,
sb->renderbuffer);
wayland_shm_buffer_attach(sb);

View File

@ -435,7 +435,7 @@ x11_output_repaint_gl(struct weston_output *output_base,
ec = output->base.compositor;
ec->renderer->repaint_output(output_base, damage);
ec->renderer->repaint_output(output_base, damage, NULL);
pixman_region32_subtract(&ec->primary_plane.damage,
&ec->primary_plane.damage, damage);
@ -512,8 +512,7 @@ x11_output_repaint_shm(struct weston_output *output_base,
ec = output->base.compositor;
b = output->backend;
pixman_renderer_output_set_buffer(output_base, image);
ec->renderer->repaint_output(output_base, damage);
ec->renderer->repaint_output(output_base, damage, output->renderbuffer);
pixman_region32_subtract(&ec->primary_plane.damage,
&ec->primary_plane.damage, damage);

View File

@ -59,7 +59,8 @@ struct weston_renderer {
uint32_t x, uint32_t y,
uint32_t width, uint32_t height);
void (*repaint_output)(struct weston_output *output,
pixman_region32_t *output_damage);
pixman_region32_t *output_damage,
struct weston_renderbuffer *renderbuffer);
/** See weston_renderer_resize_output()
*

View File

@ -47,7 +47,8 @@ noop_renderer_read_pixels(struct weston_output *output,
static void
noop_renderer_repaint_output(struct weston_output *output,
pixman_region32_t *output_damage)
pixman_region32_t *output_damage,
struct weston_renderbuffer *renderbuffer)
{
}

View File

@ -617,13 +617,22 @@ pixman_renderer_do_capture_tasks(struct weston_output *output,
}
}
static void
pixman_renderer_output_set_buffer(struct weston_output *output,
pixman_image_t *buffer);
static void
pixman_renderer_repaint_output(struct weston_output *output,
pixman_region32_t *output_damage)
pixman_region32_t *output_damage,
struct weston_renderbuffer *renderbuffer)
{
struct pixman_output_state *po = get_output_state(output);
pixman_region32_t hw_damage;
assert(renderbuffer);
pixman_renderer_output_set_buffer(output, renderbuffer->image);
assert(output->from_blend_to_output_by_backend ||
output->color_outcome->from_blend_to_output == NULL);
@ -1018,7 +1027,7 @@ pixman_renderer_init(struct weston_compositor *ec)
return 0;
}
WL_EXPORT void
static void
pixman_renderer_output_set_buffer(struct weston_output *output,
pixman_image_t *buffer)
{

View File

@ -40,10 +40,6 @@ struct pixman_renderer_output_options {
struct weston_size fb_size;
};
void
pixman_renderer_output_set_buffer(struct weston_output *output,
pixman_image_t *buffer);
void
pixman_renderer_output_set_hw_extra_damage(struct weston_output *output,
pixman_region32_t *extra_damage);

View File

@ -1716,7 +1716,8 @@ blit_shadow_to_output(struct weston_output *output,
*/
static void
gl_renderer_repaint_output(struct weston_output *output,
pixman_region32_t *output_damage)
pixman_region32_t *output_damage,
struct weston_renderbuffer *renderbuffer)
{
struct gl_output_state *go = get_output_state(output);
struct weston_compositor *compositor = output->compositor;