Skip to content

[Bug]: Nix GPU Acceleration / AMD GPU Support #417

Closed
@zierf

Description

@zierf

Checklist

  • I am using an up-to-date version.
  • I have read the documentation.
  • I have searched existing issues.

TagStudio Version

main #cb4798b

Operating System & Version

NixOS 24.11 (Vicuna), 24.11.20240818.8a33541 | nixpkgs-unstable#8a33541 | KDE

Description

It looks like Nix Flake is missing a qt6.full dependency listing for video playback, which means the video preview remains empty (Wayland and X11).

Screenshot_20240830_000755

This is also noted in the console log at the beginning, but when clicking a video only Playing … appears as normal and no further error message.

No QtMultimedia backends found. Only QMediaDevices, QAudioDevice, QSoundEffect, QAudioSink, and QAudioSource are available.
Failed to initialize QMediaPlayer "Not available"
Failed to create QVideoSink "Not available"
# ...
Playing /MEDIA_PATH/big_buck_bunny_1080p_h264.mov

After adding the qt6.full dependency, video playback in the preview window works for X11.

Video playback would work under Wayland too, but only using the CPU.
So an additional entry for wayland libraries in the library search path is needed.

Without the Wayland libraries, this error message would appear.
qt.qpa.wayland: EGL not available
# ...
Playing /MEDIA_PATH/big_buck_bunny_1080p_h264.mov
QRhi* initializeRHI(QRhi*) : No RHI backend. Using CPU conversion.

Running QT Creator results in a similar message.

qt.qpa.wayland: EGL not available
Warning: fallback to QtQuick software backend.

Screenshot_20240830_011211

The only ugly thing that remains is that PySide6 seems to rely only on VDPAU for hardware-accelerated video playback and apparently still wants to use a hard-coded NVIDIA library.

Playing /MEDIA_PATH/big_buck_bunny_1080p_h264.mov
Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file: No such file or directory

Fortunately, the driver to be used can at least be overridden for the free AMD driver with the environment variable VDPAU_DRIVER=radeonsi, which provides a translation layer for VDPAU to VA-API.

Use VDPAU for AMD driver.

AMD driver provides VA-API out of the box:

$> nix shell nixpkgs#libva-utils -c vainfo

Trying display: wayland
libva info: VA-API version 1.22.0
libva info: Trying to open /run/opengl-driver/lib/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_1_22
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.22 (libva 2.22.0)
vainfo: Driver version: Mesa Gallium driver 24.1.5 for AMD Radeon RX 6900 XT (radeonsi, navi21, LLVM 18.1.8, DRM 3.57, 6.10.5-xanmod1)
# ...

No VDPAU support without overriding the proper driver:

$> nix shell nixpkgs#vdpauinfo -c vdpauinfo

display: :0   screen: 0
Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file: No such file or directory
Error creating VDPAU device: 1

Overriding the VDPAU driver to use VDPAU on an AMD GPU:

$> VDPAU_DRIVER=radeonsi nix shell nixpkgs#vdpauinfo -c vdpauinfo

display: :0   screen: 0
API version: 1
Information string: G3DVL VDPAU Driver Shared Library version 1.0

Video surface:
# ...

I can submit a pull request that enables hardware acceleration for the Nix-Flake.

The free AMD driver should be detected and the VDPAU driver will be overwritten, provided the user has not already explicitly set the environment variable VDPAU_DRIVER. For Nvidia GPUs, the variable simply remains unset.

Expected Behavior

Clicking on a video file should play the video in the preview window on the right.

Steps to Reproduce

  1. Open TagStudio
  2. Click on a video file

Logs

Branch main (Commit #cb4798b)
$> tagstudio

[ResourceManager] 4 resources registered
[QT DRIVER] Config File not specified, defaulting to /home/USER/.config/TagStudio/TagStudio.ini
No QtMultimedia backends found. Only QMediaDevices, QAudioDevice, QSoundEffect, QAudioSink, and QAudioSource are available.
Failed to initialize QMediaPlayer "Not available"
Failed to create QVideoSink "Not available"
Calling NavForward with Content:False, Index:0, PageCount:0
[ENTRY PANEL] UPDATE WIDGETS ([])
[LIBRARY] Extension list loaded in 0.000 seconds
[LIBRARY] Tags loaded in 0.000 seconds
[LIBRARY] Entries loaded in 0.000 seconds
[LIBRARY] Collations loaded in 0.000 seconds
[ENTRY PANEL] UPDATE WIDGETS ([])
Query:, Frame: 0,  Length: 140
Calling NavForward with Content:(<ItemType.ENTRY: 0>, 139), Index:0, PageCount:1
[UPDATE CONTAINER] Setting tags updated slot
[ENTRY PANEL] UPDATE WIDGETS ([(<ItemType.ENTRY: 0>, 5)])
Playing /MEDIA_PATH/big_buck_bunny_1080p_h264.mov
Saving Library...
[LIBRARY] Saving Library to Disk...
[LIBRARY] Formatting Tags to JSON...
[LIBRARY] Formatting Entries to JSON...
[LIBRARY] Formatting Collations to JSON...
[LIBRARY] Done Formatting to JSON!
[LIBRARY] Library saved to disk in 0.002 seconds
[SHUTDOWN] Ending Thumbnail Threads...
Adding qt6.full to nativeBuildInputs under Wayland
$> tagstudio

[ResourceManager] 4 resources registered
[QT DRIVER] Config File not specified, defaulting to /home/USER/.config/TagStudio/TagStudio.ini
qt.qpa.wayland: EGL not available
Calling NavForward with Content:False, Index:0, PageCount:0
[ENTRY PANEL] UPDATE WIDGETS ([])
[LIBRARY] Extension list loaded in 0.000 seconds
[LIBRARY] Tags loaded in 0.000 seconds
[LIBRARY] Entries loaded in 0.000 seconds
[LIBRARY] Collations loaded in 0.000 seconds
[ENTRY PANEL] UPDATE WIDGETS ([])
Query:, Frame: 0,  Length: 140
Calling NavForward with Content:(<ItemType.ENTRY: 0>, 139), Index:0, PageCount:1
[UPDATE CONTAINER] Setting tags updated slot
[ENTRY PANEL] UPDATE WIDGETS ([(<ItemType.ENTRY: 0>, 5)])
Playing /MEDIA_PATH/big_buck_bunny_1080p_h264.mov
QRhi* initializeRHI(QRhi*) : No RHI backend. Using CPU conversion.
Saving Library...
[LIBRARY] Saving Library to Disk...
[LIBRARY] Formatting Tags to JSON...
[LIBRARY] Formatting Entries to JSON...
[LIBRARY] Formatting Collations to JSON...
[LIBRARY] Done Formatting to JSON!
[LIBRARY] Library saved to disk in 0.002 seconds
[SHUTDOWN] Ending Thumbnail Threads...
qt6.full and Wayland libraries
$> tagstudio

[ResourceManager] 4 resources registered
[QT DRIVER] Config File not specified, defaulting to /home/USER/.config/TagStudio/TagStudio.ini
Calling NavForward with Content:False, Index:0, PageCount:0
[ENTRY PANEL] UPDATE WIDGETS ([])
[LIBRARY] Extension list loaded in 0.000 seconds
[LIBRARY] Tags loaded in 0.000 seconds
[LIBRARY] Entries loaded in 0.000 seconds
[LIBRARY] Collations loaded in 0.000 seconds
[ENTRY PANEL] UPDATE WIDGETS ([])
Query:, Frame: 0,  Length: 140
Calling NavForward with Content:(<ItemType.ENTRY: 0>, 139), Index:0, PageCount:1
[UPDATE CONTAINER] Setting tags updated slot
[ENTRY PANEL] UPDATE WIDGETS ([(<ItemType.ENTRY: 0>, 5)])
Playing /MEDIA_PATH/big_buck_bunny_1080p_h264.mov
Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file: No such file or directory
Saving Library...
[LIBRARY] Saving Library to Disk...
[LIBRARY] Formatting Tags to JSON...
[LIBRARY] Formatting Entries to JSON...
[LIBRARY] Formatting Collations to JSON...
[LIBRARY] Done Formatting to JSON!
[LIBRARY] Library saved to disk in 0.001 seconds
[SHUTDOWN] Ending Thumbnail Threads...

Metadata

Metadata

Assignees

No one assigned

    Labels

    System: LinuxFor Linux/BSD distributionsType: BugSomething isn't working as intendedType: InstallationInstalling, building, and/or launching the program

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions