summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/hwdec_cuda.c
diff options
context:
space:
mode:
authorPhilip Langdale <philipl@overt.org>2016-10-08 16:51:15 -0700
committerwm4 <wm4@nowhere>2016-11-23 01:07:26 +0100
commitf5e82d5ed345dbb894ff75591abc4b262b65d0dd (patch)
tree04cf9d9c47e0a89ddeeccb295f15fe25bed40d4b /video/out/opengl/hwdec_cuda.c
parentebd9ce9fca557eb0e1388c944dc2438442785e95 (diff)
downloadmpv-f5e82d5ed345dbb894ff75591abc4b262b65d0dd.tar.bz2
mpv-f5e82d5ed345dbb894ff75591abc4b262b65d0dd.tar.xz
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.
Diffstat (limited to 'video/out/opengl/hwdec_cuda.c')
-rw-r--r--video/out/opengl/hwdec_cuda.c11
1 files changed, 9 insertions, 2 deletions
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 <libavutil/hwcontext.h>
-#include <libavutil/hwcontext_cuda.h>
+#include "cuda_dynamic.h"
#include "video/mp_image_pool.h"
#include "hwdec.h"
#include "video.h"
-#include <cudaGL.h>
+#include <libavutil/hwcontext_cuda.h>
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);