backend-pipewire: implement set_dpms

set_dpms() is used for sleep/wakeup. output_repaint_timer_handler() resets the
repaint_status if called while Weston is sleeping. If the timer is still active,
it will trigger a call to weston_output_finish_frame() which then triggers an
assertion, because the repaint_status is not REPAINT_AWAITING_COMPLETION.
Stop the timer and reset the repaint_status in this case to avoid this.

Schedule a repaint for WESTON_DPMS_ON to ensure that the current state is
rendered.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
This commit is contained in:
Michael Olbrich 2025-05-06 15:18:47 +02:00 committed by Marius Vlad
parent b5843ed366
commit d076f2c519

View file

@ -1117,6 +1117,19 @@ pipewire_ensure_matching_mode(struct weston_output *output, struct weston_mode *
target->refresh);
}
static void
pipewire_set_dpms(struct weston_output *base, enum dpms_enum level)
{
struct pipewire_output *output = to_pipewire_output(base);
if (level == WESTON_DPMS_ON)
weston_output_schedule_repaint(base);
else if (output->base.repaint_status == REPAINT_AWAITING_COMPLETION) {
wl_event_source_timer_update(output->finish_frame_timer, 0);
weston_output_schedule_repaint_reset(base);
}
}
static int
pipewire_switch_mode(struct weston_output *base, struct weston_mode *target_mode)
{
@ -1180,7 +1193,7 @@ pipewire_output_set_size(struct weston_output *base, int width, int height)
output->base.repaint = pipewire_output_repaint;
output->base.assign_planes = NULL;
output->base.set_backlight = NULL;
output->base.set_dpms = NULL;
output->base.set_dpms = pipewire_set_dpms;
output->base.switch_mode = pipewire_switch_mode;
return 0;