From f5e82d5ed345dbb894ff75591abc4b262b65d0dd Mon Sep 17 00:00:00 2001 From: Philip Langdale Date: Sat, 8 Oct 2016 16:51:15 -0700 Subject: vo_opengl: hwdec_cuda: Use dynamic loading for cuda functions This change applies the pattern used in ffmpeg to dynamically load cuda, to avoid requiring the CUDA SDK at build time. --- video/out/opengl/hwdec_cuda.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'video/out/opengl/hwdec_cuda.c') diff --git a/video/out/opengl/hwdec_cuda.c b/video/out/opengl/hwdec_cuda.c index 4dc842706c..266714a972 100644 --- a/video/out/opengl/hwdec_cuda.c +++ b/video/out/opengl/hwdec_cuda.c @@ -28,13 +28,13 @@ */ #include -#include +#include "cuda_dynamic.h" #include "video/mp_image_pool.h" #include "hwdec.h" #include "video.h" -#include +#include struct priv { struct mp_hwdec_ctx hwctx; @@ -152,6 +152,11 @@ static int cuda_create(struct gl_hwdec *hw) struct priv *p = talloc_zero(hw, struct priv); hw->priv = p; + bool loaded = cuda_load(); + if (!loaded) { + MP_ERR(hw, "Failed to load CUDA symbols\n"); + } + ret = CHECK_CU(cuInit(0)); if (ret < 0) goto error; @@ -277,6 +282,8 @@ static void destroy(struct gl_hwdec *hw) } CHECK_CU(cuCtxPopCurrent(&dummy)); + CHECK_CU(cuCtxDestroy(p->cuda_ctx)); + gl->DeleteTextures(2, p->gl_textures); hwdec_devices_remove(hw->devs, &p->hwctx); -- cgit v1.2.3