Hello.
Here's the libva-intel-media-driver that I ported, it requires igdgmm
library which I also ported.
This work is based on this:
https://github.com/intel/media-driver/pull/819
I include thy ports:
multimedia/libva-2.10.0 # LIMD-21 requires at least 2.8.0
multimedia/libva-utils-2.10.0 # with vainfo utility
multimedia/igdgmm-20.4.1 # latest atm, required for LIMD
multimedia/libva-intel-media-driver-21.1.1 # latest atm

# LIMD Port does have room for improvement:

* CMRT lib is disabled due to:
  https://github.com/intel/media-driver/pull/819#issuecomment-599480840

* using a nasty patch after configure to fix missing /usr/X11R6
includes and missing -lc LD_FLAG

* Tests are disabled due to causing segfaults, probably cmrtlib?

* c++17 <= is required to triger __ISO_C_VISIBLE <= 2011 for
aligned_malloc in /usr/include/stdlib.h used for
/media_driver/linux/common/os/mos_utilities_specific.h: _aligned_malloc

# igdgmm port:

* Tests are broken


# Result
Compiles in current state
tested with mpv + 4k 70Gb film on 2 core i5-7200u, 4k youtube in mpv works 
perfectly also

Additional flags for mpv were:
--enable-vaapi \
--disable-vaapi-drm \ # asks for vt.h
--enable-vaapi-x-egl \
--enable-vaapi-x11 \

I also tested ffmpeg with --enable-vaapi and
LIBavutil_EXTRALIBS=-lm -pthread -L/usr/local/lib -lva-glx -lva-drm -lva-x11 
-lva
I'll include a head of a log.
--
Eugene Moz.
ffmpeg started on 2021-02-07 at 19:18:16
Report written to "ffmpeg-20210207-191816.log"
Log level: 48
Command line:
ffmpeg -hide_banner -threads 1 -f x11grab -i :0.0 -vaapi_device /dev/drmR128 
-vcodec h264_vaapi -vf "format=nv12|vaapi,hwupload" output.mp4 -report
Splitting the commandline.
Reading option '-hide_banner' ... matched as option 'hide_banner' (do not show 
program banner) with argument '1'.
Reading option '-threads' ... matched as AVOption 'threads' with argument '1'.
Reading option '-f' ... matched as option 'f' (force format) with argument 
'x11grab'.
Reading option '-i' ... matched as input url with argument ':0.0'.
Reading option '-vaapi_device' ... matched as option 'vaapi_device' (set VAAPI 
hardware device (DRM path or X11 display name)) with argument '/dev/drmR128'.
Reading option '-vcodec' ... matched as option 'vcodec' (force video codec 
('copy' to copy stream)) with argument 'h264_vaapi'.
Reading option '-vf' ... matched as option 'vf' (set video filters) with 
argument 'format=nv12|vaapi,hwupload'.
Reading option 'output.mp4' ... matched as output url.
Reading option '-report' ... matched as option 'report' (generate a report) 
with argument '1'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option hide_banner (do not show program banner) with argument 1.
Applying option vaapi_device (set VAAPI hardware device (DRM path or X11 
display name)) with argument /dev/drmR128.
[AVHWDeviceContext @ 0x255396f6cc0] libva: VA-API version 1.10.0
[AVHWDeviceContext @ 0x255396f6cc0] libva: Trying to open 
/usr/local/lib/dri/iHD_drv_video.so
[AVHWDeviceContext @ 0x255396f6cc0] libva: Found init function 
__vaDriverInit_1_10
[AVHWDeviceContext @ 0x255396f6cc0] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x255396f6cc0] Initialised VAAPI connection: version 1.10
[AVHWDeviceContext @ 0x255396f6cc0] Format 0x41524742 -> bgra.
[AVHWDeviceContext @ 0x255396f6cc0] Format 0x42475241 -> argb.
[AVHWDeviceContext @ 0x255396f6cc0] Format 0x41424752 -> rgba.
[AVHWDeviceContext @ 0x255396f6cc0] Format 0x52474241 -> abgr.
[AVHWDeviceContext @ 0x255396f6cc0] Format 0x58524742 -> bgr0.
[AVHWDeviceContext @ 0x255396f6cc0] Format 0x42475258 -> 0rgb.
[AVHWDeviceContext @ 0x255396f6cc0] Format 0x58424752 -> rgb0.
[AVHWDeviceContext @ 0x255396f6cc0] Format 0x52474258 -> 0bgr.
[AVHWDeviceContext @ 0x255396f6cc0] Format 0x30335241 -> unknown.
[AVHWDeviceContext @ 0x255396f6cc0] Format 0x30334241 -> unknown.
[AVHWDeviceContext @ 0x255396f6cc0] Format 0x30335258 -> unknown.
[AVHWDeviceContext @ 0x255396f6cc0] Format 0x30334258 -> unknown.
[AVHWDeviceContext @ 0x255396f6cc0] Format 0x36314752 -> unknown.
[AVHWDeviceContext @ 0x255396f6cc0] Format 0x50424752 -> unknown.
[AVHWDeviceContext @ 0x255396f6cc0] Format 0x50524742 -> unknown.
[AVHWDeviceContext @ 0x255396f6cc0] Format 0x56555941 -> unknown.
[AVHWDeviceContext @ 0x255396f6cc0] Format 0x30303859 -> gray.
[AVHWDeviceContext @ 0x255396f6cc0] Format 0x3231564e -> nv12.
[AVHWDeviceContext @ 0x255396f6cc0] Format 0x3132564e -> unknown.
[AVHWDeviceContext @ 0x255396f6cc0] Format 0x32595559 -> yuyv422.
[AVHWDeviceContext @ 0x255396f6cc0] Format 0x59565955 -> uyvy422.
[AVHWDeviceContext @ 0x255396f6cc0] Format 0x32315659 -> yuv420p.
[AVHWDeviceContext @ 0x255396f6cc0] Format 0x30323449 -> yuv420p.
[AVHWDeviceContext @ 0x255396f6cc0] Format 0x50313134 -> yuv411p.
[AVHWDeviceContext @ 0x255396f6cc0] Format 0x48323234 -> yuv422p.
[AVHWDeviceContext @ 0x255396f6cc0] Format 0x56323234 -> yuv440p.
[AVHWDeviceContext @ 0x255396f6cc0] Format 0x50343434 -> yuv444p.
[AVHWDeviceContext @ 0x255396f6cc0] Format 0x33434d49 -> unknown.
[AVHWDeviceContext @ 0x255396f6cc0] Format 0x30313050 -> p010le.
[AVHWDeviceContext @ 0x255396f6cc0] VAAPI driver: Intel iHD driver for Intel(R) 
Gen Graphics - 21.1.1 ().
[AVHWDeviceContext @ 0x255396f6cc0] Driver not found in known nonstandard list, 
using standard behaviour.
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url :0.0.
Applying option f (force format) with argument x11grab.
Successfully parsed a group of options.
Opening an input file: :0.0.
[x11grab @ 0x2555e425800] Probe buffer size limit of 5000000 bytes reached
[x11grab @ 0x2555e425800] Stream #0: not enough frames to estimate rate; 
consider increasing probesize
Input #0, x11grab, from ':0.0':
  Duration: N/A, start: 1612714696.848904, bitrate: 1988667 kb/s
    Stream #0:0, 1, 1/1000000: Video: rawvideo (BGR[0] / 0x524742), bgr0, 
1920x1080, 1988667 kb/s, 29.97 fps, 1000k tbr, 1000k tbn, 1000k tbc
Successfully opened the file.
Parsing a group of options: output url output.mp4.
Applying option vcodec (force video codec ('copy' to copy stream)) with 
argument h264_vaapi.
Applying option vf (set video filters) with argument format=nv12|vaapi,hwupload.
Successfully parsed a group of options.
Opening an output file: output.mp4.
[file @ 0x254cc9b0080] Setting default whitelist 'file,crypto,data'
Successfully opened the file.
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (h264_vaapi))
Press [q] to stop, [?] for help
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it 
occurs once at the start per stream)
[rawvideo @ 0x25517a0e800] PACKET SIZE: 8294400, STRIDE: 7680
detected 4 logical cores
[Parsed_format_0 @ 0x254c9701900] Setting 'pix_fmts' to value 'nv12|vaapi'
[graph 0 input from stream 0:0 @ 0x25565dc4300] Setting 'video_size' to value 
'1920x1080'
[graph 0 input from stream 0:0 @ 0x25565dc4300] Setting 'pix_fmt' to value '123'
[graph 0 input from stream 0:0 @ 0x25565dc4300] Setting 'time_base' to value 
'1/1000000'
[graph 0 input from stream 0:0 @ 0x25565dc4300] Setting 'pixel_aspect' to value 
'0/1'
[graph 0 input from stream 0:0 @ 0x25565dc4300] Setting 'frame_rate' to value 
'30000/1001'
[graph 0 input from stream 0:0 @ 0x25565dc4300] w:1920 h:1080 pixfmt:bgr0 
tb:1/1000000 fr:30000/1001 sar:0/1
[format @ 0x2556b5bf400] Setting 'pix_fmts' to value 'vaapi_vld'
[auto_scaler_0 @ 0x254c9701800] Setting 'flags' to value 'bicubic'
[auto_scaler_0 @ 0x254c9701800] w:iw h:ih flags:'bicubic' interl:0
[Parsed_format_0 @ 0x254c9701900] auto-inserting filter 'auto_scaler_0' between 
the filter 'graph 0 input from stream 0:0' and the filter 'Parsed_format_0'
[AVFilterGraph @ 0x254cc9b0900] query_formats: 5 queried, 3 merged, 1 already 
done, 0 delayed
[auto_scaler_0 @ 0x254c9701800] w:1920 h:1080 fmt:bgr0 sar:0/1 -> w:1920 h:1080 
fmt:nv12 sar:0/1 flags:0x4
[hwupload @ 0x254a67cf080] Surface format is nv12.
[AVHWFramesContext @ 0x25566ae0000] Created surface 0.
[AVHWFramesContext @ 0x25566ae0000] Direct mapping possible.
[AVHWFramesContext @ 0x25566ae0000] Map surface 0.
[AVHWFramesContext @ 0x25566ae0000] Unmap surface 0.
[h264_vaapi @ 0x254ccfbc000] Using input frames context (format vaapi_vld) with 
h264_vaapi encoder.
[h264_vaapi @ 0x254ccfbc000] Input surface format is nv12.

Attachment: igdgmm.tar.gz
Description: Binary data

Attachment: libva-intel-media-driver.tar.gz
Description: Binary data

Attachment: libva-utils.tar.gz
Description: Binary data

Attachment: libva.tar.gz
Description: Binary data

Reply via email to