Re: Correct libva driver for Intel Comet Lake

From: Evgeniy Khramtsov via freebsd-x11 <freebsd-x11_at_freebsd.org>
Date: Wed, 23 Jun 2021 08:17:32 UTC
"libva-media-driver" does not exist as a $PORTNAME.

There are:
libva-intel-driver: for Intel GMA 4500 to UHD 630
libva-intel-hybrid-driver: Haswell to Braswell Hybrid VP{8,9} {en,de}decoder.
The two above are legacy drivers and were superseded by libva-intel-media-driver:
https://github.com/intel/intel-vaapi-driver/issues/499#issuecomment-638556599

intel-media-driver should support Comet Lake starting from tag intel-media-19.2.pre1:
https://github.com/intel/media-driver/commit/44ea2083b8f6c0afd6b7ee6b204a6017d1b67448
https://github.com/intel/media-driver/issues/771#issuecomment-769842424

Remove the legacy drivers if you have them installed, then install
libva-intel-media-driver, libva-utils (for vainfo) and mpv (for test).

See if you have VA-API profiles (example for Comet Lake ES that reports
as Coffee Lake 0x3E9B):

$ vainfo
libva info: VA-API version 1.12.0
libva info: Trying to open /usr/local/lib/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_12
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.12 (libva 2.12.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 21.2.2 (intel-media-21.2.2)
vainfo: Supported profile and entrypoints
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileNone                   : VAEntrypointStats
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Simple            : VAEntrypointEncSlice
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointFEI
      VAProfileH264Main               : VAEntrypointEncSliceLP
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointFEI
      VAProfileH264High               : VAEntrypointEncSliceLP
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointEncPicture
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointFEI
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
      VAProfileVP8Version0_3          : VAEntrypointVLD
      VAProfileVP8Version0_3          : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointFEI
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointEncSlice
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointVLD

Then try hardware VA-API decoding using mpv:

$ mpv --no-config --msg-level=vo/gpu=v,vd=v --hwdec=vaapi --vo=gpu \
  https://base-n.de/webm/out9.webm

Check for:
[vd] Selected codec: vp9 (Google VP9)
[vd] Pixel formats supported by decoder: vaapi_vld yuv420p
[vd] Codec profile: Profile 0 (0x0)
[vd] Requesting pixfmt 'vaapi_vld' from decoder.
Using hardware decoding (vaapi).