Patch Detail
Show a patch.
GET /api/1.1/patches/16200/?format=api
{ "id": 16200, "url": "https://patchwork.libcamera.org/api/1.1/patches/16200/?format=api", "web_url": "https://patchwork.libcamera.org/patch/16200/", "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": "<20220612152311.8408-4-laurent.pinchart@ideasonboard.com>", "date": "2022-06-12T15:23:09", "name": "[libcamera-devel,v2,3/5] libcamera: pipeline: simple: Factor out format test to separate function", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "e2e91467668e63f5e0b31014ebf75e9dd552f84c", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/16200/mbox/", "series": [ { "id": 3170, "url": "https://patchwork.libcamera.org/api/1.1/series/3170/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3170", "date": "2022-06-12T15:23:06", "name": "libcamera: pipeline: simple: Support scaling on the camea sensor", "version": 2, "mbox": "https://patchwork.libcamera.org/series/3170/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/16200/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/16200/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 52631C3275\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 12 Jun 2022 15:23:29 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 05CB265636;\n\tSun, 12 Jun 2022 17:23:28 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 06E89600F4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 12 Jun 2022 17:23:25 +0200 (CEST)", "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 2FC05DDE;\n\tSun, 12 Jun 2022 17:23:25 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1655047408;\n\tbh=NEvw7Yb0BDqt535enhFpoKtHVCWV4h2LVLSYk7WADs0=;\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:Cc:\n\tFrom;\n\tb=nclsfMlYSydR28u72ANXXh33tQpHJv5EuDBrtneF/x6Eo7p3PGOZZ5T87AF7CtGsa\n\tYW4BjJd2T8Ic5R3O5ysAYdpTTLd/Um610VomdAVYMkF3xlnnVkZ88acZw3lJNx4lQp\n\tX41zgGA3m724aAS36tGk6acGn3Q2YUhQUL7soMHKbxa95vR9Tn7UrMIORQAemTvJMt\n\tEeKD7gmK6J7BhY1FevKCtbfxsZ0RPZ14CC8piCG3nQ2YCqSuftS7pTHXSw60TleRCn\n\tL6K1xWxQq5jgTyMCn2fBRmfiBZ7IVfi6cmcLXSnlWfePMznAVAtBkI7LGMPBVwZqkc\n\tgFJUI2U/8Q9bg==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1655047405;\n\tbh=NEvw7Yb0BDqt535enhFpoKtHVCWV4h2LVLSYk7WADs0=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=SeTrA16PJqt9YR+DyiA2qHtwHsJvgl3lvSS020ayKUGjya1pmKDJ/tJj2ZHyE3lZP\n\tCVLpugj9GTyzZT2cgQhWQa4qLSsSbVeFvP0rNweoOWzbaph/lGqnOsMLlPmal3UnZJ\n\twsQgznzJi2ohAdIQEoDHnqgML9u6TZ4kvSVRTlSM=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"SeTrA16P\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org", "Date": "Sun, 12 Jun 2022 18:23:09 +0300", "Message-Id": "<20220612152311.8408-4-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.35.1", "In-Reply-To": "<20220612152311.8408-1-laurent.pinchart@ideasonboard.com>", "References": "<20220612152311.8408-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2 3/5] libcamera: pipeline: simple:\n\tFactor out format test to separate function", "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": "Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>", "Reply-To": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "Cc": "Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm>,\n\tBenjamin Schaaf <ben.schaaf@gmail.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "To prepare for the implementation of a more complex format discovery\nmethod, factor out code that tries a pipeline configuration to a\nseparate function. No functional change intended.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\nChanges since v1:\n\n- Drop unused function declaration\n- Document the tryPipeline() function\n---\n src/libcamera/pipeline/simple/simple.cpp | 118 +++++++++++++----------\n 1 file changed, 67 insertions(+), 51 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\nindex b09368aee20b..3c90bdec60e0 100644\n--- a/src/libcamera/pipeline/simple/simple.cpp\n+++ b/src/libcamera/pipeline/simple/simple.cpp\n@@ -250,6 +250,8 @@ public:\n \tstd::queue<std::map<unsigned int, FrameBuffer *>> converterQueue_;\n \n private:\n+\tvoid tryPipeline(unsigned int code, const Size &size);\n+\n \tvoid converterInputDone(FrameBuffer *buffer);\n \tvoid converterOutputDone(FrameBuffer *buffer);\n };\n@@ -466,58 +468,11 @@ int SimpleCameraData::init()\n \t\treturn ret;\n \n \t/*\n-\t * Enumerate the possible pipeline configurations. For each media bus\n-\t * format supported by the sensor, propagate the formats through the\n-\t * pipeline, and enumerate the corresponding possible V4L2 pixel\n-\t * formats on the video node.\n+\t * Generate the list of possible pipeline configurations by trying each\n+\t * media bus format supported by the sensor.\n \t */\n-\tfor (unsigned int code : sensor_->mbusCodes()) {\n-\t\tV4L2SubdeviceFormat format{};\n-\t\tformat.mbus_code = code;\n-\t\tformat.size = sensor_->resolution();\n-\n-\t\tret = setupFormats(&format, V4L2Subdevice::TryFormat);\n-\t\tif (ret < 0) {\n-\t\t\tLOG(SimplePipeline, Debug)\n-\t\t\t\t<< \"Media bus code \" << utils::hex(code, 4)\n-\t\t\t\t<< \" not supported for this pipeline\";\n-\t\t\t/* Try next mbus_code supported by the sensor */\n-\t\t\tcontinue;\n-\t\t}\n-\n-\t\tV4L2VideoDevice::Formats videoFormats =\n-\t\t\tvideo_->formats(format.mbus_code);\n-\n-\t\tLOG(SimplePipeline, Debug)\n-\t\t\t<< \"Adding configuration for \" << format.size\n-\t\t\t<< \" in pixel formats [ \"\n-\t\t\t<< utils::join(videoFormats, \", \",\n-\t\t\t\t [](const auto &f) {\n-\t\t\t\t\t return f.first.toString();\n-\t\t\t\t })\n-\t\t\t<< \" ]\";\n-\n-\t\tfor (const auto &videoFormat : videoFormats) {\n-\t\t\tPixelFormat pixelFormat = videoFormat.first.toPixelFormat();\n-\t\t\tif (!pixelFormat)\n-\t\t\t\tcontinue;\n-\n-\t\t\tConfiguration config;\n-\t\t\tconfig.code = code;\n-\t\t\tconfig.captureFormat = pixelFormat;\n-\t\t\tconfig.captureSize = format.size;\n-\n-\t\t\tif (!converter_) {\n-\t\t\t\tconfig.outputFormats = { pixelFormat };\n-\t\t\t\tconfig.outputSizes = config.captureSize;\n-\t\t\t} else {\n-\t\t\t\tconfig.outputFormats = converter_->formats(pixelFormat);\n-\t\t\t\tconfig.outputSizes = converter_->sizes(format.size);\n-\t\t\t}\n-\n-\t\t\tconfigs_.push_back(config);\n-\t\t}\n-\t}\n+\tfor (unsigned int code : sensor_->mbusCodes())\n+\t\ttryPipeline(code, sensor_->resolution());\n \n \tif (configs_.empty()) {\n \t\tLOG(SimplePipeline, Error) << \"No valid configuration found\";\n@@ -541,6 +496,67 @@ int SimpleCameraData::init()\n \treturn 0;\n }\n \n+/*\n+ * Generate a list of supported pipeline configurations for a sensor media bus\n+ * code and size.\n+ *\n+ * First propagate the media bus code and size through the pipeline from the\n+ * camera sensor to the video node. Then, query the video node for all supported\n+ * pixel formats compatible with the media bus code. For each pixel format, store\n+ * a full pipeline configuration in the configs_ vector.\n+ */\n+void SimpleCameraData::tryPipeline(unsigned int code, const Size &size)\n+{\n+\t/*\n+\t * Propagate the format through the pipeline, and enumerate the\n+\t * corresponding possible V4L2 pixel formats on the video node.\n+\t */\n+\tV4L2SubdeviceFormat format{};\n+\tformat.mbus_code = code;\n+\tformat.size = size;\n+\n+\tint ret = setupFormats(&format, V4L2Subdevice::TryFormat);\n+\tif (ret < 0) {\n+\t\t/* Pipeline configuration failed, skip this configuration. */\n+\t\tLOG(SimplePipeline, Debug)\n+\t\t\t<< \"Media bus code \" << utils::hex(code, 4)\n+\t\t\t<< \" not supported for this pipeline\";\n+\t\treturn;\n+\t}\n+\n+\tV4L2VideoDevice::Formats videoFormats = video_->formats(format.mbus_code);\n+\n+\tLOG(SimplePipeline, Debug)\n+\t\t<< \"Adding configuration for \" << format.size\n+\t\t<< \" in pixel formats [ \"\n+\t\t<< utils::join(videoFormats, \", \",\n+\t\t\t [](const auto &f) {\n+\t\t\t\t return f.first.toString();\n+\t\t\t })\n+\t\t<< \" ]\";\n+\n+\tfor (const auto &videoFormat : videoFormats) {\n+\t\tPixelFormat pixelFormat = videoFormat.first.toPixelFormat();\n+\t\tif (!pixelFormat)\n+\t\t\tcontinue;\n+\n+\t\tConfiguration config;\n+\t\tconfig.code = code;\n+\t\tconfig.captureFormat = pixelFormat;\n+\t\tconfig.captureSize = format.size;\n+\n+\t\tif (!converter_) {\n+\t\t\tconfig.outputFormats = { pixelFormat };\n+\t\t\tconfig.outputSizes = config.captureSize;\n+\t\t} else {\n+\t\t\tconfig.outputFormats = converter_->formats(pixelFormat);\n+\t\t\tconfig.outputSizes = converter_->sizes(format.size);\n+\t\t}\n+\n+\t\tconfigs_.push_back(config);\n+\t}\n+}\n+\n int SimpleCameraData::setupLinks()\n {\n \tint ret;\n", "prefixes": [ "libcamera-devel", "v2", "3/5" ] }