mirror of https://github.com/mpv-player/mpv
vo_vdpau: fix confusion around vsync_interval
vc->vsync_interval and vsync_interval should be the same value, but actually vc->vsync_interval was updated after vsync_interval was initialized. This was probably not intended. Fix this by removing the duplicate local variable. There were probably no bad effects.
This commit is contained in:
parent
5e6c9963d8
commit
461c78e4d9
|
@ -716,7 +716,6 @@ static void flip_page_timed(struct vo *vo, int64_t pts_us, int duration)
|
||||||
struct vdpctx *vc = vo->priv;
|
struct vdpctx *vc = vo->priv;
|
||||||
struct vdp_functions *vdp = vc->vdp;
|
struct vdp_functions *vdp = vc->vdp;
|
||||||
VdpStatus vdp_st;
|
VdpStatus vdp_st;
|
||||||
uint32_t vsync_interval = vc->vsync_interval;
|
|
||||||
|
|
||||||
if (!check_preemption(vo))
|
if (!check_preemption(vo))
|
||||||
return;
|
return;
|
||||||
|
@ -774,7 +773,7 @@ static void flip_page_timed(struct vo *vo, int64_t pts_us, int duration)
|
||||||
* not make the target time in reality. Without this check we could drop
|
* not make the target time in reality. Without this check we could drop
|
||||||
* every frame, freezing the display completely if video lags behind.
|
* every frame, freezing the display completely if video lags behind.
|
||||||
*/
|
*/
|
||||||
if (now > PREV_VSYNC(FFMAX(pts, vc->last_queue_time + vsync_interval)))
|
if (now > PREV_VSYNC(FFMAX(pts, vc->last_queue_time + vc->vsync_interval)))
|
||||||
npts = UINT64_MAX;
|
npts = UINT64_MAX;
|
||||||
|
|
||||||
/* Allow flipping a frame at a vsync if its presentation time is a
|
/* Allow flipping a frame at a vsync if its presentation time is a
|
||||||
|
@ -793,28 +792,28 @@ static void flip_page_timed(struct vo *vo, int64_t pts_us, int duration)
|
||||||
* there would unnecessarily be a vsync without a frame change.
|
* there would unnecessarily be a vsync without a frame change.
|
||||||
*/
|
*/
|
||||||
uint64_t vsync = PREV_VSYNC(pts);
|
uint64_t vsync = PREV_VSYNC(pts);
|
||||||
if (pts < vsync + vsync_interval / 4
|
if (pts < vsync + vc->vsync_interval / 4
|
||||||
&& (vsync - PREV_VSYNC(vc->last_queue_time)
|
&& (vsync - PREV_VSYNC(vc->last_queue_time)
|
||||||
> pts - vc->last_ideal_time + vsync_interval / 2
|
> pts - vc->last_ideal_time + vc->vsync_interval / 2
|
||||||
|| vc->dropped_frame && vsync > vc->dropped_time))
|
|| vc->dropped_frame && vsync > vc->dropped_time))
|
||||||
pts -= vsync_interval / 2;
|
pts -= vc->vsync_interval / 2;
|
||||||
|
|
||||||
vc->dropped_frame = true; // changed at end if false
|
vc->dropped_frame = true; // changed at end if false
|
||||||
vc->dropped_time = ideal_pts;
|
vc->dropped_time = ideal_pts;
|
||||||
|
|
||||||
pts = FFMAX(pts, vc->last_queue_time + vsync_interval);
|
pts = FFMAX(pts, vc->last_queue_time + vc->vsync_interval);
|
||||||
pts = FFMAX(pts, now);
|
pts = FFMAX(pts, now);
|
||||||
if (npts < PREV_VSYNC(pts) + vsync_interval)
|
if (npts < PREV_VSYNC(pts) + vc->vsync_interval)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int num_flips = update_presentation_queue_status(vo);
|
int num_flips = update_presentation_queue_status(vo);
|
||||||
vsync = vc->recent_vsync_time + num_flips * vc->vsync_interval;
|
vsync = vc->recent_vsync_time + num_flips * vc->vsync_interval;
|
||||||
pts = FFMAX(pts, now);
|
pts = FFMAX(pts, now);
|
||||||
pts = FFMAX(pts, vsync + (vsync_interval >> 2));
|
pts = FFMAX(pts, vsync + (vc->vsync_interval >> 2));
|
||||||
vsync = PREV_VSYNC(pts);
|
vsync = PREV_VSYNC(pts);
|
||||||
if (npts < vsync + vsync_interval)
|
if (npts < vsync + vc->vsync_interval)
|
||||||
return;
|
return;
|
||||||
pts = vsync + (vsync_interval >> 2);
|
pts = vsync + (vc->vsync_interval >> 2);
|
||||||
VdpOutputSurface frame = vc->output_surfaces[vc->surface_num];
|
VdpOutputSurface frame = vc->output_surfaces[vc->surface_num];
|
||||||
vdp_st = vdp->presentation_queue_display(vc->flip_queue, frame,
|
vdp_st = vdp->presentation_queue_display(vc->flip_queue, frame,
|
||||||
vo->dwidth, vo->dheight, pts);
|
vo->dwidth, vo->dheight, pts);
|
||||||
|
|
Loading…
Reference in New Issue