Patch Detail
Show a patch.
GET /api/patches/16388/?format=api
{ "id": 16388, "url": "https://patchwork.libcamera.org/api/patches/16388/?format=api", "web_url": "https://patchwork.libcamera.org/patch/16388/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20220627162732.33160-8-jacopo@jmondi.org>", "date": "2022-06-27T16:27:24", "name": "[libcamera-devel,07/15] libcamera: camera_sensor: Rename the control interface", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": true, "hash": "d6c780a6093fe61861b8a9f13ac2a597ade44aa9", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/16388/mbox/", "series": [ { "id": 3224, "url": "https://patchwork.libcamera.org/api/series/3224/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3224", "date": "2022-06-27T16:27:17", "name": "Internal controls, sensor delays and IPA init/configure rework", "version": 1, "mbox": "https://patchwork.libcamera.org/series/3224/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/16388/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/16388/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 58E74BD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 27 Jun 2022 16:27:54 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E191865641;\n\tMon, 27 Jun 2022 18:27:53 +0200 (CEST)", "from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net\n\t[IPv6:2001:4b98:dc4:8::227])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3B0CC65641\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 Jun 2022 18:27:47 +0200 (CEST)", "(Authenticated sender: jacopo@jmondi.org)\n\tby mail.gandi.net (Postfix) with ESMTPSA id 6DBF72000B;\n\tMon, 27 Jun 2022 16:27:46 +0000 (UTC)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1656347274;\n\tbh=NAA+viX/0qEteDTwxXnIhouPLrgCWAhkeOlKxIY0x8w=;\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=JpEGg3qkm8KpCewgbFkE6JmHuc4j3ApU4M3ZCo+ehmjtwmsO36Qunlt1Ax0DVrjLs\n\tAiRKJYrSrKQxegNNcPSCQ0WuJFawbaINaaUAIhTy0I6MkpecLx+d2ftpFYdiBvkY/b\n\txTmdINfzMs1ZMLy7zxJvSUnNEFuttY9ls9ZCYgnScXXy/0v7k5XAi1nvBI2lITWx+A\n\t6d2ja0Pu3Imdno7gkHn8nj8m+vMbkobVvSamyFxxQCyzZ7MWf7LBqGisDLCSWShyNW\n\trDXSvtNM25zJMLIbIJuIxuzAQ8QWfXJg0MS5OKiqUWpKM7LgegpVR7GolfAplzuOZP\n\t59JRVFJ+pepkw==", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 27 Jun 2022 18:27:24 +0200", "Message-Id": "<20220627162732.33160-8-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.36.1", "In-Reply-To": "<20220627162732.33160-1-jacopo@jmondi.org>", "References": "<20220627162732.33160-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 07/15] 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.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 0359d4609517..0bed6e679840 100644\n--- a/include/libcamera/internal/camera_sensor.h\n+++ b/include/libcamera/internal/camera_sensor.h\n@@ -59,9 +59,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.cpp b/src/libcamera/camera_sensor.cpp\nindex 5cd33e904174..e3354530380c 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/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@@ -637,10 +637,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@@ -766,7 +766,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@@ -789,7 +789,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@@ -819,7 +819,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 19d022c584ed..28442756b184 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@@ -1175,7 +1175,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@@ -1263,7 +1263,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 adc397e8aabd..782eb9ef20e8 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -1292,8 +1292,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@@ -1554,7 +1554,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@@ -1708,7 +1708,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@@ -1717,7 +1717,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@@ -1789,10 +1789,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 7cf36524ccc4..997f72500675 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -652,7 +652,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", "07/15" ] }