Subject: VDPAU can't find backends
From: John Kehayias <[email-masked]>
To: Guix Bugs <[email-masked]>
Date: Tue, 21 Mar 2023 01:39:34 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi Guix,

Currently VDPAU, through libvdpau, can't find backends as they are not part of where it will search:

<https://vdpau.pages.freedesktop.org/libvdpau/group__api__winsys__x11.html>

Namely, it will search where it is configured to at build time via pkg-config, but for us our backends will be somewhere in the store unknown unless we include e.g. mesa as an input. Rather than increasing the closure to include any VDPAU backends (I know of mesa and libvdpau-va-gl), an environment variable can be specified at runtime, VDPAU_DRIVER_PATH.

However, I'm not sure how we can use that as a search path unless we require users to install libvdpau and a backend, like mesa, in their profile. This doesn't seem like the cleanest option.

Any other options?

For testing, here is mpv not finding a VDPAU backend (trying with vaapi or hwdec auto will use vaapi successfully):

--8<---------------cut here---------------start------------->8---
❯ guix shell mpv -- mpv -vo=vdpau ~/test.mkv
 (+) Video --vid=1 (*) (h264 1920x1080 30.000fps)
 (+) Audio --aid=1 (*) 'Track1' (aac 2ch 48000Hz)
Failed to open VDPAU backend libvdpau_radeonsi.so: cannot open shared object file: No such file or directory
[vo/vdpau] Error when calling vdp_device_create_x11: 1
Error opening/initializing the selected video_out (--vo) device.
Video: no video

Exiting... (Errors when loading file)
--8<---------------cut here---------------end--------------->8---

but we can specify mesa explicitly:

--8<---------------cut here---------------start------------->8---
❯ VDPAU_DRIVER_PATH=$(guix build mesa | tail -n1)/lib/vdpau guix shell mpv -- mpv -vo=vdpau ~/test.mkv
 (+) Video --vid=1 (*) (h264 1920x1080 30.000fps)
 (+) Audio --aid=1 (*) 'Track1' (aac 2ch 48000Hz)
[vo/vdpau] Warning: this compatibility VO is low quality and may have issues with OSD, scaling, screenshots and more.
[vo/vdpau] vo=gpu is the preferred choice in any case and includes VDPAU support via hwdec=vdpau or vdpau-copy.
AO: [pulse] 48000Hz stereo 2ch float
VO: [vdpau] 1920x1080 yuv420p
[vo/vdpau] Compositing window manager detected. Assuming timing info is inaccurate.
AV: 00:00:00 / 00:20:25 (0%) A-V:  0.005 DS: 2.067/0

Exiting... (Quit)
--8<---------------cut here---------------end--------------->8---

Or, of course, using vdpauinfo:

--8<---------------cut here---------------start------------->8---
❯ guix shell vdpauinfo -- vdpauinfo
display: :0.0   screen: 0
Failed to open VDPAU backend libvdpau_radeonsi.so: cannot open shared object file: No such file or directory
Error creating VDPAU device: 1
❯ VDPAU_DRIVER_PATH=$(guix build mesa | tail -n1)/lib/vdpau guix shell vdpauinfo -- vdpauinfo
display: :0.0   screen: 0
API version: 1
Information string: G3DVL VDPAU Driver Shared Library version 1.0

Video surface:

name   width height types
------------------------------------------------------------------------
420    16384 16384  NV12 YV12
422    16384 16384  UYVY YUYV
444    16384 16384  Y8U8V8A8 V8U8Y8A8
420_16 16384 16384
422_16 16384 16384
444_16 16384 16384

[...]
--8<---------------cut here---------------end--------------->8---

John

PS: I didn't check in detail, but I would guess <https://issues.guix.gnu.org/48868> is related; though there at least mesa is an input for VLC (including libvdpau-va-gl wouldn't be much for a 1.6 gig package already).