compositor: remove repaint_data from compositor

The repaint_data is entirely backend specific. Moreover, it is only used by the
drm backend, while other backends ignore the repaint data.

There will always be only one repaint active, thus, there is no need to pass the
repaint data from the outside.

The repaint_data breaks with the multi-backend series, which calls repaint begin
for all backends to get the repaint_data. The repaint_data of the last backend
will then be passed to all other backend. At the moment, this works, because the
drm backend is the only backend that implements the begin_repaint call.

Another option would be to track the repaint data per backend in the compositor,
but actually, it the backend needs to track state across the calls, it's its own
responsibility.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
dev
Michael Tretter 3 years ago
parent c448b938f7
commit 6ee6e76a0c
  1. 6
      include/libweston/libweston.h
  2. 2
      libweston/backend-drm/drm-internal.h
  3. 3
      libweston/backend-drm/drm-virtual.c
  4. 12
      libweston/backend-drm/drm.c
  5. 2
      libweston/backend-drm/state-propose.c
  6. 3
      libweston/backend-headless/headless.c
  7. 3
      libweston/backend-rdp/rdp.c
  8. 6
      libweston/backend-wayland/wayland.c
  9. 6
      libweston/backend-x11/x11.c
  10. 12
      libweston/backend.h
  11. 22
      libweston/compositor.c

@ -336,11 +336,9 @@ struct weston_output {
bool allow_protection;
int (*start_repaint_loop)(struct weston_output *output);
int (*repaint)(struct weston_output *output,
pixman_region32_t *damage,
void *repaint_data);
int (*repaint)(struct weston_output *output, pixman_region32_t *damage);
void (*destroy)(struct weston_output *output);
void (*assign_planes)(struct weston_output *output, void *repaint_data);
void (*assign_planes)(struct weston_output *output);
int (*switch_mode)(struct weston_output *output, struct weston_mode *mode);
/* backlight values are on 0-255 range, where higher is brighter */

@ -790,7 +790,7 @@ void
drm_plane_reset_state(struct drm_plane *plane);
void
drm_assign_planes(struct weston_output *output_base, void *repaint_data);
drm_assign_planes(struct weston_output *output_base);
bool
drm_plane_is_available(struct drm_plane *plane, struct drm_output *output);

@ -185,8 +185,7 @@ drm_virtual_output_submit_frame(struct drm_output *output,
static int
drm_virtual_output_repaint(struct weston_output *output_base,
pixman_region32_t *damage,
void *repaint_data)
pixman_region32_t *damage)
{
struct drm_output_state *state = NULL;
struct drm_output *output = to_drm_output(output_base);

@ -441,9 +441,7 @@ drm_output_render(struct drm_output_state *state, pixman_region32_t *damage)
}
static int
drm_output_repaint(struct weston_output *output_base,
pixman_region32_t *damage,
void *repaint_data)
drm_output_repaint(struct weston_output *output_base, pixman_region32_t *damage)
{
struct drm_output *output = to_drm_output(output_base);
struct drm_output_state *state = NULL;
@ -610,7 +608,7 @@ finish_frame:
* a new pending_state structure to own any output state created by individual
* output repaint functions until the repaint is flushed or cancelled.
*/
static void *
static void
drm_repaint_begin(struct weston_compositor *compositor)
{
struct drm_backend *b = to_drm_backend(compositor);
@ -626,8 +624,6 @@ drm_repaint_begin(struct weston_compositor *compositor)
drm_debug(b, "%s", dbg);
free(dbg);
}
return NULL;
}
/**
@ -640,7 +636,7 @@ drm_repaint_begin(struct weston_compositor *compositor)
* state will be freed.
*/
static int
drm_repaint_flush(struct weston_compositor *compositor, void *repaint_data)
drm_repaint_flush(struct weston_compositor *compositor)
{
struct drm_backend *b = to_drm_backend(compositor);
struct drm_pending_state *pending_state = b->repaint_data;
@ -663,7 +659,7 @@ drm_repaint_flush(struct weston_compositor *compositor, void *repaint_data)
* held across the repaint cycle should be discarded.
*/
static void
drm_repaint_cancel(struct weston_compositor *compositor, void *repaint_data)
drm_repaint_cancel(struct weston_compositor *compositor)
{
struct drm_backend *b = to_drm_backend(compositor);
struct drm_pending_state *pending_state = b->repaint_data;

@ -889,7 +889,7 @@ err:
}
void
drm_assign_planes(struct weston_output *output_base, void *repaint_data)
drm_assign_planes(struct weston_output *output_base)
{
struct drm_backend *b = to_drm_backend(output_base->compositor);
struct drm_pending_state *pending_state = b->repaint_data;

@ -122,8 +122,7 @@ finish_frame_handler(void *data)
static int
headless_output_repaint(struct weston_output *output_base,
pixman_region32_t *damage,
void *repaint_data)
pixman_region32_t *damage)
{
struct headless_output *output = to_headless_output(output_base);
struct weston_compositor *ec = output->base.compositor;

@ -326,8 +326,7 @@ rdp_output_start_repaint_loop(struct weston_output *output)
}
static int
rdp_output_repaint(struct weston_output *output_base, pixman_region32_t *damage,
void *repaint_data)
rdp_output_repaint(struct weston_output *output_base, pixman_region32_t *damage)
{
struct rdp_output *output = container_of(output_base, struct rdp_output, base);
struct weston_compositor *ec = output->base.compositor;

@ -524,8 +524,7 @@ wayland_output_start_repaint_loop(struct weston_output *output_base)
#ifdef ENABLE_EGL
static int
wayland_output_repaint_gl(struct weston_output *output_base,
pixman_region32_t *damage,
void *repaint_data)
pixman_region32_t *damage)
{
struct wayland_output *output = to_wayland_output(output_base);
struct weston_compositor *ec = output->base.compositor;
@ -636,8 +635,7 @@ wayland_shm_buffer_attach(struct wayland_shm_buffer *sb)
static int
wayland_output_repaint_pixman(struct weston_output *output_base,
pixman_region32_t *damage,
void *repaint_data)
pixman_region32_t *damage)
{
struct wayland_output *output = to_wayland_output(output_base);
struct wayland_backend *b =

@ -417,8 +417,7 @@ x11_output_start_repaint_loop(struct weston_output *output)
static int
x11_output_repaint_gl(struct weston_output *output_base,
pixman_region32_t *damage,
void *repaint_data)
pixman_region32_t *damage)
{
struct x11_output *output = to_x11_output(output_base);
struct weston_compositor *ec = output->base.compositor;
@ -486,8 +485,7 @@ set_clip_for_output(struct weston_output *output_base, pixman_region32_t *region
static int
x11_output_repaint_shm(struct weston_output *output_base,
pixman_region32_t *damage,
void *repaint_data)
pixman_region32_t *damage)
{
struct x11_output *output = to_x11_output(output_base);
struct weston_compositor *ec = output->base.compositor;

@ -46,27 +46,21 @@ struct weston_backend {
* Returns an opaque pointer, which the backend may use as private
* data referring to the repaint cycle.
*/
void * (*repaint_begin)(struct weston_compositor *compositor);
void (*repaint_begin)(struct weston_compositor *compositor);
/** Cancel a repaint sequence
*
* Cancels a repaint sequence, when an error has occurred during
* one output's repaint; see repaint_begin.
*
* @param repaint_data Data returned by repaint_begin
*/
void (*repaint_cancel)(struct weston_compositor *compositor,
void *repaint_data);
void (*repaint_cancel)(struct weston_compositor *compositor);
/** Conclude a repaint sequence
*
* Called on successful completion of a repaint sequence; see
* repaint_begin.
*
* @param repaint_data Data returned by repaint_begin
*/
int (*repaint_flush)(struct weston_compositor *compositor,
void *repaint_data);
int (*repaint_flush)(struct weston_compositor *compositor);
/** Allocate a new output
*

@ -2865,7 +2865,7 @@ weston_output_take_feedback_list(struct weston_output *output,
}
static int
weston_output_repaint(struct weston_output *output, void *repaint_data)
weston_output_repaint(struct weston_output *output)
{
struct weston_compositor *ec = output->compositor;
struct weston_paint_node *pnode;
@ -2905,7 +2905,7 @@ weston_output_repaint(struct weston_output *output, void *repaint_data)
output->desired_protection = highest_requested;
if (output->assign_planes && !output->disable_planes) {
output->assign_planes(output, repaint_data);
output->assign_planes(output);
} else {
wl_list_for_each(pnode, &output->paint_node_z_order_list,
z_order_link) {
@ -2940,7 +2940,7 @@ weston_output_repaint(struct weston_output *output, void *repaint_data)
if (output->dirty)
weston_output_update_matrix(output);
r = output->repaint(output, &output_damage, repaint_data);
r = output->repaint(output, &output_damage);
pixman_region32_fini(&output_damage);
@ -2976,8 +2976,7 @@ weston_output_schedule_repaint_reset(struct weston_output *output)
}
static int
weston_output_maybe_repaint(struct weston_output *output, struct timespec *now,
void *repaint_data)
weston_output_maybe_repaint(struct weston_output *output, struct timespec *now)
{
struct weston_compositor *compositor = output->compositor;
int ret = 0;
@ -3007,7 +3006,7 @@ weston_output_maybe_repaint(struct weston_output *output, struct timespec *now,
* something schedules a successful repaint later. As repainting may
* take some time, re-read our clock as a courtesy to the next
* output. */
ret = weston_output_repaint(output, repaint_data);
ret = weston_output_repaint(output);
weston_compositor_read_presentation_clock(compositor, now);
if (ret != 0)
goto err;
@ -3065,29 +3064,26 @@ output_repaint_timer_handler(void *data)
struct weston_compositor *compositor = data;
struct weston_output *output;
struct timespec now;
void *repaint_data = NULL;
int ret = 0;
weston_compositor_read_presentation_clock(compositor, &now);
compositor->last_repaint_start = now;
if (compositor->backend->repaint_begin)
repaint_data = compositor->backend->repaint_begin(compositor);
compositor->backend->repaint_begin(compositor);
wl_list_for_each(output, &compositor->output_list, link) {
ret = weston_output_maybe_repaint(output, &now, repaint_data);
ret = weston_output_maybe_repaint(output, &now);
if (ret)
break;
}
if (ret == 0) {
if (compositor->backend->repaint_flush)
ret = compositor->backend->repaint_flush(compositor,
repaint_data);
ret = compositor->backend->repaint_flush(compositor);
} else {
if (compositor->backend->repaint_cancel)
compositor->backend->repaint_cancel(compositor,
repaint_data);
compositor->backend->repaint_cancel(compositor);
}
if (ret != 0) {

Loading…
Cancel
Save