Patch Detail
Show a patch.
GET /api/1.1/patches/23670/?format=api
{ "id": 23670, "url": "https://patchwork.libcamera.org/api/1.1/patches/23670/?format=api", "web_url": "https://patchwork.libcamera.org/patch/23670/", "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": "<20250627094809.1296587-2-naush@raspberrypi.com>", "date": "2025-06-27T09:46:26", "name": "[v2,1/1] pipeline: rpi: Fix for enumerating the media graphs", "commit_ref": "5f94209b1d2149a3ceea3692bae49256038c2bb3", "pull_url": null, "state": "accepted", "archived": false, "hash": "4d04e803665acf5b09a5dddc700c286b3f5178aa", "submitter": { "id": 34, "url": "https://patchwork.libcamera.org/api/1.1/people/34/?format=api", "name": "Naushir Patuck", "email": "naush@raspberrypi.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/23670/mbox/", "series": [ { "id": 5254, "url": "https://patchwork.libcamera.org/api/1.1/series/5254/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5254", "date": "2025-06-27T09:46:26", "name": "Raspberry Pi: Media graph enumeration updates", "version": 2, "mbox": "https://patchwork.libcamera.org/series/5254/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/23670/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/23670/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 7C8F7BDCBF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 27 Jun 2025 09:48:16 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 24EB368E00;\n\tFri, 27 Jun 2025 11:48:15 +0200 (CEST)", "from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com\n\t[IPv6:2a00:1450:4864:20::32c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DA32568DF4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 27 Jun 2025 11:48:12 +0200 (CEST)", "by mail-wm1-x32c.google.com with SMTP id\n\t5b1f17b1804b1-45362642f3bso2800135e9.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 27 Jun 2025 02:48:12 -0700 (PDT)", "from NAUSH-P-DELL.pitowers.org ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tffacd0b85a97d-3a88c7fa2a7sm2218406f8f.21.2025.06.27.02.48.11\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 27 Jun 2025 02:48:11 -0700 (PDT)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"Bv8+oMTJ\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1751017692; x=1751622492;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=6FiYlkSSoNgr+KpU0D0i7w6SDl0C32f+GR8qpH8YvxM=;\n\tb=Bv8+oMTJiwYnzNtteXoIX3nrgX7KIojaMDwgRUTdWVtk663z98z0yh7tUhGkTpjP8H\n\tbiS2/tSYGwOK63YfckdstEMVdHIMEZ/FCHRBJqIBIvXqkIVqUEfXYyGxNO7XUxZIy3Ee\n\tYSUaOFRpCCqA3JZfrb4GbzWD2b2ZRTgbR0l4+2DIwdS/JYFIqd8M/pyjiCpGCnY4SDNL\n\teB2CXi2X2vBqWdZ+6aoqy0jDmJD/XdWDDxPJ1gZCnO8FIjYgf9KdciG13MDk3/ZFWIAC\n\tcpTJREfGrUrxXfAXEAkXtHGnmJuAiACZoViezEDec5sGzSQe159BnWtUNozGrNw3jsm0\n\txa3A==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1751017692; x=1751622492;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=6FiYlkSSoNgr+KpU0D0i7w6SDl0C32f+GR8qpH8YvxM=;\n\tb=n1TVJRpy68Y19oLxSTpt1DwpXhXeX8ZPogcT/t7Xdb1saLVY8IB8gtNQo1rI4Wjs8e\n\tTlb/jfYVOwitBXsm25Y8xJP+lBaVMi6GVF9gMX4ADDBiBTO/UMmMGoWNB89XF0xcXhNR\n\tlnBehk565+s2dbAisc/impUYlPi8Sck9o17T++n7KsDtLtKc54u+30lcTALkPl9cr4Gm\n\trnwogodthMexkhZdCyrzEnxhrmY5CGpCuQ6GkyDo6/YgVGywOZrEm9xAV+BXxnCxlEZE\n\tBqxLHjo0KDv5av4DLmdRo0VLutu38zk/tr3SaiVtBqEty+tKXDxZCBO2ekkIvNBc2cuz\n\tFnDg==", "X-Gm-Message-State": "AOJu0YznAvzx6CtAvz9AM5iQ76fTnqLgdXXM8PNmvDOK5H+8AjLcCbRV\n\tU5SM57KZdEMAsZcPqYib4sfHR51B8Bic0qFBg1xg0bv8EQD5eMU8mfRDc0oYfc+ETCBkExzlsj1\n\t+Qxui", "X-Gm-Gg": "ASbGncvAhQxzX+XvG161wHzvk90my/5z/JMu52xdPnEJxSkUGJWFTDV0s/Qj0hXOxrA\n\tcifJT4pUddlAW2W5COBzUygJ9bWceSn0PcknzBgNHm4deLfhpIslu/x7gKfIMenjLm0XzIBwwzh\n\typov6h+ZdVfg77EzA4xHG0TaCF1If0no5Md7tlEQj9UyQkR3h9qB+bwcBLXQ/s6a+0x8lGbQFgQ\n\tm6QS+EZWC04kfqRHHutNiWj9hgygYolw9fijIgHtkfTcX1m4Kh1Mdi+NWXJP6cc17izAedA1IT9\n\tUJlxaXdVbeTeYRm9JqHAUuJmKIxPKkhWd6YhABXv12TNeJiNBXOlao2AovK7Ov+mET9fafwHgEy\n\t3/EmLcA==", "X-Google-Smtp-Source": "AGHT+IE6m6dEDe5t6z5z8C0WBZz9fkwsSa3DdQVzcfTEyhn11mQ3ktnhvVp0BLyvFwbhYogQf0PZcg==", "X-Received": "by 2002:a05:600c:c05a:b0:453:435a:6cda with SMTP id\n\t5b1f17b1804b1-4538ee345a6mr7747775e9.2.1751017691876; \n\tFri, 27 Jun 2025 02:48:11 -0700 (PDT)", "From": "Naushir Patuck <naush@raspberrypi.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Naushir Patuck <naush@raspberrypi.com>, Umang Jain <uajain@igalia.com>, \n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>", "Subject": "[PATCH v2 1/1] pipeline: rpi: Fix for enumerating the media graphs", "Date": "Fri, 27 Jun 2025 10:46:26 +0100", "Message-ID": "<20250627094809.1296587-2-naush@raspberrypi.com>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20250627094809.1296587-1-naush@raspberrypi.com>", "References": "<20250627094809.1296587-1-naush@raspberrypi.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": "When there are multiple entities between the sensor and CFE device (e.g.\na serialiser and deserialiser or multiple mux devices), the media graph\nenumeration would work incorrectly and report that the frontend entity\nwas not found. This is because the found flag was stored locally in a\nboolean and got lost in the recursion.\n\nFix this by explicitly tracking and returning the frontend found flag\nthrough the return value of enumerateVideoDevices(). This ensures the\nflag does not get lost through nested recursion.\n\nThis flag can also be used to fail a camera registration if the frontend\nis not found.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: Umang Jain <uajain@igalia.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n .../pipeline/rpi/common/pipeline_base.cpp | 22 +++++++++++--------\n .../pipeline/rpi/common/pipeline_base.h | 2 +-\n 2 files changed, 14 insertions(+), 10 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\nindex e14d3b913aaa..eafe94427dbc 100644\n--- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n+++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n@@ -806,7 +806,8 @@ int PipelineHandlerBase::registerCamera(std::unique_ptr<RPi::CameraData> &camera\n \t * chain. There may be a cascade of devices in this chain!\n \t */\n \tMediaLink *link = sensorEntity->getPadByIndex(0)->links()[0];\n-\tdata->enumerateVideoDevices(link, frontendName);\n+\tif (!data->enumerateVideoDevices(link, frontendName))\n+\t\treturn -EINVAL;\n \n \tipa::RPi::InitResult result;\n \tif (data->loadIPA(&result)) {\n@@ -1018,16 +1019,20 @@ void CameraData::freeBuffers()\n * | Sensor2 | | Sensor3 |\n * +---------+ +---------+\n */\n-void CameraData::enumerateVideoDevices(MediaLink *link, const std::string &frontend)\n+bool CameraData::enumerateVideoDevices(MediaLink *link, const std::string &frontend)\n {\n \tconst MediaPad *sinkPad = link->sink();\n \tconst MediaEntity *entity = sinkPad->entity();\n \tbool frontendFound = false;\n \n+\t/* Once we reach the Frontend entity, we are done. */\n+\tif (link->sink()->entity()->name() == frontend)\n+\t\treturn true;\n+\n \t/* We only deal with Video Mux and Bridge devices in cascade. */\n \tif (entity->function() != MEDIA_ENT_F_VID_MUX &&\n \t entity->function() != MEDIA_ENT_F_VID_IF_BRIDGE)\n-\t\treturn;\n+\t\treturn false;\n \n \t/* Find the source pad for this Video Mux or Bridge device. */\n \tconst MediaPad *sourcePad = nullptr;\n@@ -1039,7 +1044,7 @@ void CameraData::enumerateVideoDevices(MediaLink *link, const std::string &front\n \t\t\t * and this branch in the cascade.\n \t\t\t */\n \t\t\tif (sourcePad)\n-\t\t\t\treturn;\n+\t\t\t\treturn false;\n \n \t\t\tsourcePad = pad;\n \t\t}\n@@ -1056,12 +1061,9 @@ void CameraData::enumerateVideoDevices(MediaLink *link, const std::string &front\n \t * other Video Mux and Bridge devices.\n \t */\n \tfor (MediaLink *l : sourcePad->links()) {\n-\t\tenumerateVideoDevices(l, frontend);\n-\t\t/* Once we reach the Frontend entity, we are done. */\n-\t\tif (l->sink()->entity()->name() == frontend) {\n-\t\t\tfrontendFound = true;\n+\t\tfrontendFound = enumerateVideoDevices(l, frontend);\n+\t\tif (frontendFound)\n \t\t\tbreak;\n-\t\t}\n \t}\n \n \t/* This identifies the end of our entity enumeration recursion. */\n@@ -1076,6 +1078,8 @@ void CameraData::enumerateVideoDevices(MediaLink *link, const std::string &front\n \t\t\tbridgeDevices_.clear();\n \t\t}\n \t}\n+\n+\treturn frontendFound;\n }\n \n int CameraData::loadPipelineConfiguration()\ndiff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.h b/src/libcamera/pipeline/rpi/common/pipeline_base.h\nindex 4c5743e04f86..4bce4ec4f978 100644\n--- a/src/libcamera/pipeline/rpi/common/pipeline_base.h\n+++ b/src/libcamera/pipeline/rpi/common/pipeline_base.h\n@@ -68,7 +68,7 @@ public:\n \tvoid freeBuffers();\n \tvirtual void platformFreeBuffers() = 0;\n \n-\tvoid enumerateVideoDevices(MediaLink *link, const std::string &frontend);\n+\tbool enumerateVideoDevices(MediaLink *link, const std::string &frontend);\n \n \tint loadPipelineConfiguration();\n \tint loadIPA(ipa::RPi::InitResult *result);\n", "prefixes": [ "v2", "1/1" ] }