Skip to content

Commit

Permalink
hwdec_cuda: Move cuda_load_functions to cuda_priv_init
Browse files Browse the repository at this point in the history
  • Loading branch information
jrelvas-ipc committed Apr 30, 2024
1 parent 10b6961 commit b80b40f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions video/out/hwdec/hwdec_cuda.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,21 @@ int cuda_priv_init(const struct ra_hwdec *hw)
struct cuda_hw_priv *p = hw->priv;
CudaFunctions *cu = p->cu;
int ret = 0;
int level = hw->probing ? MSGL_V : MSGL_ERR;

if (p->initialized)
return ret;

ret = cuda_load_functions(&p->cu, NULL);
if (ret != 0) {
MP_MSG(hw, level, "Failed to load CUDA symbols\n");
return ret;
}

ret = CHECK_CU(cu->cuInit(0));
p->initialized = true;

if (ret >= 0)
p->initialized = true;

return ret;
}
Expand All @@ -95,11 +104,6 @@ static int cuda_init(struct ra_hwdec *hw)
CudaFunctions *cu;
int level = hw->probing ? MSGL_V : MSGL_ERR;

ret = cuda_load_functions(&p->cu, NULL);
if (ret != 0) {
MP_MSG(hw, level, "Failed to load CUDA symbols\n");
return -1;
}
cu = p->cu;

// Initialise CUDA context from backend.
Expand Down

0 comments on commit b80b40f

Please sign in to comment.