{"id":16464,"url":"https://patchwork.libcamera.org/api/patches/16464/?format=json","web_url":"https://patchwork.libcamera.org/patch/16464/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20220630133902.321099-8-jacopo@jmondi.org>","date":"2022-06-30T13:38:46","name":"[libcamera-devel,v3,07/23] libcamera: camera_sensor: Rename the control interface","commit_ref":null,"pull_url":null,"state":"not-applicable","archived":true,"hash":"5f5dbe7a9210e7ca2b561db0cce4b3f94114d7a2","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/16464/mbox/","series":[{"id":3238,"url":"https://patchwork.libcamera.org/api/series/3238/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3238","date":"2022-06-30T13:38:39","name":"Internal controls, sensor delays and IPA rework","version":3,"mbox":"https://patchwork.libcamera.org/series/3238/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16464/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16464/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id E339CC3278\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 30 Jun 2022 13:39:32 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 33A4A6569C;\n\tThu, 30 Jun 2022 15:39:32 +0200 (CEST)","from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net\n\t[IPv6:2001:4b98:dc4:8::221])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 42D956564C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 30 Jun 2022 15:39:27 +0200 (CEST)","(Authenticated sender: jacopo@jmondi.org)\n\tby mail.gandi.net (Postfix) with ESMTPSA id DEEAC24000B;\n\tThu, 30 Jun 2022 13:39:25 +0000 (UTC)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1656596372;\n\tbh=Wze/zWdkmyZCcAc3Lfnv2bHGjZUXn9zlfAP79PKvJcs=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=EN0HTxzYu+xXEMoDTEZd7KnEq2U0YHFYK45Wfr+V0nFX/zOGlQcXcT94t5/cMlytu\n\t9jlnKd2lspkbP+TAYXJZded6nN6aeZu9YGdKKnKzo9Pn4x8rKG+v4qUQs7MJCRi/Rr\n\tIyuzSQP4+PTTFF0d1rBtShGUCpq5zH1jRANdalrFuk3t+eWk0Hda9CJ9JdigZ5zQLa\n\t2UUuf281jsGuNuXL2gGm3iVqqzdlYkgNY4QfoE9wscXCblcqiyP9W00PJCoLtn0U/F\n\tJJTDD36pbX4ulXBbSN35LrAiQhw8uTeBC2dgADmQLoPfwqxd9wfkoG3vUQp6+I5+6L\n\tvc6v2GMctvrFA==","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 30 Jun 2022 15:38:46 +0200","Message-Id":"<20220630133902.321099-8-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.36.1","In-Reply-To":"<20220630133902.321099-1-jacopo@jmondi.org>","References":"<20220630133902.321099-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v3 07/23] libcamera: camera_sensor: Rename\n\tthe control interface","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Jacopo Mondi <jacopo@jmondi.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The control interface of the CameraSensor class operates on V4L2\ncontrols.\n\nTo prepare to move the CameraSensor interface to use libcamera::internal\ncontrols, rename the existing interface to be the 'v4l2' control\ninterface, to allow users to transition to the new interface gradually.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n include/libcamera/internal/camera_sensor.h         |  6 +++---\n src/libcamera/camera_sensor/camera_sensor.cpp      | 14 +++++++-------\n src/libcamera/pipeline/ipu3/ipu3.cpp               | 10 +++++-----\n src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 14 +++++++-------\n src/libcamera/pipeline/rkisp1/rkisp1.cpp           |  2 +-\n src/libcamera/pipeline/vimc/vimc.cpp               |  8 ++++----\n 6 files changed, 27 insertions(+), 27 deletions(-)","diff":"diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h\nindex 43b035b77f2b..2a850dedc0aa 100644\n--- a/include/libcamera/internal/camera_sensor.h\n+++ b/include/libcamera/internal/camera_sensor.h\n@@ -56,9 +56,9 @@ public:\n \t\t\t\t      const Size &size) const;\n \tint setFormat(V4L2SubdeviceFormat *format);\n \n-\tconst ControlInfoMap &controls() const;\n-\tControlList getControls(const std::vector<uint32_t> &ids);\n-\tint setControls(ControlList *ctrls);\n+\tconst ControlInfoMap &v4l2Controls() const;\n+\tControlList getV4L2Controls(const std::vector<uint32_t> &ids);\n+\tint setV4L2Controls(ControlList *ctrls);\n \n \tV4L2Subdevice *device() { return subdev_.get(); }\n \ndiff --git a/src/libcamera/camera_sensor/camera_sensor.cpp b/src/libcamera/camera_sensor/camera_sensor.cpp\nindex 59b956e40803..26cfa7d0f65a 100644\n--- a/src/libcamera/camera_sensor/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor/camera_sensor.cpp\n@@ -335,8 +335,8 @@ void CameraSensor::initStaticProperties()\n \n void CameraSensor::initTestPatternModes()\n {\n-\tconst auto &v4l2TestPattern = controls().find(V4L2_CID_TEST_PATTERN);\n-\tif (v4l2TestPattern == controls().end()) {\n+\tconst auto &v4l2TestPattern = v4l2Controls().find(V4L2_CID_TEST_PATTERN);\n+\tif (v4l2TestPattern == v4l2Controls().end()) {\n \t\tLOG(CameraSensor, Debug) << \"V4L2_CID_TEST_PATTERN is not supported\";\n \t\treturn;\n \t}\n@@ -615,10 +615,10 @@ int CameraSensor::applyTestPatternMode(controls::draft::TestPatternModeEnum mode\n \tLOG(CameraSensor, Debug) << \"Apply test pattern mode \" << mode;\n \n \tint32_t index = staticProps_->testPatternModes.at(mode);\n-\tControlList ctrls{ controls() };\n+\tControlList ctrls{ v4l2Controls() };\n \tctrls.set(V4L2_CID_TEST_PATTERN, index);\n \n-\tint ret = setControls(&ctrls);\n+\tint ret = setV4L2Controls(&ctrls);\n \tif (ret)\n \t\treturn ret;\n \n@@ -744,7 +744,7 @@ int CameraSensor::setFormat(V4L2SubdeviceFormat *format)\n  *\n  * \\return A map of the V4L2 controls supported by the sensor\n  */\n-const ControlInfoMap &CameraSensor::controls() const\n+const ControlInfoMap &CameraSensor::v4l2Controls() const\n {\n \treturn subdev_->controls();\n }\n@@ -767,7 +767,7 @@ const ControlInfoMap &CameraSensor::controls() const\n  * \\return The control values in a ControlList on success, or an empty list on\n  * error\n  */\n-ControlList CameraSensor::getControls(const std::vector<uint32_t> &ids)\n+ControlList CameraSensor::getV4L2Controls(const std::vector<uint32_t> &ids)\n {\n \treturn subdev_->getControls(ids);\n }\n@@ -797,7 +797,7 @@ ControlList CameraSensor::getControls(const std::vector<uint32_t> &ids)\n  * \\retval -EINVAL One of the control is not supported or not accessible\n  * \\retval i The index of the control that failed\n  */\n-int CameraSensor::setControls(ControlList *ctrls)\n+int CameraSensor::setV4L2Controls(ControlList *ctrls)\n {\n \treturn subdev_->setControls(ctrls);\n }\ndiff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex b7dda282faab..85e5f8a70408 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -581,7 +581,7 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c)\n \t * the sensor and user transform.\n \t */\n \tif (data->supportsFlips_) {\n-\t\tControlList sensorCtrls(cio2->sensor()->controls());\n+\t\tControlList sensorCtrls(cio2->sensor()->v4l2Controls());\n \t\tsensorCtrls.set(V4L2_CID_HFLIP,\n \t\t\t\tstatic_cast<int32_t>(!!(config->combinedTransform_\n \t\t\t\t\t\t\t& Transform::HFlip)));\n@@ -589,7 +589,7 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c)\n \t\t\t\tstatic_cast<int32_t>(!!(config->combinedTransform_\n \t\t\t\t\t\t        & Transform::VFlip)));\n \n-\t\tret = cio2->sensor()->setControls(&sensorCtrls);\n+\t\tret = cio2->sensor()->setV4L2Controls(&sensorCtrls);\n \t\tif (ret)\n \t\t\treturn ret;\n \t}\n@@ -662,7 +662,7 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c)\n \t}\n \n \tipa::ipu3::IPAConfigInfo configInfo;\n-\tconfigInfo.sensorControls = data->cio2_.sensor()->controls();\n+\tconfigInfo.sensorControls = data->cio2_.sensor()->v4l2Controls();\n \n \tCameraLens *lens = data->cio2_.sensor()->focusLens();\n \tif (lens)\n@@ -1157,7 +1157,7 @@ int PipelineHandlerIPU3::registerCameras()\n \t\t\tLOG(IPU3, Warning) << \"Invalid rotation of \" << rotation\n \t\t\t\t\t   << \" degrees: ignoring\";\n \n-\t\tControlList ctrls = cio2->sensor()->getControls({ V4L2_CID_HFLIP });\n+\t\tControlList ctrls = cio2->sensor()->getV4L2Controls({ V4L2_CID_HFLIP });\n \t\tif (!ctrls.empty())\n \t\t\t/* We assume the sensor supports VFLIP too. */\n \t\t\tdata->supportsFlips_ = true;\n@@ -1245,7 +1245,7 @@ int IPU3CameraData::loadIPA()\n \t\treturn ret;\n \n \tret = ipa_->init(IPASettings{ \"\", sensor->model() }, sensorInfo,\n-\t\t\t sensor->controls(), &ipaControls_);\n+\t\t\t sensor->v4l2Controls(), &ipaControls_);\n \tif (ret) {\n \t\tLOG(IPU3, Error) << \"Failed to initialise the IPU3 IPA\";\n \t\treturn ret;\ndiff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 66a84b1dfb97..f0013d3a1485 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -1303,8 +1303,8 @@ int PipelineHandlerRPi::registerCamera(MediaDevice *unicam, MediaDevice *isp, Me\n \t * sensor of the colour gains. It is defined to be a linear gain where\n \t * the default value represents a gain of exactly one.\n \t */\n-\tauto it = data->sensor_->controls().find(V4L2_CID_NOTIFY_GAINS);\n-\tif (it != data->sensor_->controls().end())\n+\tauto it = data->sensor_->v4l2Controls().find(V4L2_CID_NOTIFY_GAINS);\n+\tif (it != data->sensor_->v4l2Controls().end())\n \t\tdata->notifyGainsUnity_ = it->second.def().get<int32_t>();\n \n \t/*\n@@ -1565,7 +1565,7 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config, ipa::RPi::IPA\n \t\t}\n \t}\n \n-\tentityControls.emplace(0, sensor_->controls());\n+\tentityControls.emplace(0, sensor_->v4l2Controls());\n \tentityControls.emplace(1, isp_[Isp::Input].dev()->controls());\n \n \t/* Always send the user transform to the IPA. */\n@@ -1719,7 +1719,7 @@ void RPiCameraData::statsMetadataComplete(uint32_t bufferId, const ControlList &\n \tif (notifyGainsUnity_ && controls.contains(libcamera::controls::ColourGains)) {\n \t\tlibcamera::Span<const float> colourGains = controls.get(libcamera::controls::ColourGains);\n \t\t/* The control wants linear gains in the order B, Gb, Gr, R. */\n-\t\tControlList ctrls(sensor_->controls());\n+\t\tControlList ctrls(sensor_->v4l2Controls());\n \t\tstd::array<int32_t, 4> gains{\n \t\t\tstatic_cast<int32_t>(colourGains[1] * *notifyGainsUnity_),\n \t\t\t*notifyGainsUnity_,\n@@ -1728,7 +1728,7 @@ void RPiCameraData::statsMetadataComplete(uint32_t bufferId, const ControlList &\n \t\t};\n \t\tctrls.set(V4L2_CID_NOTIFY_GAINS, Span<const int32_t>{ gains });\n \n-\t\tsensor_->setControls(&ctrls);\n+\t\tsensor_->setV4L2Controls(&ctrls);\n \t}\n \n \tstate_ = State::IpaComplete;\n@@ -1800,10 +1800,10 @@ void RPiCameraData::setSensorControls(ControlList &controls)\n \t\tControlList vblank_ctrl;\n \n \t\tvblank_ctrl.set(V4L2_CID_VBLANK, controls.get(V4L2_CID_VBLANK));\n-\t\tsensor_->setControls(&vblank_ctrl);\n+\t\tsensor_->setV4L2Controls(&vblank_ctrl);\n \t}\n \n-\tsensor_->setControls(&controls);\n+\tsensor_->setV4L2Controls(&controls);\n }\n \n void RPiCameraData::unicamTimeout()\ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 3dc0850c7c89..83b67a8205f5 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -670,7 +670,7 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c)\n \t}\n \n \tstd::map<uint32_t, ControlInfoMap> entityControls;\n-\tentityControls.emplace(0, data->sensor_->controls());\n+\tentityControls.emplace(0, data->sensor_->v4l2Controls());\n \n \tret = data->ipa_->configure(sensorInfo, streamConfig, entityControls);\n \tif (ret) {\ndiff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp\nindex 3379ac5cd47d..2991306ca9d8 100644\n--- a/src/libcamera/pipeline/vimc/vimc.cpp\n+++ b/src/libcamera/pipeline/vimc/vimc.cpp\n@@ -307,7 +307,7 @@ int PipelineHandlerVimc::configure(Camera *camera, CameraConfiguration *config)\n \t\t\t\t     std::forward_as_tuple(cfg.pixelFormat, cfg.size));\n \n \t\tstd::map<unsigned int, ControlInfoMap> entityControls;\n-\t\tentityControls.emplace(0, data->sensor_->controls());\n+\t\tentityControls.emplace(0, data->sensor_->v4l2Controls());\n \n \t\tIPACameraSensorInfo sensorInfo;\n \t\tdata->sensor_->sensorInfo(&sensorInfo);\n@@ -376,7 +376,7 @@ void PipelineHandlerVimc::stopDevice(Camera *camera)\n \n int PipelineHandlerVimc::processControls(VimcCameraData *data, Request *request)\n {\n-\tControlList controls(data->sensor_->controls());\n+\tControlList controls(data->sensor_->v4l2Controls());\n \n \tfor (auto it : request->controls()) {\n \t\tunsigned int id = it.first;\n@@ -405,7 +405,7 @@ int PipelineHandlerVimc::processControls(VimcCameraData *data, Request *request)\n \t\t\t<< \"Setting control \" << utils::hex(ctrl.first)\n \t\t\t<< \" to \" << ctrl.second.toString();\n \n-\tint ret = data->sensor_->setControls(&controls);\n+\tint ret = data->sensor_->setV4L2Controls(&controls);\n \tif (ret) {\n \t\tLOG(VIMC, Error) << \"Failed to set controls: \" << ret;\n \t\treturn ret < 0 ? ret : -EINVAL;\n@@ -530,7 +530,7 @@ int VimcCameraData::init()\n \t}\n \n \t/* Initialise the supported controls. */\n-\tconst ControlInfoMap &controls = sensor_->controls();\n+\tconst ControlInfoMap &controls = sensor_->v4l2Controls();\n \tControlInfoMap::Map ctrls;\n \n \tfor (const auto &ctrl : controls) {\n","prefixes":["libcamera-devel","v3","07/23"]}