[libcamera-devel] [PATCH v2 00/32] libcamera: Add support for array controls

Laurent Pinchart laurent.pinchart at ideasonboard.com
Fri Mar 6 16:59:30 CET 2020


Hello,

This large patch series is the result of collective work from Jacopo and
me. It adds support in the libcamera Control classes to handle array of
values, in addition to the single values we support today.

Compared to v1, small issues have been fixed, based on review comments.
The patches not meant for integration have been dropped.

The first two patches (01/32 and 02/32) add an implementation of the
C++20 std::span<> class and a related test. This will be used
extensively to support array controls.

The next 13 patches (03/32 to 15/32) refactor the control-related
classes, as well as the IPA control code, to prepare for array controls.
Patch 16/32 is then the main change in the series, implementing support
for array controls, and patch 17/32 improves the ControlList::set() API
to make array controls more usable. Patch 18/32 wires this up in the
yaml parser.

Patches 19/32 and 20/32 are a small intermission that add support for
float and bytes controls (previously int8_t). The latter is particularly
useful to create byte array controls. Patch 21/32 then changes to
boolean control print code to use lower case.

Patch 22/32 adds support for array controls in the IPA protocol, patches
23/32 to 25/32 improve the ByteStreamBuffer class and patches 26/32 to
29/32 extend the control serializer to support array controls.

Patches 30/32 and 31/32 extend the ControlValue test cases to test all
control types and array controls. Note that the array control API of the
ControlList class isn't tested here, for lack of an array control
defined in libcamera. Separate tests with a fictional array control have
been performed and will be reposted separately when a real array control
will be available.

Patch 32/32 finally extends the cam utility to support array controls.

Jacopo Mondi (12):
  libcamera: Add a C++20-compliant std::span<> implementation
  libcamera: gen-controls: Fix documentation issue with <<
  libcamera: ipa: Remove unused IPA control types
  libcamera: controls: Reorder ControlValue methods
  libcamera: controls: Support array controls in ControlValue
  libcamera: controls: Add a 'size' yaml property
  libcamera: controls: Add support for float controls
  libcamera: controls: Add support for byte controls
  libcamera: byte_stream_buffer: Fix documentation of read() and write()
  libcamera: byte_stream_buffer: Add Span<> support
  libcamera: control_serializer: Add support for array controls
  cam: Add option to list camera properties

Laurent Pinchart (20):
  test: Add Span test
  libcamera: ipa: Make <ipa/ipa_controls.h> self-contained
  libcamera: ipa: Test control structure size with static_assert
  libcamera: controls: Don't convert 32-bit and 64-bit implicitly
  libcamera: controls: Decouple control and value type in
    ControlList::set()
  libcamera: controls: Return control by value
  libcamera: controls: Add templates to convert a type T to a
    ControlType
  libcamera: controls: Move ControlValue get() and set() to controls.h
  libcamera: controls: Move ControlValue constructor to controls.h
  libcamera: controls: Move Control constructor to controls.h
  libcamera: controls: Expose raw data in ControlValue
  libcamera: controls: Allow passing an std::initializer list to set()
  libcamera: controls: Convert bool ControlValue to lowercase strings
  libcamera: ipa: Support array controls in ipa_control_value_entry
  libcamera: byte_stream_buffer: Add zero-copy read() variant
  libcamera: control_serializer: Use explicit ControlTypeNone case
  libcamera: control_serializer: Simplify serialization of ControlValue
  libcamera: control_serializer: Use zero-copy ByteStreamBuffer::read()
  test: controls: control_value: Expand test to cover all control types
  test: controls: control_value: Expand test to cover array controls

 Documentation/Doxyfile.in                  |   5 +-
 include/ipa/ipa_controls.h                 |  19 +-
 include/libcamera/controls.h               | 170 +++++++--
 include/libcamera/meson.build              |   1 +
 include/libcamera/span.h                   | 417 +++++++++++++++++++++
 src/cam/main.cpp                           |  28 ++
 src/cam/main.h                             |   1 +
 src/libcamera/byte_stream_buffer.cpp       |  61 ++-
 src/libcamera/control_serializer.cpp       | 184 ++++-----
 src/libcamera/controls.cpp                 | 308 +++++++++------
 src/libcamera/gen-controls.py              |  16 +-
 src/libcamera/include/byte_stream_buffer.h |  26 ++
 src/libcamera/include/control_serializer.h |   6 +-
 src/libcamera/ipa_controls.cpp             |  53 +--
 test/controls/control_value.cpp            | 211 +++++++++--
 test/meson.build                           |   1 +
 test/span.cpp                              | 181 +++++++++
 17 files changed, 1394 insertions(+), 294 deletions(-)
 create mode 100644 include/libcamera/span.h
 create mode 100644 test/span.cpp

-- 
Regards,

Laurent Pinchart



More information about the libcamera-devel mailing list