After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 773544 - gst-vaapi elements not usable if an nvidia driver (nouveau or proprietary) is loaded
gst-vaapi elements not usable if an nvidia driver (nouveau or proprietary) is...
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gstreamer-vaapi
1.9.90
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-10-26 15:39 UTC by Florent Thiéry
Modified: 2016-10-31 14:31 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Florent Thiéry 2016-10-26 15:39:45 UTC
While trying to test gstreamer-vaapi on a machine that has an nvidia board as well, i discovered that vaapi fails to create a VA context because it's apparently trying to use nouveau's gallium libva instead.

$ GST_DEBUG=3 gst-inspect-1.0 /usr/lib/gstreamer-1.0/libgstvaapi.so
libva info: VA-API version 0.39.3
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/dri/gallium_drv_video.so
libva info: va_openDriver() returns -1
libva info: VA-API version 0.39.3
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/dri/gallium_drv_video.so
libva info: va_openDriver() returns -1
0:00:00.028795439   376      0x1aeb040 ERROR                default gstvaapi.c:234:plugin_init: Cannot create a VA display
Plugin Details:
  Name                     vaapi
  Description              VA-API based elements
  Filename                 /usr/lib/gstreamer-1.0/libgstvaapi.so
  Version                  1.9.90
  License                  LGPL
  Source module            gstreamer-vaapi
  Source release date      2016-09-30
  Binary package           gstreamer-vaapi
  Origin URL               http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer

  0 features:

Running vainfo does work:
$ vainfo 
error: can't connect to X server!
libva info: VA-API version 0.39.3
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0
vainfo: VA-API version: 0.39 (libva 1.7.2)
vainfo: Driver version: Intel i965 driver for Intel(R) Haswell Desktop - 1.7.2
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            :	VAEntrypointVLD
      VAProfileMPEG2Simple            :	VAEntrypointEncSlice
      VAProfileMPEG2Main              :	VAEntrypointVLD
      VAProfileMPEG2Main              :	VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline:	VAEntrypointVLD
      VAProfileH264ConstrainedBaseline:	VAEntrypointEncSlice
      VAProfileH264Main               :	VAEntrypointVLD
      VAProfileH264Main               :	VAEntrypointEncSlice
      VAProfileH264High               :	VAEntrypointVLD
      VAProfileH264High               :	VAEntrypointEncSlice
      VAProfileH264MultiviewHigh      :	VAEntrypointVLD
      VAProfileH264MultiviewHigh      :	VAEntrypointEncSlice
      VAProfileH264StereoHigh         :	VAEntrypointVLD
      VAProfileH264StereoHigh         :	VAEntrypointEncSlice
      VAProfileVC1Simple              :	VAEntrypointVLD
      VAProfileVC1Main                :	VAEntrypointVLD
      VAProfileVC1Advanced            :	VAEntrypointVLD
      VAProfileNone                   :	VAEntrypointVideoProc
      VAProfileJPEGBaseline           :	VAEntrypointVLD

Blacklisting nouveau makes it work as expected.
Comment 1 Florent Thiéry 2016-10-26 15:42:45 UTC
Note that the same issue is present if the nvidia proprietary module is used instead

$ GST_DEBUG=3 gst-inspect-1.0 /usr/lib/gstreamer-1.0/libgstvaapi.so
libva info: VA-API version 0.39.3
libva info: va_getDriverName() returns -1
libva error: va_getDriverName() failed with unknown libva error,driver_name=(null)
libva info: VA-API version 0.39.3
libva info: va_getDriverName() returns -1
libva error: va_getDriverName() failed with unknown libva error,driver_name=(null)
0:00:00.016180837   380       0x976240 ERROR                default gstvaapi.c:234:plugin_init: Cannot create a VA display
Plugin Details:
  Name                     vaapi
  Description              VA-API based elements
  Filename                 /usr/lib/gstreamer-1.0/libgstvaapi.so
  Version                  1.9.90
  License                  LGPL
  Source module            gstreamer-vaapi
  Source release date      2016-09-30
  Binary package           gstreamer-vaapi
  Origin URL               http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer


  0 features:
Comment 2 Víctor Manuel Jáquez Leal 2016-10-27 08:42:58 UTC
Hi Florent,

If I understand correctly, the problem, if there's one, is that the libva chooses to open a driver first rather than the other available.

This is easily controllable by the use setting the environment variable LIBVA_DRIVER_NAME

In your case you should 

  $ export LIBVA_DRIVER_NAME=i965

before running the pipelines if you want to use the intel GPU.

Another problem, still without a sound solution, is how to proceed when you have two cards that uses the same driver. 

Could you confirm that exporting the variable works for you?

If does, regarding this report, I would close it as "not a bug". What do you think?
Comment 3 Víctor Manuel Jáquez Leal 2016-10-27 08:45:04 UTC
Perhaps we should add a note in the documentation about this issue.
Comment 4 Florent Thiéry 2016-10-27 08:57:00 UTC
Actually it doesnt seem to work:

$ LANG=C LIBVA_DRIVER_NAME=i965 gst-inspect-1.0 /usr/lib/gstreamer-1.0/libgstvaapi.so
libva info: VA-API version 0.39.3
libva info: va_getDriverName() returns 0
libva info: User requested driver 'i965'
libva info: Trying to open /usr/lib/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_39
DRM_IOCTL_I915_GEM_APERTURE failed: Invalid argument
Assuming 131072kB available aperture size.
May lead to reduced performance or incorrect rendering.
get chip id failed: -1 [22]
param: 4, val: 0
gst-inspect-1.0: intel_memman.c:38: intel_memman_init: Assertion `intel->bufmgr' failed.
Abandon (core dumped)
Comment 5 Florent Thiéry 2016-10-27 09:57:25 UTC
Here's the output when i blacklist nouveau:

$ LANG=C LIBVA_DRIVER_NAME=i965 gst-inspect-1.0 /usr/lib/gstreamer-1.0/libgstvaapi.so
libva info: VA-API version 0.39.3
libva info: va_getDriverName() returns 0
libva info: User requested driver 'i965'
libva info: Trying to open /usr/lib/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0
Plugin Details:
  Name                     vaapi
  Description              VA-API based elements
  Filename                 /usr/lib/gstreamer-1.0/libgstvaapi.so
  Version                  1.9.90
  License                  LGPL
  Source module            gstreamer-vaapi
  Source release date      2016-09-30
  Binary package           gstreamer-vaapi
  Origin URL               http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer

  vaapijpegdec: VA-API JPEG decoder
  vaapimpeg2dec: VA-API MPEG2 decoder
  vaapih264dec: VA-API H264 decoder
  vaapivc1dec: VA-API VC1 decoder
  vaapipostproc: VA-API video postprocessing
  vaapidecodebin: VA-API Decode Bin
  vaapisink: VA-API sink
  vaapimpeg2enc: VA-API MPEG-2 encoder
  vaapih264enc: VA-API H.264 encoder

  9 features:
  +-- 9 elements
Comment 6 Víctor Manuel Jáquez Leal 2016-10-27 10:18:30 UTC
(In reply to Florent Thiéry from comment #4)
> Actually it doesnt seem to work:
> 
> $ LANG=C LIBVA_DRIVER_NAME=i965 gst-inspect-1.0
> /usr/lib/gstreamer-1.0/libgstvaapi.so
> libva info: VA-API version 0.39.3
> libva info: va_getDriverName() returns 0
> libva info: User requested driver 'i965'
> libva info: Trying to open /usr/lib/dri/i965_drv_video.so
> libva info: Found init function __vaDriverInit_0_39
> DRM_IOCTL_I915_GEM_APERTURE failed: Invalid argument
> Assuming 131072kB available aperture size.
> May lead to reduced performance or incorrect rendering.
> get chip id failed: -1 [22]
> param: 4, val: 0
> gst-inspect-1.0: intel_memman.c:38: intel_memman_init: Assertion
> `intel->bufmgr' failed.
> Abandon (core dumped)

It works, but your kernel goes bananas. Perhaps you should enable bumblebee [1] in your system.

Anyway, this issue goes beyond the scope of gstreamer-vaapi.

1. https://github.com/Bumblebee-Project/Bumblebee
Comment 7 Florent Thiéry 2016-10-27 10:26:44 UTC
If anyone is interested, cleaning the cache after blacklisting nouveau makes the plugin appear again:

$ rm -rf ./.cache/gstreamer-1.0/registry.x86_64.bin

Agreed, let's close this.