diff options
author | wm4 <wm4@nowhere> | 2016-01-25 16:42:54 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-01-25 16:45:18 +0100 |
commit | a16040528459844d304d39c7d567ced86565ae06 (patch) | |
tree | 95ef5264ff297abd244402d4fab454540b715873 /video/decode | |
parent | 266d8368e82bbede6a087b6c83a1066fc5d91b9c (diff) |
vdpau: force driver to report preemption early
Another fix for the crazy and insane nvidia preemption behavior.
This time, the situation is that we are using vo_opengl with vdpau
interop, and that vdpau got preempted in the background while mpv was
sitting idly. This can be e.g. reproduced by using:
--force-window=immediate --idle --hwdec=vdpau
and switching VTs. Then after switching back, load a video file.
This will not let mp_vdpau_handle_preemption() perform preemption
recovery, simply because it will do so only once vdp_decoder_create()
has been called. There are some other API calls which trigger
preemption, but many don't.
Due to the way the libavcodec API works, vdp_decoder_create() is way too
late. It does so when get_format returns. It notices creating the
decoder fails, and continues calling get_format without the vdpau
format. We could perhaps force it to reinit again (by adding a call to
vdpau.c, that checks for preemption, and sets hwdec_request_reinit), but
this seems too much of a mess.
Solve it by calling API in mp_vdpau_handle_preemption() that empirically
does trigger preemption: output_surface_put_bits_native(). This call is
useless, and in fact should be doing nothing (empty update VdpRect).
There's the slight chance that in theory it will slow down operation,
but in practice it's bound to be harmless. It's the likely cheapest and
simplest API call I've found that can trigger the fallback this way.
(The driver is closed source, so it was up to trial & error.)
Also, when initializing decoding, allow initial preemption recovery,
which is needed to pass the test mention above.
Diffstat (limited to 'video/decode')
-rw-r--r-- | video/decode/vdpau.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/video/decode/vdpau.c b/video/decode/vdpau.c index 72e050b9f0..c69465094b 100644 --- a/video/decode/vdpau.c +++ b/video/decode/vdpau.c @@ -79,9 +79,7 @@ static int init(struct lavc_ctx *ctx) }; ctx->hwdec_priv = p; - if (mp_vdpau_handle_preemption(p->mpvdp, &p->preemption_counter) < 1) - return -1; - + mp_vdpau_handle_preemption(p->mpvdp, &p->preemption_counter); return 0; } |