mirror of
https://github.com/mpv-player/mpv
synced 2024-12-27 17:42:17 +00:00
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.
This commit is contained in:
parent
441febfcba
commit
343da8d73d
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user