[libcamera-devel] [PATCH v2 00/13] Improve the application-facing controls API

Laurent Pinchart laurent.pinchart at ideasonboard.com
Sun Sep 29 21:02:41 CEST 2019


Hello,

This patch series attempts to improve the application-facing controls
API by making it more intuitive. The main goal is to allow accessing
controls stored in requests with a simple and type-safe API:

    Request *req = ...;
    ControlList &controls = req->controls();
    controls->set(controls::AwbEnable, false);
    controls->set(controls::ManualExposure, 1000);

    ...

    int32_t exposure = controls->get(controls::ManualExposure);

The first 4 patches achieve this goal.

PAth 05/13 then brings back the auto-generation of the control header
and source files that was removed in 04/13. Both the header and source
are now generated, compared to only source generation previously, at the
cost of requiring python3-yaml to build libcamera.

The next 5 patches rework the control-related classes further to make
ControlType, ControlValue and ControlRange shared between libcamera
controls and V4L2 controls.

Finally, the last 3 patches introduce a ControlValidator class to remove
the direct dependency from ControlList to Camera. A default Camera-based
validator is provided, and more validators are expected, in particular
for IPAs where no Camera object is available.

Laurent Pinchart (13):
  libcamera: controls: Rename ControlValueType to ControlType
  libcamera: controls: Make ControlValue get/set accessors template
    methods
  libcamera: controls: Use explicit 32-bit integer types
  libcamera: controls: Improve the API towards applications
  libcamera: controls: Auto-generate control_ids.h and control_ids.cpp
  libcamera: controls: Remove the unused ControlList::update() method
  libcamera: controls: Remove ControlInfo::id
  libcamera: controls: Rename ControlInfo to ControlRange
  libcamera: v4l2_controls: Use the ControlValue class for data storage
  libcamera: v4l2_controls: Use the ControlRange class for control info
  libcamera: Add ControlValidator
  libcamera: Add ControlValidator implementation for Camera
  libcamera: controls: Use ControlValidator to validate ControlList

 Documentation/Doxyfile.in                     |   4 +-
 README.rst                                    |   2 +-
 include/libcamera/control_ids.h               |  41 --
 include/libcamera/control_ids.h.in            |  31 ++
 include/libcamera/controls.h                  | 145 +++--
 include/libcamera/gen-header.sh               |   2 +-
 include/libcamera/meson.build                 |  18 +-
 include/libcamera/request.h                   |   7 +-
 .../libcamera/libcamera-9999.ebuild           |   9 +-
 src/libcamera/camera_controls.cpp             |  53 ++
 src/libcamera/control_ids.cpp.in              |  25 +
 src/libcamera/control_ids.yaml                |  35 ++
 src/libcamera/control_validator.cpp           |  45 ++
 src/libcamera/controls.cpp                    | 519 ++++++++----------
 src/libcamera/gen-controls.awk                | 106 ----
 src/libcamera/gen-controls.py                 | 114 ++++
 src/libcamera/include/camera_controls.h       |  30 +
 src/libcamera/include/control_validator.h     |  27 +
 src/libcamera/include/meson.build             |   2 +
 src/libcamera/include/v4l2_controls.h         |  21 +-
 src/libcamera/meson.build                     |  17 +-
 src/libcamera/pipeline/uvcvideo.cpp           |  52 +-
 src/libcamera/pipeline/vimc.cpp               |  36 +-
 src/libcamera/request.cpp                     |  14 +-
 src/libcamera/v4l2_controls.cpp               |  40 +-
 src/libcamera/v4l2_device.cpp                 |   8 +-
 test/controls/control_info.cpp                |  62 ---
 test/controls/control_list.cpp                |  96 +---
 test/controls/control_range.cpp               |  51 ++
 test/controls/control_value.cpp               |  12 +-
 test/controls/meson.build                     |   2 +-
 31 files changed, 892 insertions(+), 734 deletions(-)
 delete mode 100644 include/libcamera/control_ids.h
 create mode 100644 include/libcamera/control_ids.h.in
 create mode 100644 src/libcamera/camera_controls.cpp
 create mode 100644 src/libcamera/control_ids.cpp.in
 create mode 100644 src/libcamera/control_ids.yaml
 create mode 100644 src/libcamera/control_validator.cpp
 delete mode 100755 src/libcamera/gen-controls.awk
 create mode 100755 src/libcamera/gen-controls.py
 create mode 100644 src/libcamera/include/camera_controls.h
 create mode 100644 src/libcamera/include/control_validator.h
 delete mode 100644 test/controls/control_info.cpp
 create mode 100644 test/controls/control_range.cpp

-- 
Regards,

Laurent Pinchart



More information about the libcamera-devel mailing list