From afc19c2e94532a4987deaf7dcafd2adfb7637644 Mon Sep 17 00:00:00 2001 From: Michael Olbrich Date: Tue, 6 May 2025 15:18:47 +0200 Subject: [PATCH] backend-vnc: 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 --- libweston/backend-vnc/vnc.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/libweston/backend-vnc/vnc.c b/libweston/backend-vnc/vnc.c index 2c0d6b22d..5ae41011d 100644 --- a/libweston/backend-vnc/vnc.c +++ b/libweston/backend-vnc/vnc.c @@ -1093,6 +1093,19 @@ vnc_output_assign_planes(struct weston_output *base) vnc_output_assign_cursor_plane(output); } +static void +vnc_set_dpms(struct weston_output *base, enum dpms_enum level) +{ + struct vnc_output *output = to_vnc_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 vnc_switch_mode(struct weston_output *base, struct weston_mode *target_mode) { @@ -1145,7 +1158,7 @@ vnc_output_set_size(struct weston_output *base, int width, int height, output->base.repaint = vnc_output_repaint; output->base.assign_planes = vnc_output_assign_planes; output->base.set_backlight = NULL; - output->base.set_dpms = NULL; + output->base.set_dpms = vnc_set_dpms; output->base.switch_mode = vnc_switch_mode; output->resizeable = resizeable;