[FFmpeg-user] init_hw_device qsv for hwaccel on Skylake iGPU + Nvidia GF GPU

Wang, Fei W fei.w.wang at intel.com
Mon Sep 2 16:58:31 EEST 2024


On Mon, 2024-09-02 at 15:29 +0200, Terje J. Hanssen wrote:


On 9/2/24 07:01, Wang, Fei W wrote:


On Sun, 2024-09-01 at 10:53 +0200, Terje J. Hanssen wrote:


I have not succeeded yet to configure ffmpeg 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 suggestions how to solve this?

You can use vainfo to find the Intel gpu device correctly:

"vainfo --display drm --device /dev/dri/renderD12X"


Then specify device in ffmpeg cmdline with "-qsv_device

/dev/dri/renderD12X"


BTW, for legacy platforms, suggest to use libvpl with Media SDK for the

runtime implementation:

https://github.com/intel/libvpl

https://github.com/Intel-Media-SDK/MediaSDK


Thanks

Fei


@Fei, thanks for your suggestion that hopefully will probe me in the right direction.
Right now, I will be absent from my Skylake workstation a week or two, before I can test more directly on it. But I did preserve some more output I will add and refer to below.

In the meantime I also can do a bit indirectly tests on my available Kaby Lake XPS-13 with UHD 620 iGPU and a similar system installation:

    vainfo --display drm --device /dev/dri/renderD12X
    Trying display: drm
    Failed to open the given device!

As this don't find any device on Kaby Lake, I expect I rather have to put in a number "8" instead of "X" as found on Kaby Lake(?)

Yes, X stands for 8 or 9. To find the Intel device node if vainfo shows the correct message.


    ls /dev/dri
    by-path  card1  renderD128

When I try

vainfo --display drm --device /dev/dri/renderD12*
or

vainfo --display drm --device /dev/dri/renderD128
This simingly output just the same as "vainfo" alone on KabyLake.

And I have the latter preserved also from Skylake as follows:

vainfo
Trying display: wayland
libva info: VA-API version 1.22.0
libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_21
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.22 (libva 2.22.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 24.1.5 ()
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
---------------

In addition also also preserved output on Skylake from two other tools, "drmdevice" and "drm_info" as follows.


drmdevice
--- Checking the number of DRM device available ---
--- Devices reported 2 ---
--- Retrieving devices information (PCI device revision is ignored) ---
device[0]
+-> available_nodes 0x05
+-> nodes
|   +-> nodes[0] /dev/dri/card1
|   +-> nodes[2] /dev/dri/renderD128
+-> bustype 0000
|   +-> pci
|       +-> domain 0000
|       +-> bus    01
|       +-> dev    00
|       +-> func   0
+-> deviceinfo
    +-> pci
        +-> vendor_id     10de
        +-> device_id     1401
        +-> subvendor_id  1462
        +-> subdevice_id  3201
        +-> revision_id   IGNORED

--- Opening device node /dev/dri/card1 ---
--- Retrieving device info, for node /dev/dri/card1 ---
device[0]
+-> available_nodes 0x05
+-> nodes
|   +-> nodes[0] /dev/dri/card1
|   +-> nodes[2] /dev/dri/renderD128
+-> bustype 0000
|   +-> pci
|       +-> domain 0000
|       +-> bus    01
|       +-> dev    00
|       +-> func   0
+-> deviceinfo
    +-> pci
        +-> vendor_id     10de
        +-> device_id     1401
        +-> subvendor_id  1462
        +-> subdevice_id  3201
        +-> revision_id   a1

--- Opening device node /dev/dri/renderD128 ---
--- Retrieving device info, for node /dev/dri/renderD128 ---
device[0]
+-> available_nodes 0x05
+-> nodes
|   +-> nodes[0] /dev/dri/card1
|   +-> nodes[2] /dev/dri/renderD128
+-> bustype 0000
|   +-> pci
|       +-> domain 0000
|       +-> bus    01
|       +-> dev    00
|       +-> func   0
+-> deviceinfo
    +-> pci
        +-> vendor_id     10de
        +-> device_id     1401
        +-> subvendor_id  1462
        +-> subdevice_id  3201
        +-> revision_id   a1

device[1]
+-> available_nodes 0x05
+-> nodes
|   +-> nodes[0] /dev/dri/card2
|   +-> nodes[2] /dev/dri/renderD129
+-> bustype 0000
|   +-> pci
|       +-> domain 0000
|       +-> bus    00
|       +-> dev    02
|       +-> func   0
+-> deviceinfo
    +-> pci
        +-> vendor_id     8086
        +-> device_id     1912
        +-> subvendor_id  1462
        +-> subdevice_id  7971
        +-> revision_id   IGNORED

--- Opening device node /dev/dri/card2 ---
--- Retrieving device info, for node /dev/dri/card2 ---
device[1]
+-> available_nodes 0x05
+-> nodes
|   +-> nodes[0] /dev/dri/card2
|   +-> nodes[2] /dev/dri/renderD129
+-> bustype 0000
|   +-> pci
|       +-> domain 0000
|       +-> bus    00
|       +-> dev    02
|       +-> func   0
+-> deviceinfo
    +-> pci
        +-> vendor_id     8086
        +-> device_id     1912
        +-> subvendor_id  1462
        +-> subdevice_id  7971
        +-> revision_id   06

--- Opening device node /dev/dri/renderD129 ---
--- Retrieving device info, for node /dev/dri/renderD129 ---
device[1]
+-> available_nodes 0x05
+-> nodes
|   +-> nodes[0] /dev/dri/card2
|   +-> nodes[2] /dev/dri/renderD129
+-> bustype 0000
|   +-> pci
|       +-> domain 0000
|       +-> bus    00
|       +-> dev    02
|       +-> func   0
+-> deviceinfo
    +-> pci
        +-> vendor_id     8086
        +-> device_id     1912
        +-> subvendor_id  1462
        +-> subdevice_id  7971
        +-> revision_id   06

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

drm_info | grep Driver
├───Driver: nvidia-drm (NVIDIA DRM driver) version 0.0.0 (20160202)
├───Driver: i915 (Intel Graphics) version 1.6.0 (20230929)


If  /dev/dri/card2 and /dev/dri/renderD129 refer to the Skylake HD 530 iGPU
(and /dev/dri/card1 and /dev/dri/renderD128 refer to  the Nvidia GPU),
I cannot understand why the initial, second ffmpeg command in section 2) below did report  errors?

Possibly syntax error or something else?

The command looks good. There are 2 run-time implementation Media SDK and vpl-gpu-rt for libvpl(
more details can be found on github of libvpl: https://github.com/intel/libvpl).
While only Media SDK supported on Skylake. So you may check if you installed Meida SDK on your Skylake
but not vpl-gpu-rt.

Thanks
Fei





My tested ffmpeg code lines and system information below.


1) Tested first this simple ffmpeg decode bencmark code line from

https://trac.ffmpeg.org/wiki/Hardware/QuickSync#Decode-only

This works fine on single GPU Caby Lake/UHD 620 and on Alder Lake/Arc

A750, but on Skylake with dual iGPU HD 530 and a Nvidia GeForce GTX

960

card, these errors are reported:


    ffmpeg -hide_banner -hwaccel qsv -hwaccel_output_format qsv -i

    h264_8bit_yuv420p.mp4 -f null -

    ....

    [AVHWDeviceContext @ 0x55bed1a7c500] Error creating a MFX

session: -9.

    Device creation failed: -1313558101.

    [vist#0:0/h264 @ 0x55bed1a656c0] [dec:h264_qsv @ 0x55bed1a64300]

No

    device available for decoder: device type qsv needed for codec

h264_qsv.

    [vist#0:0/h264 @ 0x55bed1a656c0] [dec:h264_qsv @ 0x55bed1a64300]

    Hardware device setup failed for decoder: Unknown error occurred

    [vost#0:0/wrapped_avframe @ 0x55bed1a63740] Error initializing a

    simple filtergraph

    Error opening output file -.

    Error opening output files: Unknown error occurred

    bench: maxrss=59076KiB






2) Additional tests where I experimented to apply suggestions from

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).



    ffmpeg -hide_banner -hwaccel qsv -qsv_device /dev/dri/renderD128

-i

    h264_8bit_yuv420p.mp4 -f null -

    DRM_IOCTL_VERSION, unsupported drm device by media driver: nvid

    DRM_IOCTL_VERSION, unsupported drm device by media driver: nvid

    [AVHWDeviceContext @ 0x56330da80dc0] libva:

    /usr/lib64/dri/iHD_drv_video.so init failed

    [AVHWDeviceContext @ 0x56330da80dc0] Failed to initialise VAAPI

    connection: 18 (invalid parameter).

    Device creation failed: -5.

    Failed to set value '/dev/dri/renderD128' for option

'qsv_device':

    Input/output error

    Error parsing global options: Input/output error



    ffmpeg -hide_banner -hwaccel qsv -qsv_device /dev/dri/renderD129

-i

    h264_8bit_yuv420p.mp4 -f null -

    [AVHWDeviceContext @ 0x55deafcbcec0] Error creating a MFX

session: -9.

    Device creation failed: -1313558101.

    Failed to set value '/dev/dri/renderD129' for option

'qsv_device':

    Unknown error occurred

    Error parsing global options: Unknown error occurred



    ffmpeg -hide_banner -init_hw_device qsv=hw -filter_hw_device hw

    -hwaccel_output_format qsv -hwaccel qsv -qsv_device

    /dev/dri/renderD128 -i h264_8bit_yuv420p.mp4 -f null -

    [AVHWDeviceContext @ 0x563f568e7e00] Error creating a MFX

session: -9.

    Device creation failed: -1313558101.

    Failed to set value 'qsv=hw' for option 'init_hw_device': Unknown

    error occurred

    Error parsing global options: Unknown error occurred






More information about the ffmpeg-user mailing list