From 9ce2bafbe9a49afe65eb86b46625f12dcb1b3110 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Sun, 4 Feb 2024 19:03:18 +0100 Subject: [PATCH] vo_vdpau: cosmetic changes to timings Remove unneded range check. Print time difference with more precision. Use the same data formats for fps and interval as in other VOs. --- video/out/vo_vdpau.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/video/out/vo_vdpau.c b/video/out/vo_vdpau.c index 8fb46d157b..f1f6f3ae71 100644 --- a/video/out/vo_vdpau.c +++ b/video/out/vo_vdpau.c @@ -104,9 +104,9 @@ struct vdpctx { int surface_num; // indexes output_surfaces int query_surface_num; VdpTime recent_vsync_time; - float user_fps; + double user_fps; bool composite_detect; - int vsync_interval; + int64_t vsync_interval; uint64_t last_queue_time; uint64_t queue_time[MAX_OUTPUT_SURFACES]; uint64_t last_ideal_time; @@ -721,12 +721,12 @@ static int update_presentation_queue_status(struct vo *vo) break; if (vc->vsync_interval > 1) { uint64_t qtime = vc->queue_time[vc->query_surface_num]; - int diff = ((int64_t)vtime - (int64_t)qtime) / 1e6; - MP_TRACE(vo, "Queue time difference: %d ms\n", diff); + double diff = MP_TIME_NS_TO_MS((int64_t)vtime - (int64_t)qtime); + MP_TRACE(vo, "Queue time difference: %.4f ms\n", diff); if (vtime < qtime + vc->vsync_interval / 2) - MP_VERBOSE(vo, "Frame shown too early (%d ms)\n", diff); + MP_VERBOSE(vo, "Frame shown too early (%.4f ms)\n", diff); if (vtime > qtime + vc->vsync_interval) - MP_VERBOSE(vo, "Frame shown late (%d ms)\n", diff); + MP_VERBOSE(vo, "Frame shown late (%.4f ms)\n", diff); } vc->query_surface_num = WRAP_ADD(vc->query_surface_num, 1, vc->num_output_surfaces); @@ -770,9 +770,6 @@ static void flip_page(struct vo *vo) } vc->vsync_interval = MPMAX(vc->vsync_interval, 1); - if (duration > INT_MAX) - duration = -1; - if (vc->vsync_interval == 1) duration = -1; // Make sure drop logic is disabled @@ -1122,7 +1119,7 @@ const struct vo_driver video_out_vdpau = { {"denoise", OPT_FLOAT(denoise), M_RANGE(0, 1)}, {"sharpen", OPT_FLOAT(sharpen), M_RANGE(-1, 1)}, {"hqscaling", OPT_INT(hqscaling), M_RANGE(0, 9)}, - {"fps", OPT_FLOAT(user_fps)}, + {"fps", OPT_DOUBLE(user_fps)}, {"composite-detect", OPT_BOOL(composite_detect), OPTDEF_INT(1)}, {"queuetime-windowed", OPT_INT(flip_offset_window), OPTDEF_INT(50)}, {"queuetime-fs", OPT_INT(flip_offset_fs), OPTDEF_INT(50)},