Patch Detail
Show a patch.
GET /api/patches/21383/?format=api
{ "id": 21383, "url": "https://patchwork.libcamera.org/api/patches/21383/?format=api", "web_url": "https://patchwork.libcamera.org/patch/21383/", "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": "<20240926133236.98137-1-umang.jain@ideasonboard.com>", "date": "2024-09-26T13:32:36", "name": "[v3] pipeline: rkisp1: Filter out sensor sizes not supported by the pipeline", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "79554c9cdfa656e2212f2522a8fc4d3839b1f16c", "submitter": { "id": 86, "url": "https://patchwork.libcamera.org/api/people/86/?format=api", "name": "Umang Jain", "email": "umang.jain@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/21383/mbox/", "series": [ { "id": 4631, "url": "https://patchwork.libcamera.org/api/series/4631/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4631", "date": "2024-09-26T13:32:36", "name": "[v3] pipeline: rkisp1: Filter out sensor sizes not supported by the pipeline", "version": 3, "mbox": "https://patchwork.libcamera.org/series/4631/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/21383/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/21383/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 3E9CCC0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 26 Sep 2024 13:32:59 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3CD166350F;\n\tThu, 26 Sep 2024 15:32:58 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DE5E5634F9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Sep 2024 15:32:56 +0200 (CEST)", "from localhost.localdomain (unknown\n\t[IPv6:2405:201:2015:f873:55f8:639e:8e9f:12ec])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A30BF169;\n\tThu, 26 Sep 2024 15:31:27 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"jmKicQsz\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1727357488;\n\tbh=c/w1/5hbV7ZOOtgGbateWcl9KBLJmRLdHBeP4ywgAqc=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=jmKicQszBKnERZS9xqbgu9fTmC3W3QRP/IXY4eCb5U+EEv9VOlczymJy+jDekW+OY\n\tsS3FpAkHbr2K0uXcLM7AhFMErvbaHSGa8GorS8IrOMS8gpuc0Q5Jf9BgnY1JEr7h/4\n\tqqsvOtJDcSIE+HS7g8YK8pmmpRfUYcP+2UM1Dzjc=", "From": "Umang Jain <umang.jain@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Umang Jain <umang.jain@ideasonboard.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>", "Subject": "[PATCH v3] pipeline: rkisp1: Filter out sensor sizes not supported\n\tby the pipeline", "Date": "Thu, 26 Sep 2024 19:02:36 +0530", "Message-ID": "<20240926133236.98137-1-umang.jain@ideasonboard.com>", "X-Mailer": "git-send-email 2.45.0", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "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>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "It is possible that the maximum sensor size (returned by\nCameraSensor::resolution()) is not supported by the pipeline. In such\ncases, a filter function is required to filter out resolutions of the\ncamera sensor, which cannot be supported by the pipeline.\n\nIntroduce the filter function filterSensorResolution() in RkISP1Path\nclass and use it for validate() and generateConfiguration(). The\nmaximum sensor resolution is picked from that filtered set of\nresolutions instead of CameraSensor::resolution().\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nTested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\nChanges v3:\n- None, just a resent over latest master\n- Split out from [v2,0/2] pipeline: rkisp1: Filter out sensor sizes not supported by the pipeline\n so that, this can make independent progress.\n---\n src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 51 ++++++++++++++++++-\n src/libcamera/pipeline/rkisp1/rkisp1_path.h | 8 +++\n 2 files changed, 57 insertions(+), 2 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\nindex c49017d1..2421d06c 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n@@ -126,12 +126,59 @@ void RkISP1Path::populateFormats()\n \t}\n }\n \n+/**\n+ * \\brief Filter the sensor resolutions that can be supported\n+ * \\param[in] sensor The camera sensor\n+ *\n+ * This function retrieves all the sizes supported by the sensor and\n+ * filters all the resolutions that can be supported on the pipeline.\n+ * It is possible that the sensor's maximum output resolution is higher\n+ * than the ISP maximum input. In that case, this function filters out all\n+ * the resolution incapable of being supported and returns the maximum\n+ * sensor resolution that can be supported by the pipeline.\n+ *\n+ * \\return Maximum sensor size supported on the pipeline\n+ */\n+Size RkISP1Path::filterSensorResolution(const CameraSensor *sensor)\n+{\n+\tauto iter = sensorSizesMap_.find(sensor);\n+\tif (iter != sensorSizesMap_.end() && !iter->second.empty())\n+\t\treturn iter->second.back();\n+\n+\tsensorSizesMap_.emplace(sensor, std::vector<Size>());\n+\n+\tstd::vector<Size> sensorSizes;\n+\tconst std::vector<unsigned int> &mbusCodes = sensor->mbusCodes();\n+\tfor (const auto it : mbusCodes) {\n+\t\tstd::vector<Size> sizes = sensor->sizes(it);\n+\t\tfor (Size sz : sizes)\n+\t\t\tsensorSizes.push_back(sz);\n+\t}\n+\n+\tstd::sort(sensorSizes.begin(), sensorSizes.end());\n+\n+\t/* Remove duplicates. */\n+\tauto last = std::unique(sensorSizes.begin(), sensorSizes.end());\n+\tsensorSizes.erase(last, sensorSizes.end());\n+\n+\t/* Discard any sizes that the pipeline is unable to support. */\n+\tfor (auto sz : sensorSizes) {\n+\t\tif (sz.width > maxResolution_.width ||\n+\t\t sz.height > maxResolution_.height)\n+\t\t\tcontinue;\n+\n+\t\tsensorSizesMap_[sensor].push_back(sz);\n+\t}\n+\n+\treturn sensorSizesMap_[sensor].back();\n+}\n+\n StreamConfiguration\n RkISP1Path::generateConfiguration(const CameraSensor *sensor, const Size &size,\n \t\t\t\t StreamRole role)\n {\n \tconst std::vector<unsigned int> &mbusCodes = sensor->mbusCodes();\n-\tconst Size &resolution = sensor->resolution();\n+\tSize resolution = filterSensorResolution(sensor);\n \n \t/* Min and max resolutions to populate the available stream formats. */\n \tSize maxResolution = maxResolution_.boundedToAspectRatio(resolution)\n@@ -220,7 +267,7 @@ CameraConfiguration::Status RkISP1Path::validate(const CameraSensor *sensor,\n \t\t\t\t\t\t StreamConfiguration *cfg)\n {\n \tconst std::vector<unsigned int> &mbusCodes = sensor->mbusCodes();\n-\tconst Size &resolution = sensor->resolution();\n+\tSize resolution = filterSensorResolution(sensor);\n \n \tconst StreamConfiguration reqCfg = *cfg;\n \tCameraConfiguration::Status status = CameraConfiguration::Valid;\ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.h b/src/libcamera/pipeline/rkisp1/rkisp1_path.h\nindex 08edefec..9f75fe1f 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1_path.h\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.h\n@@ -7,6 +7,7 @@\n \n #pragma once\n \n+#include <map>\n #include <memory>\n #include <set>\n #include <vector>\n@@ -63,6 +64,7 @@ public:\n \n private:\n \tvoid populateFormats();\n+\tSize filterSensorResolution(const CameraSensor *sensor);\n \n \tstatic constexpr unsigned int RKISP1_BUFFER_COUNT = 4;\n \n@@ -77,6 +79,12 @@ private:\n \tstd::unique_ptr<V4L2Subdevice> resizer_;\n \tstd::unique_ptr<V4L2VideoDevice> video_;\n \tMediaLink *link_;\n+\n+\t/*\n+\t * Map from camera sensors to the sizes (in increasing order),\n+\t * which are guaranteed to be supported by the pipeline.\n+\t */\n+\tstd::map<const CameraSensor *, std::vector<Size>> sensorSizesMap_;\n };\n \n class RkISP1MainPath : public RkISP1Path\n", "prefixes": [ "v3" ] }