This is proof that discrete Intel Arc use the same old hardware acceleration block for encoding

Best Regards,
Andrey


вт, 10 сент. 2024 г. в 18:35, Terje J. Hanssen via Cin <cin@lists.cinelerra-gg.org>:


Den 31.08.2024 00:58, skrev Terje J. Hanssen:
I am stuck how to configure QSV access to an enabled iGPU onboard  an Intel Core i7-6700K (Skylake). This is a legacy, rebuilt workstation with additional, discrete Nvidia GeForce GTX 960 GPU on a MSI-Z170-A Pro mobo.  Any idea and code modification below?

Details as follows:

inxi -CGMSz
System:
  Kernel: 6.10.5-1-default arch: x86_64 bits: 64
  Desktop: GNOME v: 46.3.1 Distro: openSUSE Tumbleweed-Slowroll 20240803
Machine:
  Type: Desktop Mobo: MSI model: Z170-A PRO (MS-7971) v: 1.0
    serial: <superuser required> UEFI: American Megatrends v: 1.K0
    date: 07/10/2018
CPU:
  Info: quad core model: Intel Core i7-6700K bits: 64 type: MT MCP cache:
    L2: 1024 KiB
  Speed (MHz): avg: 800 min/max: 800/4200 cores: 1: 800 2: 800 3: 800 4: 800
    5: 800 6: 800 7: 800 8: 800
Graphics:
  Device-1: Intel HD Graphics 530 driver: i915 v: kernel
  Device-2: NVIDIA GM206 [GeForce GTX 960] driver: nvidia v: 550.100
  Display: wayland server: X.org v: 1.21.1.12 with: Xwayland v: 24.1.1
    compositor: gnome-shell driver: X: loaded: modesetting unloaded: fbdev,vesa
    gpu: nvidia,nvidia-nvswitch resolution: 1920x1080~60Hz
  API: OpenGL v: 4.6.0 vendor: nvidia v: 550.100 renderer: NVIDIA GeForce
    GTX 960/PCIe/SSE2
  API: Vulkan v: 1.3.290 drivers: N/A surfaces: xcb,xlib,wayland
  API: EGL Message: EGL data requires eglinfo. Check --recommends.


lspci -k | grep -EA3 'VGA|3D|Display'
00:02.0 Display controller: Intel Corporation HD Graphics 530 (rev 06)
    DeviceName:  Onboard IGD
    Subsystem: Micro-Star International Co., Ltd. [MSI] Device 7971
    Kernel driver in use: i915
--
01:00.0 VGA compatible controller: NVIDIA Corporation GM206 [GeForce GTX 960] (rev a1)
    Subsystem: Micro-Star International Co., Ltd. [MSI] Device 3201
    Kernel driver in use: nvidia
    Kernel modules: nouveau, nvidia_drm, nvidia

=====================================================================

Trying to test QSV via FFmpeg benchmark similar like this Vulkan code
ffmpeg -init_hw_device "vulkan=vk:0" -hwaccel vulkan -hwaccel_output_format vulkan -i INPUT -f null - -benchmark
https://trac.ffmpeg.org/wiki/HWAccelIntro#Vulkan

cause an output error which reports: "device type qsv needed".
Intel Skylake with HD 530 graphics gen 9, should be capable to decode and encode MPEG-2/H.264/H.265 according to
https://trac.ffmpeg.org/wiki/Hardware/QuickSync#HardwareSupport

ffmpeg -hide_banner -hwaccel qsv -hwaccel_output_format qsv -i h264_8bit_yuv420p.mp4 -f null - -benchmark
[AVHWDeviceContext @ 0x557526873500] Error creating a MFX session: -9.
Device creation failed: -1313558101.
[vist#0:0/h264 @ 0x55752685c6c0] [dec:h264_qsv @ 0x55752685b300] No device available for decoder: device type qsv needed for codec h264_qsv.
[vist#0:0/h264 @ 0x55752685c6c0] [dec:h264_qsv @ 0x55752685b300] Hardware device setup failed for decoder: Unknown error occurred
[vost#0:0/wrapped_avframe @ 0x55752685a740] Error initializing a simple filtergraph
Error opening output file -.
Error opening output files: Unknown error occurred
bench: maxrss=67452KiB


I have tried to define and add a qsv device according to the last section here
https://trac.ffmpeg.org/wiki/Hardware/QuickSync#Transcode

-qsv_device is an qsv customized option can be used to specify a hardware device and avoid the default device initialization failure when multiple devices usable (eg: an Intel integrated GPU and an AMD/Nvidia discrete graphics card). One example on Linux (more details please see https://trac.ffmpeg.org/ticket/7649)

ffmpeg -hwaccel qsv -qsv_device /dev/dri/renderD128 -c:v h264_qsv -i input.mp4 -c:v h264_qsv output.mp4

and also had a look at this answer
https://stackoverflow.com/questions/44747381/i-cant-use-hw-encoder-of-qsv-by-ffmpeg#47145215

..... snip


In the meantime I have also queried this QSV issue on the ffmpeg-user mailing list, where I got some hints that helped me to solve it.
So to not leave this as an open issue here, I repost my reply to that list:

Yes, now I have verified that "libmfx" runtime was not installed by default on the Skylake workstation  (possibly because I enabled its iGPU in BIOS afterwards).
My ffmpeg had "libvpl" enabled, and "libmfx-gen1_2" was installed by default. When

When I add-installed "libmfx1", QSV via FFmpeg worked as it should:

ffmpeg -hide_banner -hwaccel qsv -hwaccel_output_format qsv -i h264_8bit_yuv420p.mp4 -f null -

1) On  Skylake i7-6700K / HD-530 iGPU:
frame= 1780 fps=882 q=-0.0 Lsize=N/A time=00:01:11.20 bitrate=N/A speed=35.3x

2) On KabyLake i7-8550U / UHD-620 iGPU:
frame= 1780 fps=795 q=-0.0 Lsize=N/A time=00:01:11.20 bitrate=N/A speed=31.8x   

3) On AlderLake i7-12700KF + DG2 A750 GPU:
frame= 1780 fps=833 q=-0.0 Lsize=N/A time=00:01:11.20 bitrate=N/A speed=33.3x   

What surprise me here, is that the current most powerful workstation 3), is not faster here than the legacy 1) and 2)


References:
https://github.com/intel/libvpl?tab=readme-ov-file#architecture
https://github.com/Intel-Media-SDK/MediaSDK?tab=readme-ov-file#id10
https://wiki.archlinux.org/title/FFmpeg#Intel_QuickSync_(QSV)

And as orientation for possibly other QSV interested in reading more of this thread at ffmpeg-user, here is the url:
https://ffmpeg.org/pipermail/ffmpeg-user/2024-September/058677.html

--
Cin mailing list
Cin@lists.cinelerra-gg.org
https://lists.cinelerra-gg.org/mailman/listinfo/cin