Patch Detail
Show a patch.
GET /api/patches/18260/?format=api
{ "id": 18260, "url": "https://patchwork.libcamera.org/api/patches/18260/?format=api", "web_url": "https://patchwork.libcamera.org/patch/18260/", "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": "<20230207075210.3789-1-jacopo.mondi@ideasonboard.com>", "date": "2023-02-07T07:52:09", "name": "[libcamera-devel,v2] libcamera: Remove transform from V4L2SubdeviceFormat", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "7eb2c81f323db4e803a86e032d16f7a3b05ee2bc", "submitter": { "id": 143, "url": "https://patchwork.libcamera.org/api/people/143/?format=api", "name": "Jacopo Mondi", "email": "jacopo.mondi@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/18260/mbox/", "series": [ { "id": 3742, "url": "https://patchwork.libcamera.org/api/series/3742/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3742", "date": "2023-02-07T07:52:09", "name": "[libcamera-devel,v2] libcamera: Remove transform from V4L2SubdeviceFormat", "version": 2, "mbox": "https://patchwork.libcamera.org/series/3742/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/18260/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/18260/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 ECBECBEFBE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 7 Feb 2023 07:52:22 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0FA74625F1;\n\tTue, 7 Feb 2023 08:52:22 +0100 (CET)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 997BA603BA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 7 Feb 2023 08:52:20 +0100 (CET)", "from uno.homenet.telecomitalia.it\n\t(host-79-35-57-126.retail.telecomitalia.it [79.35.57.126])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 854AF4AF;\n\tTue, 7 Feb 2023 08:52:19 +0100 (CET)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1675756342;\n\tbh=h4geM8hbaSsUuhXkSF5ci5ipCk2mPK5X3HKq+XxIRk4=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:Cc:From;\n\tb=FueHEslS1sLywff68V6pLYV3nxlNjy/qRplj4VHe7cqoIvMrTx6KR0TQ0o0+5+qZO\n\tDZwD2x8YE4zPH699uNZ5Wu5sQzY1OjTpuAMR4emQhpSwG/nmyuLT2kCEXmU7SPFV5C\n\tygfBmVjSSW8iFR010BoNlTZGFxQeRVBadxlLlG5Oqhu19MJSzgc+9fUF8Go0bd787n\n\tfCfSeIoouFhGpCW2CytBlbPC+Q/dJsH55vE0r9OZUgJEx4SdpcRNgI7Ho7le3A+02v\n\tD3+OuxUCgx2BTKdWDXzUWEBo9vhj9hqrbi92MdjOuNeZ2ZqWpIbL/y06U/JOcd0kzD\n\t8QrhROiK1m8EA==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1675756340;\n\tbh=h4geM8hbaSsUuhXkSF5ci5ipCk2mPK5X3HKq+XxIRk4=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=W7kIABKZBieMwH6w3WWgC7c4XK699jZKoIdbPBgvuFSma1M3mwwF5MnH5yTUkioFG\n\tt7/VN3HFnrA/MNnnkH6/v6Wc6BLx9ILVDDp5/t0JnnsjGKhYna1/vHCOnmFqqhaHPX\n\tlvKRGVyZiOa268lNfJudc5vl8uk0P2YpwA6ubGzI=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"W7kIABKZ\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 7 Feb 2023 08:52:09 +0100", "Message-Id": "<20230207075210.3789-1-jacopo.mondi@ideasonboard.com>", "X-Mailer": "git-send-email 2.39.0", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2] libcamera: Remove transform from\n\tV4L2SubdeviceFormat", "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.mondi@ideasonboard.com>", "Cc": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Commit 6f6e1bf704fe (\"libcamera: camera_sensor: Apply flips at\nsetFormat()\") extended the CameraSensor::setFormat() function\nto apply vertical/horizontal flips on the sensor based on the\nsupplied Transform. To pass the Transform to the function the\nV4L2SubdeviceFormat structure has been augmented with a Transform\nmember.\n\nHowever as the newly added Transform is not used at all in the\nV4L2Subdevice class, it should not be part of V4L2SubdeviceFormat.\n\nFix that by removing the transform field from V4L2SubdeviceFormat\nand pass it as an explicit parameter to CameraSensor::setFormat().\n\nFixes: 6f6e1bf704fe (\"libcamera: camera_sensor: Apply flips at setFormat())\nSigned-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n\nSending a v2 instead of applying it directly as there was a leftover\nforward declaration of\n\n\tenum class Transform;\n\nin camera_sensor.h which I have now removed since I'm now including the full\nheader flie.\n\n---\n include/libcamera/internal/camera_sensor.h | 6 +++---\n include/libcamera/internal/v4l2_subdevice.h | 2 --\n src/libcamera/camera_sensor.cpp | 11 ++++-------\n src/libcamera/pipeline/ipu3/cio2.cpp | 3 +--\n src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 11 ++++++-----\n src/libcamera/pipeline/rkisp1/rkisp1.cpp | 6 ++++--\n src/libcamera/v4l2_subdevice.cpp | 7 -------\n 7 files changed, 18 insertions(+), 28 deletions(-)\n\n--\n2.39.0", "diff": "diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h\nindex bea52badaff7..a8d980e3b439 100644\n--- a/include/libcamera/internal/camera_sensor.h\n+++ b/include/libcamera/internal/camera_sensor.h\n@@ -17,6 +17,7 @@\n #include <libcamera/control_ids.h>\n #include <libcamera/controls.h>\n #include <libcamera/geometry.h>\n+#include <libcamera/transform.h>\n\n #include <libcamera/ipa/core_ipa_interface.h>\n\n@@ -29,8 +30,6 @@ class BayerFormat;\n class CameraLens;\n class MediaEntity;\n\n-enum class Transform;\n-\n struct CameraSensorProperties;\n\n class CameraSensor : protected Loggable\n@@ -55,7 +54,8 @@ public:\n\n \tV4L2SubdeviceFormat getFormat(const std::vector<unsigned int> &mbusCodes,\n \t\t\t\t const Size &size) const;\n-\tint setFormat(V4L2SubdeviceFormat *format);\n+\tint setFormat(V4L2SubdeviceFormat *format,\n+\t\t const Transform transform = Transform::Identity);\n\n \tconst ControlInfoMap &controls() const;\n \tControlList getControls(const std::vector<uint32_t> &ids);\ndiff --git a/include/libcamera/internal/v4l2_subdevice.h b/include/libcamera/internal/v4l2_subdevice.h\nindex 576faf971a05..69862de0585a 100644\n--- a/include/libcamera/internal/v4l2_subdevice.h\n+++ b/include/libcamera/internal/v4l2_subdevice.h\n@@ -20,7 +20,6 @@\n\n #include <libcamera/color_space.h>\n #include <libcamera/geometry.h>\n-#include <libcamera/transform.h>\n\n #include \"libcamera/internal/formats.h\"\n #include \"libcamera/internal/media_object.h\"\n@@ -45,7 +44,6 @@ struct V4L2SubdeviceFormat {\n \tuint32_t mbus_code;\n \tSize size;\n \tstd::optional<ColorSpace> colorSpace;\n-\tTransform transform = Transform::Identity;\n\n \tconst std::string toString() const;\n \tuint8_t bitsPerPixel() const;\ndiff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex 274ed419ddfd..19f0ce6a47bb 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -16,7 +16,6 @@\n #include <string.h>\n\n #include <libcamera/property_ids.h>\n-#include <libcamera/transform.h>\n\n #include <libcamera/base/utils.h>\n\n@@ -751,7 +750,6 @@ V4L2SubdeviceFormat CameraSensor::getFormat(const std::vector<unsigned int> &mbu\n \t\t.mbus_code = bestCode,\n \t\t.size = *bestSize,\n \t\t.colorSpace = ColorSpace::Raw,\n-\t\t.transform = Transform::Identity,\n \t};\n\n \treturn format;\n@@ -760,6 +758,7 @@ V4L2SubdeviceFormat CameraSensor::getFormat(const std::vector<unsigned int> &mbu\n /**\n * \\brief Set the sensor output format\n * \\param[in] format The desired sensor output format\n+ * \\param[in] transform The transform to be applied on the sensor. Defaults to Identity.\n *\n * If flips are writable they are configured according to the desired Transform.\n * Transform::Identity always corresponds to H/V flip being disabled if the\n@@ -770,18 +769,16 @@ V4L2SubdeviceFormat CameraSensor::getFormat(const std::vector<unsigned int> &mbu\n *\n * \\return 0 on success or a negative error code otherwise\n */\n-int CameraSensor::setFormat(V4L2SubdeviceFormat *format)\n+int CameraSensor::setFormat(V4L2SubdeviceFormat *format, const Transform transform)\n {\n \t/* Configure flips if the sensor supports that. */\n \tif (supportFlips_) {\n \t\tControlList flipCtrls(subdev_->controls());\n\n \t\tflipCtrls.set(V4L2_CID_HFLIP,\n-\t\t\t static_cast<int32_t>(!!(format->transform &\n-\t\t\t\t\t\t Transform::HFlip)));\n+\t\t\t static_cast<int32_t>(!!(transform & Transform::HFlip)));\n \t\tflipCtrls.set(V4L2_CID_VFLIP,\n-\t\t\t static_cast<int32_t>(!!(format->transform &\n-\t\t\t\t\t\t Transform::VFlip)));\n+\t\t\t static_cast<int32_t>(!!(transform & Transform::VFlip)));\n\n \t\tint ret = subdev_->setControls(&flipCtrls);\n \t\tif (ret)\ndiff --git a/src/libcamera/pipeline/ipu3/cio2.cpp b/src/libcamera/pipeline/ipu3/cio2.cpp\nindex a819884f762d..7400cb0b644c 100644\n--- a/src/libcamera/pipeline/ipu3/cio2.cpp\n+++ b/src/libcamera/pipeline/ipu3/cio2.cpp\n@@ -194,8 +194,7 @@ int CIO2Device::configure(const Size &size, const Transform &transform,\n \t */\n \tstd::vector<unsigned int> mbusCodes = utils::map_keys(mbusCodesToPixelFormat);\n \tsensorFormat = getSensorFormat(mbusCodes, size);\n-\tsensorFormat.transform = transform;\n-\tret = sensor_->setFormat(&sensorFormat);\n+\tret = sensor_->setFormat(&sensorFormat, transform);\n \tif (ret)\n \t\treturn ret;\n\ndiff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 77e860ab0e72..c0dd95513583 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -832,13 +832,14 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n \t\t}\n \t}\n\n-\t/* First calculate the best sensor mode we can use based on the user request. */\n+\t/*\n+\t * Calculate the best sensor mode we can use based on the user's\n+\t * request, and apply it to the sensor with the cached transform, if\n+\t * any.\n+\t */\n \tV4L2SubdeviceFormat sensorFormat = findBestFormat(data->sensorFormats_, rawStream ? sensorSize : maxSize, bitDepth);\n-\t/* Apply any cached transform. */\n \tconst RPiCameraConfiguration *rpiConfig = static_cast<const RPiCameraConfiguration *>(config);\n-\tsensorFormat.transform = rpiConfig->combinedTransform_;\n-\t/* Finally apply the format on the sensor. */\n-\tret = data->sensor_->setFormat(&sensorFormat);\n+\tret = data->sensor_->setFormat(&sensorFormat, rpiConfig->combinedTransform_);\n \tif (ret)\n \t\treturn ret;\n\ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 5f22a29d02c6..8a30fe061d04 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -125,6 +125,7 @@ public:\n \tStatus validate() override;\n\n \tconst V4L2SubdeviceFormat &sensorFormat() { return sensorFormat_; }\n+\tconst Transform &combinedTransform() { return combinedTransform_; }\n\n private:\n \tbool fitsAllPaths(const StreamConfiguration &cfg);\n@@ -138,6 +139,7 @@ private:\n \tconst RkISP1CameraData *data_;\n\n \tV4L2SubdeviceFormat sensorFormat_;\n+\tTransform combinedTransform_;\n };\n\n class PipelineHandlerRkISP1 : public PipelineHandler\n@@ -591,7 +593,7 @@ CameraConfiguration::Status RkISP1CameraConfiguration::validate()\n \tif (sensorFormat_.size.isNull())\n \t\tsensorFormat_.size = sensor->resolution();\n\n-\tsensorFormat_.transform = combined;\n+\tcombinedTransform_ = combined;\n\n \treturn status;\n }\n@@ -720,7 +722,7 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c)\n \tV4L2SubdeviceFormat format = config->sensorFormat();\n \tLOG(RkISP1, Debug) << \"Configuring sensor with \" << format;\n\n-\tret = sensor->setFormat(&format);\n+\tret = sensor->setFormat(&format, config->combinedTransform());\n \tif (ret < 0)\n \t\treturn ret;\n\ndiff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\nindex 38ff8b0c605b..15e8206a915c 100644\n--- a/src/libcamera/v4l2_subdevice.cpp\n+++ b/src/libcamera/v4l2_subdevice.cpp\n@@ -216,13 +216,6 @@ const std::map<uint32_t, V4L2SubdeviceFormatInfo> formatInfoMap = {\n * resulting color space is acceptable.\n */\n\n-/**\n- * \\var V4L2SubdeviceFormat::transform\n- * \\brief The transform (vertical/horizontal flips) to be applied on the subdev\n- *\n- * Default initialized to Identity (no transform).\n- */\n-\n /**\n * \\brief Assemble and return a string describing the format\n * \\return A string describing the V4L2SubdeviceFormat\n", "prefixes": [ "libcamera-devel", "v2" ] }