diff options
author | 2014-05-18 18:59:59 +0200 | |
---|---|---|
committer | 2014-05-18 19:21:39 +0200 | |
commit | b3aa5dafa3ef096bb5e919d3f8453b9d1123883c (patch) | |
tree | 80a40836929e1a49fcb1eae3c53d26135e032bf0 /video | |
parent | 537ac1a15fbc02619ebe8c7b97823d06937c8107 (diff) |
vdpau: don't fallback to software decoding on preemption
This was requested by someone. Not sure if it's a good idea; it seems
more can go wrong than right.
Diffstat (limited to 'video')
-rw-r--r-- | video/decode/vdpau.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/video/decode/vdpau.c b/video/decode/vdpau.c index 7f1af56581..4cd1eee531 100644 --- a/video/decode/vdpau.c +++ b/video/decode/vdpau.c @@ -34,6 +34,7 @@ struct priv { struct mp_vdpau_ctx *mpvdp; struct vdp_functions *vdp; uint64_t preemption_counter; + int fmt, w, h; AVVDPAUContext context; }; @@ -67,8 +68,13 @@ static int init_decoder(struct lavc_ctx *ctx, int fmt, int w, int h) VdpDevice vdp_device = p->mpvdp->vdp_device; VdpStatus vdp_st; - if (mp_vdpau_handle_preemption(p->mpvdp, &p->preemption_counter) < 1) - goto fail; + p->fmt = fmt; + p->w = w; + p->h = h; + + // During preemption, pretend everything is ok. + if (mp_vdpau_handle_preemption(p->mpvdp, &p->preemption_counter) < 0) + return 0; if (p->context.decoder != VDP_INVALID_HANDLE) vdp->decoder_destroy(p->context.decoder); @@ -114,11 +120,10 @@ static struct mp_image *allocate_image(struct lavc_ctx *ctx, int fmt, { struct priv *p = ctx->hwdec_priv; - // Trigger software fallback, but only _after_ recovery. This way, - // vo_reconfig will not fail (which it will during preemption on systems - // with nvidia binary drivers). - if (mp_vdpau_handle_preemption(p->mpvdp, &p->preemption_counter) == 0) - return NULL; + if (mp_vdpau_handle_preemption(p->mpvdp, &p->preemption_counter) == 0) { + if (init_decoder(ctx, p->fmt, p->w, p->h) < 0) + return NULL; + } VdpChromaType chroma; mp_vdpau_get_format(IMGFMT_VDPAU, &chroma, NULL); |