[c-host] nvfbc: print out the SDK version and enable NvFBC

This commit is contained in:
Geoffrey McRae 2019-05-23 14:49:38 +10:00
parent 09d4fea9e2
commit afe072adf1
2 changed files with 37 additions and 9 deletions

View File

@ -1 +1 @@
a12-212-g58c3fba6b9+1
a12-213-g09d4fea9e2+1

View File

@ -37,6 +37,7 @@ struct NVAPI
NvFBC_SetGlobalFlagsType setGlobalFlags;
NvFBC_GetStatusExFunctionType getStatusEx;
NvFBC_EnableFunctionType enable;
NvFBC_GetSDKVersionFunctionType getVersion;
};
struct stNvFBCHandle
@ -62,8 +63,35 @@ bool NvFBCInit()
nvapi.createEx = (NvFBC_CreateFunctionExType )GetProcAddress(nvapi.dll, "NvFBC_CreateEx" );
nvapi.setGlobalFlags = (NvFBC_SetGlobalFlagsType )GetProcAddress(nvapi.dll, "NvFBC_SetGlobalFlags");
nvapi.getStatusEx = (NvFBC_GetStatusExFunctionType)GetProcAddress(nvapi.dll, "NvFBC_GetStatusEx" );
nvapi.getStatusEx = (NvFBC_GetStatusExFunctionType )GetProcAddress(nvapi.dll, "NvFBC_GetStatusEx" );
nvapi.enable = (NvFBC_EnableFunctionType )GetProcAddress(nvapi.dll, "NvFBC_Enable" );
nvapi.getVersion = (NvFBC_GetSDKVersionFunctionType)GetProcAddress(nvapi.dll, "NvFBC_GetSDKVersion" );
if (
!nvapi.createEx ||
!nvapi.setGlobalFlags ||
!nvapi.getStatusEx ||
!nvapi.enable ||
!nvapi.getVersion)
{
DEBUG_ERROR("Failed to get the required proc addresses");
return false;
}
NvU32 version;
if (nvapi.getVersion(&version) != NVFBC_SUCCESS)
{
DEBUG_ERROR("Failed to get the NvFBC SDK version");
return false;
}
DEBUG_INFO("NvFBC SDK Version: %lu", version);
if (nvapi.enable(NVFBC_STATE_ENABLE) != NVFBC_SUCCESS)
{
DEBUG_ERROR("Failed to enable the NvFBC interface");
return false;
}
nvapi.initialized = true;
return true;