From patchwork Sun Sep 29 19:02:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 2055 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 749AE61654 for ; Sun, 29 Sep 2019 21:03:11 +0200 (CEST) Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E5659320 for ; Sun, 29 Sep 2019 21:03:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1569783791; bh=a1AdZsPYJJxDHcpBGdFvqeQMVs+zE5GTjQDkxYST+zg=; h=From:To:Subject:Date:From; b=njRLWECNy9HOdnbEsMply3NZ44V3VrtxxFgZdALgji24HLufzcuRECDqiSPuEKb7q zcN25POE0vBuAaKWLmQ2DPYtVTZm1EPcjlfgZ87IowmK2RYwr9ianbnkTksdDlru2G VYaGa4TIMpqHFWXbdgIOSFBg8BIYiX5nm3gBV0Yo= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Sun, 29 Sep 2019 22:02:41 +0300 Message-Id: <20190929190254.18920-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 00/13] Improve the application-facing controls API X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Sep 2019 19:03:11 -0000 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