From eefe7ad28bceccd509d389dc4dba465467231fb1 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 3 May 2016 13:56:11 +0200 Subject: vo_opengl: vdpau: fix certain cases of preemption recovery failures The vdpau_mixer could fail to be recreated properly if preemption occured at some point before playback initialization (like when using --hwdec-preload and the opengl-cb API). Normally, the vdpau_mixer was supposed to be marked invalid when the components using it detect a preemption, e.g. in hwdec_vdpau.c. This one didn't mark the vdpau_mixer as invalid if preemption was detected in reinit(), only in map_image(). It's cleaner to detect preemption directly in the vdpau_mixer, which ensures it's always recreated correctly. --- video/vdpau_mixer.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'video/vdpau_mixer.c') diff --git a/video/vdpau_mixer.c b/video/vdpau_mixer.c index 7025aef459..d6f93a9d13 100644 --- a/video/vdpau_mixer.c +++ b/video/vdpau_mixer.c @@ -71,6 +71,7 @@ struct mp_vdpau_mixer *mp_vdpau_mixer_create(struct mp_vdpau_ctx *vdp_ctx, .capabilities = MP_CSP_EQ_CAPS_COLORMATRIX, }, }; + mp_vdpau_handle_preemption(mixer->ctx, &mixer->preemption_counter); return mixer; } @@ -228,6 +229,13 @@ int mp_vdpau_mixer_render(struct mp_vdpau_mixer *mixer, if (!video_rect) video_rect = &fallback_rect; + int pe = mp_vdpau_handle_preemption(mixer->ctx, &mixer->preemption_counter); + if (pe < 1) { + mixer->video_mixer = VDP_INVALID_HANDLE; + if (pe < 0) + return -1; + } + if (video->imgfmt == IMGFMT_VDPAU_OUTPUT) { VdpOutputSurface surface = (uintptr_t)video->planes[3]; int flags = VDP_OUTPUT_SURFACE_RENDER_ROTATE_0; -- cgit v1.2.3