From patchwork Sun Oct 13 23:33:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 2192 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8631961563 for ; Mon, 14 Oct 2019 01:33:21 +0200 (CEST) Received: from pendragon.bb.dnainternet.fi (dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0C81C33A for ; Mon, 14 Oct 2019 01:33:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1571009601; bh=BPWhUKkkGasKdBMhZF2Tha1m7WZpEfLt4jka6PbfKeQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=WgBKv4qS3UfPULkTtsCvTRIueVZJKTGRQCjrYukqBtczI/56bpOeNzfFsV28jK57L VYeZy0dZLpLygTMfzVheHSMi+VrKy3bUZV1X29AYqpg6oRxozG12GOAIvhT17+lZ+H mgUQ3VMAtFRAPPOVKlGj+E3aLoNNjlNLC55B2mho= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Mon, 14 Oct 2019 02:33:14 +0300 Message-Id: <20191013233314.4434-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191013232755.3292-1-laurent.pinchart@ideasonboard.com> References: <20191013232755.3292-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 10/10] libcamera: v4l2_controls: Remove V4L2ControlList class 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, 13 Oct 2019 23:33:21 -0000 The V4L2ControlList class only provides a convenience constructor for the ControlList, which can easily be moved to the ControlList class and may benefit it later (to construct a ControlList from controls supported by a camera). Move the constructor and remove V4L2ControlList. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund Reviewed-by: Jacopo Mondi --- include/libcamera/controls.h | 1 + src/ipa/rkisp1/rkisp1.cpp | 2 +- src/libcamera/controls.cpp | 10 ++++++++++ src/libcamera/include/v4l2_controls.h | 14 -------------- src/libcamera/pipeline/ipu3/ipu3.cpp | 2 +- src/libcamera/pipeline/uvcvideo.cpp | 2 +- src/libcamera/pipeline/vimc.cpp | 2 +- src/libcamera/v4l2_controls.cpp | 20 -------------------- test/v4l2_videodevice/controls.cpp | 2 +- 9 files changed, 16 insertions(+), 39 deletions(-) diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h index 80414c6f0748..0d279d508dcc 100644 --- a/include/libcamera/controls.h +++ b/include/libcamera/controls.h @@ -170,6 +170,7 @@ private: public: ControlList(const ControlIdMap &idmap, ControlValidator *validator = nullptr); + ControlList(const ControlInfoMap &info, ControlValidator *validator = nullptr); using iterator = ControlListMap::iterator; using const_iterator = ControlListMap::const_iterator; diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp index bd703898c523..570145ce71b2 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -212,7 +212,7 @@ void IPARkISP1::setControls(unsigned int frame) IPAOperationData op; op.operation = RKISP1_IPA_ACTION_V4L2_SET; - V4L2ControlList ctrls(ctrls_); + ControlList ctrls(ctrls_); ctrls.set(V4L2_CID_EXPOSURE, static_cast(exposure_)); ctrls.set(V4L2_CID_ANALOGUE_GAIN, static_cast(gain_)); op.controls.push_back(ctrls); diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp index bf7634aab470..93ad2fc6a276 100644 --- a/src/libcamera/controls.cpp +++ b/src/libcamera/controls.cpp @@ -561,6 +561,16 @@ ControlList::ControlList(const ControlIdMap &idmap, ControlValidator *validator) { } +/** + * \brief Construct a ControlList with the idmap of a control info map + * \param[in] info The ControlInfoMap for the control list target object + * \param[in] validator The validator (may be null) + */ +ControlList::ControlList(const ControlInfoMap &info, ControlValidator *validator) + : validator_(validator), idmap_(&info.idmap()) +{ +} + /** * \typedef ControlList::iterator * \brief Iterator for the controls contained within the list diff --git a/src/libcamera/include/v4l2_controls.h b/src/libcamera/include/v4l2_controls.h index e16c4957f9d1..882546a89340 100644 --- a/src/libcamera/include/v4l2_controls.h +++ b/src/libcamera/include/v4l2_controls.h @@ -8,11 +8,6 @@ #ifndef __LIBCAMERA_V4L2_CONTROLS_H__ #define __LIBCAMERA_V4L2_CONTROLS_H__ -#include -#include -#include -#include - #include #include @@ -31,15 +26,6 @@ public: V4L2ControlRange(const struct v4l2_query_ext_ctrl &ctrl); }; -class V4L2ControlList : public ControlList -{ -public: - V4L2ControlList(const ControlInfoMap &info) - : ControlList(info.idmap()) - { - } -}; - } /* namespace libcamera */ #endif /* __LIBCAMERA_V4L2_CONTROLS_H__ */ diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 9776b36b88cd..8d3ad568d16e 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -604,7 +604,7 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c) return ret; /* Apply the "pipe_mode" control to the ImgU subdevice. */ - V4L2ControlList ctrls(imgu->imgu_->controls()); + ControlList ctrls(imgu->imgu_->controls()); ctrls.set(V4L2_CID_IPU3_PIPE_MODE, static_cast(vfStream->active_ ? IPU3PipeModeVideo : IPU3PipeModeStillCapture)); diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp index a64e1af4c550..fae0ffc4de30 100644 --- a/src/libcamera/pipeline/uvcvideo.cpp +++ b/src/libcamera/pipeline/uvcvideo.cpp @@ -228,7 +228,7 @@ void PipelineHandlerUVC::stop(Camera *camera) int PipelineHandlerUVC::processControls(UVCCameraData *data, Request *request) { - V4L2ControlList controls(data->video_->controls()); + ControlList controls(data->video_->controls()); for (auto it : request->controls()) { const ControlId &id = *it.first; diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp index 6a4244119dc5..dcdaef120ad1 100644 --- a/src/libcamera/pipeline/vimc.cpp +++ b/src/libcamera/pipeline/vimc.cpp @@ -279,7 +279,7 @@ void PipelineHandlerVimc::stop(Camera *camera) int PipelineHandlerVimc::processControls(VimcCameraData *data, Request *request) { - V4L2ControlList controls(data->sensor_->controls()); + ControlList controls(data->sensor_->controls()); for (auto it : request->controls()) { const ControlId &id = *it.first; diff --git a/src/libcamera/v4l2_controls.cpp b/src/libcamera/v4l2_controls.cpp index bd5e18590b76..83ac7b0dc666 100644 --- a/src/libcamera/v4l2_controls.cpp +++ b/src/libcamera/v4l2_controls.cpp @@ -134,24 +134,4 @@ V4L2ControlRange::V4L2ControlRange(const struct v4l2_query_ext_ctrl &ctrl) static_cast(ctrl.maximum))); } -/** - * \class V4L2ControlList - * \brief A list of controls for a V4L2 device - * - * This class specialises the ControList class for use with V4L2 devices. It - * offers a convenience API to create a ControlList from a ControlInfoMap. - * - * V4L2ControlList allows easy construction of a ControlList containing V4L2 - * controls for a device. It can be used to construct the list of controls - * passed to the V4L2Device::getControls() and V4L2Device::setControls() - * methods. The class should however not be used in place of ControlList in - * APIs. - */ - -/** - * \fn V4L2ControlList::V4L2ControlList(const ControlInfoMap &info) - * \brief Construct a V4L2ControlList associated with a V4L2 device - * \param[in] info The V4L2 device control info map - */ - } /* namespace libcamera */ diff --git a/test/v4l2_videodevice/controls.cpp b/test/v4l2_videodevice/controls.cpp index 31879b794ed0..975c852b8cbf 100644 --- a/test/v4l2_videodevice/controls.cpp +++ b/test/v4l2_videodevice/controls.cpp @@ -46,7 +46,7 @@ protected: const ControlRange &saturation = info.find(V4L2_CID_SATURATION)->second; /* Test getting controls. */ - V4L2ControlList ctrls(info); + ControlList ctrls(info); ctrls.set(V4L2_CID_BRIGHTNESS, -1); ctrls.set(V4L2_CID_CONTRAST, -1); ctrls.set(V4L2_CID_SATURATION, -1);