summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorPhilip Langdale <philipl@overt.org>2016-09-22 21:52:23 -0700
committerwm4 <wm4@nowhere>2016-09-24 17:11:09 +0200
commit343da8d73d02e655f59cfe72448dc68061494c06 (patch)
tree944b52917e0d18584fdb027c0bf62eaa255e8f7b /video
parent441febfcbab2281d80579ded5cb8d9a7f4ca1e94 (diff)
downloadmpv-343da8d73d02e655f59cfe72448dc68061494c06.tar.bz2
mpv-343da8d73d02e655f59cfe72448dc68061494c06.tar.xz
vo_opengl: hwdec_cuda: get the cuda device from the GL context
Obviously, in the vast majority of cases, there's only one device in the system, but doing this means we're more likely to get a usable device in the multi-device case. cuda would support decoding on one device and displaying on another but the peer memory handling is not transparent and I have no way to test it so I can't really write it.
Diffstat (limited to 'video')
-rw-r--r--video/out/opengl/hwdec_cuda.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/video/out/opengl/hwdec_cuda.c b/video/out/opengl/hwdec_cuda.c
index c58b00e71f..539acbd4ba 100644
--- a/video/out/opengl/hwdec_cuda.c
+++ b/video/out/opengl/hwdec_cuda.c
@@ -126,9 +126,9 @@ static int cuda_create(struct gl_hwdec *hw)
CUdevice device;
CUcontext cuda_ctx = NULL;
CUcontext dummy;
+ unsigned int device_count;
int ret = 0, eret = 0;
- // PBO Requirements
if (hw->gl->version < 210 && hw->gl->es < 300) {
MP_ERR(hw, "need OpenGL >= 2.1 or OpenGL-ES >= 3.0\n");
return -1;
@@ -141,8 +141,8 @@ static int cuda_create(struct gl_hwdec *hw)
if (ret < 0)
goto error;
- ///TODO: Make device index configurable
- ret = CHECK_CU(cuDeviceGet(&device, 0));
+ ret = CHECK_CU(cuGLGetDevices(&device_count, &device, 1,
+ CU_GL_DEVICE_LIST_ALL));
if (ret < 0)
goto error;