How to Identify Which /dev/dri/renderD Device Is Your AMD Radeon GPU

If your PC has more than one GPU, the Radeon card is not necessarily at /dev/dri/renderD128. Use the steps below to find the correct render node for hardware-accelerated video encoding with av1_vaapi or h264_vaapi.

1. List the DRM devices

list_dri.sh
ls -l /dev/dri/

On this machine the output is:

dri_devices.txt
crw-rw----+1 root video  226,   1 Sep 12 02:06 card1
crw-rw----+1 root video  226,   2 Sep 12 02:06 card2
crw-rw----+1 root render 226, 128 Sep 12 02:06 renderD128
crw-rw----+1 root render 226, 129 Sep 12 02:06 renderD129

renderD128 and renderD129 are the two render nodes. To find which belongs to the Radeon, continue with the next steps.

2. Map the device to a PCI device

The by-path symlinks show which PCI function each render node belongs to:

dri_by_path.sh
ls -l /dev/dri/by-path/
dri_by_path.txt
lrwxrwxrwx+1 root root  8 Sep 11 05:01 pci-0000:00:02.0-card -> ../card1
lrwxrwxrwx+1 root root 13 Sep 11 05:01 pci-0000:00:02.0-render -> ../renderD128
lrwxrwxrwx+1 root root  8 Sep 11 05:01 pci-0000:03:00.0-card -> ../card2
lrwxrwxrwx+1 root root 13 Sep 11 05:01 pci-0000:03:00.0-render -> ../renderD129

Here renderD128 is on PCI 0000:00:02.0 and renderD129 is on 0000:03:00.0.

3. Match the PCI address to a GPU name

lspci_gpu.sh
lspci -k | grep -iE 'vga|display|3d'
lspci_gpu.txt
00:02.0 Display controller: Intel Corporation Skylake-S GT2 [HD Graphics 530] (rev 06)
03:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Navi 32 [Radeon RX 7700 XT / 7800 XT] (rev c8)

So on this PC the AMD Radeon is the device at 03:00.0, and the matching render node is /dev/dri/renderD129.

4. Confirm VAAPI on the chosen render node

Run vainfo against the render node you suspect belongs to the Radeon, here renderD129:

vainfo_radeon.sh
LIBVA_DRIVER_NAME=radeonsi vainfo --display drm --device /dev/dri/renderD129
vainfo_radeon.txt
libva info: VA-API version 1.23.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/radeonsi_drv_video.so
libva info: va_openDriver() returns 0
Trying display: drm
vainfo: VA-API version: 1.23 (libva 2.22.0)
vainfo: Driver version: Mesa Gallium driver 26.0.8-1ubuntu0.3 for AMD Radeon RX 7800 XT (radeonsi, navi32, ACO, DRM 3.64, 7.0.0-31-generic)
vainfo: Supported profile and entrypoints
      VAProfileH264ConstrainedBaseline:	VAEntrypointVLD
      VAProfileH264ConstrainedBaseline:	VAEntrypointEncSlice
      ...
      VAProfileAV1Profile0            :	VAEntrypointVLD
      VAProfileAV1Profile0            :	VAEntrypointEncSlice

The EncSlice entry for VAProfileAV1Profile0 confirms that AV1 hardware encoding is available on this device.

Summary

Use ls /dev/dri/ to see the available render nodes, then map each one to a PCI address with ls /dev/dri/by-path/. Cross-check the PCI address with lspci -k | grep -iE 'vga|display|3d' to find which one is the AMD Radeon. Finally, run vainfo --display drm --device /dev/dri/renderD... on that node to confirm the VAEntrypointEncSlice for AV1 is present.

Once you know the correct device, use it in the FFmpeg VAAPI command, for example:

example_ffmpeg.sh
LIBVA_DRIVER_NAME=radeonsi ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD129 -hwaccel_output_format vaapi -i input.mp4 -c:v av1_vaapi -rc_mode CQP -global_quality:v 105 -c:a copy output.mkv

Check out similar posts by category: Linux Video