How to display CUDA AVFrame on Egl surface

I have setup ffmpeg to decode some video using NVDEC:

  // Allocate hardware device context
  AVBufferRef *hw_device_ctx = nullptr;
  int err = av_hwdevice_ctx_create(&hw_device_ctx, AV_HWDEVICE_TYPE_CUDA,
                                   nullptr, 
                                   nullptr, 0);
  if (err < 0)
    return NoHarwareDecoding;
  m_hwDeviceContext = hw_device_ctx;
  m_codecContext->hw_device_ctx = av_buffer_ref(m_hwDeviceContext);
  if (!m_codecContext->hw_device_ctx)
    return NoHarwareDecoding;
  m_codecContext->get_format = get_hw_format;

  if (avcodec_open2(m_codecContext, m_codec, nullptr) < 0)
    return NoHarwareDecoding;


And now i want to display the frame on an egl surface on Linux wayland. I’ve already done it for VAAPI and it works but i’m trying to achieve native Nvidia support on linux:

  //av frame data
  std::cout << m_paper->m_frame->data[0] << std::endl;
  std::cout << m_paper->m_frame->data[1] << std::endl;

For vaapi i was able to obtain the vasurfaceid and was good from there, i don’t know what to do for CUDA. Can’t find any samples either. Any guidance would be appreciated.