Skip to content

Additional features for Hantro HEVC

Benjamin Gaignard linux-arm-kernel linux-media linux-rockchip lkml 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest9 patches 3 repliesIn review
  2. v38 patches 12 repliesSuperseded
  3. v28 patches 4 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v18 patches12 repliesSuperseded

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9media: hantro: Trace hevc hw cycles performance registerDocumentation/admin-guide/media/hantro.rst Documentation/admin-guide/media/v4l-drivers.rst drivers/staging/media/hantro/hantro_drv.c +5 more+78 -00 replies
2/9media: hantro: Add support of compressed reference buffersdrivers/staging/media/hantro/hantro_g2_hevc_dec.c drivers/staging/media/hantro/hantro_g2_regs.h drivers/staging/media/hantro/hantro_hevc.c +1 more+74 -40 replies
3/9media: hantro: hevc: Allow 10-bits encoded streamsdrivers/staging/media/hantro/hantro_drv.c drivers/staging/media/hantro/hantro_g2_hevc_dec.c drivers/staging/media/hantro/hantro_g2_regs.h +1 more+31 -90 replies
4/9media: Add P010 video formatDocumentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst drivers/media/v4l2-core/v4l2-common.c drivers/media/v4l2-core/v4l2-ioctl.c +1 more+79 -21 reply
5/9media: hantro: hevc: Allow to produce 10-bit framesdrivers/staging/media/hantro/hantro_g2_hevc_dec.c drivers/staging/media/hantro/hantro_hevc.c drivers/staging/media/hantro/hantro_v4l2.c +1 more+50 -50 replies
6/9media: hantro: create ops for variantsdrivers/staging/media/hantro/hantro.h drivers/staging/media/hantro/hantro_drv.c drivers/staging/media/hantro/imx8m_vpu_hw.c +2 more+49 -210 replies
7/9media: hantro: enumerate scaled output formatsdrivers/staging/media/hantro/hantro.h drivers/staging/media/hantro/hantro_g2_hevc_dec.c drivers/staging/media/hantro/hantro_g2_regs.h +3 more+70 -60 replies
8/9media: hevc: Add scaling matrix controlDocumentation/userspace-api/media/v4l/ext-ctrls-codec.rst Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst drivers/media/v4l2-core/v4l2-ctrls-core.c +2 more+72 -02 replies
9/9media: hantro: Add scaling lists featuredrivers/staging/media/hantro/hantro_drv.c drivers/staging/media/hantro/hantro_g2_hevc_dec.c drivers/staging/media/hantro/hantro_hevc.c +1 more+81 -30 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [PATCH v4 0/9] Additional features for Hantro HEVC

version 4:
- Log file descriptor in trace point.
- Add documentation about how use the trace points in Hantro driver.
- Fix typos.
- Make sure that 10 bits output format (i.e. P010) is only enumerated when encoded input stream is 10 bits.
- Create ops structure for variant to store their specific functions.
- Rename scaling ops to enumare_framesizes

Run fluster on this version: the results are the same 70 over 147 streams OK. Test streams with embedded scaling list are now decoded and the output is correct for our eyes but the values of the pixels (y, u and V) are different from the values of the reference (decoded for FFMPEG) so the stream of still KO. When decoded with GStreamer or vendor stack the pixels values are the same but not matching with FFMPEG.

Compressed help to increase the performance of the whole stack, it could
be up to 50 fps (against 45 fps) on IMX8MQ.
The impact of compressed frames is confirmed when using perf to monitor
the number of memory accesses with or without 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 ! fakesink

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

       14965816743      imx8_ddr0/cycles/                                           
         889197312      imx8_ddr0/read-cycles/                                      
        1819348862      imx8_ddr0/write-cycles/                                     
      18.707373001 seconds time elapsed

with compression feature:
Performance counter stats for 'system wide':

       13750218243      imx8_ddr0/cycles/                                           
         402428744      imx8_ddr0/read-cycles/                                      
        1255676693      imx8_ddr0/write-cycles/                                     
      17.188320061 seconds time elapsed

As expected the number of read/write cycles are really lower when compression is used.
Thanks to Chris for perf command line :-)

version 3:
- Change trace file name to hantro_trace.h

version 2:
- Fix structure name in ext-ctrls-codec.rst
- Define the value for compression storage size
- Add comments about registers usage
- Add documentation about P010 padding

Basic HEVC support has been added to Hantro driver in this pull request:
https://www.spinics.net/lists/linux-media/msg193744.html

Thanks to that it is now possible to support more features for this driver.

The first patch allow to log the hardware performance per macroblock. The second patch makes the driver use compressed reference frames to reduce memory bandwidth consumption.
Patches 3 to 5 allow to decode and produce 10-bits P010 frames. Patch 6 make usage of G2 post processor to scale down the frames. Patches 7 and 8 add the support of HEVC scaling matrix by adding a new control.

All these patches enhance the HEVC support for Hantro (G2) hardware. Unluckily they almost all touch the same pieces of code, where buffer size, offset and addresses are set, so they have to be in this order. They depend of the series pushed in this pull request:
https://www.spinics.net/lists/linux-media/msg193744.html

Benjamin

Benjamin Gaignard (9):
media: hantro: Trace hevc hw cycles performance register
media: hantro: Add support of compressed reference buffers
media: hantro: hevc: Allow 10-bits encoded streams
media: Add P010 video format
media: hantro: hevc: Allow to produce 10-bit frames
media: hantro: create ops for variants
media: hantro: enumerate scaled output formats
media: hevc: Add scaling matrix control
media: hantro: Add scaling lists feature

 Documentation/admin-guide/media/hantro.rst    |  14 ++
 .../admin-guide/media/v4l-drivers.rst         |   1 +
 .../media/v4l/ext-ctrls-codec.rst             |  45 +++++
 .../media/v4l/pixfmt-yuv-planar.rst           |  78 +++++++-
 .../media/v4l/vidioc-queryctrl.rst            |   6 +
 drivers/media/v4l2-core/v4l2-common.c         |   1 +
 drivers/media/v4l2-core/v4l2-ctrls-core.c     |   6 +
 drivers/media/v4l2-core/v4l2-ctrls-defs.c     |   4 +
 drivers/media/v4l2-core/v4l2-ioctl.c          |   1 +
 drivers/staging/media/hantro/hantro.h         |  21 +-
 drivers/staging/media/hantro/hantro_drv.c     |  22 ++-
 .../staging/media/hantro/hantro_g2_hevc_dec.c | 186 ++++++++++++++++--
 drivers/staging/media/hantro/hantro_g2_regs.h |  12 ++
 drivers/staging/media/hantro/hantro_hevc.c    |  69 ++++++-
 drivers/staging/media/hantro/hantro_hw.h      |   8 +
 drivers/staging/media/hantro/hantro_trace.h   |  41 ++++
 drivers/staging/media/hantro/hantro_v4l2.c    |  41 +++-
 drivers/staging/media/hantro/imx8m_vpu_hw.c   |  22 ++-
 .../staging/media/hantro/rockchip_vpu_hw.c    |  30 ++-
 .../staging/media/hantro/sama5d4_vdec_hw.c    |   6 +-
 include/media/hevc-ctrls.h                    |  11 ++
 include/uapi/linux/videodev2.h                |   1 +
 22 files changed, 580 insertions(+), 46 deletions(-)
 create mode 100644 Documentation/admin-guide/media/hantro.rst
 create mode 100644 drivers/staging/media/hantro/hantro_trace.h
Signature · 1 line
2.25.1