summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2021-11-21 14:56:29 -0600
committerNiklas Haas <github-daiK1o@haasn.dev>2021-11-21 22:56:30 +0100
commit67c1ff8dad2ba8dafcf60436d7d513d114a7eabf (patch)
treeccd83448ab74f38db4e58cdff59a749093689c58
parentac3d567bd32497facbf4af0a838eb0ad69dcc447 (diff)
downloadmpv-67c1ff8dad2ba8dafcf60436d7d513d114a7eabf.tar.bz2
mpv-67c1ff8dad2ba8dafcf60436d7d513d114a7eabf.tar.xz
vo_gpu_next: fix timings without interpolation
Adding vsync_offset to the pts in pl_queue_update actually messes up frame timings if one isn't using interpolation. The easiest way to see this is to have the monitor's refresh rate at an integer multiple of a video during a panning shot (classic case). There will be very visible judder/stutter in this case that does not happen in vo_gpu. The cause of this is the addition of the extra vsync_offset. Just match the semantics of vo_gpu where this is only used when interpolating.
-rw-r--r--video/out/vo_gpu_next.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/video/out/vo_gpu_next.c b/video/out/vo_gpu_next.c
index 1a02f27699..72596a3cba 100644
--- a/video/out/vo_gpu_next.c
+++ b/video/out/vo_gpu_next.c
@@ -634,13 +634,16 @@ static void draw_frame(struct vo *vo, struct vo_frame *frame)
pl_swapchain_colorspace_hint(p->sw, NULL);
}
+ const struct gl_video_opts *opts = p->opts_cache->opts;
+ double vsync_offset = opts->interpolation ? frame->vsync_offset : 0;
+
struct pl_swapchain_frame swframe;
struct ra_swapchain *sw = p->ra_ctx->swapchain;
bool should_draw = sw->fns->start_frame(sw, NULL); // for wayland logic
if (!should_draw || !pl_swapchain_start_frame(p->sw, &swframe)) {
// Advance the queue state to the current PTS to discard unused frames
pl_queue_update(p->queue, NULL, &(struct pl_queue_params) {
- .pts = frame->current->pts + frame->vsync_offset,
+ .pts = frame->current->pts + vsync_offset,
.radius = pl_frame_mix_radius(&p->params),
});
return;
@@ -663,7 +666,6 @@ static void draw_frame(struct vo *vo, struct vo_frame *frame)
#endif
// Target colorspace overrides
- const struct gl_video_opts *opts = p->opts_cache->opts;
if (opts->target_prim)
target.color.primaries = mp_prim_to_pl(opts->target_prim);
if (opts->target_trc)
@@ -680,7 +682,7 @@ static void draw_frame(struct vo *vo, struct vo_frame *frame)
if (frame->current) {
// Update queue state
struct pl_queue_params qparams = {
- .pts = frame->current->pts + frame->vsync_offset,
+ .pts = frame->current->pts + vsync_offset,
.radius = pl_frame_mix_radius(&p->params),
.vsync_duration = frame->vsync_interval,
.frame_duration = frame->ideal_frame_duration,