mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-17 06:46:39 -04:00
deferred cursors: add a max_cursor_latency for output
This commit is contained in:
parent
ed2cd86cee
commit
a601eafb7a
2 changed files with 9 additions and 2 deletions
|
|
@ -156,6 +156,8 @@ struct wlr_output {
|
||||||
enum wlr_output_adaptive_sync_status adaptive_sync_status;
|
enum wlr_output_adaptive_sync_status adaptive_sync_status;
|
||||||
uint32_t render_format;
|
uint32_t render_format;
|
||||||
|
|
||||||
|
int max_cursor_latency;
|
||||||
|
|
||||||
bool needs_frame;
|
bool needs_frame;
|
||||||
// damage for cursors and fullscreen surface, in output-local coordinates
|
// damage for cursors and fullscreen surface, in output-local coordinates
|
||||||
bool frame_pending;
|
bool frame_pending;
|
||||||
|
|
|
||||||
|
|
@ -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,
|
static bool output_cursor_move_should_defer(struct wlr_output_cursor *cursor,
|
||||||
struct timespec *now) {
|
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->refresh // avoid divide by zero
|
||||||
|| cursor->output->adaptive_sync_status != WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED)
|
|| cursor->output->adaptive_sync_status != WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED)
|
||||||
return false;
|
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.
|
int32_t vrr_min = NSEC_PER_SEC / 30; // edid? enforce 30fps minimum for now.
|
||||||
timespec_sub(&delta, now, &cursor->last_presentation);
|
timespec_sub(&delta, now, &cursor->last_presentation);
|
||||||
if (delta.tv_sec
|
if (delta.tv_sec
|
||||||
|| delta.tv_nsec >= cursor->max_latency
|
|| delta.tv_nsec >= max_latency
|
||||||
|| delta.tv_nsec >= vrr_min)
|
|| delta.tv_nsec >= vrr_min)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue