VDPAU error: GPU at BusId 0x2 doesn't have a supported video decoder

When I try to use vdpauinfo, I got the following error:

$ export VDPAU_TRACE=2
$ export VDPAU_NVIDIA_DEBUG=3
$ vdpauinfo 
display: :0.0   screen: 0
VDPAU capture: Enabled
vdp_imp_device_create_x11(0x55e4ab2b1e70, 0, -, -)
GPU at BusId 0x2 doesn't have a supported video decoder
VDPAU nvidia: Version: NVIDIA VDPAU Driver Shared Library  418.43  Tue Feb 19 01:03:14 CST 2019
VDPAU nvidia: Error detected 9 373  3
VDPAU nvidia: Backtrace:
--: /usr/lib/x86_64-linux-gnu/vdpau/libvdpau_nvidia.so.1 [0x7f061682d000] DSO load base
00: /usr/lib/x86_64-linux-gnu/vdpau/libvdpau_nvidia.so.1 [0x7f061686551c] 
01: /usr/lib/x86_64-linux-gnu/vdpau/libvdpau_nvidia.so.1 [0x7f0616854033] 
02: /usr/lib/x86_64-linux-gnu/vdpau/libvdpau_nvidia.so.1 [0x7f06168374f1] vdp_imp_device_create_x11
    -> 1
Error creating VDPAU device: 1

It seems like VDPAU driver complains about Intel iGPU, cause it is attached to PCI:0:2:0

I’ve created xorg.conf according to driver documentation, to use NVidia dGPU as a primary GPU:

$ cat /etc/X11/xorg.conf
Section "ServerLayout"
    Identifier "layout"
    Screen 0 "nvidia"
    Inactive "intel"
EndSection

Section "Device"
    Identifier	"nvidia"
    Driver	"nvidia"
    BusID	"PCI:2:0:0"
EndSection

Section "Screen"
    Identifier	"nvidia"
    Device	"nvidia"
    Option	"AllowEmptyInitialConfiguration"
EndSection

Section "Device"
    Identifier	"intel"
    Driver	"modesetting"
    BusID	"PCI:0:2:0"
EndSection

Section "Screen"
    Identifier	"intel"
    Device	"intel"
EndSection

glxinfo, glxgears and nvidia-smi shows that OpenGL works fine. Rendering is done using NVidia dGPU.

$ glxinfo | grep -i vendor
server glx vendor string: NVIDIA Corporation
client glx vendor string: NVIDIA Corporation
OpenGL vendor string: NVIDIA Corporation
$ nvidia-smi
Tue Mar 12 22:10:04 2019       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 418.43       Driver Version: 418.43       CUDA Version: 10.1     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  Quadro P500         Off  | 00000000:02:00.0 Off |                  N/A |
| N/A   49C    P0    N/A /  N/A |    271MiB /  2002MiB |     22%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1349      G   /usr/lib/xorg/Xorg                           266MiB |
|    0      3051      G   ./insync                                       3MiB |
|    0     10573      G   glxgears                                       1MiB |
+-----------------------------------------------------------------------------+

prime-select shows that nvidia is selected:

$ prime-select query
nvidia

System is Ubuntu LTS 18.04.2, driver is 418.43, kernel 4.18.0-16-generic, Xorg 1.19.6

lspci output is:

00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers (rev 08)
00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 620 (rev 07)
00:04.0 Signal processing controller: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Thermal Subsystem (rev 08)
00:08.0 System peripheral: Intel Corporation Xeon E3-1200 v5/v6 / E3-1500 v5 / 6th/7th Gen Core Processor Gaussian Mixture Model
00:14.0 USB controller: Intel Corporation Sunrise Point-LP USB 3.0 xHCI Controller (rev 21)
00:14.2 Signal processing controller: Intel Corporation Sunrise Point-LP Thermal subsystem (rev 21)
00:16.0 Communication controller: Intel Corporation Sunrise Point-LP CSME HECI #1 (rev 21)
00:1c.0 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #1 (rev f1)
00:1c.6 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #7 (rev f1)
00:1d.0 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #9 (rev f1)
00:1d.2 PCI bridge: Intel Corporation Device 9d1a (rev f1)
00:1f.0 ISA bridge: Intel Corporation Intel(R) 100 Series Chipset Family LPC Controller/eSPI Controller - 9D4E (rev 21)
00:1f.2 Memory controller: Intel Corporation Sunrise Point-LP PMC (rev 21)
00:1f.3 Audio device: Intel Corporation Sunrise Point-LP HD Audio (rev 21)
00:1f.4 SMBus: Intel Corporation Sunrise Point-LP SMBus (rev 21)
00:1f.6 Ethernet controller: Intel Corporation Ethernet Connection (4) I219-V (rev 21)
02:00.0 3D controller: NVIDIA Corporation GP108GLM [Quadro P500 Mobile] (rev a1)
04:00.0 Network controller: Intel Corporation Wireless 8265 / 8275 (rev 78)
40:00.0 Non-Volatile memory controller: Samsung Electronics Co Ltd NVMe SSD Controller SM981/PM981

It seems like VDPAU driver has bug. It should ignore Intel integrated GPU. Instead it tries to initialize it and fails. And then fail the whole VDPAU initialization.
nvidia-bug-report.log.gz (979 KB)