diff options
Diffstat (limited to 'video/out/opengl/hwdec_vdpau.c')
-rw-r--r-- | video/out/opengl/hwdec_vdpau.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/video/out/opengl/hwdec_vdpau.c b/video/out/opengl/hwdec_vdpau.c index 13e4995fc1..b1d49622fc 100644 --- a/video/out/opengl/hwdec_vdpau.c +++ b/video/out/opengl/hwdec_vdpau.c @@ -37,6 +37,7 @@ struct priv { uint64_t preemption_counter; struct mp_image_params image_params; GLuint gl_texture; + bool vdpgl_initialized; GLvdpauSurfaceNV vdpgl_surface; VdpOutputSurface vdp_surface; struct mp_vdpau_mixer *mixer; @@ -78,13 +79,12 @@ static void destroy_objects(struct gl_hwdec *hw) glCheckError(gl, hw->log, "Before uninitializing OpenGL interop"); - gl->VDPAUFiniNV(); + if (p->vdpgl_initialized) + gl->VDPAUFiniNV(); - // If the GL/vdpau state is not initialized, above calls raises an error. - while (1) { - if (gl->GetError() == GL_NO_ERROR) - break; - } + p->vdpgl_initialized = false; + + glCheckError(gl, hw->log, "After uninitializing OpenGL interop"); } static void destroy(struct gl_hwdec *hw) @@ -137,11 +137,13 @@ static int reinit(struct gl_hwdec *hw, struct mp_image_params *params) assert(params->imgfmt == hw->driver->imgfmt); p->image_params = *params; - if (mp_vdpau_handle_preemption(p->ctx, &p->preemption_counter) < 1) + if (mp_vdpau_handle_preemption(p->ctx, &p->preemption_counter) < 0) return -1; gl->VDPAUInitNV(BRAINDEATH(p->ctx->vdp_device), p->ctx->get_proc_address); + p->vdpgl_initialized = true; + vdp_st = vdp->output_surface_create(p->ctx->vdp_device, VDP_RGBA_FORMAT_B8G8R8A8, params->w, params->h, &p->vdp_surface); @@ -200,7 +202,8 @@ static int map_image(struct gl_hwdec *hw, struct mp_image *hw_image, } const struct gl_hwdec_driver gl_hwdec_vdpau = { - .api_name = "vdpau", + .name = "vdpau-glx", + .api = HWDEC_VDPAU, .imgfmt = IMGFMT_VDPAU, .create = create, .reinit = reinit, |