NV_ENC_ERR_UNSUPPORTED_DEVICE on nvEncOpenEncodeSessionEx

After updating driver to 398.36 on one of our test machines(gtx 970, maxwell), nvidia encoding is failed in nvEncOpenEncodeSessionEx with NV_ENC_ERR_UNSUPPORTED_DEVICE.

Following code is what I am using for opening nvidia encoding session… Any idea?

NVENCSTATUS CNvHWEncoder::NvEncOpenEncodeSessionEx(void* device, NV_ENC_DEVICE_TYPE deviceType) {
  NVENCSTATUS nvStatus = NV_ENC_SUCCESS;
  NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS openSessionExParams;

  memset(&openSessionExParams, 0, sizeof(openSessionExParams));
  SET_VER(openSessionExParams, NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS);

  openSessionExParams.device = device;
  openSessionExParams.deviceType = deviceType;
  openSessionExParams.apiVersion = NVENCAPI_VERSION;

  nvStatus = m_pEncodeAPI->nvEncOpenEncodeSessionEx(&openSessionExParams, &m_hEncoder);
  ...
}

Hi hmGo,

Could you provide the following information:

  1. Encode API version
  2. Operating system
  3. Could you also share an application using the encode API that can reproduce the issue?

Thanks,
Ryan Park

Hi Ryan,

I found the reason…
Now I am using triple monitors and two of them were connecting to mother board, not nvidia card.
I could resolve it with connecting those monitors to nvidia card.
But here is question… Why it causes this plen when some of monitors are connected to mother board?

Which device type are you using here? Is it DX or CUDA?

For a moment, assuming that you are using DX device here, it seems that you may be passing a device created on a non-NVIDIA adapter to nvEncOpenEncodeSessionEx. If the device is not created a proper adapter then nvEncOpenEncodeSessionEx API is expected to fail.

What we think/guess could be happening here is when you are connecting all your displays to NVIDIA card, then the adapter being enumerated is NVIDIA’s and device is created on NV GPU and hence nvEncOpenEncodeSessionEx started to pass.

Thanks,
Ryan Park

Yes I am using DX device…
If so, there is no way to create the device on Nvidia adapter by force no matter what monitors are connected to mother board and graphics card together?
I’m also using NvOptimusEnablement api just in case.

while doing encoding getting below logs…

GPU in use: TITAN RTX
unknown file: Failure
C++ exception with description "NvEncoder : m_nvenc.nvEncOpenEncodeSessionEx(&encodeSessionExParams, &hEncoder) returned error 2 .

any idea ?

Q:
NvEncOpenEncodeSessionEx(void* device, NV_ENC_DEVICE_TYPE deviceType) return 2 (NV_ENC_ERR_UNSUPPORTED_DEVICE)

A:
does void* device refer nvidia GPU? (multiply GPU on board such as laptop)

try

  1. Enumerating nvidia Adapter
  2. Create Device with nvidia adapter
    D3D11CreateDevice(pAdapter, D3D_DRIVER_TYPE_UNKNOWN, …
  3. open encode session with nvidia device