Any advise for a new user to get hw accelerated video working with gpu-passthrough?

Hello everyone,

I used fedora-40 template in HVM mode and kernel provided with qube, I have passed the gpu and related devices to vm.

05:00.0 VGA compatible controller: NVIDIA Corporation TU102 [GeForce RTX 2080 Ti Rev. A] (rev a1)
05:00.1 Audio device: NVIDIA Corporation TU102 High Definition Audio Controller (rev a1)
05:00.2 USB controller: NVIDIA Corporation TU102 USB 3.1 Host Controller (rev a1)
05:00.3 Serial bus controller: NVIDIA Corporation TU102 USB Type-C UCSI Controller (rev a1)

Iā€™m using nvidia proprietary drivers, nvidia-smi shows 565.77 version. Output from vainfo and vdpauinfo also seems fine and lists HEVC decoder.

When I try to play HEVC encoded video with ā€œmpv --hwdec=autoā€, I get this kind of output:

MESA-LOADER: failed to open bochs-drm: /usr/lib64/dri/bochs-drm_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib64/dri, suffix _dri)
ā€¦
[vo/gpu/drm] Picked DRM card 1, primary node /dev/dri/card1 as the default.
ā€¦
[vd] Selected codec: HEVC (High Efficiency Video Coding)
ā€¦
[vd] Using hardware decoding (nvdec).
ā€¦
[vo/gpu] Loading hwdec drivers for format: ā€˜cudaā€™

full mpv log

From what I understood, that error might not matter but then again, I donā€™t understand that much.

So it says itā€™s using hardware decoding but there are dropped frames and nvtop shows over 100% cpu load on 1080p video, so it doesnā€™t seem to be working any better than software rendering and canā€™t play 4k videos. So, I donā€™t think itā€™s working correctly.

Is this be because I still use qubes display and can this even work without me having its own output on passed through gpu? In ~/.local/share/xorg/Xorg.0.log I have this:

[ 9.130] (II) AIGLX: Screen 0 is not DRI2 capable
[ 9.245] (II) IGLX: Loaded and initialized swrast

Xorg sees two cards but there are errors:

[ 8.885] (II) xfree86: Adding drm device (/dev/dri/card1)
[ 8.886] (II) systemd-logind: got fd for /dev/dri/card1 226:1 fd 13 paused 1
[ 8.886] (EE) Error systemd-logind returned paused fd for drm node
[ 8.886] (II) systemd-logind: releasing fd for 226:1
[ 8.886] (II) xfree86: Adding drm device (/dev/dri/card0)
[ 8.887] (II) systemd-logind: got fd for /dev/dri/card0 226:0 fd 14 paused 1
[ 8.887] (EE) Error systemd-logind returned paused fd for drm node
[ 8.887] (II) systemd-logind: releasing fd for 226:0

Xorg log also has this but I have no idea what it means:

[ 9.279] (**) qubesdev: (accel) keeping acceleration scheme 1
[ 9.279] (**) qubesdev: (accel) acceleration profile 0
[ 9.279] (**) qubesdev: (accel) acceleration factor: 2.000
[ 9.279] (**) qubesdev: (accel) acceleration threshold: 4
[ 9.279] (II) qubesdev: On.

It seems so close to be working. Any hints?

Edit:
With mpv --vo=x11 -profile=sw-fast I now get just 16% cpu load on 4k hevc video and no dropped frames. It says that itā€™s using software decoding but I didnā€™t get this smooth video with that same command line without a gpu. This is much better than when it supposedly used hardware decoding. I donā€™t understand whatā€™s going on but Iā€™m happy my videos are playing.

1 Like