After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 789472 - vaapih264enc bitrate target not respected in low-power mode
vaapih264enc bitrate target not respected in low-power mode
Status: RESOLVED NOTABUG
Product: GStreamer
Classification: Platform
Component: gstreamer-vaapi
git master
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-10-25 10:47 UTC by Florent Thiéry
Modified: 2017-12-06 18:31 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Florent Thiéry 2017-10-25 10:47:02 UTC
Trying to generate a 8 Mbits/s file, but the resulting one is 20 Mbits/s.

gst-launch-1.0 videotestsrc num-buffers=1000 ! "video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive" ! vaapih264enc bitrate=8000 keyframe-period=30 tune=low-power ! mp4mux ! filesink location=test.mp4

Also, specifying CBR fails:

gst-launch-1.0 videotestsrc num-buffers=1000 ! "video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive" ! vaapih264enc bitrate=8000 keyframe-period=30 tune=low-power rate-control=cbr ! mp4mux ! filesink location=test.mp4
0:00:00.064459811  2165 0x55eb91cce230 ERROR                  vaapi gstvaapicontext.c:274:config_create: unsupported CBR rate control

So my guess is that it's doing cqp ? What can i do to control the target bitrate in low power mode ?
Comment 1 Florent Thiéry 2017-11-29 13:23:36 UTC
Hi; is the bitrate property ignored ? How/is it possible to specify a constant bitrate with low-power tune ?
Comment 2 Víctor Manuel Jáquez Leal 2017-11-30 13:48:44 UTC
Is this is only happening in low-power mode?
Comment 3 Florent Thiéry 2017-12-04 13:03:36 UTC
Yes; but CBR is explicitly not supported with low power (and the pipeline fails if i select CBR), so is the bitrate property simply ignored ? Is implementing CBR the only option here (and if so, it it planned)?

This is problematic to me since my application targets 30 fps, and i am not reaching it if do not use tune=low-power.
Comment 4 Víctor Manuel Jáquez Leal 2017-12-06 15:59:55 UTC
Ok. I debugged it.

1\ Constant QP (CQP), the default rate control, doesn't support the setting of a bit rate.
2\ vaapi-intel-driver, low-power mode, only support CQP: https://github.com/01org/intel-vaapi-driver/blob/master/src/i965_device_info.c#L378

Perhaps you would like to open an issue in the driver to ask for it.
Comment 5 Florent Thiéry 2017-12-06 16:18:57 UTC
Alright, thanks. So basically setting the bitrate property has no effect, many thanks for investigating.

I will open an issue
Comment 6 Florent Thiéry 2017-12-06 17:33:50 UTC
Here is the response from the driver people; i believe it indicates it is doing CBR.

https://github.com/01org/intel-vaapi-driver/blob/master/src/i965_device_info.c#L1052
Comment 7 sreerenj 2017-12-06 18:00:39 UTC
All SKL+ platforms support CBR in low-power mode, only thing is that you need huc firmware support in your kernel.

Make sure your kernel correctly loaded the HuC firmware.
Comment 8 Florent Thiéry 2017-12-06 18:13:25 UTC
I do see this, but seems unrelated:

# dmesg | grep i915 | grep loading
[    2.316605] [drm] Finished loading i915/skl_dmc_ver1_26.bin (v1.26)

I'm running 4.9.66-1-lts, is that even supported ? 

I tried this:
# cat /etc/modprobe.d/i915.conf 
enable_guc_loading=1 enable_guc_submission=1

I do have a recent linux-firmware: 20171123.90436ce-1
# pacman -Ql linux-firmware | grep skl
linux-firmware /usr/lib/firmware/i915/skl_dmc_ver1.bin
linux-firmware /usr/lib/firmware/i915/skl_dmc_ver1_23.bin
linux-firmware /usr/lib/firmware/i915/skl_dmc_ver1_26.bin
linux-firmware /usr/lib/firmware/i915/skl_guc_ver1.bin
linux-firmware /usr/lib/firmware/i915/skl_guc_ver4.bin
linux-firmware /usr/lib/firmware/i915/skl_guc_ver6.bin
linux-firmware /usr/lib/firmware/i915/skl_guc_ver6_1.bin
linux-firmware /usr/lib/firmware/i915/skl_guc_ver9_33.bin
linux-firmware /usr/lib/firmware/i915/skl_huc_ver01_07_1398.bin

But no joy:

# cat /sys/kernel/debug/dri/0/i915_huc_load_status
cat: /sys/kernel/debug/dri/0/i915_huc_load_status: No such file or directory

# cat /sys/kernel/debug/dri/0/i915_guc_load_status
GuC firmware status:
	path: i915/skl_guc_ver6_1.bin
	fetch: NONE
	load: NONE
	version wanted: 6.1
	version found: 0.0
	header: offset is 0; size = 0
	uCode: offset is 0; size = 0
	RSA: offset is 0; size = 0

GuC status 0x00000001:
	Bootrom status = 0x0
	uKernel status = 0x0
	MIA Core status = 0x0

Scratch registers:
	 0: 	0x0
	 1: 	0x0
	 2: 	0x0
	 3: 	0x0
	 4: 	0x0
	 5: 	0x0
	 6: 	0x0
	 7: 	0x0
	 8: 	0x0
	 9: 	0x0
	10: 	0x0
	11: 	0x0
	12: 	0x0
	13: 	0x0
	14: 	0x0
	15: 	0x0

Looks like a very recent kernel is necessary.

What happens if i don't have the updated HuC firmware loaded ? What is the rate control then ?
Comment 9 sreerenj 2017-12-06 18:21:00 UTC
Seems like you have no huc firmware.

Just install the firmwares for your platform from https://01.org/linuxgraphics/downloads/firmware

Without huc, CQP will be the only BRC mode.
Comment 10 Florent Thiéry 2017-12-06 18:30:46 UTC
Many thanks.
Comment 11 Florent Thiéry 2017-12-06 18:31:22 UTC
For the record, the related ticket on the va driver: https://github.com/01org/intel-vaapi-driver/issues/312