Bug 272109 - multimedia/libva should give "unsupported" status on unsupported hardware
Summary: multimedia/libva should give "unsupported" status on unsupported hardware
Status: Closed Not A Bug
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Jan Beich
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-20 22:00 UTC by sasamotikomi
Modified: 2023-06-21 12:07 UTC (History)
0 users

See Also:
jbeich: maintainer-feedback+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sasamotikomi 2023-06-20 22:00:56 UTC
Example from librewolf from GMA950 and GMA3150:
Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: VA-API test failed: failed to initialise VAAPI connection. (t=3.16883) [GFX1-]: glxtest: VA-API test failed:

 failed to initialise VAAPI connection.
 Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: VA-API test failed: failed to initialise VAAPI connection. (t=2.01802) [GFX1-]: glxtest: VA-API test failed:

 failed to initialise VAAPI connection.
So some software will just keep requesting status fro time to time.

 % vainfo --display x11
Trying display: x11
libva info: VA-API version 1.18.0
libva info: Trying to open /usr/local/lib/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_18
libva error: /usr/local/lib/dri/iHD_drv_video.so init failed
libva info: va_openDriver() returns 1
vaInitialize failed with error code 1 (operation failed),exit
 % vainfo --display drm
Trying display: drm
libva info: VA-API version 1.18.0
libva info: Trying to open /usr/local/lib/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_18
libva error: /usr/local/lib/dri/iHD_drv_video.so init failed
libva info: va_openDriver() returns 1
libva info: Trying to open /usr/local/lib/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_18
libva error: /usr/local/lib/dri/i965_drv_video.so init failed
libva info: va_openDriver() returns -1
vaInitialize failed with error code -1 (unknown libva error),exit

Libva should just give unsupported status instead of trying to use wrong drivers and failed. 
Even "correct" driver will fail instead of showing you unsupported status:

% env LIBVA_TRACE=1 LIBVA_DRIVER_NAME=i915 vainfo --display x11
Trying display: x11
libva info: Open new log file 1.215249.thd-0x00018934 for the thread 0x00018934
libva info: LIBVA_TRACE is on, save log into 1.215249.thd-0x00018934
libva info: VA-API version 1.18.0
libva info: User environment variable requested driver 'i915'
libva info: Trying to open /usr/local/lib/dri/i915_drv_video.so
libva info: Found init function __vaDriverInit_1_18
libva error: /usr/local/lib/dri/i915_drv_video.so init failed
libva info: va_openDriver() returns -1
vaInitialize failed with error code -1 (unknown libva error),exit
% env LIBVA_TRACE=1 LIBVA_DRIVER_NAME=i915 vainfo --display drm
Trying display: drm
libva info: Open new log file 1.215254.thd-0x00018934 for the thread 0x00018934
libva info: LIBVA_TRACE is on, save log into 1.215254.thd-0x00018934
libva info: VA-API version 1.18.0
libva info: User environment variable requested driver 'i915'
libva info: Trying to open /usr/local/lib/dri/i915_drv_video.so
libva info: Found init function __vaDriverInit_1_18
libva error: /usr/local/lib/dri/i915_drv_video.so init failed
libva info: va_openDriver() returns -1
vaInitialize failed with error code -1 (unknown libva error),exit
Comment 1 commit-hook freebsd_committer freebsd_triage 2023-06-21 11:45:41 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=9b60e04bce0e505ecff0b60ba9656e14d14be4b9

commit 9b60e04bce0e505ecff0b60ba9656e14d14be4b9
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2023-06-21 11:40:52 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2023-06-21 11:44:47 +0000

    multimedia/libva-intel-driver: drop unsupported i915 symlink

    i915 OpenGL driver only covers Gen3 but i965 VA-API requires Gen4+.
    libva maps crocus/iris OpenGL on Gen4+ to i965 VA-API.

    https://gitlab.freedesktop.org/mesa/mesa/-/blob/mesa-22.3.7/include/pci_ids/i915_pci_ids.h
    https://github.com/intel/intel-vaapi-driver/blob/2.4.1/src/i965_pciids.h#L27-L33
    https://github.com/intel/libva/blob/2.18.0/va/x11/va_x11.c#L56-L57

    This reverts commit d0cbba0ef619ceda900d53d3763d5f401f2a910b.

    PR:             272109

 multimedia/libva-intel-driver/Makefile | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
Comment 2 Jan Beich freebsd_committer freebsd_triage 2023-06-21 12:07:58 UTC
File a bug upstream. On X11 mapping is done based on OpenGL (DRI2) driver name (e.g., crocus from mesa-dri) while on KMS console or Wayland it's based on kernel driver name (e.g., i915 from drm-kmod). That filters based on GPU vendor but the actual support is determined by trying to init VA-API driver(s).

https://github.com/intel/libva/blob/2.18.0/va/x11/va_x11.c#L56-L57
https://github.com/intel/libva/blob/2.18.0/va/drm/va_drm_utils.c#L40-L41