NVIDIA
NVIFR_ERROR_DX_DRIVER_FAILURE
OS: windows Server 2012 x64 GPU: NVIDIA GRID K520 Driver Version: 354.1 (Link: [url]http://www.nvidia.com/download/driverResults.aspx/95515/en-us[/url]) I am getting ID3D10Device by hooking into DXGISwapChain::Present() method and then `This->GetDevice(IID_ID3D10Device, &ppDevice);` The problem is that `g_pIFR->NvIFRSetUpH264HWEncoder(&params);` returns -4 or NVIFR_ERROR_DX_DRIVER_FAILURE. Why is that? [code] int InitNVIFR(ID3D10Device *g_pD3DDevice) { HINSTANCE g_hNvIFRDll=NULL; NvIFRLibrary NvIFRLib; //! Load the NvIFR.dll library if(NULL == (g_hNvIFRDll = NvIFRLib.load())) return -1; //! Create the NvIFRToH264HWEncoder object g_pIFR = (NvIFRToH264HWEncoder *) NvIFRLib.create (g_pD3DDevice, NVIFR_TOH264HWENCODER); if(NULL == g_pIFR) { gbx_error("Failed to create the NvIFRToH264HWEncoder\r\n"); return -1; } for (DWORD i = 0; i < NUMFRAMESINFLIGHT; i++) { //! Create the events for allowing rendering to continue after a capture is complete g_aCanRenderEvents[i] = CreateEvent(NULL, TRUE, TRUE, NULL); } g_hThreadQuitEvent = CreateEvent(NULL, TRUE, FALSE, NULL); //! Set up the H.264 encoder and target buffers DWORD dwBitRate720p = 3000000; double dBitRate = double(dwBitRate720p); NvIFR_H264HWEncoder_Config encodeConfig = {0}; encodeConfig.dwVersion = NVIFR_H264HWENCODER_CONFIG_VER; encodeConfig.dwAvgBitRate = (DWORD)dBitRate; encodeConfig.dwFrameRateDen = 1; encodeConfig.dwFrameRateNum = 30; encodeConfig.dwPeakBitRate = (encodeConfig.dwAvgBitRate * 12/10); // +20% encodeConfig.dwGOPLength = 0xffffffff; encodeConfig.bEnableIntraRefresh = 1; encodeConfig.dwMaxNumRefFrames = 16; encodeConfig.dwProfile = 100; encodeConfig.eRateControl = NVIFR_H264_ENC_PARAMS_RC_2_PASS_QUALITY; encodeConfig.ePresetConfig = NVIFR_H264_PRESET_LOW_LATENCY_HQ; encodeConfig.dwQP = 26; encodeConfig.bEnableAQ = 1; NVIFR_SETUP_H264_PARAMS params = {0}; params.dwVersion = NVIFR_SETUP_H264_PARAMS_VER; params.pEncodeConfig = &encodeConfig; params.eStreamStereoFormat = NVIFR_H264_STEREO_NONE; params.dwNBuffers = NUMFRAMESINFLIGHT; params.dwBSMaxSize = 256*1024; params.ppPageLockedBitStreamBuffers = g_pMainBuffer; params.ppEncodeCompletionEvents = g_hCaptureCompleteEvent; params.dwTargetHeight = video_source_out_height(0); params.dwTargetWidth = video_source_out_width(0); NVIFRRESULT res = g_pIFR->NvIFRSetUpH264HWEncoder(&params); if (res != NVIFR_SUCCESS) { if (res == NVIFR_ERROR_INVALID_PARAM || res != NVIFR_ERROR_INVALID_PTR) gbx_error("NvIFR Buffer creation failed due to invalid params.\n"); else gbx_error("Something is wrong with the driver, cannot initialize IFR buffers\n"); return -1; } gbx_error("NVIDIA device configured\n"); nvIfr_initialized = 1; return nvIfr_initialized; } [/code]
OS: windows Server 2012 x64
GPU: NVIDIA GRID K520
Driver Version: 354.1 (Link: http://www.nvidia.com/download/driverResults.aspx/95515/en-us)

I am getting ID3D10Device by hooking into DXGISwapChain::Present() method and then `This->GetDevice(IID_ID3D10Device, &ppDevice);`

The problem is that `g_pIFR->NvIFRSetUpH264HWEncoder(&params);` returns -4 or NVIFR_ERROR_DX_DRIVER_FAILURE. Why is that?

int InitNVIFR(ID3D10Device *g_pD3DDevice)
{
HINSTANCE g_hNvIFRDll=NULL;
NvIFRLibrary NvIFRLib;
//! Load the NvIFR.dll library
if(NULL == (g_hNvIFRDll = NvIFRLib.load()))
return -1;

//! Create the NvIFRToH264HWEncoder object
g_pIFR = (NvIFRToH264HWEncoder *) NvIFRLib.create (g_pD3DDevice, NVIFR_TOH264HWENCODER);
if(NULL == g_pIFR)
{
gbx_error("Failed to create the NvIFRToH264HWEncoder\r\n");
return -1;
}

for (DWORD i = 0; i < NUMFRAMESINFLIGHT; i++)
{
//! Create the events for allowing rendering to continue after a capture is complete
g_aCanRenderEvents[i] = CreateEvent(NULL, TRUE, TRUE, NULL);
}
g_hThreadQuitEvent = CreateEvent(NULL, TRUE, FALSE, NULL);

//! Set up the H.264 encoder and target buffers
DWORD dwBitRate720p = 3000000;
double dBitRate = double(dwBitRate720p);
NvIFR_H264HWEncoder_Config encodeConfig = {0};
encodeConfig.dwVersion = NVIFR_H264HWENCODER_CONFIG_VER;
encodeConfig.dwAvgBitRate = (DWORD)dBitRate;
encodeConfig.dwFrameRateDen = 1;
encodeConfig.dwFrameRateNum = 30;
encodeConfig.dwPeakBitRate = (encodeConfig.dwAvgBitRate * 12/10); // +20%
encodeConfig.dwGOPLength = 0xffffffff;
encodeConfig.bEnableIntraRefresh = 1;
encodeConfig.dwMaxNumRefFrames = 16;
encodeConfig.dwProfile = 100;
encodeConfig.eRateControl = NVIFR_H264_ENC_PARAMS_RC_2_PASS_QUALITY;
encodeConfig.ePresetConfig = NVIFR_H264_PRESET_LOW_LATENCY_HQ;
encodeConfig.dwQP = 26;
encodeConfig.bEnableAQ = 1;

NVIFR_SETUP_H264_PARAMS params = {0};
params.dwVersion = NVIFR_SETUP_H264_PARAMS_VER;
params.pEncodeConfig = &encodeConfig;
params.eStreamStereoFormat = NVIFR_H264_STEREO_NONE;
params.dwNBuffers = NUMFRAMESINFLIGHT;
params.dwBSMaxSize = 256*1024;
params.ppPageLockedBitStreamBuffers = g_pMainBuffer;
params.ppEncodeCompletionEvents = g_hCaptureCompleteEvent;
params.dwTargetHeight = video_source_out_height(0);
params.dwTargetWidth = video_source_out_width(0);

NVIFRRESULT res = g_pIFR->NvIFRSetUpH264HWEncoder(&params);

if (res != NVIFR_SUCCESS)
{
if (res == NVIFR_ERROR_INVALID_PARAM || res != NVIFR_ERROR_INVALID_PTR)
gbx_error("NvIFR Buffer creation failed due to invalid params.\n");
else
gbx_error("Something is wrong with the driver, cannot initialize IFR buffers\n");
return -1;
}

gbx_error("NVIDIA device configured\n");

nvIfr_initialized = 1;
return nvIfr_initialized;
}

#1
Posted 03/07/2016 01:00 PM   
There is more developer-oriented forum [url]https://devtalk.nvidia.com/default/board/55/gpu-accelerated-libraries/[/url] ([url]https://devtalk.nvidia.com/[/url]). I did not read any developer oriented answer on this forum :-(. M.C>
There is more developer-oriented forum https://devtalk.nvidia.com/default/board/55/gpu-accelerated-libraries/ (https://devtalk.nvidia.com/).
I did not read any developer oriented answer on this forum :-(.

M.C>

#2
Posted 03/07/2016 01:27 PM   
Thanks. Posted there as well. Same method works for DirectX 9 but not working for DX 10
Thanks. Posted there as well. Same method works for DirectX 9 but not working for DX 10

#3
Posted 03/08/2016 06:43 AM   
I get the following GridLog [code] ## 0.000 | NvIFR | PID 6788 ## NVIFR_CREATE_PARAMS::dwVersion: 0x22010100 NVIFR_CREATE_PARAMS::dwInterfaceType: 8707 NVIFR_CREATE_PARAMS::pDevice: 0x 004E2064 NVIFR_CREATE_PARAMS::pPrivateData: 0x 00000000 NVIFR_CREATE_PARAMS::dwPrivateDataSize: 0. ## 0.105 | NvIFR | PID 6788 ## : NvIFRCreate_Core ::Entry. ## 0.156 | NvIFR | PID 6788 ## : NvIFRCreate_Core :: Success (NVIFR_SUCCESS). . ## 0.156 | NvIFR | PID 6788 ## NVIFR_CREATE_PARAMS::dwNvIFRVersion: 64 NVIFR_CREATE_PARAMS::pNvIFR: 0x 05162F0C NVIFR_CREATE_PARAMS::result: NVIFR_SUCCESS. ## 8.654 | NvIFR | PID 6788 ## : NvIFRH264Dx1xImp_v2::NvIFRSetUpH264HWEncoder :: Entry. ## 8.654 | NvIFR | PID 6788 ## NVIFR_SETUP_H264_PARAMS_V2::dwVersion: 0x22020180 NVIFR_SETUP_H264_PARAMS_V2::eStreamStereoFormat: NVIFR_H264_STEREO_NONE NVIFR_SETUP_H264_PARAMS_V2::dwTargetWidth: 980 NVIFR_SETUP_H264_PARAMS_V2::dwTargetHeight: 734 NVIFR_SETUP_H264_PARAMS_V2::dwNBuffers: 1 NVIFR_SETUP_H264_PARAMS_V2::dwBSMaxSize: 2097152 NVIFR_SETUP_H264_PARAMS_V2::ppPageLockedBitStreamBuffers: 0x 5EA2A400 NVIFR_SETUP_H264_PARAMS_V2::ppEncodeCompletionEvents: 0x 5EA2A3E4 NVIFR_SETUP_H264_PARAMS_V2::dwBitStreamOffset: 0 NVIFR_SETUP_H264_PARAMS_V2::bIsCustomYUV444: 0. ## 8.655 | NvIFR | PID 6788 ## NvIFR_H264HWEncoder_Config_V2::dwVersion: 0x22020180 NvIFR_H264HWEncoder_Config_V2::dwProfile: 100 NvIFR_H264HWEncoder_Config_V2::dwFrameRateNum: 30 NvIFR_H264HWEncoder_Config_V2::dwFrameRateDen: 1 NvIFR_H264HWEncoder_Config_V2::dwAvgBitRate: 3000000 NvIFR_H264HWEncoder_Config_V2::dwPeakBitRate: 3600000 NvIFR_H264HWEncoder_Config_V2::dwGOPLength: 75 NvIFR_H264HWEncoder_Config_V2::dwQP: 26 NvIFR_H264HWEncoder_Config_V2::maxRCQP[P frame]: 0 NvIFR_H264HWEncoder_Config_V2::maxRCQP[B frame]: 0 NvIFR_H264HWEncoder_Config_V2::maxRCQP[I frame]: 0 NvIFR_H264HWEncoder_Config_V2::bUseMaxRCQP: 0 NvIFR_H264HWEncoder_Config_V2::bRepeatSPSPPSHeader: 0 NvIFR_H264HWEn. ## 8.655 | NvIFR | PID 6788 ## : NvIFRH264Dx1xImp_v0::CleanUp :: Exit. ## 8.655 | NvIFR | PID 6788 ## : NvIFRDx10::SetCurrentRenderTarget :: Error (NVIFR_ERROR_GENERIC). . ## 8.655 | NvIFR | PID 6788 ## : NvIFRH264Dx1xImp_v2::NvIFRSetUpH264HWEncoder :: got driver error unknown return code from driver. ## 8.655 | NvIFR | PID 6788 ## : NvIFRH264Dx1xImp_v2::NvIFRSetUpH264HWEncoder :: Error (NVIFR_ERROR_DX_DRIVER_FAILURE). Failed to set current RenderTarget.. [/code]
I get the following GridLog

## 0.000 | NvIFR | PID 6788 ## 
NVIFR_CREATE_PARAMS::dwVersion: 0x22010100
NVIFR_CREATE_PARAMS::dwInterfaceType: 8707
NVIFR_CREATE_PARAMS::pDevice: 0x 004E2064
NVIFR_CREATE_PARAMS::pPrivateData: 0x 00000000
NVIFR_CREATE_PARAMS::dwPrivateDataSize: 0.
## 0.105 | NvIFR | PID 6788 ## : NvIFRCreate_Core ::Entry.
## 0.156 | NvIFR | PID 6788 ## : NvIFRCreate_Core :: Success (NVIFR_SUCCESS). .
## 0.156 | NvIFR | PID 6788 ##
NVIFR_CREATE_PARAMS::dwNvIFRVersion: 64
NVIFR_CREATE_PARAMS::pNvIFR: 0x 05162F0C
NVIFR_CREATE_PARAMS::result: NVIFR_SUCCESS.
## 8.654 | NvIFR | PID 6788 ## : NvIFRH264Dx1xImp_v2::NvIFRSetUpH264HWEncoder :: Entry.
## 8.654 | NvIFR | PID 6788 ##
NVIFR_SETUP_H264_PARAMS_V2::dwVersion: 0x22020180
NVIFR_SETUP_H264_PARAMS_V2::eStreamStereoFormat: NVIFR_H264_STEREO_NONE
NVIFR_SETUP_H264_PARAMS_V2::dwTargetWidth: 980
NVIFR_SETUP_H264_PARAMS_V2::dwTargetHeight: 734
NVIFR_SETUP_H264_PARAMS_V2::dwNBuffers: 1
NVIFR_SETUP_H264_PARAMS_V2::dwBSMaxSize: 2097152
NVIFR_SETUP_H264_PARAMS_V2::ppPageLockedBitStreamBuffers: 0x 5EA2A400
NVIFR_SETUP_H264_PARAMS_V2::ppEncodeCompletionEvents: 0x 5EA2A3E4
NVIFR_SETUP_H264_PARAMS_V2::dwBitStreamOffset: 0
NVIFR_SETUP_H264_PARAMS_V2::bIsCustomYUV444: 0.
## 8.655 | NvIFR | PID 6788 ##
NvIFR_H264HWEncoder_Config_V2::dwVersion: 0x22020180
NvIFR_H264HWEncoder_Config_V2::dwProfile: 100
NvIFR_H264HWEncoder_Config_V2::dwFrameRateNum: 30
NvIFR_H264HWEncoder_Config_V2::dwFrameRateDen: 1
NvIFR_H264HWEncoder_Config_V2::dwAvgBitRate: 3000000
NvIFR_H264HWEncoder_Config_V2::dwPeakBitRate: 3600000
NvIFR_H264HWEncoder_Config_V2::dwGOPLength: 75
NvIFR_H264HWEncoder_Config_V2::dwQP: 26
NvIFR_H264HWEncoder_Config_V2::maxRCQP[P frame]: 0
NvIFR_H264HWEncoder_Config_V2::maxRCQP[B frame]: 0
NvIFR_H264HWEncoder_Config_V2::maxRCQP[I frame]: 0
NvIFR_H264HWEncoder_Config_V2::bUseMaxRCQP: 0
NvIFR_H264HWEncoder_Config_V2::bRepeatSPSPPSHeader: 0
NvIFR_H264HWEn.
## 8.655 | NvIFR | PID 6788 ## : NvIFRH264Dx1xImp_v0::CleanUp :: Exit.
## 8.655 | NvIFR | PID 6788 ## : NvIFRDx10::SetCurrentRenderTarget :: Error (NVIFR_ERROR_GENERIC). .
## 8.655 | NvIFR | PID 6788 ## : NvIFRH264Dx1xImp_v2::NvIFRSetUpH264HWEncoder :: got driver error unknown return code from driver.
## 8.655 | NvIFR | PID 6788 ## : NvIFRH264Dx1xImp_v2::NvIFRSetUpH264HWEncoder :: Error (NVIFR_ERROR_DX_DRIVER_FAILURE). Failed to set current RenderTarget..

#4
Posted 03/08/2016 09:38 AM   
Scroll To Top

Add Reply