summaryrefslogtreecommitdiffstats
path: root/libhb/nvenc_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'libhb/nvenc_common.c')
-rw-r--r--libhb/nvenc_common.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/libhb/nvenc_common.c b/libhb/nvenc_common.c
index 15d839e2d..538ea4f39 100644
--- a/libhb/nvenc_common.c
+++ b/libhb/nvenc_common.c
@@ -35,6 +35,7 @@ int hb_nvenc_h265_available()
#endif
}
+static int isAvailable = -1;
int hb_check_nvenc_available()
{
if (is_hardware_disabled())
@@ -42,6 +43,10 @@ int hb_check_nvenc_available()
return 0;
}
+ if (isAvailable != -1){
+ return isAvailable;
+ }
+
#if HB_PROJECT_FEATURE_NVENC
uint32_t nvenc_ver;
void *context = NULL;
@@ -49,15 +54,25 @@ int hb_check_nvenc_available()
int loadErr = nvenc_load_functions(&nvenc_dl, context);
if (loadErr < 0) {
+ isAvailable = 0;
return 0;
}
NVENCSTATUS apiErr = nvenc_dl->NvEncodeAPIGetMaxSupportedVersion(&nvenc_ver);
if (apiErr != NV_ENC_SUCCESS)
{
+ isAvailable = 0;
+ return 0;
+ }
+
+ hb_log("Nvenc version %d.%d\n", nvenc_ver >> 4, nvenc_ver & 0xf);
+ if ((NVENCAPI_MAJOR_VERSION << 4 | NVENCAPI_MINOR_VERSION) > nvenc_ver) {
+ hb_log("NVENC version not supported. Disabling feature.");
+ isAvailable = 0;
return 0;
}
+ isAvailable = 1;
return 1;
#else
return 0;