Patch Detail
Show a patch.
GET /api/1.1/patches/21413/?format=api
{ "id": 21413, "url": "https://patchwork.libcamera.org/api/1.1/patches/21413/?format=api", "web_url": "https://patchwork.libcamera.org/patch/21413/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/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": "<20240930054025.5770-1-umang.jain@ideasonboard.com>", "date": "2024-09-30T05:40:25", "name": "[v4] pipeline: rkisp1: Filter out sensor sizes not supported by the pipeline", "commit_ref": "761545407c7666063f4c98d92a17af2a2c790b08", "pull_url": null, "state": "accepted", "archived": false, "hash": "76a29dd9a2e7c3bda8450afe06843e54a0a287c6", "submitter": { "id": 86, "url": "https://patchwork.libcamera.org/api/1.1/people/86/?format=api", "name": "Umang Jain", "email": "umang.jain@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/21413/mbox/", "series": [ { "id": 4636, "url": "https://patchwork.libcamera.org/api/1.1/series/4636/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4636", "date": "2024-09-30T05:40:25", "name": "[v4] pipeline: rkisp1: Filter out sensor sizes not supported by the pipeline", "version": 4, "mbox": "https://patchwork.libcamera.org/series/4636/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/21413/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/21413/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 DBFB8C0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 30 Sep 2024 05:40:44 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7585263512;\n\tMon, 30 Sep 2024 07:40:43 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3A20062C92\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 30 Sep 2024 07:40:41 +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 82B35A1A;\n\tMon, 30 Sep 2024 07:39:09 +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=\"urkoh8we\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1727674750;\n\tbh=mqQnwW4OdlTfbwn0GJPQ3VOXw3HKi0Gd3BGlQHssGQw=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=urkoh8wek9x8UKlns67OYVyR7T1gN7zh25XxRdYJD269FYIApWvO34NOET5bSZhv0\n\tFTCAkS1uDQWWyBQjj4DMUuOxyBaoKiT47IYeMCTPo7JaOoLs2VkkKZwlxILiiZmsy2\n\tFMpeITtAT49WWsHRkFtP3ekWaYIIMvu3lGBa/JTA=", "From": "Umang Jain <umang.jain@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>,\n\tUmang Jain <umang.jain@ideasonboard.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>", "Subject": "[PATCH v4] pipeline: rkisp1: Filter out sensor sizes not supported\n\tby the pipeline", "Date": "Mon, 30 Sep 2024 11:10:25 +0530", "Message-ID": "<20240930054025.5770-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 in v4:\n- Include Jacopo's suggestion(v3) for sorting in-place.\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 | 42 ++++++++++++++++++-\n src/libcamera/pipeline/rkisp1/rkisp1_path.h | 8 ++++\n 2 files changed, 48 insertions(+), 2 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\nindex c49017d1..90c49d99 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n@@ -126,12 +126,50 @@ 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())\n+\t\treturn iter->second.back();\n+\n+\tstd::vector<Size> &sizes = sensorSizesMap_[sensor];\n+\tfor (unsigned int code : sensor->mbusCodes()) {\n+\t\tfor (const Size &size : sensor->sizes(code)) {\n+\t\t\tif (size.width > maxResolution_.width ||\n+\t\t\t size.height > maxResolution_.height)\n+\t\t\t\tcontinue;\n+\n+\t\t\tsizes.push_back(size);\n+\t\t}\n+\t}\n+\n+\t/* Sort in increasing order and remove duplicates. */\n+\tstd::sort(sizes.begin(), sizes.end());\n+\tauto last = std::unique(sizes.begin(), sizes.end());\n+\tsizes.erase(last, sizes.end());\n+\n+\treturn sizes.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 +258,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": [ "v4" ] }