From 343da8d73d02e655f59cfe72448dc68061494c06 Mon Sep 17 00:00:00 2001 From: Philip Langdale Date: Thu, 22 Sep 2016 21:52:23 -0700 Subject: 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. --- video/out/opengl/hwdec_cuda.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'video') 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; -- cgit v1.2.3