Intel-Media-SDK / MediaSDK

The Intel® Media SDK
MIT License
924 stars 454 forks source link

Only CQP rate control is available on Elkhart Lake #3008

Closed rekjanov closed 1 year ago

rekjanov commented 1 year ago

System information

Issue behavior

Tried on uptodate Ubuntu Server 22.04.1 with distribution provided media sdk packages, on generic (5.15) and oem (6.1) kernel Also tried on a from scratch system with stock 5.15 kernel and latest media sdk/va driver 22.5.4 with requirements.

Describe the current behavior

root@test1:/usr/share/mfx/samples# LD_PRELOAD=libmfx-tracer.so.1.35 ./sample_encode h264 -i /dev/zero -o /dev/null -w 1920 -h 1080 -n 1000 -b 2000
libva info: Open new log file /tmp/libva_trace.log.222024.thd-0x000006a1 for the thread 0x000006a1
libva info: LIBVA_TRACE is on, save log into /tmp/libva_trace.log.222024.thd-0x000006a1
libva info: VA-API version 1.14.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_14
libva info: va_openDriver() returns 0

[ERROR], sts=MFX_ERR_UNSUPPORTED(-3), AllocFrames, Query (for encoder) failed at ./samples/sample_encode/src/pipeline_encode.cpp:966

[ERROR], sts=MFX_ERR_UNSUPPORTED(-3), ResetMFXComponents, AllocFrames failed at ./samples/sample_encode/src/pipeline_encode.cpp:2076

[ERROR], sts=MFX_ERR_UNSUPPORTED(-3), Init, ResetMFXComponents failed at ./samples/sample_encode/src/pipeline_encode.cpp:1857

[ERROR], sts=MFX_ERR_UNSUPPORTED(-3), main, pPipeline->Init failed at ./samples/sample_encode/src/sample_encode.cpp:1787
Frame number: 0
Encoding fps: -nan

but

root@test1:/usr/share/mfx/samples# ./sample_encode h264 -i /dev/zero -o /dev/null -w 1920 -h 1080 -n 1000 -cqp
libva info: Open new log file /tmp/libva_trace.log.222213.thd-0x000006a8 for the thread 0x000006a8
libva info: LIBVA_TRACE is on, save log into /tmp/libva_trace.log.222213.thd-0x000006a8
libva info: VA-API version 1.14.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_14
libva info: va_openDriver() returns 0
libva info: Save context 0x20000000 into log file /tmp/libva_trace.log.222213.thd-0x000006a8
Encoding Sample Version 8.4.27.0

Input file format   YUV420
Output video        AVC 
Source picture:
    Resolution  1920x1088
    Crop X,Y,W,H    0,0,1920,1080
Destination picture:
    Resolution  1920x1088
    Crop X,Y,W,H    0,0,1920,1080
Frame rate  30.00
QPI 10
QPP 10
QPB 10
Gop size    256
Ref dist    1
Ref number  2
Idr Interval    0
Target usage    balanced
Memory type vaapi
Media SDK impl      hw
Media SDK version   1.35

Processing started
libva info: Open new log file /tmp/libva_trace.log.222213.thd-0x000006a9 for the thread 0x000006a9
Frame number: 1000

Encoding fps: 244

Processing finished

any other rc doesn't work either

Describe the expected behavior

Debug information

rekjanov commented 1 year ago

I also tried, on Ubuntu 22.04.1 with the following updated media components:

nyanmisaka commented 1 year ago

I've filed an issue: https://gitlab.freedesktop.org/drm/intel/-/issues/8080

This has been a long time issue due to the neglect of Intel devs.

Intel disabled the HuC loading by default on pre-Gen12 platforms, however Jasper Lake and Elkhart Lake are two stripped version of Gen11, which means they only support CQP rate control by default unless you add the i915.enable_guc=2 option in your kernel parameters but you can't expect any end user can achieve this on their own.

I don't think this is the desired behavior since CBR and VBR rate control methods are the basic feature of any full functional video encoder such as H.264 and HEVC. They should reconsider enable HuC loading on these two chips.

rekjanov commented 1 year ago

Thank you. I figured out about enable_guc=2. The problem is that on 5.15 kernel GuC initialization fails with error -110 (time out). This parameter works on 6.1.10 kernel though. I haven't tried the versions inbeetwen. To add to confusion, in my previous experience with MediaSDK (18.3) and kernel 4.19 on SKL and APL, I didn't need any GuC/HuC firmware to get cbr/vbr.

nyanmisaka commented 1 year ago

5.15 had a known issue that prevent you from using the GuC/HuC fimware.

Only JSL and EHL are affected by this issue and end users have to add this parameter on their own.

Because these two chip doesn't support non-low-power(PAK+kernel+VME) encoding.