Benjamin Gaignard 5423e2d220 media: verisilicon: Add reference buffer compression feature
Reference frame compression is a feature added in the G2 decoder to
compress frame buffers so that the bandwidth of storing/loading
reference frames can be reduced, especially with high resolution decoded
streams.

The impact of compressed frames is confirmed when using perf to monitor
the number of memory accesses with or without the compression feature.
The following command:

perf stat -a -e \
imx8_ddr0/cycles/,imx8_ddr0/read-cycles/,imx8_ddr0/write-cycles/ \
gst-launch-1.0 filesrc \
location=Jockey_3840x2160_120fps_420_8bit_HEVC_RAW.hevc ! queue ! \
h265parse ! v4l2slh265dec ! video/x-raw,format=NV12 ! fakesink

Gives us these results without the compression feature:
Performance counter stats for 'system wide':

        1711300345      imx8_ddr0/cycles/
         892207924      imx8_ddr0/read-cycles/
        1291785864      imx8_ddr0/write-cycles/

      13.760048353 seconds time elapsed

With the compression feature:
Performance counter stats for 'system wide':

         274526799      imx8_ddr0/cycles/
         453120194      imx8_ddr0/read-cycles/
         833391434      imx8_ddr0/write-cycles/

      18.257831534 seconds time elapsed

As expected the number of read/write cycles are really lower when
compression is used.

Since storing the compression data requires more memory a module
parameter named 'hevc_use_compression' is used to enable/disable
this feature and, by default, compression isn't used.

Enabling the compression feature means that the output-frames of the
decoder
are stored with a specific compression pixel-format. Since this
pixel format is unknown, this patch restrains the compression feature
usage to the cases where post-processor pixel-formats (NV12 or NV15)
are selected by the applications.

The Fluster compliance HEVC test suite score is still 141/147 with this
patch.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Tested-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-08-28 10:01:10 +02:00

71 lines
1.9 KiB
Plaintext

# SPDX-License-Identifier: GPL-2.0-only
comment "Verisilicon media platform drivers"
config VIDEO_HANTRO
tristate "Hantro VPU driver"
depends on ARCH_MXC || ARCH_ROCKCHIP || ARCH_AT91 || ARCH_SUNXI || ARCH_STM32 || COMPILE_TEST
depends on V4L_MEM2MEM_DRIVERS
depends on VIDEO_DEV
select MEDIA_CONTROLLER
select VIDEOBUF2_DMA_CONTIG
select VIDEOBUF2_VMALLOC
select V4L2_MEM2MEM_DEV
select V4L2_H264
select V4L2_JPEG_HELPER
select V4L2_VP9
help
Support for the Hantro IP based Video Processing Units present on
Rockchip, NXP i.MX8M and STM32MP25 SoCs, which accelerate video
and image encoding and decoding.
To compile this driver as a module, choose M here: the module
will be called hantro-vpu.
config VIDEO_HANTRO_HEVC_RFC
bool "Use reference frame compression for HEVC"
depends on VIDEO_HANTRO
default n
help
Enable the reference frame compression feature for the HEVC codec.
It will use more memory but save bandwidth on memory bus.
config VIDEO_HANTRO_IMX8M
bool "Hantro VPU i.MX8M support"
depends on VIDEO_HANTRO
depends on ARCH_MXC || COMPILE_TEST
default y
help
Enable support for i.MX8M SoCs.
config VIDEO_HANTRO_SAMA5D4
bool "Hantro VDEC SAMA5D4 support"
depends on VIDEO_HANTRO
depends on ARCH_AT91 || COMPILE_TEST
default y
help
Enable support for Microchip SAMA5D4 SoCs.
config VIDEO_HANTRO_ROCKCHIP
bool "Hantro VPU Rockchip support"
depends on VIDEO_HANTRO
depends on ARCH_ROCKCHIP || COMPILE_TEST
default y
help
Enable support for RK3288, RK3328, and RK3399 SoCs.
config VIDEO_HANTRO_SUNXI
bool "Hantro VPU Allwinner support"
depends on VIDEO_HANTRO
depends on ARCH_SUNXI || COMPILE_TEST
default y
help
Enable support for H6 SoC.
config VIDEO_HANTRO_STM32MP25
bool "Hantro STM32MP25 support"
depends on VIDEO_HANTRO
depends on ARCH_STM32 || COMPILE_TEST
default y
help
Enable support for STM32MP25 SoCs.