|
|
Log in / Subscribe / Register

Add V4L2 M2M Driver for E5010 JPEG Encoder

From:  Devarsh Thakkar <devarsht-AT-ti.com>
To:  <mchehab-AT-kernel.org>, <robh-AT-kernel.org>, <krzysztof.kozlowski+dt-AT-linaro.org>, <conor+dt-AT-kernel.org>, <hverkuil-cisco-AT-xs4all.nl>, <linux-media-AT-vger.kernel.org>, <devicetree-AT-vger.kernel.org>, <linux-kernel-AT-vger.kernel.org>, <benjamin.gaignard-AT-collabora.com>, <sebastian.fricke-AT-collabora.com>
Subject:  [PATCH v10 00/11] Add V4L2 M2M Driver for E5010 JPEG Encoder
Date:  Thu, 30 May 2024 22:29:25 +0530
Message-ID:  <20240530165925.2715837-1-devarsht@ti.com>
Cc:  <laurent.pinchart-AT-ideasonboard.com>, <praneeth-AT-ti.com>, <nm-AT-ti.com>, <vigneshr-AT-ti.com>, <a-bhatia1-AT-ti.com>, <j-luthra-AT-ti.com>, <b-brnich-AT-ti.com>, <detheridge-AT-ti.com>, <p-mantena-AT-ti.com>, <vijayp-AT-ti.com>, <devarsht-AT-ti.com>, <andrzej.p-AT-collabora.com>, <nicolas-AT-ndufresne.ca>, <akpm-AT-linux-foundation.org>, <gregkh-AT-linuxfoundation.org>, <andriy.shevchenko-AT-linux.intel.com>, <adobriyan-AT-gmail.com>, <p.zabel-AT-pengutronix.de>, <airlied-AT-gmail.com>, <daniel-AT-ffwll.ch>, <jani.nikula-AT-intel.com>, <dri-devel-AT-lists.freedesktop.org>, <linux-rockchip-AT-lists.infradead.org>, <davidgow-AT-google.com>, <dlatypov-AT-google.com>
Archive-link:  Article

This adds support for V4L2 M2M based driver for E5010 JPEG Encoder
which is a stateful JPEG encoder from Imagination technologies
and is present in TI AM62A SoC.

While adding support for it, following additional framework changes were
made:
 - Moved reference quantization and huffman tables provided in
   ITU-T-REC-T.81 to v4l2-jpeg.c as suggested in mailing list [1].
 - Add macros to round to closest integer (either higher or lower) while
   rounding in order of 2.
 - Add KUnit tests for math functions.

v4l2-compliance test :
Link: https://gist.github.com/devarsht/1f039c631ca953a57f405cfc...

E5010 JPEG Encoder Manual tests :

Performance:
Link: https://gist.github.com/devarsht/c40672944fd71c9a53ab55ad...

Functionality:
Link: https://gist.github.com/devarsht/8e88fcaabff016bb2bac83d8...

Compression Quality:
Link: https://gist.github.com/devarsht/cbcc7cd97e8c48ba1486caa2...

Multi Instance:
Link: https://gist.github.com/devarsht/22c2fca08cd3441fb40f2c7a...

Crop support:
Link: https://gist.github.com/devarsht/de6f5142f678bb1a5338abfd...

Runtime PM:
Link: https://gist.github.com/devarsht/70cd95d4440ddc678489d938...

Math lib KUnit tests:
Link: https://gist.github.com/devarsht/3f9042825be3da4e133b8f4e...

[1]: 
https://lore.kernel.org/all/de46aefe-36da-4e1a-b4fa-b375b...

Changelog:
V9->V10:
 - Update commenting style in math.h and add notes for new jpeg header
   macros
 - Add KUnit dependency for math_kunit

V8->V9:
 - Remove kernel.h header file
 - Remove stale filler data on jpeg header in E5010 jpeg driver

V7->V8:
 - Add KUnit tests for math functions
 - Add roundclosest() for supporting rounding for non-multiple of 2
 - Update commit message as suggested
 - Add Reviewed-by and Acked-by tags to patches as received

V6->V7:
 - Fix cropping support
 - Move reference huffman and quantization tables to v4l2-jpeg.c
 - Fix suspend/resume use-case
 - Add Reviewed-by

V5->V6:
 - Fix sparse warnings

V4->V5:
 - Sort the #includes in driver file alphabetically
 - Rename huffman and quantization tables to not use '_'
 - Add Reviewed-by tag

V3->V4:
- Use ti-specific compatible ti,am62a-jpeg-enc as secondary one in
  dt-binding
- Remove clock-names as only single clock in dt-binding
- Fix issue with default params setting
- Correct v4l2 error prints
- Simplify register write functions with single statement return values
- Remove unrequired error checks from get_queue()
- Drop explicit device_caps setting as it is already taken care by v4l2
  core
- Remove unrequired multiplanar checks and memset from s_fmt, g_fmt
  callback functions
- Fix try_fmt callback to not update the queues
- Remove unrequired contiguous format attribute from queue_init
- Use dynamic allocation for video_device and remove unrequired
  assignments in probe()
- Remove unrequired checks from queue_setup function
- Return queued buffers back if start_streaming fails
- Use ARRAY_SIZE in place of hard-coding
- Use huffman and quantization tables from reference header file

V2->V3:
- Add DONOTMERGE patches for dts and defconfig
- Update driver with below changes :
  - Correct license headers
  - Use more generic name core instead of jasper for base registers
  - Add Comment for forward declarations
  - Simplify quantization table calculations
  - Use v4l2_apply_frmsize_constraints for updating framesize and remove
    unrequired functions
  - Place TODO at top of file and in commit message too
  - Use dev_err_probe helper in probe function
  - Fix return value checking for failure scenarios in probe function
  - Use v4l2_err/info/warn helpers instead of dev_err/info/warn helpers
  - Fix unexpected indentation
  - Correct commit message
- Update dt-bindings with below changes :
  - Add vendor specific compatible 
  - Fix commit title and message
  - Update reg names
  - Update clocks to 1
  - Fix dts example with proper naming

V1->V2:
 - Send dt-bindings and driver together

Patch-Diff between the series :
V9->V10 Range diff :
https://gist.github.com/devarsht/b446acee460b8c65fb577d06...

V8->V9 Range diff :
https://gist.github.com/devarsht/3fd6c4e8031ab114248f93d0...

V6->V7 Range diff :
https://gist.github.com/devarsht/1db185b1e187eaf397e9e4c3...

V5->V6 Range diff :
https://gist.github.com/devarsht/c89180ac2b0d2814614f2b59...

V4->V5 Range diff :
https://gist.github.com/devarsht/298790af819f299a0a05fec8...

V3->V4 Range diff :
https://gist.github.com/devarsht/22a744d999080de6e813bcfb...

Previous patch series:
V9: https://lore.kernel.org/all/20240526175655.1093707-1-deva...
V8: https://lore.kernel.org/all/20240517171532.748684-1-devar...
V7: https://lore.kernel.org/all/20240510082603.1263256-1-deva...
V6: https://lore.kernel.org/all/20240228141140.3530612-1-deva...
V5: https://lore.kernel.org/all/20240215134641.3381478-1-deva...
V4: https://lore.kernel.org/all/20240205114239.924697-1-devar...
V3: https://lore.kernel.org/all/20230816152210.4080779-1-deva...
V2: https://lore.kernel.org/all/20230727112546.2201995-1-deva...


Daniel Latypov (1):
  lib: add basic KUnit test for lib/math

Devarsh Thakkar (10):
  media: dt-bindings: Add Imagination E5010 JPEG Encoder
  media: imagination: Add E5010 JPEG Encoder driver
  media: v4l2-jpeg: Export reference quantization and huffman tables
  media: imagination: Use exported tables from v4l2-jpeg core
  media: verisilicon : Use exported tables from v4l2-jpeg for hantro
    codec
  math.h: Add macros for rounding to closest value
  Documentation: core-api: Add math.h macros and functions
  lib: math_kunit: Add tests for new macros related to rounding to
    nearest value
  media: imagination: Round to closest multiple for cropping region
  gpu: ipu-v3: Use generic macro for rounding closest to specified value

 Documentation/core-api/kernel-api.rst         |    6 +
 .../bindings/media/img,e5010-jpeg-enc.yaml    |   75 +
 MAINTAINERS                                   |    7 +
 drivers/gpu/ipu-v3/ipu-image-convert.c        |    4 +-
 drivers/media/platform/Kconfig                |    1 +
 drivers/media/platform/Makefile               |    1 +
 drivers/media/platform/imagination/Kconfig    |   12 +
 drivers/media/platform/imagination/Makefile   |    3 +
 .../platform/imagination/e5010-core-regs.h    |  585 ++++++
 .../platform/imagination/e5010-jpeg-enc-hw.c  |  267 +++
 .../platform/imagination/e5010-jpeg-enc-hw.h  |   42 +
 .../platform/imagination/e5010-jpeg-enc.c     | 1644 +++++++++++++++++
 .../platform/imagination/e5010-jpeg-enc.h     |  168 ++
 .../platform/imagination/e5010-mmu-regs.h     |  311 ++++
 .../media/platform/verisilicon/hantro_jpeg.c  |  128 +-
 drivers/media/v4l2-core/v4l2-jpeg.c           |  162 +-
 include/linux/math.h                          |   72 +
 include/media/v4l2-jpeg.h                     |   28 +
 lib/math/Kconfig                              |   14 +
 lib/math/Makefile                             |    1 +
 lib/math/math_kunit.c                         |  325 ++++
 21 files changed, 3738 insertions(+), 118 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/img,e5010-jpeg-enc.yaml
 create mode 100644 drivers/media/platform/imagination/Kconfig
 create mode 100644 drivers/media/platform/imagination/Makefile
 create mode 100644 drivers/media/platform/imagination/e5010-core-regs.h
 create mode 100644 drivers/media/platform/imagination/e5010-jpeg-enc-hw.c
 create mode 100644 drivers/media/platform/imagination/e5010-jpeg-enc-hw.h
 create mode 100644 drivers/media/platform/imagination/e5010-jpeg-enc.c
 create mode 100644 drivers/media/platform/imagination/e5010-jpeg-enc.h
 create mode 100644 drivers/media/platform/imagination/e5010-mmu-regs.h
 create mode 100644 lib/math/math_kunit.c

-- 
2.39.1




Copyright © 2024, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds