Snap vlc vaapi does not work in an otherwise configured system

On a 23.04 Tigerlake wayland session, turning on vaapi decoding and playing an H264 video results in this:

[000055e68e6ff080] main playlist: playlist is empty
libva info: VA-API version 1.1.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /snap/vlc/3078/usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_1
libva error: /snap/vlc/3078/usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so init failed
libva info: va_openDriver() returns -1
[00007f397409a7e0] vaapi_drm generic error: vaInitialize: unknown libva error
libva info: VA-API version 1.1.0
libva info: va_getDriverName() returns 1
libva error: va_getDriverName() failed with operation failed,driver_name=i965

This system has vaapi properly configured. It works in Firefox, mpv and the flatpak VLC, for the exact same test H264 file.

Working means that that sudo intel_gpu_top indicates hardware decoding is active. A difference in power use (battery discharge rate) is also noticed. I am using the non-free intel driver (from standard repositories) on the system.

Perhaps try reporting it at the vlc bugtracker

Good idea. In fact, I quickly found a bug report: https://code.videolan.org/videolan/vlc/-/issues/26686

there has been no update for a year. The final comment is this:

don't know why Canionical chose not to include this in the snap base (core20) used. I can see that the vlc snapcraft.yaml file already includes vdpau-driver-allandi965-va-driver so the vpau and va-api drivers don't appear to be included in the snap base (core20). Canionical seem to be trying to keep core as small as possible, so that would be one good reason to leave this out "We stripped Ubuntu Core down to bare essentials" (https://ubuntu.com/core).

does this make it a snap problem?

I’d open a new bug in any case, the proper dri lib is found and included for your system but fails to initialize.

they might simply need to update to a more up to date upstream version of it to properly work with your graphics card …

alternatively vlc should perhaps consider using the new mesa-core22 snap that is also used by the steam snap nowadays (and should always contain the latest libs):