mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-11 02:51:10 +00:00
fix: keep a slightly early vsync tick for frame pacing (#1405)
Gamescope paces from the presentation timestamp. The Choreographer tick is often still slightly ahead of the render thread, and that tick was thrown away, so the draw time was reported instead. A tick within one refresh of the draw is now kept, whether it is slightly ahead or slightly behind. A missing tick, or one more than a refresh away, still falls back to the draw time.
This commit is contained in:
1 file changed
+7
-3
@@ -808,10 +808,14 @@ static uint32_t nominal_refresh_ns(void) {
|
||||
}
|
||||
|
||||
static int64_t presented_ns(int64_t render_ns) {
|
||||
if (!g_tick_vsync_ns || render_ns - g_last_vsync_ns > (int64_t)nominal_refresh_ns() ||
|
||||
render_ns < g_tick_vsync_ns)
|
||||
int64_t tick = g_tick_vsync_ns;
|
||||
int64_t refresh = (int64_t)nominal_refresh_ns();
|
||||
if (!tick || render_ns - g_last_vsync_ns > refresh)
|
||||
return render_ns;
|
||||
return g_tick_vsync_ns;
|
||||
int64_t delta = render_ns - tick;
|
||||
if (delta > refresh || -delta > refresh)
|
||||
return render_ns;
|
||||
return tick;
|
||||
}
|
||||
|
||||
static void feedback_present_all(struct wl_list *list, int64_t t) {
|
||||
|
||||
Reference in new issue
Block a user