media/gpu/vaapi: reduce encoding quality on low power ChromeOSes
This CL queries the driver for the encoding quality range and, if available and the device is considered "low power" (celeron, pentium and Core -Y devices), sets it to its maximum value, for highest speed and lowest power consumption, albeit at lower encoding quality. The quality difference should not be noticeable for video conference scenarios. I followed the code in both of Intel's VA backends. For the legacy i965: - VP8 supports values 1-2 [1]. (ENCODER_LOW_QUALITY is 2 so at least this CL can supersede the patch in [2] which is what it was set off to do). - AVC1 and VP9 support 1-7 [3,4], ENCODER_QUALITY_RANGE_(AVC,VP9) == 7 see [5], but this only on Gen9 [6a, 6b] (VP9 encoding is only available in Gen9+ FTR). For the modern intel-media-driver iHD, values are configured with names, 1 being TARGETUSAGE_BEST_QUALITY ([7] and its following lines). By default, the TARGETUSAGE_RT_SPEED == 4 is used, and 7 would be TARGETUSAGE_BEST_SPEED. Improvements depend on the input content. I measured kohaku with EncodeAccelPerf.h264_1080p_i420 and when ToT is ~204fps, 4.75W, with this CL I see ~220 fps, 4.42W. [1] https://github.com/intel/intel-vaapi-driver/blob/d87db2111a33b157d1913415f15d201cc5182850/src/i965_drv_video.c#L1151 [2] https://source.chromium.org/chromiumos/chromiumos/codesearch/+/master:src/third_party/chromiumos-overlay/x11-libs/libva-intel-driver/files/vp8-encoder-Workaround-to-force-perforamce-mode-enco.patch;l=36 [3] https://github.com/intel/intel-vaapi-driver/blob/d87db2111a33b157d1913415f15d201cc5182850/src/i965_drv_video.c#L1142 [4] https://github.com/intel/intel-vaapi-driver/blob/d87db2111a33b157d1913415f15d201cc5182850/src/i965_drv_video.c#L1149 [5] https://github.com/intel/intel-vaapi-driver/blob/021bcb79d1bd873bbd9fbca55f40320344bab866/src/i965_drv_video.h#L76 [6a] https://github.com/intel/intel-vaapi-driver/blob/021bcb79d1bd873bbd9fbca55f40320344bab866/src/i965_encoder.c#L1599 [6b] https://github.com/intel/intel-vaapi-driver/blob/021bcb79d1bd873bbd9fbca55f40320344bab866/src/i965_encoder.c#L1653 [7] https://github.com/intel/media-driver/blob/105f0341a21324ae3bc458cfa6c25c7df0517f3a/media_driver/agnostic/common/codec/shared/codec_def_common.h#L333 Bug: b:141147405 Change-Id: I7e5c54f1e5a7ac7a51c5503f37168db16f9e99f7 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2344526 Commit-Queue: Miguel Casas <mcasas@chromium.org> Reviewed-by:Andres Calderon Jaramillo <andrescj@chromium.org> Reviewed-by:
Sreerenj Balachandran <sreerenj.balachandran@intel.com> Reviewed-by:
Hirokazu Honda <hiroh@chromium.org> Cr-Commit-Position: refs/heads/master@{#827439}
Showing
Please register or sign in to comment