]> www.infradead.org Git - users/jedix/linux-maple.git/commit
media: verisilicon: Add reference buffer compression feature
authorBenjamin Gaignard <benjamin.gaignard@collabora.com>
Thu, 16 May 2024 08:41:07 +0000 (10:41 +0200)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Wed, 28 Aug 2024 08:01:10 +0000 (10:01 +0200)
commit5423e2d220bebb4304f7ff739d02180f676eefd0
treec5ac0b5246dc313e410dd5c2d181c578c1b74954
parent41eb4fb5d936bfa711020af30fa444776c1a6884
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>
drivers/media/platform/verisilicon/Kconfig
drivers/media/platform/verisilicon/hantro_g2.c
drivers/media/platform/verisilicon/hantro_g2_hevc_dec.c
drivers/media/platform/verisilicon/hantro_g2_regs.h
drivers/media/platform/verisilicon/hantro_hevc.c
drivers/media/platform/verisilicon/hantro_hw.h
drivers/media/platform/verisilicon/hantro_postproc.c