From bfb2dfae6313f2f0adbe8707266444c4633ff17d Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Tue, 4 Feb 2025 08:38:04 -0600 Subject: [PATCH] compositor: Try an immediate repaint if VRR enabled When in VRR mode, repainting without a wait might happen instantly, so do it. This is likely not the best long term solution, but is ok for now while weston's vrr support is experimental. Signed-off-by: Derek Foreman --- libweston/compositor.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libweston/compositor.c b/libweston/compositor.c index d5815660c..0da681c8d 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -4146,6 +4146,18 @@ weston_output_finish_frame(struct weston_output *output, goto out; } + /* If we're doing game mode VRR, repainting right away + * might be better than waiting, so try now. + * TODO: Come up with some better handling... + * We should probably try to use "repaint window" style behaviour + * if we're scheduling a repaint during the vactive display + * period, but try to render immediately if we're not. + */ + if (output->vrr_mode == WESTON_VRR_MODE_GAME) { + output->next_repaint = now; + goto out; + } + timespec_add_nsec(&output->next_repaint, stamp, refresh_nsec); timespec_add_msec(&output->next_repaint, &output->next_repaint, -compositor->repaint_msec);