Patch Detail
Show a patch.
GET /api/1.1/patches/23034/?format=api
{ "id": 23034, "url": "https://patchwork.libcamera.org/api/1.1/patches/23034/?format=api", "web_url": "https://patchwork.libcamera.org/patch/23034/", "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": "<20250326084800.1880530-3-paul.elder@ideasonboard.com>", "date": "2025-03-26T08:47:59", "name": "[v2,2/2] pipeline: simple: Fix matching with empty media graphs", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "2b03ae78b139abe5e15da3d928fbf8a04de0d5f6", "submitter": { "id": 17, "url": "https://patchwork.libcamera.org/api/1.1/people/17/?format=api", "name": "Paul Elder", "email": "paul.elder@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/23034/mbox/", "series": [ { "id": 5082, "url": "https://patchwork.libcamera.org/api/1.1/series/5082/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5082", "date": "2025-03-26T08:47:57", "name": "pipeline: simple: Fix matching with an empty media graph", "version": 2, "mbox": "https://patchwork.libcamera.org/series/5082/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/23034/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/23034/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 48BCDC323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 26 Mar 2025 08:48:16 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 070366895E;\n\tWed, 26 Mar 2025 09:48:16 +0100 (CET)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CA5C768947\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 26 Mar 2025 09:48:12 +0100 (CET)", "from neptunite.flets-east.jp (unknown\n\t[IPv6:2404:7a81:160:2100:7402:917d:ea0c:6d4c])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id DC6D4475;\n\tWed, 26 Mar 2025 09:46:23 +0100 (CET)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"HU6zDp6J\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1742978785;\n\tbh=cbVTajNwRb0xuy1nyFHbxZqlZ3YPJDlLnVXTWvh3sJM=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=HU6zDp6JTznC8JNLdY2/ISQL4CwM/Ayc2ltsOqoFQ7cn476452Hw2ieUTEzaSZpdG\n\tV3ofXtciYY2gGHnHKIOvENW29I0I6sLVE9XwB9og2zZAbhE0Aqa8VVP0LQLysTHIIS\n\tKKbzt1kxFO2f2aGyefpbyZ6dKCfloWG2ah6zkGWQ=", "From": "Paul Elder <paul.elder@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Paul Elder <paul.elder@ideasonboard.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>", "Subject": "[PATCH v2 2/2] pipeline: simple: Fix matching with empty media\n\tgraphs", "Date": "Wed, 26 Mar 2025 17:47:59 +0900", "Message-ID": "<20250326084800.1880530-3-paul.elder@ideasonboard.com>", "X-Mailer": "git-send-email 2.47.2", "In-Reply-To": "<20250326084800.1880530-1-paul.elder@ideasonboard.com>", "References": "<20250326084800.1880530-1-paul.elder@ideasonboard.com>", "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": "The match() function currently reports that it is not possible to create\nany cameras if it encounters an empty media graph.\n\nFix this by looping over all media graphs and only returning false when\nall of them fail to create a camera.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\nChanges in v2:\n- prevent a mix of valid and invalid media devices from ending up in\n mediaDevices_\n---\n src/libcamera/pipeline/simple/simple.cpp | 52 ++++++++++++++++--------\n 1 file changed, 35 insertions(+), 17 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\nindex 6e039bf35fc1..a6bdd6024a99 100644\n--- a/src/libcamera/pipeline/simple/simple.cpp\n+++ b/src/libcamera/pipeline/simple/simple.cpp\n@@ -373,6 +373,9 @@ private:\n \t\treturn static_cast<SimpleCameraData *>(camera->_d());\n \t}\n \n+\tbool matchDevice(MediaDevice *media, const SimplePipelineInfo &info,\n+\t\t\t DeviceEnumerator *enumerator);\n+\n \tstd::vector<MediaEntity *> locateSensors(MediaDevice *media);\n \tstatic int resetRoutingTable(V4L2Subdevice *subdev);\n \n@@ -1532,25 +1535,13 @@ int SimplePipelineHandler::resetRoutingTable(V4L2Subdevice *subdev)\n \treturn 0;\n }\n \n-bool SimplePipelineHandler::match(DeviceEnumerator *enumerator)\n+bool SimplePipelineHandler::matchDevice(MediaDevice *media,\n+\t\t\t\t\tconst SimplePipelineInfo &info,\n+\t\t\t\t\tDeviceEnumerator *enumerator)\n {\n-\tconst SimplePipelineInfo *info = nullptr;\n \tunsigned int numStreams = 1;\n-\tMediaDevice *media;\n-\n-\tfor (const SimplePipelineInfo &inf : supportedDevices) {\n-\t\tDeviceMatch dm(inf.driver);\n-\t\tmedia = acquireMediaDevice(enumerator, dm);\n-\t\tif (media) {\n-\t\t\tinfo = &inf;\n-\t\t\tbreak;\n-\t\t}\n-\t}\n-\n-\tif (!media)\n-\t\treturn false;\n \n-\tfor (const auto &[name, streams] : info->converters) {\n+\tfor (const auto &[name, streams] : info.converters) {\n \t\tDeviceMatch converterMatch(name);\n \t\tconverter_ = acquireMediaDevice(enumerator, converterMatch);\n \t\tif (converter_) {\n@@ -1559,7 +1550,7 @@ bool SimplePipelineHandler::match(DeviceEnumerator *enumerator)\n \t\t}\n \t}\n \n-\tswIspEnabled_ = info->swIspEnabled;\n+\tswIspEnabled_ = info.swIspEnabled;\n \n \t/* Locate the sensors. */\n \tstd::vector<MediaEntity *> sensors = locateSensors(media);\n@@ -1678,6 +1669,33 @@ bool SimplePipelineHandler::match(DeviceEnumerator *enumerator)\n \treturn registered;\n }\n \n+bool SimplePipelineHandler::match(DeviceEnumerator *enumerator)\n+{\n+\tMediaDevice *media;\n+\n+\tfor (const SimplePipelineInfo &inf : supportedDevices) {\n+\t\tDeviceMatch dm(inf.driver);\n+\t\twhile ((media = acquireMediaDevice(enumerator, dm))) {\n+\t\t\t/*\n+\t\t\t * If match succeeds, return true to let match() be\n+\t\t\t * called again on a new instance of the pipeline\n+\t\t\t * handler. Otherwise keep looping until we do\n+\t\t\t * successfully match one (or run out).\n+\t\t\t */\n+\t\t\tif (matchDevice(media, inf, enumerator)) {\n+\t\t\t\tLOG(SimplePipeline, Debug)\n+\t\t\t\t\t<< \"Matched on device: \"\n+\t\t\t\t\t<< media->deviceNode();\n+\t\t\t\treturn true;\n+\t\t\t}\n+\t\t}\n+\n+\t\tclearMediaDevices();\n+\t}\n+\n+\treturn false;\n+}\n+\n V4L2VideoDevice *SimplePipelineHandler::video(const MediaEntity *entity)\n {\n \tauto iter = entities_.find(entity);\n", "prefixes": [ "v2", "2/2" ] }