[v2,0/7] Add support for IPA debugging metadata
mbox series

Message ID 20241007095425.211158-1-stefan.klug@ideasonboard.com
Headers show
Series
  • Add support for IPA debugging metadata
Related show

Message

Stefan Klug Oct. 7, 2024, 9:54 a.m. UTC
To easily debug the algorithms of a running IPA it is necessary to
inspect live data. Three options where discussed on how to make that
process easier:

1. Tracing using lttng: We already have a bit infrastructure for that.
Nevertheless the setup is a bit more involved and there is no code
available (yet) to digest the live data. Adding new tracepoints also
requires modifications at multiple places.

2. Extending the metadata infrastructure: We already have good
infrastructure for metadata handling. Tooling around libcamera (like
camshark) already have good support for metadata. The downside of
metadata might be the limited efficiency on the way from the ipa to the
user involving (possibly) inefficient serializations and copies.

3. Adding a completely new infrastructure for debug metadata and
seperate interfaces on the API.

This series implements the tooling for option 2 (add debug metadata).
Option 1 will also be investigated further, but seems to be better
fitted to performance issues than to algorithmic issue.  Option 3 was
not investigated further due to the involved effort and the unclear
needs on the overall process.

Patches 1-3 add some infrastructure to make the process easier.

Patches 4 and 6 are tiny fixups.

Patch 5 adds debug metadata support to the rkisp1 IPA.

Patch 7 adds actual debug entries to the agc algorithm in the rkisp1.

The whole series works in companion with the new graph display in
camhsark, that is available in the current master of camshark (
https://gitlab.freedesktop.org/camera/camshark )

Best regards,
Stefan

Changes in v2:
- Replaced the assignList functionality by moveEntries
- Fixes from review (detailed changelogs in the patches)
- Dropped patch 8 as it is not needed anymore

Stefan Klug (7):
  libcamera: Add debug control space
  libcamera: Add a DebugMetadata helper
  utils: Add script to generate control_ids_debug.yaml
  ipa: rkisp1: Add constructor to the ipa context
  ipa: rkisp1: Add debug metadata support to the rkisp1
  ipa: libipa: Add data accessor to Histogram
  [DNI] ipa: Add debug controls to the agc algorithm

 include/libcamera/internal/debug_controls.h |  46 ++++++
 include/libcamera/internal/meson.build      |   1 +
 include/libcamera/meson.build               |   5 +-
 src/ipa/libipa/agc_mean_luminance.cpp       |   8 +
 src/ipa/libipa/agc_mean_luminance.h         |   4 +
 src/ipa/libipa/histogram.cpp                |   6 +
 src/ipa/libipa/histogram.h                  |   1 +
 src/ipa/rkisp1/algorithms/agc.cpp           |  10 ++
 src/ipa/rkisp1/ipa_context.h                |  10 ++
 src/ipa/rkisp1/rkisp1.cpp                   |   5 +-
 src/libcamera/control_ids_core.yaml         |   5 +
 src/libcamera/control_ids_debug.yaml        |  25 +++
 src/libcamera/control_ranges.yaml           |   4 +-
 src/libcamera/debug_controls.cpp            | 145 +++++++++++++++++
 src/libcamera/meson.build                   |   1 +
 utils/gen-debug-controls.py                 | 165 ++++++++++++++++++++
 16 files changed, 437 insertions(+), 4 deletions(-)
 create mode 100644 include/libcamera/internal/debug_controls.h
 create mode 100644 src/libcamera/control_ids_debug.yaml
 create mode 100644 src/libcamera/debug_controls.cpp
 create mode 100755 utils/gen-debug-controls.py