mirror of
https://github.com/mpv-player/mpv
synced 2024-12-22 14:52:43 +00:00
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.
This commit is contained in:
parent
51e4c065ff
commit
eefe7ad28b
@ -49,7 +49,6 @@ static void mark_vdpau_objects_uninitialized(struct gl_hwdec *hw)
|
|||||||
struct priv *p = hw->priv;
|
struct priv *p = hw->priv;
|
||||||
|
|
||||||
p->vdp_surface = VDP_INVALID_HANDLE;
|
p->vdp_surface = VDP_INVALID_HANDLE;
|
||||||
p->mixer->video_mixer = VDP_INVALID_HANDLE;
|
|
||||||
p->mapped = false;
|
p->mapped = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -448,7 +448,6 @@ static void mark_vdpau_objects_uninitialized(struct vo *vo)
|
|||||||
|
|
||||||
forget_frames(vo, false);
|
forget_frames(vo, false);
|
||||||
vc->black_pixel = VDP_INVALID_HANDLE;
|
vc->black_pixel = VDP_INVALID_HANDLE;
|
||||||
vc->video_mixer->video_mixer = VDP_INVALID_HANDLE;
|
|
||||||
vc->flip_queue = VDP_INVALID_HANDLE;
|
vc->flip_queue = VDP_INVALID_HANDLE;
|
||||||
vc->flip_target = VDP_INVALID_HANDLE;
|
vc->flip_target = VDP_INVALID_HANDLE;
|
||||||
for (int i = 0; i < MAX_OUTPUT_SURFACES; i++)
|
for (int i = 0; i < MAX_OUTPUT_SURFACES; i++)
|
||||||
|
@ -71,6 +71,7 @@ struct mp_vdpau_mixer *mp_vdpau_mixer_create(struct mp_vdpau_ctx *vdp_ctx,
|
|||||||
.capabilities = MP_CSP_EQ_CAPS_COLORMATRIX,
|
.capabilities = MP_CSP_EQ_CAPS_COLORMATRIX,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
mp_vdpau_handle_preemption(mixer->ctx, &mixer->preemption_counter);
|
||||||
return mixer;
|
return mixer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,6 +229,13 @@ int mp_vdpau_mixer_render(struct mp_vdpau_mixer *mixer,
|
|||||||
if (!video_rect)
|
if (!video_rect)
|
||||||
video_rect = &fallback_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) {
|
if (video->imgfmt == IMGFMT_VDPAU_OUTPUT) {
|
||||||
VdpOutputSurface surface = (uintptr_t)video->planes[3];
|
VdpOutputSurface surface = (uintptr_t)video->planes[3];
|
||||||
int flags = VDP_OUTPUT_SURFACE_RENDER_ROTATE_0;
|
int flags = VDP_OUTPUT_SURFACE_RENDER_ROTATE_0;
|
||||||
|
@ -30,6 +30,7 @@ struct mp_vdpau_mixer_frame {
|
|||||||
struct mp_vdpau_mixer {
|
struct mp_vdpau_mixer {
|
||||||
struct mp_log *log;
|
struct mp_log *log;
|
||||||
struct mp_vdpau_ctx *ctx;
|
struct mp_vdpau_ctx *ctx;
|
||||||
|
uint64_t preemption_counter;
|
||||||
bool initialized;
|
bool initialized;
|
||||||
|
|
||||||
struct mp_image_params image_params;
|
struct mp_image_params image_params;
|
||||||
|
Loading…
Reference in New Issue
Block a user