Patch Detail
Show a patch.
GET /api/patches/23649/?format=api
{ "id": 23649, "url": "https://patchwork.libcamera.org/api/patches/23649/?format=api", "web_url": "https://patchwork.libcamera.org/patch/23649/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/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": "<20250625084212.858487-2-naush@raspberrypi.com>", "date": "2025-06-25T08:41:16", "name": "[v1,1/3] pipeline: rpi: Fix for enumerating the media graphs", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "4d04e803665acf5b09a5dddc700c286b3f5178aa", "submitter": { "id": 34, "url": "https://patchwork.libcamera.org/api/people/34/?format=api", "name": "Naushir Patuck", "email": "naush@raspberrypi.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/23649/mbox/", "series": [ { "id": 5246, "url": "https://patchwork.libcamera.org/api/series/5246/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5246", "date": "2025-06-25T08:41:15", "name": "Raspberry Pi: Media graph enumeration updates", "version": 1, "mbox": "https://patchwork.libcamera.org/series/5246/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/23649/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/23649/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 4E07BBDCBF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 25 Jun 2025 08:42:21 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D7BB568DEE;\n\tWed, 25 Jun 2025 10:42:19 +0200 (CEST)", "from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com\n\t[IPv6:2a00:1450:4864:20::42b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 290D168DDB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 25 Jun 2025 10:42:16 +0200 (CEST)", "by mail-wr1-x42b.google.com with SMTP id\n\tffacd0b85a97d-3a4eb4dfd8eso937919f8f.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 25 Jun 2025 01:42:16 -0700 (PDT)", "from NAUSH-P-DELL.pitowers.org ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tffacd0b85a97d-3a6e80f296bsm3974297f8f.60.2025.06.25.01.42.14\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 25 Jun 2025 01:42:15 -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=\"kawcPkvK\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1750840935; x=1751445735;\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=WKQHh9LbhltE62Muvas//gPdUkd0dcSgEm/ISD64DFE=;\n\tb=kawcPkvKk/HOyFyb8wCRMlit32bRBYupCgS3E7vEseUNTTzyqdwmqocSgkTQfttVKq\n\tEQYUt58xIYzsPZboSHscbJQlXPKqOSFq/1S+Vk5kRa1xQwU5b6DtWGBpem+mKCFtJ7j5\n\toSih7KaX4PoU7Wg0iel4HhFte36xynQ8ONNu/kVngrwM1PxyLN7lapYJtypAtcGQ4lRO\n\tfPUKIwH5TsVvubEu/wYgVKfzOm11N8Q2IP8siy9pubvgUi+x3dt/qdPsfGJR/VP9IE9h\n\t8SJ/jBPgqc+OU1Li5GY/VhNFWq2VxtdfImxi6+biGZeusUoe9jJRHgEnOpEVcpQBLBQG\n\tJ/ig==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1750840935; x=1751445735;\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=WKQHh9LbhltE62Muvas//gPdUkd0dcSgEm/ISD64DFE=;\n\tb=FKb63drf3Gc73mg2hujRY7jB7BipqIfPEpn3Bp6qXtoNUzAv9K8oK26gd0GQ2ZGYc/\n\tW8+QDAYFBf8yMxQlk+woIFp1bRzQRDmE3ufhXoUmn02UovUnbc/21cuZ5jUBmuKaR50k\n\trZCSfFBW74souwwAfhv8zKNo+CqGyydbwboJ2ykrKkJo2xs561wz+hc062t1Gi70cGrV\n\t9fFPHahdhD7fuD790Qo7K07MLeqNadY7hw/DElbQCi6qZKeB2yYBO5FewPMvwWQsiQib\n\tnV7+mwAACDGrdLQs0egxo49qkH1TQAnzD2uZ00hJRCwHXJ9T3gwQsPgG+p6qJcABK6SG\n\t1b6A==", "X-Gm-Message-State": "AOJu0Yyzhyr3F4tPuMXkIxRzDFvcWPLzqkDk1Ci4T1247GwmyFhIlPMu\n\t/R5W7fBcJMJw6I/V1mPZUHzGOwNSOON/GxPbfyxCrqB1TUA1/95gg6n63cBAyDHZ/QOx+QZ7MQY\n\tL5ygN", "X-Gm-Gg": "ASbGncsF5RbH/eCVawqZUV4PRHfGa8wNqfa7Zj16CK3cGoRf5aAvq3asS5JoQcQiRU0\n\t6APcE/RYYStO+whKtPoMT/iyeBqKPhVU5ZuO5L4wE0N8m0w0EeDjv61WpPNTte+9pMb9CqzdaNq\n\tiqcPNsHlRSFfNQAltF2exG94MyWbLHu+K7oCO5AmTZFBwqjli33w3xBAAXp/Bi6u1fQZjMeO5K1\n\tx0qTdHdv/DJC8QyIbUjsGvIE7nYCuwnsCTRGnHFGIh+USwbW+T9msYQRA/kf0wa36Kbc+5i5u2l\n\tEQFpxYZhMb3QG27U+NDNSfkyH39Ha9zx5Z7FOcDVnMB/0Abuxj9tqnSp/dH9y7QquGpZDo4ZJhh\n\tWIQ+lrg==", "X-Google-Smtp-Source": "AGHT+IFt4JLM6v4b9BmAIyMH3HyNlV3ANsbfzPJXRPKcETbQ5FytFrSnLpSGUe6QC4vq6Ozo9XlWfQ==", "X-Received": "by 2002:a05:6000:2d09:b0:3a5:28f9:7175 with SMTP id\n\tffacd0b85a97d-3a6ed63c8d5mr382019f8f.9.1750840935340; \n\tWed, 25 Jun 2025 01:42:15 -0700 (PDT)", "From": "Naushir Patuck <naush@raspberrypi.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "dave.stevenson@raspberrypi.com,\n\tNaushir Patuck <naush@raspberrypi.com>", "Subject": "[PATCH v1 1/3] pipeline: rpi: Fix for enumerating the media graphs", "Date": "Wed, 25 Jun 2025 09:41:16 +0100", "Message-ID": "<20250625084212.858487-2-naush@raspberrypi.com>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20250625084212.858487-1-naush@raspberrypi.com>", "References": "<20250625084212.858487-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 seraliser and deserialiser or multiple mux devices), the media graph\nenumeration would work incorrectly and report that the frontend entity\nwas not found. This is beause 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>\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": [ "v1", "1/3" ] }