[libcamera-devel,00/12] Improve the application-facing controls API
mbox series

Message ID 20190928152238.23752-1-laurent.pinchart@ideasonboard.com
Headers show
Series
  • Improve the application-facing controls API
Related show

Message

Laurent Pinchart Sept. 28, 2019, 3:22 p.m. UTC
Hello,

This patch series attempts to improbe 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.

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 (12):
  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: 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

 include/libcamera/control_ids.h           |  45 +-
 include/libcamera/controls.h              | 145 +++---
 include/libcamera/request.h               |   7 +-
 src/libcamera/camera_controls.cpp         |  53 +++
 src/libcamera/control_ids.cpp             |  72 +++
 src/libcamera/control_validator.cpp       |  45 ++
 src/libcamera/controls.cpp                | 518 ++++++++++------------
 src/libcamera/gen-controls.awk            | 106 -----
 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                 |  13 +-
 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 +-
 23 files changed, 746 insertions(+), 711 deletions(-)
 create mode 100644 src/libcamera/camera_controls.cpp
 create mode 100644 src/libcamera/control_ids.cpp
 create mode 100644 src/libcamera/control_validator.cpp
 delete mode 100755 src/libcamera/gen-controls.awk
 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