Patch Detail
Show a patch.
GET /api/1.1/patches/20849/?format=api
{ "id": 20849, "url": "https://patchwork.libcamera.org/api/1.1/patches/20849/?format=api", "web_url": "https://patchwork.libcamera.org/patch/20849/", "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": "<20240808173921.2519957-3-kieran.bingham@ideasonboard.com>", "date": "2024-08-08T17:39:21", "name": "[2/2] pipeline: simple: Fix matching with empty media graphs", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "09593c0941ede5f3d4f61bb8f69199ea1f0e4bc4", "submitter": { "id": 4, "url": "https://patchwork.libcamera.org/api/1.1/people/4/?format=api", "name": "Kieran Bingham", "email": "kieran.bingham@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/20849/mbox/", "series": [ { "id": 4505, "url": "https://patchwork.libcamera.org/api/1.1/series/4505/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4505", "date": "2024-08-08T17:39:19", "name": "pipeline: simple: Fix matching with an empty media graph", "version": 1, "mbox": "https://patchwork.libcamera.org/series/4505/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/20849/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/20849/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 C9BA7C323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 8 Aug 2024 17:39:31 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 61D74633B4;\n\tThu, 8 Aug 2024 19:39:30 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id ED5D263382\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 8 Aug 2024 19:39:24 +0200 (CEST)", "from Monstersaurus.tail69b4.ts.net\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 3B57C124E;\n\tThu, 8 Aug 2024 19:38:31 +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=\"EuHgcExi\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1723138711;\n\tbh=assIro+CC+XYMVMUNLpVmwfxKJAsTHIOpgXaxvnQMZ4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=EuHgcExi0oL8rZj7IpFl6luLOx/04t+EzIBW5PnQ3U3GCf4WsrUxwWdHhb6c+OoCa\n\tIf80HNlZ/u5bKQ9cm8eOAfV3+0ov/evTMUigvX6TD7iSVyVqPLQ3NEyJN03xaY35fz\n\t0/drVXkrmXbV7kN8mbXH46hPg48vVFCSNxzeAd3w=", "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>", "To": "libcamera devel <libcamera-devel@lists.libcamera.org>", "Cc": "Paul Elder <paul.elder@ideasonboard.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>", "Subject": "[PATCH 2/2] pipeline: simple: Fix matching with empty media graphs", "Date": "Thu, 8 Aug 2024 18:39:21 +0100", "Message-Id": "<20240808173921.2519957-3-kieran.bingham@ideasonboard.com>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20240808173921.2519957-1-kieran.bingham@ideasonboard.com>", "References": "<20240808173921.2519957-1-kieran.bingham@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": "From: Paul Elder <paul.elder@ideasonboard.com>\n\nThe 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---\n src/libcamera/pipeline/simple/simple.cpp | 50 ++++++++++++++++--------\n 1 file changed, 33 insertions(+), 17 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\nindex 222052ce02f8..115f8528fc71 100644\n--- a/src/libcamera/pipeline/simple/simple.cpp\n+++ b/src/libcamera/pipeline/simple/simple.cpp\n@@ -363,6 +363,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@@ -1516,25 +1519,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@@ -1543,7 +1534,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@@ -1662,6 +1653,31 @@ 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+\t}\n+\n+\treturn false;\n+}\n+\n V4L2VideoDevice *SimplePipelineHandler::video(const MediaEntity *entity)\n {\n \tauto iter = entities_.find(entity);\n", "prefixes": [ "2/2" ] }