diff options
Diffstat (limited to 'video/out/hwdec/hwdec_cuda_gl.c')
-rw-r--r-- | video/out/hwdec/hwdec_cuda_gl.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/video/out/hwdec/hwdec_cuda_gl.c b/video/out/hwdec/hwdec_cuda_gl.c index f20540ed4d..4c2535232f 100644 --- a/video/out/hwdec/hwdec_cuda_gl.c +++ b/video/out/hwdec/hwdec_cuda_gl.c @@ -25,7 +25,6 @@ #include <libavutil/hwcontext.h> #include <libavutil/hwcontext_cuda.h> -#include <unistd.h> #define CHECK_CU(x) check_cu((mapper)->owner, (x), #x) @@ -106,22 +105,24 @@ static void cuda_ext_gl_uninit(const struct ra_hwdec_mapper *mapper, int n) #undef CHECK_CU #define CHECK_CU(x) check_cu(hw, (x), #x) -bool cuda_gl_init(const struct ra_hwdec *hw) { - int ret = 0; - struct cuda_hw_priv *p = hw->priv; - CudaFunctions *cu = p->cu; +static bool cuda_gl_check(const struct ra_hwdec *hw) { + if (!ra_is_gl(hw->ra_ctx->ra)) + return false; // This is not an OpenGL RA. - if (ra_is_gl(hw->ra_ctx->ra)) { - GL *gl = ra_gl_get(hw->ra_ctx->ra); - if (gl->version < 210 && gl->es < 300) { - MP_VERBOSE(hw, "need OpenGL >= 2.1 or OpenGL-ES >= 3.0\n"); - return false; - } - } else { - // This is not an OpenGL RA. + GL *gl = ra_gl_get(hw->ra_ctx->ra); + if (gl->version < 210 && gl->es < 300) { + MP_VERBOSE(hw, "need OpenGL >= 2.1 or OpenGL-ES >= 3.0\n"); return false; } + return true; +} + +static bool cuda_gl_init(const struct ra_hwdec *hw) { + int ret = 0; + struct cuda_hw_priv *p = hw->priv; + CudaFunctions *cu = p->cu; + CUdevice display_dev; unsigned int device_count; ret = CHECK_CU(cu->cuGLGetDevices(&device_count, &display_dev, 1, @@ -172,3 +173,8 @@ bool cuda_gl_init(const struct ra_hwdec *hw) { return true; } + +struct cuda_interop_fn cuda_gl_fn = { + .check = cuda_gl_check, + .init = cuda_gl_init +}; |