diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index 31e2b9da9..dc4fea96c 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -156,6 +156,8 @@ struct wlr_output { enum wlr_output_adaptive_sync_status adaptive_sync_status; uint32_t render_format; + int max_cursor_latency; + bool needs_frame; // damage for cursors and fullscreen surface, in output-local coordinates bool frame_pending; diff --git a/types/output/cursor.c b/types/output/cursor.c index 170a9b003..c9f09d4a3 100644 --- a/types/output/cursor.c +++ b/types/output/cursor.c @@ -499,7 +499,12 @@ static bool output_cursor_move(struct wlr_output_cursor *cursor, static bool output_cursor_move_should_defer(struct wlr_output_cursor *cursor, struct timespec *now) { - if (!cursor->max_latency + int max_latency = cursor->max_latency; + + if (!max_latency) + max_latency = cursor->output->max_cursor_latency; + + if (!max_latency || !cursor->output->refresh // avoid divide by zero || cursor->output->adaptive_sync_status != WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED) return false; @@ -508,7 +513,7 @@ static bool output_cursor_move_should_defer(struct wlr_output_cursor *cursor, int32_t vrr_min = NSEC_PER_SEC / 30; // edid? enforce 30fps minimum for now. timespec_sub(&delta, now, &cursor->last_presentation); if (delta.tv_sec - || delta.tv_nsec >= cursor->max_latency + || delta.tv_nsec >= max_latency || delta.tv_nsec >= vrr_min) return false;