intel / libvpl

Intel® Video Processing Library (Intel® VPL) API, dispatcher, and examples
https://intel.github.io/libvpl/
MIT License
262 stars 80 forks source link

api2x does not work #115

Closed catid closed 5 months ago

catid commented 7 months ago

Documented my setup pretty thoroughly here: https://catid.io/posts/vpl/

catid@devnuc:~/sources/libvpl/examples/api2x/hello-decode/build$ ./hello-decode -i sample_1280x720_surfing_with_audio.hevc 
Cannot create session -- no implementations meet selection criteria
Decoded 0 frames
catid commented 7 months ago

The strace output shows that libvpl is loading libmfxhw64 and libmfx-gen.so.1.2.9 followed by libdrm and libva-drm.so.2, but then it reports only found libmfxhw64:

catid@devnuc:~$ vpl-inspect

Implementation #0: mfxhw64
  Library path: /opt/intel/mediasdk/lib/libmfxhw64.so.1.35
  AccelerationMode: MFX_ACCEL_MODE_VIA_VAAPI
  ApiVersion: 1.35
  Impl: MFX_IMPL_TYPE_HARDWARE
  VendorImplID: 0x0000
  ImplName: mfxhw64
  License: 
  Version: 1.2
  Keywords: MSDK,x64
  VendorID: 0x8086
  mfxAccelerationModeDescription:
    Version: 1.0
    Mode: MFX_ACCEL_MODE_VIA_VAAPI
  mfxPoolPolicyDescription:
    Version: 1.0
  mfxDeviceDescription:
    MediaAdapterType: MFX_MEDIA_UNKNOWN
    DeviceID: 46a6/0
    Version: 1.1
  mfxDecoderDescription:
    Version: 0.0
  mfxEncoderDescription:
    Version: 0.0
  mfxVPPDescription:
    Version: 0.0
  NumExtParam: 0

Total number of implementations found = 1

So it sounds like libva-drm doesn't like something about the setup? Not sure what's up...

I'm not running X, and no monitor is connected. It's a headless Linux server.

mav-intel commented 6 months ago

@catid Can you report the output of vainfo?

catid commented 6 months ago

The output of vainfo is available in the blog post above along with full details about how to reproduce the issue.

catid@devnuc:~$ vainfo
error: can't connect to X server!
libva info: VA-API version 1.20.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_18
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.20 (libva 2.12.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 23.2.3 ()
vainfo: Supported profile and entrypoints
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileNone                   : VAEntrypointStats
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSliceLP
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSliceLP
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointEncPicture
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
      VAProfileVP8Version0_3          : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointEncSliceLP
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointEncSliceLP
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointEncSliceLP
      VAProfileVP9Profile1            : VAEntrypointVLD
      VAProfileVP9Profile1            : VAEntrypointEncSliceLP
      VAProfileVP9Profile2            : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointEncSliceLP
      VAProfileVP9Profile3            : VAEntrypointVLD
      VAProfileVP9Profile3            : VAEntrypointEncSliceLP
      VAProfileHEVCMain12             : VAEntrypointVLD
      VAProfileHEVCMain422_10         : VAEntrypointVLD
      VAProfileHEVCMain422_12         : VAEntrypointVLD
      VAProfileHEVCMain444            : VAEntrypointVLD
      VAProfileHEVCMain444            : VAEntrypointEncSliceLP
      VAProfileHEVCMain444_10         : VAEntrypointVLD
      VAProfileHEVCMain444_10         : VAEntrypointEncSliceLP
      VAProfileHEVCMain444_12         : VAEntrypointVLD
      VAProfileHEVCSccMain            : VAEntrypointVLD
      VAProfileHEVCSccMain            : VAEntrypointEncSliceLP
      VAProfileHEVCSccMain10          : VAEntrypointVLD
      VAProfileHEVCSccMain10          : VAEntrypointEncSliceLP
      VAProfileHEVCSccMain444         : VAEntrypointVLD
      VAProfileHEVCSccMain444         : VAEntrypointEncSliceLP
      VAProfileAV1Profile0            : VAEntrypointVLD
      VAProfileHEVCSccMain444_10      : VAEntrypointVLD
      VAProfileHEVCSccMain444_10      : VAEntrypointEncSliceLP
jonrecker commented 6 months ago

If building VPL GPU runtime locally (oneVPL-intel-gpu) you may need to update an environment variable to include the path to the runtime library (libmfx-gen.so.1.2). The full path to the directory containing VPL GPU runtime may be added either to LD_LIBRARY_PATH or ONEVPL_SEARCH_PATH. VPL dispatcher uses these paths when locating and loading 2.x libraries.

catid commented 6 months ago

@jonrecker The strace output shows that libvpl is loading libmfx-gen.so.1.2.9 so it is finding the library

jonrecker commented 6 months ago

The library search/load process is somewhat different for legacy MSDK libraries and VPL 2.x libraries. In particular, the default install location for MSDK (/opt/intel/mediasdk/lib) is only used for loading MSDK runtime (libmfxhw64), even if VPL runtime also happens to be installed in the same place. More info here.

If the VPL runtime still does not load after adding its location to LD_LIBRARY_PATH, then likely there is an issue with the media driver installation which is causing VPL runtime to fail during the capabilities query.

catid commented 6 months ago

If it's the cap query thing, will there be useful logs somewhere I can check?

jonrecker commented 6 months ago

The GPU runtime supports some logging options which can be enabled at build time. Info here.

nemosupremo commented 5 months ago

I was having this same issue - I was trying to debug why gstreamer msdk package wasn't working for me on ubuntu 22.04. I had a similar installation path that you outlined in your blog which I had found after googling the symptoms. The changes I had to do was:

  1. Do not install intel-media-sdk.
  2. Use the LD_LIBRARY_PATH variable.

I had originally tried writing /opt/intel/mediasdk/lib to /etc/ld.so.conf.d/intel-mediasdk.conf, but this didn't work. It only worked when I used sudo LD_LIBRARY_PATH=/opt/intel/mediasdk/lib ./hello-sharing-vaapi-import -i ../examples/content/cars_320x240.nv12 -w 320 -h 240

My guess is there's some bias/priority to loading libmfxhw64 without libmfx-gen when both are found in ldconfig. I thought about removing libmfxhw64 entirely, but I couldn't do so as many apt managed dependencies required it.

akwrobel commented 5 months ago

Adding the path to the environment variables is the correct way to resolve this as laid out by the commenter above.