From patchwork Mon Aug 9 15:23:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 13262 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id E0230C3240 for ; Mon, 9 Aug 2021 15:22:26 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 76DD168889; Mon, 9 Aug 2021 17:22:26 +0200 (CEST) Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2B19D60269 for ; Mon, 9 Aug 2021 17:22:24 +0200 (CEST) Received: (Authenticated sender: jacopo@jmondi.org) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 776E6FF803; Mon, 9 Aug 2021 15:22:23 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Mon, 9 Aug 2021 17:23:04 +0200 Message-Id: <20210809152308.31947-2-jacopo@jmondi.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210809152308.31947-1-jacopo@jmondi.org> References: <20210809152308.31947-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 1/5] libcamera: controls: Create ControlInfoMap with ControlIdMap 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" ControlInfoMap does not have a ControlId map associated, but rather creates one with the generateIdMap() function at creation time. As a consequence, when in the need to de-serialize a ControlInfoMap all the ControlId it contains are created by the deserializer instance, not being able to discern if the controls the ControlIdMap refers to are the global libcamera controls (and proeprties) or instances local to the V4L2 device that has first initialized the controls. As a consequence the ControlId stored in a de-serialized map will always be newly created entities, preventing lookup by ControlId reference on a de-serialized ControlInfoMap. In order to make it possible to use globally available ControlId instances whenever possible, create ControlInfoMap with a reference to an externally allocated ControlIdMap instead of generating one internally. Has a consequence the class constructors take and additional argument, which might be not pleaseant to type in, but enforces the concepts that ControlInfoMap should be created with controls part of the same id map. As the ControlIdMap the ControlInfoMap refers to needs to be allocated externally: - Use the globally available controls::controls (or properties::properties) id map when referring to libcamera controls - The V4L2 device that creates ControlInfoMap by parsing the device's controls has to allocate a ControlIdMap - The ControlSerializer that de-serializes a ControlInfoMap has to create and store the ControlIdMap the de-serialized info map refers to Signed-off-by: Jacopo Mondi Reviewed-by: Paul Elder --- include/libcamera/controls.h | 13 ++- .../libcamera/internal/control_serializer.h | 1 + include/libcamera/internal/v4l2_device.h | 1 + include/libcamera/ipa/raspberrypi.h | 40 ++++---- src/libcamera/control_serializer.cpp | 11 ++- src/libcamera/controls.cpp | 94 +++++-------------- src/libcamera/pipeline/ipu3/ipu3.cpp | 3 +- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 3 +- src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 2 +- src/libcamera/pipeline/vimc/vimc.cpp | 2 +- src/libcamera/v4l2_device.cpp | 3 +- .../ipa_data_serializer_test.cpp | 14 +-- 12 files changed, 77 insertions(+), 110 deletions(-) diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h index de733bd868a6..e9e09c200da2 100644 --- a/include/libcamera/controls.h +++ b/include/libcamera/controls.h @@ -309,12 +309,11 @@ public: ControlInfoMap() = default; ControlInfoMap(const ControlInfoMap &other) = default; - ControlInfoMap(std::initializer_list init); - ControlInfoMap(Map &&info); + ControlInfoMap(std::initializer_list init, + const ControlIdMap &idmap); + ControlInfoMap(Map &&info, const ControlIdMap &idmap); ControlInfoMap &operator=(const ControlInfoMap &other) = default; - ControlInfoMap &operator=(std::initializer_list init); - ControlInfoMap &operator=(Map &&info); using Map::key_type; using Map::mapped_type; @@ -339,12 +338,12 @@ public: iterator find(unsigned int key); const_iterator find(unsigned int key) const; - const ControlIdMap &idmap() const { return idmap_; } + const ControlIdMap &idmap() const { return *idmap_; } private: - void generateIdmap(); + const ControlIdMap *idmap_; - ControlIdMap idmap_; + void validate(); }; class ControlList diff --git a/include/libcamera/internal/control_serializer.h b/include/libcamera/internal/control_serializer.h index 7d4426c95d12..8a66be324138 100644 --- a/include/libcamera/internal/control_serializer.h +++ b/include/libcamera/internal/control_serializer.h @@ -48,6 +48,7 @@ private: unsigned int serial_; std::vector> controlIds_; + std::vector> controlIdMaps_; std::map infoMaps_; std::map infoMapHandles_; }; diff --git a/include/libcamera/internal/v4l2_device.h b/include/libcamera/internal/v4l2_device.h index 77b835b3cb80..423c8fb11845 100644 --- a/include/libcamera/internal/v4l2_device.h +++ b/include/libcamera/internal/v4l2_device.h @@ -69,6 +69,7 @@ private: std::map controlInfo_; std::vector> controlIds_; + ControlIdMap controlIdMap_; ControlInfoMap controls_; std::string deviceNode_; int fd_; diff --git a/include/libcamera/ipa/raspberrypi.h b/include/libcamera/ipa/raspberrypi.h index a8790000e2d9..521eaecd19b2 100644 --- a/include/libcamera/ipa/raspberrypi.h +++ b/include/libcamera/ipa/raspberrypi.h @@ -27,26 +27,26 @@ namespace RPi { * and the pipeline handler may be reverted so that it aborts when an * unsupported control is encountered. */ -static const ControlInfoMap Controls = { - { &controls::AeEnable, ControlInfo(false, true) }, - { &controls::ExposureTime, ControlInfo(0, 999999) }, - { &controls::AnalogueGain, ControlInfo(1.0f, 32.0f) }, - { &controls::AeMeteringMode, ControlInfo(controls::AeMeteringModeValues) }, - { &controls::AeConstraintMode, ControlInfo(controls::AeConstraintModeValues) }, - { &controls::AeExposureMode, ControlInfo(controls::AeExposureModeValues) }, - { &controls::ExposureValue, ControlInfo(0.0f, 16.0f) }, - { &controls::AwbEnable, ControlInfo(false, true) }, - { &controls::ColourGains, ControlInfo(0.0f, 32.0f) }, - { &controls::AwbMode, ControlInfo(controls::AwbModeValues) }, - { &controls::Brightness, ControlInfo(-1.0f, 1.0f) }, - { &controls::Contrast, ControlInfo(0.0f, 32.0f) }, - { &controls::Saturation, ControlInfo(0.0f, 32.0f) }, - { &controls::Sharpness, ControlInfo(0.0f, 16.0f, 1.0f) }, - { &controls::ColourCorrectionMatrix, ControlInfo(-16.0f, 16.0f) }, - { &controls::ScalerCrop, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), Rectangle{}) }, - { &controls::FrameDurationLimits, ControlInfo(INT64_C(1000), INT64_C(1000000000)) }, - { &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) }, -}; +static const ControlInfoMap Controls({ + { &controls::AeEnable, ControlInfo(false, true) }, + { &controls::ExposureTime, ControlInfo(0, 999999) }, + { &controls::AnalogueGain, ControlInfo(1.0f, 32.0f) }, + { &controls::AeMeteringMode, ControlInfo(controls::AeMeteringModeValues) }, + { &controls::AeConstraintMode, ControlInfo(controls::AeConstraintModeValues) }, + { &controls::AeExposureMode, ControlInfo(controls::AeExposureModeValues) }, + { &controls::ExposureValue, ControlInfo(0.0f, 16.0f) }, + { &controls::AwbEnable, ControlInfo(false, true) }, + { &controls::ColourGains, ControlInfo(0.0f, 32.0f) }, + { &controls::AwbMode, ControlInfo(controls::AwbModeValues) }, + { &controls::Brightness, ControlInfo(-1.0f, 1.0f) }, + { &controls::Contrast, ControlInfo(0.0f, 32.0f) }, + { &controls::Saturation, ControlInfo(0.0f, 32.0f) }, + { &controls::Sharpness, ControlInfo(0.0f, 16.0f, 1.0f) }, + { &controls::ColourCorrectionMatrix, ControlInfo(-16.0f, 16.0f) }, + { &controls::ScalerCrop, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), Rectangle{}) }, + { &controls::FrameDurationLimits, ControlInfo(INT64_C(1000), INT64_C(1000000000)) }, + { &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) } + }, controls::controls); } /* namespace RPi */ diff --git a/src/libcamera/control_serializer.cpp b/src/libcamera/control_serializer.cpp index 300466285a57..df6ed93f477e 100644 --- a/src/libcamera/control_serializer.cpp +++ b/src/libcamera/control_serializer.cpp @@ -93,6 +93,7 @@ void ControlSerializer::reset() infoMapHandles_.clear(); infoMaps_.clear(); controlIds_.clear(); + controlIdMaps_.clear(); } size_t ControlSerializer::binarySize(const ControlValue &value) @@ -376,6 +377,8 @@ ControlInfoMap ControlSerializer::deserialize(ByteStreamBuffer & } ControlInfoMap::Map ctrls; + controlIdMaps_.emplace_back(std::make_unique()); + ControlIdMap *localIdMap = controlIdMaps_.back().get(); for (unsigned int i = 0; i < hdr->entries; ++i) { const struct ipa_control_info_entry *entry = @@ -392,6 +395,8 @@ ControlInfoMap ControlSerializer::deserialize(ByteStreamBuffer & * purpose. */ controlIds_.emplace_back(std::make_unique(entry->id, "", type)); + ControlId *controlId = controlIds_.back().get(); + (*localIdMap)[entry->id] = controlId; if (entry->offset != values.offset()) { LOG(Serializer, Error) @@ -401,15 +406,15 @@ ControlInfoMap ControlSerializer::deserialize(ByteStreamBuffer & } /* Create and store the ControlInfo. */ - ctrls.emplace(controlIds_.back().get(), - loadControlInfo(type, values)); + ctrls.emplace(controlId, loadControlInfo(type, values)); } /* * Create the ControlInfoMap in the cache, and store the map to handle * association. */ - ControlInfoMap &map = infoMaps_[hdr->handle] = std::move(ctrls); + infoMaps_[hdr->handle] = ControlInfoMap(std::move(ctrls), *localIdMap); + ControlInfoMap &map = infoMaps_[hdr->handle]; infoMapHandles_[&map] = hdr->handle; return map; diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp index 283472c5ab4d..f891692da669 100644 --- a/src/libcamera/controls.cpp +++ b/src/libcamera/controls.cpp @@ -625,10 +625,10 @@ std::string ControlInfo::toString() const * constructed, and thus only exposes the read accessors of the * std::unsorted_map<> base class. * - * In addition to the features of the standard unsorted map, this class also - * provides access to the mapped elements using numerical ID keys. It maintains - * an internal map of numerical ID to ControlId for this purpose, and exposes it - * through the idmap() method to help construction of ControlList instances. + * The class needs to be constructed with a reference to the ControlIdMap all + * the ControlId belongs to. The ControlIdMap is used to provide, in addition to + * the features of the standard unsorted map, access to the mapped elements + * using numerical ID keys. */ /** @@ -645,24 +645,27 @@ std::string ControlInfo::toString() const /** * \brief Construct a ControlInfoMap from an initializer list * \param[in] init The initializer list + * \param[in] idmap The idmap used by the ControlInfoMap */ -ControlInfoMap::ControlInfoMap(std::initializer_list init) - : Map(init) +ControlInfoMap::ControlInfoMap(std::initializer_list init, + const ControlIdMap &idmap) + : Map(init), idmap_(&idmap) { - generateIdmap(); + validate(); } /** * \brief Construct a ControlInfoMap from a plain map * \param[in] info The control info plain map + * \param[in] idmap The idmap used by the ControlInfoMap * * Construct a new ControlInfoMap and populate its contents with those of * \a info using move semantics. Upon return the \a info map will be empty. */ -ControlInfoMap::ControlInfoMap(Map &&info) - : Map(std::move(info)) +ControlInfoMap::ControlInfoMap(Map &&info, const ControlIdMap &idmap) + : Map(std::move(info)), idmap_(&idmap) { - generateIdmap(); + validate(); } /** @@ -672,32 +675,14 @@ ControlInfoMap::ControlInfoMap(Map &&info) * \return A reference to the ControlInfoMap */ -/** - * \brief Replace the contents with those from the initializer list - * \param[in] init The initializer list - * \return A reference to the ControlInfoMap - */ -ControlInfoMap &ControlInfoMap::operator=(std::initializer_list init) +void ControlInfoMap::validate() { - Map::operator=(init); - generateIdmap(); - return *this; -} + for (const auto &controlInfo : *this) { + const ControlId *id = controlInfo.first; + auto it = idmap_->find(id->id()); -/** - * \brief Move assignment operator from a plain map - * \param[in] info The control info plain map - * - * Populate the map by replacing its contents with those of \a info using move - * semantics. Upon return the \a info map will be empty. - * - * \return A reference to the populated ControlInfoMap - */ -ControlInfoMap &ControlInfoMap::operator=(Map &&info) -{ - Map::operator=(std::move(info)); - generateIdmap(); - return *this; + ASSERT(it != idmap_->end()); + } } /** @@ -707,7 +692,7 @@ ControlInfoMap &ControlInfoMap::operator=(Map &&info) */ ControlInfoMap::mapped_type &ControlInfoMap::at(unsigned int id) { - return at(idmap_.at(id)); + return at(idmap_->at(id)); } /** @@ -717,7 +702,7 @@ ControlInfoMap::mapped_type &ControlInfoMap::at(unsigned int id) */ const ControlInfoMap::mapped_type &ControlInfoMap::at(unsigned int id) const { - return at(idmap_.at(id)); + return at(idmap_->at(id)); } /** @@ -732,7 +717,7 @@ ControlInfoMap::size_type ControlInfoMap::count(unsigned int id) const * entries, we can thus just count the matching entries in idmap to * avoid an additional lookup. */ - return idmap_.count(id); + return idmap_->count(id); } /** @@ -743,8 +728,8 @@ ControlInfoMap::size_type ControlInfoMap::count(unsigned int id) const */ ControlInfoMap::iterator ControlInfoMap::find(unsigned int id) { - auto iter = idmap_.find(id); - if (iter == idmap_.end()) + auto iter = idmap_->find(id); + if (iter == idmap_->end()) return end(); return find(iter->second); @@ -758,8 +743,8 @@ ControlInfoMap::iterator ControlInfoMap::find(unsigned int id) */ ControlInfoMap::const_iterator ControlInfoMap::find(unsigned int id) const { - auto iter = idmap_.find(id); - if (iter == idmap_.end()) + auto iter = idmap_->find(id); + if (iter == idmap_->end()) return end(); return find(iter->second); @@ -776,33 +761,6 @@ ControlInfoMap::const_iterator ControlInfoMap::find(unsigned int id) const * \return The ControlId map */ -void ControlInfoMap::generateIdmap() -{ - idmap_.clear(); - - for (const auto &ctrl : *this) { - /* - * For string controls, min and max define the valid - * range for the string size, not for the individual - * values. - */ - ControlType rangeType = ctrl.first->type() == ControlTypeString - ? ControlTypeInteger32 : ctrl.first->type(); - const ControlInfo &info = ctrl.second; - - if (info.min().type() != rangeType) { - LOG(Controls, Error) - << "Control " << utils::hex(ctrl.first->id()) - << " type and info type mismatch"; - idmap_.clear(); - clear(); - return; - } - - idmap_[ctrl.first->id()] = ctrl.first; - } -} - /** * \class ControlList * \brief Associate a list of ControlId with their values for an object diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 19cb5c4ec9c3..9c23788e5231 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -1071,7 +1071,8 @@ int PipelineHandlerIPU3::initControls(IPU3CameraData *data) controls[&controls::ScalerCrop] = ControlInfo(minCrop, maxCrop, maxCrop); - data->controlInfo_ = std::move(controls); + data->controlInfo_ = ControlInfoMap(std::move(controls), + controls::controls); return 0; } diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 42911a8fdfdb..710b9309448e 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -935,7 +935,8 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor) std::forward_as_tuple(&controls::AeEnable), std::forward_as_tuple(false, true)); - data->controlInfo_ = std::move(ctrls); + data->controlInfo_ = ControlInfoMap(std::move(ctrls), + controls::controls); data->sensor_ = std::make_unique(sensor); ret = data->sensor_->init(); diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp index 0f634b8da609..573d8042c18c 100644 --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp @@ -535,7 +535,7 @@ int UVCCameraData::init(MediaDevice *media) addControl(cid, info, &ctrls); } - controlInfo_ = std::move(ctrls); + controlInfo_ = ControlInfoMap(std::move(ctrls), controls::controls); return 0; } diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp index 12f7517fd0ae..d4b041d33eb4 100644 --- a/src/libcamera/pipeline/vimc/vimc.cpp +++ b/src/libcamera/pipeline/vimc/vimc.cpp @@ -512,7 +512,7 @@ int VimcCameraData::init() ctrls.emplace(id, info); } - controlInfo_ = std::move(ctrls); + controlInfo_ = ControlInfoMap(std::move(ctrls), controls::controls); /* Initialize the camera properties. */ properties_ = sensor_->properties(); diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp index 98d93a12a7be..6ccd8eb86016 100644 --- a/src/libcamera/v4l2_device.cpp +++ b/src/libcamera/v4l2_device.cpp @@ -611,12 +611,13 @@ void V4L2Device::listControls() << " (" << utils::hex(ctrl.id) << ")"; controlIds_.emplace_back(v4l2ControlId(ctrl)); + controlIdMap_[ctrl.id] = controlIds_.back().get(); controlInfo_.emplace(ctrl.id, ctrl); ctrls.emplace(controlIds_.back().get(), v4l2ControlInfo(ctrl)); } - controls_ = std::move(ctrls); + controls_ = ControlInfoMap(std::move(ctrls), controlIdMap_); } /** diff --git a/test/serialization/ipa_data_serializer_test.cpp b/test/serialization/ipa_data_serializer_test.cpp index 880bcd02c6be..bf7e34e28af3 100644 --- a/test/serialization/ipa_data_serializer_test.cpp +++ b/test/serialization/ipa_data_serializer_test.cpp @@ -32,13 +32,13 @@ using namespace std; using namespace libcamera; -static const ControlInfoMap Controls = { - { &controls::AeEnable, ControlInfo(false, true) }, - { &controls::ExposureTime, ControlInfo(0, 999999) }, - { &controls::AnalogueGain, ControlInfo(1.0f, 32.0f) }, - { &controls::ColourGains, ControlInfo(0.0f, 32.0f) }, - { &controls::Brightness, ControlInfo(-1.0f, 1.0f) }, -}; +static const ControlInfoMap Controls = ControlInfoMap({ + { &controls::AeEnable, ControlInfo(false, true) }, + { &controls::ExposureTime, ControlInfo(0, 999999) }, + { &controls::AnalogueGain, ControlInfo(1.0f, 32.0f) }, + { &controls::ColourGains, ControlInfo(0.0f, 32.0f) }, + { &controls::Brightness, ControlInfo(-1.0f, 1.0f) }, + }, controls::controls); namespace libcamera { From patchwork Mon Aug 9 15:23:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 13263 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 1E68DC3240 for ; Mon, 9 Aug 2021 15:22:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D87856888F; Mon, 9 Aug 2021 17:22:28 +0200 (CEST) Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 260A460269 for ; Mon, 9 Aug 2021 17:22:25 +0200 (CEST) Received: (Authenticated sender: jacopo@jmondi.org) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 57B42FF804; Mon, 9 Aug 2021 15:22:24 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Mon, 9 Aug 2021 17:23:05 +0200 Message-Id: <20210809152308.31947-3-jacopo@jmondi.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210809152308.31947-1-jacopo@jmondi.org> References: <20210809152308.31947-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 2/5] test: control serialization: Test lookup by ControlId 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Test that lookup by ControlId reference works in the control serialization test making sure that the control limits are not changed by de-serialization. The test currently fails and demonstates that lookup by ControlId is currently not supported until the introduction of the next patch. Signed-off-by: Jacopo Mondi Reviewed-by: Paul Elder Reviewed-by: Laurent Pinchart --- test/serialization/control_serialization.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/serialization/control_serialization.cpp b/test/serialization/control_serialization.cpp index e23383d13bd6..5ac9c4ede5f9 100644 --- a/test/serialization/control_serialization.cpp +++ b/test/serialization/control_serialization.cpp @@ -140,6 +140,15 @@ protected: return TestFail; } + /* Make sure control limits looked up by id are not changed. */ + const ControlInfo &newLimits = newInfoMap.at(&controls::Brightness); + const ControlInfo &initialLimits = infoMap.at(&controls::Brightness); + if (newLimits.min() != initialLimits.min() || + newLimits.max() != initialLimits.max()) { + cerr << "The brightness control limits have changed" << endl; + return TestFail; + } + /* Deserialize the control list and verify the contents. */ buffer = ByteStreamBuffer(const_cast(listData.data()), listData.size()); From patchwork Mon Aug 9 15:23:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 13264 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 50810C3241 for ; Mon, 9 Aug 2021 15:22:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0989468892; Mon, 9 Aug 2021 17:22:29 +0200 (CEST) Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E93B360269 for ; Mon, 9 Aug 2021 17:22:25 +0200 (CEST) Received: (Authenticated sender: jacopo@jmondi.org) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 5280DFF803; Mon, 9 Aug 2021 15:22:25 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Mon, 9 Aug 2021 17:23:06 +0200 Message-Id: <20210809152308.31947-4-jacopo@jmondi.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210809152308.31947-1-jacopo@jmondi.org> References: <20210809152308.31947-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 3/5] libcamera: controls: Use ControlIdMap in deserialization 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Introduce a new field in the controls serialization protocol to allow discerning which ControlIdMap a ControlInfoMap refers to. The newly introduced IdMapType enumeration describes the possible info maps: - Either the globally available controls::controls and properties::properties maps, which are valid across IPC boundaries - A ControlIdMap created locally by the V4L2 device, which is not valid across the IPC boundaries At de-serialization time the idMapType filed is inspected and - If the idmap is a globally available one, there's no need to create new ControlId instances when populating the de-serialized ControlInfoMap. Use the globally available map to retrieve the ControlId reference and use it - If the idmap is a map only available locally, create a new ControlId as it used to happen before this patch. As a direct consequence, this change allows us to perform lookup by ControlId reference on de-serialized ControlIdMap that refers to the libcamera defined controls::controls and properties::properties. Signed-off-by: Jacopo Mondi Reviewed-by: Paul Elder Reviewed-by: Laurent Pinchart --- include/libcamera/ipa/ipa_controls.h | 9 +++- src/libcamera/control_serializer.cpp | 65 +++++++++++++++++++++++----- src/libcamera/ipa_controls.cpp | 29 +++++++++++++ 3 files changed, 90 insertions(+), 13 deletions(-) diff --git a/include/libcamera/ipa/ipa_controls.h b/include/libcamera/ipa/ipa_controls.h index 6d3bf279c22d..f4bb7b77a974 100644 --- a/include/libcamera/ipa/ipa_controls.h +++ b/include/libcamera/ipa/ipa_controls.h @@ -15,13 +15,20 @@ extern "C" { #define IPA_CONTROLS_FORMAT_VERSION 1 +enum ipa_controls_id_map_type { + IPA_CONTROL_ID_MAP_CONTROLS, + IPA_CONTROL_ID_MAP_PROPERTIES, + IPA_CONTROL_ID_MAP_V4L2, +}; + struct ipa_controls_header { uint32_t version; uint32_t handle; uint32_t entries; uint32_t size; uint32_t data_offset; - uint32_t reserved[3]; + ipa_controls_id_map_type id_map_type; + uint32_t reserved[2]; }; struct ipa_control_value_entry { diff --git a/src/libcamera/control_serializer.cpp b/src/libcamera/control_serializer.cpp index df6ed93f477e..9127678f25f6 100644 --- a/src/libcamera/control_serializer.cpp +++ b/src/libcamera/control_serializer.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include "libcamera/internal/byte_stream_buffer.h" @@ -188,6 +189,15 @@ int ControlSerializer::serialize(const ControlInfoMap &infoMap, for (const auto &ctrl : infoMap) valuesSize += binarySize(ctrl.second); + const ControlIdMap *idmap = &infoMap.idmap(); + enum ipa_controls_id_map_type idMapType; + if (idmap == &controls::controls) + idMapType = IPA_CONTROL_ID_MAP_CONTROLS; + else if (idmap == &properties::properties) + idMapType = IPA_CONTROL_ID_MAP_PROPERTIES; + else + idMapType = IPA_CONTROL_ID_MAP_V4L2; + /* Prepare the packet header, assign a handle to the ControlInfoMap. */ struct ipa_controls_header hdr; hdr.version = IPA_CONTROLS_FORMAT_VERSION; @@ -195,6 +205,7 @@ int ControlSerializer::serialize(const ControlInfoMap &infoMap, hdr.entries = infoMap.size(); hdr.size = sizeof(hdr) + entriesSize + valuesSize; hdr.data_offset = sizeof(hdr) + entriesSize; + hdr.id_map_type = idMapType; buffer.write(&hdr); @@ -368,6 +379,33 @@ ControlInfoMap ControlSerializer::deserialize(ByteStreamBuffer & return {}; } + /* + * Use the ControlIdMap corresponding to the id map type. If the type + * references a globally defined id map (such as controls::controls + * or properties::properties), use it. Otherwise, create a local id map + * that will be populated with dynamically created ControlId instances + * when deserializing individual ControlInfoMap entries. + */ + const ControlIdMap *idMap = nullptr; + ControlIdMap *localIdMap = nullptr; + switch (hdr->id_map_type) { + case IPA_CONTROL_ID_MAP_CONTROLS: + idMap = &controls::controls; + break; + case IPA_CONTROL_ID_MAP_PROPERTIES: + idMap = &properties::properties; + break; + case IPA_CONTROL_ID_MAP_V4L2: + controlIdMaps_.emplace_back(std::make_unique()); + localIdMap = controlIdMaps_.back().get(); + idMap = localIdMap; + break; + default: + LOG(Serializer, Error) + << "Unknown id map type: " << hdr->id_map_type; + return {}; + } + ByteStreamBuffer entries = buffer.carveOut(hdr->data_offset - sizeof(*hdr)); ByteStreamBuffer values = buffer.carveOut(hdr->size - hdr->data_offset); @@ -377,9 +415,6 @@ ControlInfoMap ControlSerializer::deserialize(ByteStreamBuffer & } ControlInfoMap::Map ctrls; - controlIdMaps_.emplace_back(std::make_unique()); - ControlIdMap *localIdMap = controlIdMaps_.back().get(); - for (unsigned int i = 0; i < hdr->entries; ++i) { const struct ipa_control_info_entry *entry = entries.read(); @@ -388,15 +423,21 @@ ControlInfoMap ControlSerializer::deserialize(ByteStreamBuffer & return {}; } - /* Create and cache the individual ControlId. */ ControlType type = static_cast(entry->type); - /** - * \todo Find a way to preserve the control name for debugging - * purpose. - */ - controlIds_.emplace_back(std::make_unique(entry->id, "", type)); - ControlId *controlId = controlIds_.back().get(); - (*localIdMap)[entry->id] = controlId; + + /* If we're using a local id map, populate it. */ + if (localIdMap) { + /** + * \todo Find a way to preserve the control name for + * debugging purpose. + */ + controlIds_.emplace_back(std::make_unique(entry->id, + "", type)); + (*localIdMap)[entry->id] = controlIds_.back().get(); + } + + const ControlId *controlId = idMap->at(entry->id); + ASSERT(controlId); if (entry->offset != values.offset()) { LOG(Serializer, Error) @@ -413,7 +454,7 @@ ControlInfoMap ControlSerializer::deserialize(ByteStreamBuffer & * Create the ControlInfoMap in the cache, and store the map to handle * association. */ - infoMaps_[hdr->handle] = ControlInfoMap(std::move(ctrls), *localIdMap); + infoMaps_[hdr->handle] = ControlInfoMap(std::move(ctrls), *idMap); ControlInfoMap &map = infoMaps_[hdr->handle]; infoMapHandles_[&map] = hdr->handle; diff --git a/src/libcamera/ipa_controls.cpp b/src/libcamera/ipa_controls.cpp index 8fd726513182..fb98cda30ede 100644 --- a/src/libcamera/ipa_controls.cpp +++ b/src/libcamera/ipa_controls.cpp @@ -134,6 +134,33 @@ * \brief The current control serialization format version */ +/** + * \var ipa_controls_id_map_type + * \brief Enumerates the different control id map types + * + * Each ControlInfoMap and ControlList refers to a control id map that + * associates the ControlId references to a numerical identifier. + * During the serialization procedure the raw pointers to the ControlId + * instances cannot be transported on the wire, hence their numerical id is + * used to identify them in the serialized data buffer. At deserialization time + * it is required to associate back to the numerical id the ControlId instance + * it represents. This enumeration describes which ControlIdMap should be + * used to perform such operation. + * + * \var ipa_controls_id_map_type::IPA_CONTROL_ID_MAP_CONTROLS + * \brief The numerical control identifier are resolved to a ControlId * using + * the global controls::controls id map + * \var ipa_controls_id_map_type::IPA_CONTROL_ID_MAP_PROPERTIES + * \brief The numerical control identifier are resolved to a ControlId * using + * the global properties::properties id map + * \var ipa_controls_id_map_type::IPA_CONTROL_ID_MAP_V4L2 + * \brief ControlId for V4L2 defined controls are created by the video device + * that enumerates them, and are not available across the IPC boundaries. The + * deserializer shall create new ControlId instances for them as well as store + * them in a dedicated ControlIdMap. Only lookup by numerical id can be + * performed on de-serialized ControlInfoMap that represents V4L2 controls. + */ + /** * \struct ipa_controls_header * \brief Serialized control packet header @@ -149,6 +176,8 @@ * The total packet size in bytes * \var ipa_controls_header::data_offset * Offset in bytes from the beginning of the packet of the data section start + * \var ipa_controls_header::id_map_type + * The id map type as defined by the ipa_controls_id_map_type enumeration * \var ipa_controls_header::reserved * Reserved for future extensions */ From patchwork Mon Aug 9 15:23:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 13266 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id D671AC3242 for ; Mon, 9 Aug 2021 15:22:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 27DEA68895; Mon, 9 Aug 2021 17:22:29 +0200 (CEST) Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E0B8F68826 for ; Mon, 9 Aug 2021 17:22:26 +0200 (CEST) Received: (Authenticated sender: jacopo@jmondi.org) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 292E8FF803; Mon, 9 Aug 2021 15:22:25 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Mon, 9 Aug 2021 17:23:07 +0200 Message-Id: <20210809152308.31947-5-jacopo@jmondi.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210809152308.31947-1-jacopo@jmondi.org> References: <20210809152308.31947-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 4/5] libcamera: ipu3: Initialize controls in the IPA 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" All the IPU3 Camera controls are currently initialized by the pipeline handler which initializes them using the camera sensor configuration and platform specific requirements. However, some controls are better initialized by the IPA, which might, in example, cap the exposure times and frame duration to the constraints of its algorithms implementation. Also, moving forward, the IPA should register controls to report its capabilities, in example the ability to enable/disable 3A algorithms on request. Move the existing controls initialization to the IPA, by providing the sensor configuration and its controls to the IPU3IPA::init() function, which initializes controls and returns them to the pipeline through an output parameter. The existing controls initialization has been copied verbatim from the pipeline handler to the IPA, if not a for few line breaks adjustments and the resulting Camera controls values are not changed . Signed-off-by: Jacopo Mondi Reviewed-by: Paul Elder Reviewed-by: Laurent Pinchart --- include/libcamera/ipa/ipu3.mojom | 5 +- src/ipa/ipu3/ipu3.cpp | 71 ++++++++++++++++++++- src/libcamera/pipeline/ipu3/ipu3.cpp | 95 ++++++++++++---------------- 3 files changed, 113 insertions(+), 58 deletions(-) diff --git a/include/libcamera/ipa/ipu3.mojom b/include/libcamera/ipa/ipu3.mojom index 911a3a072464..d561c2244907 100644 --- a/include/libcamera/ipa/ipu3.mojom +++ b/include/libcamera/ipa/ipu3.mojom @@ -38,7 +38,10 @@ struct IPAConfigInfo { }; interface IPAIPU3Interface { - init(libcamera.IPASettings settings) => (int32 ret); + init(libcamera.IPASettings settings, + libcamera.IPACameraSensorInfo sensorInfo, + libcamera.ControlInfoMap sensorControls) + => (int32 ret, libcamera.ControlInfoMap ipaControls); start() => (int32 ret); stop(); diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index 71698d36e50f..5e4b2bdc9ace 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -5,8 +5,10 @@ * ipu3.cpp - IPU3 Image Processing Algorithms */ +#include #include #include +#include #include #include @@ -38,7 +40,11 @@ namespace ipa::ipu3 { class IPAIPU3 : public IPAIPU3Interface { public: - int init(const IPASettings &settings) override; + int init(const IPASettings &settings, + const IPACameraSensorInfo &sensorInfo, + const ControlInfoMap &sensorControls, + ControlInfoMap *ipaControls) override; + int start() override; void stop() override {} @@ -86,14 +92,73 @@ private: struct ipu3_uapi_grid_config bdsGrid_; }; -int IPAIPU3::init(const IPASettings &settings) +/** + * Initialize the IPA module and its controls. + * + * This function receives the camera sensor information from the pipeline + * handler, computes the limits of the controls it handles and returns + * them in the \a ipaControls output parameter. + */ +int IPAIPU3::init(const IPASettings &settings, + const IPACameraSensorInfo &sensorInfo, + const ControlInfoMap &sensorControls, + ControlInfoMap *ipaControls) { camHelper_ = CameraSensorHelperFactory::create(settings.sensorModel); if (camHelper_ == nullptr) { - LOG(IPAIPU3, Error) << "Failed to create camera sensor helper for " << settings.sensorModel; + LOG(IPAIPU3, Error) << "Failed to create camera sensor helper for " + << settings.sensorModel; return -ENODEV; } + /* Initialize Controls. */ + ControlInfoMap::Map controls{}; + + /* + * Compute exposure time limits. + * + * Initialize the control using the line length and pixel rate of the + * current configuration converted to microseconds. Use the + * V4L2_CID_EXPOSURE control to get exposure min, max and default and + * convert it from lines to microseconds. + */ + double lineDuration = sensorInfo.lineLength / (sensorInfo.pixelRate / 1e6); + const ControlInfo &v4l2Exposure = sensorControls.find(V4L2_CID_EXPOSURE)->second; + int32_t minExposure = v4l2Exposure.min().get() * lineDuration; + int32_t maxExposure = v4l2Exposure.max().get() * lineDuration; + int32_t defExposure = v4l2Exposure.def().get() * lineDuration; + controls[&controls::ExposureTime] = ControlInfo(minExposure, maxExposure, + defExposure); + + /* + * Compute the frame duration limits. + * + * The frame length is computed assuming a fixed line length combined + * with the vertical frame sizes. + */ + const ControlInfo &v4l2HBlank = sensorControls.find(V4L2_CID_HBLANK)->second; + uint32_t hblank = v4l2HBlank.def().get(); + uint32_t lineLength = sensorInfo.outputSize.width + hblank; + + const ControlInfo &v4l2VBlank = sensorControls.find(V4L2_CID_VBLANK)->second; + std::array frameHeights{ + v4l2VBlank.min().get() + sensorInfo.outputSize.height, + v4l2VBlank.max().get() + sensorInfo.outputSize.height, + v4l2VBlank.def().get() + sensorInfo.outputSize.height, + }; + + std::array frameDurations; + for (unsigned int i = 0; i < frameHeights.size(); ++i) { + uint64_t frameSize = lineLength * frameHeights[i]; + frameDurations[i] = frameSize / (sensorInfo.pixelRate / 1000000U); + } + + controls[&controls::FrameDurationLimits] = ControlInfo(frameDurations[0], + frameDurations[1], + frameDurations[2]); + + *ipaControls = ControlInfoMap(std::move(controls), controls::controls); + return 0; } diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 9c23788e5231..a2d2c887590f 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -88,6 +88,8 @@ public: std::queue pendingRequests_; + ControlInfoMap ipaControls_; + private: void queueFrameAction(unsigned int id, const ipa::ipu3::IPU3Action &action); @@ -954,7 +956,6 @@ int PipelineHandlerIPU3::initControls(IPU3CameraData *data) return ret; ControlInfoMap::Map controls = IPU3Controls; - const ControlInfoMap &sensorControls = sensor->controls(); const std::vector &testPatternModes = sensor->testPatternModes(); if (!testPatternModes.empty()) { std::vector values; @@ -966,58 +967,6 @@ int PipelineHandlerIPU3::initControls(IPU3CameraData *data) controls[&controls::draft::TestPatternMode] = ControlInfo(values); } - /* - * Compute exposure time limits. - * - * Initialize the control using the line length and pixel rate of the - * current configuration converted to microseconds. Use the - * V4L2_CID_EXPOSURE control to get exposure min, max and default and - * convert it from lines to microseconds. - */ - double lineDuration = sensorInfo.lineLength - / (sensorInfo.pixelRate / 1e6); - const ControlInfo &v4l2Exposure = sensorControls.find(V4L2_CID_EXPOSURE)->second; - int32_t minExposure = v4l2Exposure.min().get() * lineDuration; - int32_t maxExposure = v4l2Exposure.max().get() * lineDuration; - int32_t defExposure = v4l2Exposure.def().get() * lineDuration; - - /* - * \todo Report the actual exposure time, use the default for the - * moment. - */ - data->exposureTime_ = defExposure; - - controls[&controls::ExposureTime] = ControlInfo(minExposure, maxExposure, - defExposure); - - /* - * Compute the frame duration limits. - * - * The frame length is computed assuming a fixed line length combined - * with the vertical frame sizes. - */ - const ControlInfo &v4l2HBlank = sensorControls.find(V4L2_CID_HBLANK)->second; - uint32_t hblank = v4l2HBlank.def().get(); - uint32_t lineLength = sensorInfo.outputSize.width + hblank; - - const ControlInfo &v4l2VBlank = sensorControls.find(V4L2_CID_VBLANK)->second; - std::array frameHeights{ - v4l2VBlank.min().get() + sensorInfo.outputSize.height, - v4l2VBlank.max().get() + sensorInfo.outputSize.height, - v4l2VBlank.def().get() + sensorInfo.outputSize.height, - }; - - std::array frameDurations; - for (unsigned int i = 0; i < frameHeights.size(); ++i) { - uint64_t frameSize = lineLength * frameHeights[i]; - frameDurations[i] = frameSize / (sensorInfo.pixelRate / 1000000U); - } - - controls[&controls::FrameDurationLimits] = - ControlInfo(frameDurations[0], - frameDurations[1], - frameDurations[2]); - /* * Compute the scaler crop limits. * @@ -1071,6 +1020,21 @@ int PipelineHandlerIPU3::initControls(IPU3CameraData *data) controls[&controls::ScalerCrop] = ControlInfo(minCrop, maxCrop, maxCrop); + /* + * \todo Report the actual exposure time, use the default for the + * moment. + */ + const auto exposureInfo = data->ipaControls_.find(&controls::ExposureTime); + if (exposureInfo == data->ipaControls_.end()) { + LOG(IPU3, Error) << "Exposure control not initialized by the IPA"; + return -EINVAL; + } + data->exposureTime_ = exposureInfo->second.def().get(); + + /* Add the IPA registered controls to list of camera controls. */ + for (const auto &ipaControl : data->ipaControls_) + controls[ipaControl.first] = ipaControl.second; + data->controlInfo_ = ControlInfoMap(std::move(controls), controls::controls); @@ -1223,8 +1187,31 @@ int IPU3CameraData::loadIPA() ipa_->queueFrameAction.connect(this, &IPU3CameraData::queueFrameAction); + /* + * Pass the sensor info to the IPA to initialize controls. + * + * \todo Find a way to initialize IPA controls without basing their + * limits on a particular sensor mode. We currently pass sensor + * information corresponding to the largest sensor resolution, and the + * IPA uses this to compute limits for supported controls. There's a + * discrepancy between the need to compute IPA control limits at init + * time, and the fact that those limits may depend on the sensor mode. + * Research is required to find out to handle this issue. + */ CameraSensor *sensor = cio2_.sensor(); - int ret = ipa_->init(IPASettings{ "", sensor->model() }); + V4L2SubdeviceFormat sensorFormat = {}; + sensorFormat.size = sensor->resolution(); + int ret = sensor->setFormat(&sensorFormat); + if (ret) + return ret; + + IPACameraSensorInfo sensorInfo{}; + ret = sensor->sensorInfo(&sensorInfo); + if (ret) + return ret; + + ret = ipa_->init(IPASettings{ "", sensor->model() }, sensorInfo, + sensor->controls(), &ipaControls_); if (ret) { LOG(IPU3, Error) << "Failed to initialise the IPU3 IPA"; return ret; From patchwork Mon Aug 9 15:23:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 13265 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 1707AC3243 for ; Mon, 9 Aug 2021 15:22:30 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 48A87688A5; Mon, 9 Aug 2021 17:22:29 +0200 (CEST) Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 07C1660269 for ; Mon, 9 Aug 2021 17:22:28 +0200 (CEST) Received: (Authenticated sender: jacopo@jmondi.org) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 0BDD2FF803; Mon, 9 Aug 2021 15:22:26 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Mon, 9 Aug 2021 17:23:08 +0200 Message-Id: <20210809152308.31947-6-jacopo@jmondi.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210809152308.31947-1-jacopo@jmondi.org> References: <20210809152308.31947-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 5/5] ipa: ipu3: Tidy-up includes 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Tidy-up a bit the inclusions directive in the IPU3 IPA module. In detail: - ipu3.cpp is missing inclusions for: std::abs from std::map from std::min/max from std::numeric_limits from std::unique_ptr from std::vector from and does not require - ipu3_agc has two not used inclusions in the header file and one the cpp file and is missing for std::literals::chrono_literals - ipu3_awb is missing for std::sort and does not use or Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart Reviewed-by: Umang Jain Reviewed-by: Paul Elder --- src/ipa/ipu3/ipu3.cpp | 7 ++++++- src/ipa/ipu3/ipu3_agc.cpp | 2 +- src/ipa/ipu3/ipu3_agc.h | 3 --- src/ipa/ipu3/ipu3_awb.cpp | 3 +-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index 5e4b2bdc9ace..dd9a9603dcb9 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -5,10 +5,15 @@ * ipu3.cpp - IPU3 Image Processing Algorithms */ +#include #include +#include +#include +#include +#include #include -#include #include +#include #include #include diff --git a/src/ipa/ipu3/ipu3_agc.cpp b/src/ipa/ipu3/ipu3_agc.cpp index 6253ab94cff1..408eb849b428 100644 --- a/src/ipa/ipu3/ipu3_agc.cpp +++ b/src/ipa/ipu3/ipu3_agc.cpp @@ -8,8 +8,8 @@ #include "ipu3_agc.h" #include +#include #include -#include #include diff --git a/src/ipa/ipu3/ipu3_agc.h b/src/ipa/ipu3/ipu3_agc.h index 3deca3ae6933..9f3d4257d945 100644 --- a/src/ipa/ipu3/ipu3_agc.h +++ b/src/ipa/ipu3/ipu3_agc.h @@ -7,9 +7,6 @@ #ifndef __LIBCAMERA_IPU3_AGC_H__ #define __LIBCAMERA_IPU3_AGC_H__ -#include -#include - #include #include diff --git a/src/ipa/ipu3/ipu3_awb.cpp b/src/ipa/ipu3/ipu3_awb.cpp index 9b409c8ffad9..4bb321b377a2 100644 --- a/src/ipa/ipu3/ipu3_awb.cpp +++ b/src/ipa/ipu3/ipu3_awb.cpp @@ -6,9 +6,8 @@ */ #include "ipu3_awb.h" +#include #include -#include -#include #include