[PATCH 0/4] media: cedrus: Add a JPEG decoder

Emmanuel Gil Peyrot linkmauve at linkmauve.fr
Wed Jul 31 09:44:10 PDT 2024


The Video Engine present on all (?) AllWinner SoCs includes a JPEG
decoder, which shares the same engine as the MPEG2 decoder.  I mostly
used the linux-sunxi resources on the engine[0], as well as some
reverse-engineered userland using the legacy /dev/cedar_dev API[1].

I wrote the Onix library[2] to exercise this driver.  With it, I have
tested this series on the A10, A20 and A64, as found in Olimex Lime,
Lime 2 and PinePhone respectively, so further testing on other SoCs
would be very welcome.

On the A10 and A20, since only the tiled ST12 format is supported, the
file dump binary is a bit unusable, but I have tested displaying to DRM
and to Wayland just fine on these SoCs.

They also only support downscaling from 4:4:4 to 4:2:2, unlike newer
SoCs which support downscaling from either 4:4:4 or 4:2:2 to 4:2:2 or
4:2:0.  This prompts the issue of which formats to advertise: currently
I chose to only expose NV12, but ideally NV16 would be exposed when the
user tries to decode a 4:2:2 or 4:4:4 image.  By the time the user has
called ENUM_FMTS on the capture queue, the driver doesn’t know the
subsampling in the JPEG file, so it can’t expose only the supported
formats.  A possible solution could be to add a new v4l2_ext_ctrl
describing the JPEG, but this is a new uAPI which should get discussed
outside of this driver.

[0] https://linux-sunxi.org/VE_Register_guide
[1] https://github.com/jemk/cedrus
[2] https://linkmauve.fr/dev/onix/

Emmanuel Gil Peyrot (1):
  media: cedrus: Add JPEG decoder

Jernej Skrabec (3):
  media: cedrus: Setup secondary output formats
  media: cedrus: Enable JPEG decoding in various variants
  media: cedrus: Don't require requests for all codecs

 drivers/staging/media/sunxi/cedrus/Kconfig    |   1 +
 drivers/staging/media/sunxi/cedrus/Makefile   |   2 +-
 drivers/staging/media/sunxi/cedrus/cedrus.c   |  10 +
 drivers/staging/media/sunxi/cedrus/cedrus.h   |   5 +
 .../staging/media/sunxi/cedrus/cedrus_hw.c    |  14 +-
 .../staging/media/sunxi/cedrus/cedrus_jpeg.c  | 352 ++++++++++++++++++
 .../staging/media/sunxi/cedrus/cedrus_regs.h  |  25 +-
 .../staging/media/sunxi/cedrus/cedrus_video.c |  11 +-
 8 files changed, 413 insertions(+), 7 deletions(-)
 create mode 100644 drivers/staging/media/sunxi/cedrus/cedrus_jpeg.c

-- 
2.45.2




More information about the linux-arm-kernel mailing list