From 68b7217d41f3f5344e60001b0b365d47a180d6e8 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 20 Sep 2014 15:14:43 +0200 Subject: vo_vdpau: better integration with the generic framedrop code vo_vdpau uses its own framedrop code, mostly for historic reasons. It has some tricky heuristics, of which I'm not sure how they work, or if they have any effect at all, but in any case, I want to keep this code for now. One day it might get fully ported to the vo.c framedrop code, or just removed. But improve its interaction with the user-visible framedrop controls. Make --framedrop actually enable and disable the vo_vdpau framedrop code, and increment the number of dropped frames correctly. The code path for other VOs should be equivalent. The vo_vdpau behavior should, except for the improvements mentioned above, be mostly equivalent as well. One minor change is that frames "shown" during preemption are always count as dropped. Remove the statement from the manpage that vo_vdpau is the default; this hasn't been the case for a while. --- video/out/vo_vdpau.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'video/out/vo_vdpau.c') diff --git a/video/out/vo_vdpau.c b/video/out/vo_vdpau.c index f5f3121504..e6acc4067e 100644 --- a/video/out/vo_vdpau.c +++ b/video/out/vo_vdpau.c @@ -711,14 +711,16 @@ static inline uint64_t prev_vsync(struct vdpctx *vc, uint64_t ts) return ts - offset; } -static void flip_page_timed(struct vo *vo, int64_t pts_us, int duration) +static int flip_page_timed(struct vo *vo, int64_t pts_us, int duration) { struct vdpctx *vc = vo->priv; struct vdp_functions *vdp = vc->vdp; VdpStatus vdp_st; + vc->dropped_frame = true; // changed at end if false + if (!check_preemption(vo)) - return; + return 0; vc->vsync_interval = 1; if (vc->user_fps > 0) { @@ -798,13 +800,12 @@ static void flip_page_timed(struct vo *vo, int64_t pts_us, int duration) || vc->dropped_frame && vsync > vc->dropped_time)) pts -= vc->vsync_interval / 2; - vc->dropped_frame = true; // changed at end if false vc->dropped_time = ideal_pts; pts = FFMAX(pts, vc->last_queue_time + vc->vsync_interval); pts = FFMAX(pts, now); if (npts < PREV_VSYNC(pts) + vc->vsync_interval) - return; + return 0; int num_flips = update_presentation_queue_status(vo); vsync = vc->recent_vsync_time + num_flips * vc->vsync_interval; @@ -812,7 +813,7 @@ static void flip_page_timed(struct vo *vo, int64_t pts_us, int duration) pts = FFMAX(pts, vsync + (vc->vsync_interval >> 2)); vsync = PREV_VSYNC(pts); if (npts < vsync + vc->vsync_interval) - return; + return 0; pts = vsync + (vc->vsync_interval >> 2); VdpOutputSurface frame = vc->output_surfaces[vc->surface_num]; vdp_st = vdp->presentation_queue_display(vc->flip_queue, frame, @@ -827,6 +828,7 @@ static void flip_page_timed(struct vo *vo, int64_t pts_us, int duration) vc->last_ideal_time = ideal_pts; vc->dropped_frame = false; vc->surface_num = WRAP_ADD(vc->surface_num, 1, vc->num_output_surfaces); + return 1; } static void draw_image(struct vo *vo, struct mp_image *mpi) -- cgit v1.2.3