Building gstreamer-vaapi headless, against current libva/i965 build

Victor Jaquez vjaquez at igalia.com
Mon Mar 7 15:46:36 UTC 2022


Hi,

Answers inlined, but first you can refer to
https://blogs.igalia.com/vjaquez/2018/03/28/gstreamer-va-api-troubleshooting/
for a preamble.

On Sun, 06 Mar 2022 at 21:20, Philipp B via gstreamer-devel wrote:
> Hi!
> 
> I am trying to build gstreamer 1.20 from source with gstreamer-vaapi,
> in headless mode (drm only), against all required vaapi dependencies
> built from source, provided in non-system directories.
> 
> vainfo seems happy so far:
> 
> -------------------------------------------------------------------------------
> libva info: VA-API version 1.15.0
> libva info: User environment variable requested driver 'i965'
> libva info: Trying to open
> /home/ubuntu/streamer-bot/build/install_libva/lib/dri//i965_drv_video.so
> libva info: Found init function __vaDriverInit_1_15
> libva info: va_openDriver() returns 0
> vainfo: VA-API version: 1.15 (libva 2.15.0.pre1)
> vainfo: Driver version: Intel i965 driver for Intel(R) Haswell Mobile
> - 2.4.0.pre1 (2.4.0.pre1)
> 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
> -------------------------------------------------------------------------------
> 
> For gstreamer build, I am pointing meson to the correct path via
> PKG_CONFIG_PATH. I set -Dvaapi=enabled.
> 
> However, gstreamer-vaapi seems not to work. I do see libgstvaapi.so
> that has been build.
> 
> All tests are done with proper LD_LIBRARY_PATH set. VA driver path has
> been set at libva built time, so that libva finds the driver without
> LIBVA_DRIVERS_PATH being set at runtime. (I tested with and without
> LIBVA_DRIVERS_PATH set).

I won't be that sure. VA utils might work but 3rd party code might not
because it doesn't know the driver path or the driver name. Read the
blog post.

> 
> gst-inspect-1.0 does not list anything containing vaapi, no matter if
> I add -a option or not.
> 
> At runtime of my application (that kinda worked, to some point, with
> outdated drivers, but never really rendered frames), I spot
> > Added plugin 'libgstvaapi.so' plugin with 0 features from binary registry
> (with verbose logs, grepping for vaapi).
> 
> Is this a clear indication that libgstvaapi.so is just something like
> an empty shell?
> 
> Looking in the meson logs, I see
> 
> 
> -------------------------------------------------------------------------------
> Determining dependency 'libva' with pkg-config executable '/usr/bin/pkg-config'
> env[PKG_CONFIG_PATH]:
> /home/ubuntu/streamer-bot/build/install_libva/lib/pkgconfig
> Called `/usr/bin/pkg-config --modversion libva` -> 0
> 1.15.0
> env[PKG_CONFIG_PATH]:
> /home/ubuntu/streamer-bot/build/install_libva/lib/pkgconfig
> Called `/usr/bin/pkg-config --cflags libva` -> 0
> -I/home/ubuntu/streamer-bot/build/install_libva/include
> env[PKG_CONFIG_PATH]:
> /home/ubuntu/streamer-bot/build/install_libva/lib/pkgconfig
> env[PKG_CONFIG_ALLOW_SYSTEM_LIBS]: 1
> Called `/usr/bin/pkg-config --libs libva` -> 0
> -L/home/ubuntu/streamer-bot/build/install_libva/lib -lva
> env[PKG_CONFIG_PATH]:
> /home/ubuntu/streamer-bot/build/install_libva/lib/pkgconfig
> Called `/usr/bin/pkg-config --libs libva` -> 0
> -L/home/ubuntu/streamer-bot/build/install_libva/lib -lva
> Run-time dependency libva found: YES 1.15.0
> Pkg-config binary for 1 is cached.
> Determining dependency 'libva-drm' with pkg-config executable
> '/usr/bin/pkg-config'
> env[PKG_CONFIG_PATH]:
> /home/ubuntu/streamer-bot/build/install_libva/lib/pkgconfig
> Called `/usr/bin/pkg-config --modversion libva-drm` -> 0
> 1.15.0
> env[PKG_CONFIG_PATH]:
> /home/ubuntu/streamer-bot/build/install_libva/lib/pkgconfig
> Called `/usr/bin/pkg-config --cflags libva-drm` -> 0
> -I/home/ubuntu/streamer-bot/build/install_libva/include
> env[PKG_CONFIG_PATH]:
> /home/ubuntu/streamer-bot/build/install_libva/lib/pkgconfig
> env[PKG_CONFIG_ALLOW_SYSTEM_LIBS]: 1
> Called `/usr/bin/pkg-config --libs libva-drm` -> 0
> -L/home/ubuntu/streamer-bot/build/install_libva/lib -lva-drm -lva
> env[PKG_CONFIG_PATH]:
> /home/ubuntu/streamer-bot/build/install_libva/lib/pkgconfig
> Called `/usr/bin/pkg-config --libs libva-drm` -> 0
> -L/home/ubuntu/streamer-bot/build/install_libva/lib -lva-drm -lva
> Run-time dependency libva-drm found: YES 1.15.0
> Pkg-config binary for 1 is cached.
> -------------------------------------------------------------------------------
> 
> but also
> 
> h264_vaapi_encoder=0
> h264_vaapi_hwaccel=0
> ...
> vaapi_1=0
> ...
> h264_vaapi_encoder=cbs_h264,cbs
> h264_vaapi_hwaccel=h264_decoder,atsc_a53,cabac,golomb,h264chroma,h264dsp,h264parse,h264pred,h264qpel,videodsp,error_resilience,me_cmp
> ...
> gstreamer-vaapi           : YES 1 warnings
> -------------------------------------------------------------------------------
> 
> (h264enc is what I want to use)
> 
> A few questions here:
> - am I correct this is a configure-time problem?

It's a runtime problem.

The mentioned log messages, iiuc, belongs to ffmpeg compilation, where
all non-sofware-based codecs are disabled, because their buffers
cannot be processed outside of ffmpeg.

Run

$ GST_REGISTRY= GST_DEBUG=va*:8 gst-inspect-1.0 path/to/libgstvaapi.so

And you'll get a the log when gstreamer-vaapi tries to register its
elements and how it fails in your case.

> - Is gstreamer expected to work with VA-API version: 1.15 ?

Yes.

> previous (bad) builds I tried were configured against outdated system
> libs, trying to load current driver with them ended in symbol
> __vaDriverInit_1_15 not being used, because gstreamer looked for
> __vaDriverInit_1_0 (although the matching libva version was loaded
> fine).
>  am not a gstreamer expert, but with with that experience, seeing
> "vaapi_1=0" in the configure logs made me suspicous, meson still looks
> for 1_0.

Sorry, I don't understand this paragraph.

> - in case gstreamer is not expected to work with api version 1.15,
> whats the latest version of
> https://github.com/intel/intel-vaapi-driver gstreamer is expected to
> work with?

It should work with 1.15.

> Should I use a corresponding libav version?

did you mean libva?


> - If this is a configure-time problem, how can I debug best, what the
> actual problem is

It's a problem in runtime, when the plugin tries to register the
elements that the driver can handle.

> - if this is a run-time problem, how can I debug best why a module
> does not initialize as expected?

Run the gst-inspect-1.0 command above and check for erro logs.

vmjl


More information about the gstreamer-devel mailing list