diff options
author | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-02-05 20:13:33 +0200 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-02-05 20:20:31 +0200 |
commit | e187de88a1ce7587827824ef9c16707dfb15718b (patch) | |
tree | f2511ec02ee11a528680d4ebc06365a0e48a5158 | |
parent | 9118a5dd02c365e51a9f49dd34469dd7c26b89c7 (diff) |
vo_vdpau: make queuing future frame flips adjustable
Add -vo vdpau suboptions "queuetime_windowed" and "queuetime_fs" to
specify the maximum number of milliseconds how far into the future a
frame flip can be queued using the VDPAU presentation queue
functionality. The intended main use of these options is to allow
disabling use of the queuing feature on systems where using it causes
choppiness in other graphics behavior (this is an NVIDIA driver issue;
the video itself isn't affected).
-rw-r--r-- | DOCS/man/en/mplayer.1 | 15 | ||||
-rw-r--r-- | libvo/video_out.h | 2 | ||||
-rw-r--r-- | libvo/vo_vdpau.c | 8 | ||||
-rw-r--r-- | mplayer.c | 6 |
4 files changed, 27 insertions, 4 deletions
diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1 index 41fec8df17..5239a0e39a 100644 --- a/DOCS/man/en/mplayer.1 +++ b/DOCS/man/en/mplayer.1 @@ -3514,6 +3514,21 @@ Override autodetected display refresh rate value (the value is needed for framed Default 0 means use autodetected value. A positive value is interpreted as a refresh rate in Hz and overrides the autodetected value. A negative value disables all timing adjustment and framedrop logic. +.IPs queuetime_windowed=<number> +.IPs queuetime_fs=<number> +Use VDPAU's presentation queue functionality to queue future video frame +changes at most this many milliseconds in advance (default: 50). +This makes MPlayer's flip timing less sensitive to system CPU load and allows +it to start decoding the next frame slightly earlier which can reduce jitter +caused by individual slow-to-decode frames. +However the NVIDIA graphics drivers can make other window behavior such as +window moves choppy if VDPAU is using the blit queue (mainly happens +if you have the composite extension enabled) and this feature is active. +If this happens on your system and you care about it then you can set the +time to 0 to disable this feature. +The settings to use in windowed and fullscreen mode are separate because there +should be less reason to disable this for fullscreen mode (as the driver issue +shouldn't affect the video itself). .RE .PD 1 . diff --git a/libvo/video_out.h b/libvo/video_out.h index 9331e80faf..697cc4e0d5 100644 --- a/libvo/video_out.h +++ b/libvo/video_out.h @@ -239,6 +239,8 @@ struct vo { double next_pts; // pts value of the next frame if any double next_pts2; // optional pts of frame after that + double flip_queue_offset; // queue flip events at most this much in advance + const struct vo_driver *driver; void *priv; struct MPOpts *opts; diff --git a/libvo/vo_vdpau.c b/libvo/vo_vdpau.c index 79465748c5..1b34cba642 100644 --- a/libvo/vo_vdpau.c +++ b/libvo/vo_vdpau.c @@ -134,6 +134,8 @@ struct vdpctx { float sharpen; int hqscaling; int chroma_deint; + int flip_offset_window; + int flip_offset_fs; int top_field_first; bool flip; @@ -386,6 +388,8 @@ static void resize(struct vo *vo) force_load_font = 1; #endif vo_osd_changed(OSDTYPE_OSD); + int flip_offset_ms = vo_fs ? vc->flip_offset_fs : vc->flip_offset_window; + vo->flip_queue_offset = flip_offset_ms / 1000.; bool had_frames = vc->num_shown_frames; if (vc->output_surface_width < vo->dwidth @@ -1593,6 +1597,8 @@ static int preinit(struct vo *vo, const char *arg) vc->deint_type = 3; vc->chroma_deint = 1; vc->user_colorspace = 1; + vc->flip_offset_window = 50; + vc->flip_offset_fs = 50; const opt_t subopts[] = { {"deint", OPT_ARG_INT, &vc->deint, (opt_test_f)int_non_neg}, {"chroma-deint", OPT_ARG_BOOL, &vc->chroma_deint, NULL}, @@ -1602,6 +1608,8 @@ static int preinit(struct vo *vo, const char *arg) {"colorspace", OPT_ARG_INT, &vc->user_colorspace, NULL}, {"hqscaling", OPT_ARG_INT, &vc->hqscaling, NULL}, {"fps", OPT_ARG_FLOAT, &vc->user_fps, NULL}, + {"queuetime_windowed", OPT_ARG_INT, &vc->flip_offset_window, NULL}, + {"queuetime_fs", OPT_ARG_INT, &vc->flip_offset_fs, NULL}, {NULL} }; if (subopt_parse(arg, subopts) != 0) { @@ -2167,13 +2167,11 @@ static int sleep_until_update(struct MPContext *mpctx, float *time_frame, //============================== SLEEP: =================================== - if (mpctx->video_out->driver->flip_page_timed) - *time_frame -= 0.05; + *time_frame -= mpctx->video_out->flip_queue_offset; // flag 256 means: libvo driver does its timing (dvb card) if (*time_frame > 0.001 && !(mpctx->sh_video->output_flags&256)) *time_frame = timing_sleep(mpctx, *time_frame); - if (mpctx->video_out->driver->flip_page_timed) - *time_frame += 0.05; + *time_frame += mpctx->video_out->flip_queue_offset; return frame_time_remaining; } |