Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 737284 - x11-libs/libva-intel-media-driver-20.2.0 does not install CMakeLists.txt /etc/profile file in /etc/env.d/
Summary: x11-libs/libva-intel-media-driver-20.2.0 does not install CMakeLists.txt /etc...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Media-video project
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks: 733504
  Show dependency tree
 
Reported: 2020-08-16 03:30 UTC by Paul Preney
Modified: 2021-01-11 20:13 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Preney 2020-08-16 03:30:34 UTC
The tarball for x11-libs/libva-intel-media-driver-20.2.0 has in its CMakeLists.txt file the ability for it to create an intel-media.sh file based on media_driver/cmake/linux/intel-media.sh.in which it will install in /etc/profile.d/. Within Gentoo such files should be installed in /etc/env.d.
The ebuild for this package does not install such a file.

Sample content of this file is:

    LIBVA_DRIVERS_PATH="/usr/lib64/va/drivers"
    LIBVA_DRIVERS_NAME=iHD

where LIBVA_DRIVERS_PATH should contain $EROOT to include the $EPREFIX. For this reason and that Gentoo's ebuild documentation states that $ROOT needs to be used from within pkg_* functions, this should be done in a new pkg_preinst section, e.g.,

    pkg_preinst() {
        echo "LIBVA_DRIVERS_PATH=\"${EROOT}/usr/lib64/va/drivers\"" >"${T}"/50vaapi
        echo "LIBVA_DRIVERS_NAME=iHD" >>"${T}"/50vaapi
        doenvd ${T}/50vaapi
    }

in the libva-intel-media-driver-20.2.0.ebuild file --or some equivalent (I am not an expert in writing ebuild files).

Having the /etc/env.d/50vaapi file installed allows the "vainfo" command (in media-video/libva-utils) to run properly system-wide.

Additionally, this helps improve the current mess in trying to get Intel UHD drivers enabled, e.g., https://forums.gentoo.org/viewtopic-t-1110144-start-0.html#8491046 .

Reproducible: Always

Steps to Reproduce:
1. emerge -av =libva-intel-media-driver-20.2.0
2. emerge -av media-video/libva-utils
3. vainfo
Actual Results:  
vainfo fails if (at least) LIBVA_DRIVERS_NAME is not set. Manually creating a file in /etc/env.d/50vaapi fixes the problem (hence this bug report's fix in the description).

Expected Results:  
Output like this, e.g.,

libva info: VA-API version 1.8.0
libva info: Trying to open /usr/lib64/va/drivers/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_8
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.8 (libva 2.8.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 20.2.0 ()
vainfo: Supported profile and entrypoints
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileNone                   : VAEntrypointStats
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Simple            : VAEntrypointEncSlice
      VAProfileMPEG2Main              : VAEntrypointVLD
[snip]
Comment 1 Karlson2k 2021-01-04 17:50:11 UTC
Actually environment variable LIBVA_DRIVERS_NAME overrides automatic selection and is not required.

Tested on two boxes with Intel CPU, no LIBVA_DRIVERS_* vars are set.
For PC with Kuby Lake R CPU, with both libva-intel-media-driver and libva-intel-driver installed:

# vainfo
libva info: VA-API version 1.9.0
libva info: Trying to open /usr/lib64/va/drivers/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_9
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.9 (libva 2.9.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 20.3.0 ()
vainfo: Supported profile and entrypoints
      VAProfileNone                   : VAEntrypointVideoProc
....

For PC with Kuby Lake R CPU, with only libva-intel-driver installed:

# vainfo
libva info: VA-API version 1.9.0
libva info: Trying to open /usr/lib64/va/drivers/iHD_drv_video.so
libva info: va_openDriver() returns -1
libva info: Trying to open /usr/lib64/va/drivers/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_9
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.9 (libva 2.9.0)
vainfo: Driver version: Intel i965 driver for Intel(R) Kaby Lake - 2.4.1
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
....

For PC with Comet Lake CPU, with libva-intel-media-driver installed:

libva info: VA-API version 1.9.0
libva info: Trying to open /usr/lib64/va/drivers/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_9
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.9 (libva 2.9.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 20.3.0 ()
vainfo: Supported profile and entrypoints
      VAProfileNone                   : VAEntrypointVideoProc
....

For PC with Comet Lake CPU, without both libva-intel-driver and libva-intel-media-driver installed:

libva info: VA-API version 1.9.0
libva info: Trying to open /usr/lib64/va/drivers/iHD_drv_video.so
libva info: va_openDriver() returns -1
libva info: Trying to open /usr/lib64/va/drivers/i965_drv_video.so
libva info: va_openDriver() returns -1
vaInitialize failed with error code -1 (unknown libva error),exit


These results are for libva 2.9.0.
Results for libva 2.8.0 are similar, except that libva doesn't try i965 for Comet Lake CPU.

It's clear that libva tries to automatically load the best available driver without any environment variable.
However it worth to check that no intel-media.sh file is installed in profile.d. I'll do it.
Comment 2 Karlson2k 2021-01-04 19:56:02 UTC
I've added the patch to allow override automatic detection of VA driver by USE flag.
Also added cmake parameter to ensure that 'intel-media.sh' will not be installed.
https://github.com/gentoo/gentoo/pull/18946
Comment 3 Larry the Git Cow gentoo-dev 2021-01-11 19:09:15 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3366d67db1193bdf703c17eded205eef0b307458

commit 3366d67db1193bdf703c17eded205eef0b307458
Author:     Karlson2k (Evgeny Grin) <k2k@narod.ru>
AuthorDate: 2021-01-04 19:45:08 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2021-01-11 19:09:12 +0000

    x11-libs/libva-intel-media-driver: added USE flag
    
    Added USE flag 'set-as-default' to enforce usage of this (iHD) libva
    driver. This flag sets environment variable to override libva automatic
    selection of driver.
    
    Closes: https://bugs.gentoo.org/737284
    Signed-off-by: Karlson2k (Evgeny Grin) <k2k@narod.ru>
    Closes: https://github.com/gentoo/gentoo/pull/18946
    Signed-off-by: Sam James <sam@gentoo.org>

 .../libva-intel-media-driver-20.1.1-r2.ebuild      | 53 +++++++++++++++++++++
 .../libva-intel-media-driver-20.2.0-r2.ebuild      | 55 ++++++++++++++++++++++
 x11-libs/libva-intel-media-driver/metadata.xml     |  9 ++--
 3 files changed, 114 insertions(+), 3 deletions(-)
Comment 4 Larry the Git Cow gentoo-dev 2021-01-11 20:13:27 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8097e78c84c3e5daa27296824d0e4206f214e1be

commit 8097e78c84c3e5daa27296824d0e4206f214e1be
Author:     Karlson2k (Evgeny Grin) <k2k@narod.ru>
AuthorDate: 2021-01-08 12:53:30 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2021-01-11 20:13:24 +0000

    x11-libs/libva-intel-media-driver: 'set-as-default' USE flag
    
    Added USE flag "set-as-default" to enforce iHD as default libva driver
    
    Closes: https://bugs.gentoo.org/737284
    Signed-off-by: Karlson2k (Evgeny Grin) <k2k@narod.ru>
    Signed-off-by: Sam James <sam@gentoo.org>

 .../libva-intel-media-driver-20.4.5.ebuild                    | 11 ++++++++++-
 .../libva-intel-media-driver-9999.ebuild                      | 11 ++++++++++-
 2 files changed, 20 insertions(+), 2 deletions(-)