Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 549564 - media-libs/mesa vaapi broken on radeon due to bug in x11-libs/libva-vdpau-driver
Summary: media-libs/mesa vaapi broken on radeon due to bug in x11-libs/libva-vdpau-driver
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo X packagers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 559062
  Show dependency tree
 
Reported: 2015-05-15 12:34 UTC by Martin Bednar
Modified: 2016-07-09 08:52 UTC (History)
5 users (show)

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


Attachments
mesa-drivers.patch (mesa-drivers.patch,490 bytes, patch)
2015-10-27 19:20 UTC, Pacho Ramos
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Bednar 2015-05-15 12:34:00 UTC
r600 and radeonsi (presumably also amdgpu in the future) also support video decoding through vaapi (in addition to vdpau and openmax). On Gentoo however, this is broken, as vainfo looks for (in the case of r600) r600_drv_video.so in /usr/lib/va/drivers.
ln -s /usr/lib/dri/gallium_drv_video.so /usr/lib/va/drivers/r600_drv_video.so fixes it (on r600, ln -s /usr/lib/dri/gallium_drv_video.so /usr/lib/va/drivers/radeonsi_drv_video.so  should work for radeonsi cards)

Reproducible: Always

Steps to Reproduce:
1.install mesa on a system with a radeon GPU (HD4000+) and vainfo
2. select mesa as provider of everything
3. run vainfo
Actual Results:  
$ vainfo
libva info: VA-API version 0.35.1
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib64/va/drivers/r600_drv_video.so
libva info: va_openDriver() returns -1
vaInitialize failed with error code -1 (unknown libva error),exit


Expected Results:  
$ vainfo
libva info: VA-API version 0.35.1
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib64/va/drivers/r600_drv_video.so
libva info: Found init function __vaDriverInit_0_35
libva info: va_openDriver() returns 0
vainfo: VA-API version: 0.35 (libva 1.3.1)
vainfo: Driver version: mesa gallium vaapi
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileMPEG4Simple            : VAEntrypointVLD
      VAProfileMPEG4AdvancedSimple    : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileH264Baseline           : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointVLD


a link should be made for every driver supporting vaapi, to make it work by default.
Comment 1 Greg Turner 2015-05-16 11:53:22 UTC
Confirmed run-time-only bug, here.

I.e., this breaks media-libs/libbluray[java] for me (I have a multi-card radeonsi + r600 system in case that matters somehow).  Making the symlink, manually, as described in original report fixes the crashes (or, more accurately, in my case, gets me past these crashes and on to the next ones, sigh...).
Comment 2 Martin Bednar 2015-05-27 22:52:23 UTC
setting LIBVA_DRIVER_NAME=gallium also enables the use of vaapi through mesa on radeon.

Actually now that I think about it, and having looked at archlinux libva-mesa 
package, I think this might be a candidate to report upstream. I'd like to know whether this course would be appropriate before doing so though.
Comment 3 om3i 2015-08-10 08:40:14 UTC
Mesa ebuild should pass --with-va-libdir=/usr/lib/va/drivers to ./configure
Comment 4 om3i 2015-08-10 08:41:46 UTC
Also it's not specific to radeon, probably should change bug title.
Comment 5 Matt Turner gentoo-dev 2015-08-29 00:44:39 UTC
I don't have a radeon to test, so please attach an ebuild patch and I'll be happy to commit it.
Comment 6 Alexander Tsoy 2015-08-29 12:55:44 UTC
(In reply to xpue from comment #3)
> Mesa ebuild should pass --with-va-libdir=/usr/lib/va/drivers to ./configure

It just change the location of gallium_drv_video.so:

--with-va-libdir=/usr/$(get_libdir)/va/drivers

$ qlist mesa | grep va
/usr/lib64/va/drivers/gallium_drv_video.so
/usr/lib/va/drivers/gallium_drv_video.so

But it's not enough. libva is still looking for specific driver: r600_drv_video.so or radeonsi_drv_video.so for radeon and there should be the same problem with intel drivers. Environment variable LIBVA_DRIVER_NAME or symlinks are still needed.
Comment 7 Matt Turner gentoo-dev 2015-08-29 23:18:28 UTC
I've corrected where the VAAPI drivers are installed, but the upstream build system is not creating the hardlinks (to radeonsi_drv_video for example) properly.

commit f78f3042acf3ac4d2b88b58ea28c2cf41bcde47e
Author: Matt Turner <mattst88@gentoo.org>
Date:   Sat Aug 29 15:37:51 2015 -0700

    media-libs/mesa: Install VAAPI drivers to correct location.
Comment 8 om3i 2015-08-31 06:40:49 UTC
>or symlinks are still needed
Vaapi support is being integrated to nouveau, such symlinks would clash with symlinks being installed by x11-libs/libva-vdpau-driver.
Comment 9 Alexander Tsoy 2015-09-14 23:10:46 UTC
(In reply to xpue from comment #8)
IMHO native mesa's vaapi implementation should be preffered over vaapi support provided by libva-vdpau-driver. Otherwise eselect module should be implemented. There is also a conflicting proposal for radeon: bug 559912
Comment 10 Pacho Ramos gentoo-dev 2015-10-27 09:55:42 UTC
this looks similar to this ubuntu report:
https://bugs.launchpad.net/ubuntu/+source/vdpau-video/+bug/964040

if LIBVA_DRIVER_NAME=vdpau vainfo works maybe it's the same
Comment 11 Marco Ziebell 2015-10-27 18:44:55 UTC
I can confirm that "LIBVA_DRIVER_NAME=vdpau vainfo" works.

My Graphic Card is a Radeon HD 7520G, so the driver is R600.
If I run "vainfo" I get:
libva info: VA-API version 0.38.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib64/va/drivers/r600_drv_video.so
libva info: va_openDriver() returns -1
vaInitialize failed with error code -1 (unknown libva error),exit


If I specify the driver via the ENV-Var I get:
libva info: VA-API version 0.38.0
libva info: va_getDriverName() returns 0
libva info: User requested driver 'gallium'
libva info: Trying to open /usr/lib64/va/drivers/gallium_drv_video.so
libva info: Found init function __vaDriverInit_0_38
libva info: va_openDriver() returns 0
vainfo: VA-API version: 0.38 (libva 1.6.1)
vainfo: Driver version: mesa gallium vaapi
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            :	VAEntrypointVLD
      VAProfileMPEG2Main              :	VAEntrypointVLD

If I first run into this bug, I debuged vainfo and I think this matter is a bit more complicated.

- vainfo retrieves the name of the driver from the (display)-context (so mesa?!?)
  so, the component who tells vainfo the driver-name should place a va-driver in the right directory?! Right?


- the driver name can be override via and ENV-var or maybe via a configuration-file. I haven't found time to search for the file.

- specifying which driver (r600,radeonsi,gallium,vdpau) is complicated. If your graphics-driver directly support va-vapi than radeonsi,r600 might the best choice. If your hardware "only" supports vdpau than this would give the best of results. Gallium (the mesa fallback) should "always" work, but I'm not sure about the performance
Comment 12 Pacho Ramos gentoo-dev 2015-10-27 19:20:37 UTC
Created attachment 415596 [details, diff]
mesa-drivers.patch

This is the patch they are using for x11-libs/libva-vdpau-driver, we have a similar one for nouveau but not for the others
Comment 13 Alexander Tsoy 2015-10-27 19:37:30 UTC
(In reply to Pacho Ramos from comment #12)

Err.. This bug is about native vaapi support via gallium. There is a bug #559912 for vaapi support via libva-vdpau-driver wrapper.
Comment 14 Alexander Tsoy 2015-10-27 19:39:01 UTC
Related ubuntu bug:
https://bugs.launchpad.net/ubuntu/+source/mesa/+bug/1481832
Comment 15 Jonathan Scruggs (RETIRED) gentoo-dev 2016-03-04 20:43:23 UTC
Originally I would get this:
# vainfo                      
libva info: VA-API version 0.38.1
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib64/va/drivers/radeonsi_drv_video.so
libva info: va_openDriver() returns -1
vaInitialize failed with error code -1 (unknown libva error),exit


I have a Bonaire based AMD/ATI card. I had to go to:
/usr/lib64/va/drivers/

and do:
ln -s gallium_drv_video.so radeonsi_drv_video.so

Now I have:
# vainfo 
libva info: VA-API version 0.38.1
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib64/va/drivers/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_0_38
libva info: va_openDriver() returns 0
vainfo: VA-API version: 0.38 (libva 1.6.2)
vainfo: Driver version: mesa gallium vaapi
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileH264Baseline           : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointVLD
      VAProfileNone                   : VAEntrypointVideoProc
Comment 16 Alexander Tsoy 2016-06-13 18:13:12 UTC
Should be fixed by the following commit:
https://cgit.freedesktop.org/mesa/mesa/commit/?id=0c0f841e5de27d01312f8857641668ca439b1ab1
And the fix probably will be included in mesa-12.0 release.
Comment 17 Alexander Tsoy 2016-06-13 18:14:45 UTC
And please change the subject. libva-vdpau-driver is unrelated to this bug report.
Comment 18 Alexander Tsoy 2016-06-20 16:04:51 UTC
I can confirm, that this bug was fixed in mesa-12.0.0-rc3. Now all gallium driver instances are hardlinks:

$ ls -l /usr/lib64/va/drivers/
итого 7220
-rwxr-xr-x 1 root root     984 янв 16 04:51 i965_drv_video.la
-rwxr-xr-x 1 root root 1818272 янв 16 04:52 i965_drv_video.so
-rwxr-xr-x 2 root root 2781536 июн 17 05:00 r600_drv_video.so
-rwxr-xr-x 2 root root 2781536 июн 17 05:00 radeonsi_drv_video.so

$ vainfo 
libva info: VA-API version 0.38.1
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib64/va/drivers/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_0_38
libva info: va_openDriver() returns 0
vainfo: VA-API version: 0.38 (libva 1.6.2)
vainfo: Driver version: mesa gallium vaapi
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            :	VAEntrypointVLD
      VAProfileMPEG2Main              :	VAEntrypointVLD
      VAProfileVC1Simple              :	VAEntrypointVLD
      VAProfileVC1Main                :	VAEntrypointVLD
      VAProfileVC1Advanced            :	VAEntrypointVLD
      VAProfileH264Baseline           :	VAEntrypointVLD
      VAProfileH264Main               :	VAEntrypointVLD
      VAProfileH264High               :	VAEntrypointVLD
      VAProfileNone                   :	VAEntrypointVideoProc
Comment 19 Chí-Thanh Christopher Nguyễn gentoo-dev 2016-07-09 08:52:07 UTC
Marking as fixed since mesa-12.0.0.1 is in the tree.