Show a patch.

GET /api/1.1/patches/23650/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 23650,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/23650/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/23650/",
    "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": "<20250625084212.858487-3-naush@raspberrypi.com>",
    "date": "2025-06-25T08:41:17",
    "name": "[v1,2/3] pipeline: rpi: Move media device configuration into its own function",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "bec23e0ec103364668427c18eaa860e9d5a4dce7",
    "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/23650/mbox/",
    "series": [
        {
            "id": 5246,
            "url": "https://patchwork.libcamera.org/api/1.1/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/23650/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/23650/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 0CBDCBDCBF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 25 Jun 2025 08:42:23 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 45C6068DF0;\n\tWed, 25 Jun 2025 10:42:22 +0200 (CEST)",
            "from mail-wr1-x434.google.com (mail-wr1-x434.google.com\n\t[IPv6:2a00:1450:4864:20::434])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D294468DE6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 25 Jun 2025 10:42:16 +0200 (CEST)",
            "by mail-wr1-x434.google.com with SMTP id\n\tffacd0b85a97d-3a4e57d018cso871078f8f.1\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.15\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=\"n3iNIdCI\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1750840936; x=1751445736;\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=h4YFCnw/Vnf4bWX7DPoVXHfCEVt0AT65TY4/SmZkWNM=;\n\tb=n3iNIdCIiDltzbx3SqgNRfWUtCBgKU7LCUj3Mc+Va0MfuxMqzsMqlos4OLbIoqJRt+\n\tAoOkildZXi/EvvJn1DsKmR+EnglR3XsYVVsQpDIS/PRHZtCBRGikRyUnjbWbzga7ywG7\n\tVQ45WBDRwSgLIpPnw5eY/yuTtJK9c+bTdPuKWWnzryQrg04CblzuXp0MYA7ea2A2qbG1\n\tuRpg/CWR+Jc1HwQMqeAKgrWaBtC94i4RcqaZX5UBGmwPMm6owOXdndLLr8vLosscXfVh\n\tcpjJRBTEQtOxlC6WTMe3h2jo2EXGPRUn09Q/qDpNlJ16l9+R3w/a11/4HJfzTA9aSAv5\n\tlktw==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1750840936; x=1751445736;\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=h4YFCnw/Vnf4bWX7DPoVXHfCEVt0AT65TY4/SmZkWNM=;\n\tb=oRyhTo8m87hnbCiAUeuw4gLs2g/C/eW3b0zrox84DbyEGm8BuR7VXQAVnENOXyfBD5\n\tvQI0uPkvzSAS8r6bP+s0bRE3Kzq0/rQvM0c48TOLROoMDitjxxCdCDeW1WI8n1Fb4D2e\n\tsWpDljFQjdDebu14GzYW+w3u6S6qmKnRXmpwe+uF4POLQCFvbkcn5EdYMf7cOjyrcT2H\n\tSbDeC7+9PSHQksCObXnXO0EHIDC5thv6ncrbah2vKRwiZc+LOSkp47tj1nRoSV/dUNGt\n\tZQAcSXt8thwr+Ri34w8lO+jom8ab+skOjWHd3jp3ZE6BOU3tqR4jMAWhVwfqGDrUOlmO\n\tcrDg==",
        "X-Gm-Message-State": "AOJu0YyzFmo6ItGVJO+lnm6NcuftvRYvVWfzAxs3plYBHTSoDV8SZ0mr\n\trT4fohvWKp+Pwu6CyS7I+Dehqx7NBqoXUJDbkkDJVlAsm1W9xosUfXYgEvETgEw3zS3rU91P/vw\n\tRVjMe",
        "X-Gm-Gg": "ASbGnct0i8yWaC7qgk/FpRKrO219jcqrjsQ7vrTMpNWSUxqXZ/M3sDB9Swc8idvpwlo\n\t9FhEZb7t4o6WZj1zGp6ZhsorNheXKpi76kKI/zKmRCrveZow9XNjZR0U0L8bCF8i6OSZHFZUqQ1\n\tWRdJGFs7UPvKonZ7lxBFqqvZ9Xo8sr1nK33+SLJowYURPUHjl5v9hLo5i1Uf5hVxyV6J4Bc4aZx\n\tb4GkHeXoA33eIXKq93hk/fArYkm/0nDAJkGc2cbVZlF+xAkHKdoqSNL07DauXpXwPkcJpvwgJ21\n\tghiFY7LyJV3mVyR8PVJXb4lSDofXoBeIldYp/yu3vQq+UWmK9L3+jtWZ4xORjM1py9FihaEWIY+\n\tvgS93mg==",
        "X-Google-Smtp-Source": "AGHT+IG3a15v2N/CJJHDO/EMVpA7vyosQYRr+19nnug/2K1ZW8ZG8kivIZTBK+x8wfa+yA5PeX+AIw==",
        "X-Received": "by 2002:a05:600c:c059:20b0:453:59b5:25cc with SMTP id\n\t5b1f17b1804b1-45381b15784mr3824225e9.7.1750840935963; \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 2/3] pipeline: rpi: Move media device configuration into\n\tits own function",
        "Date": "Wed, 25 Jun 2025 09:41:17 +0100",
        "Message-ID": "<20250625084212.858487-3-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": "Add a new function configureMediaDevices() used to configure the\nmedia links and pads for all known bridge/mux entities in the media\ngraph.\n\nNo functional change, this simply moves existing code into a new\nfunction in prepartion for further changes in a subsequent commit.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n .../pipeline/rpi/common/pipeline_base.cpp     | 84 ++++++++++---------\n 1 file changed, 46 insertions(+), 38 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\nindex eafe94427dbc..219bd81cc63a 100644\n--- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n+++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n@@ -85,6 +85,51 @@ std::optional<ColorSpace> findValidColorSpace(const ColorSpace &colourSpace)\n \treturn std::nullopt;\n }\n \n+int configureMediaDevices(std::vector<std::pair<std::unique_ptr<V4L2Subdevice>, MediaLink *>> &bridgeDevices,\n+\t\t\t  V4L2SubdeviceFormat *sensorFormat)\n+{\n+\tint ret = 0;\n+\n+\t/* Setup the Video Mux/Bridge entities. */\n+\tfor (auto &[device, link] : bridgeDevices) {\n+\t\t/*\n+\t\t * Start by disabling all the sink pad links on the devices in the\n+\t\t * cascade, with the exception of the link connecting the device.\n+\t\t */\n+\t\tfor (const MediaPad *p : device->entity()->pads()) {\n+\t\t\tif (!(p->flags() & MEDIA_PAD_FL_SINK))\n+\t\t\t\tcontinue;\n+\n+\t\t\tfor (MediaLink *l : p->links()) {\n+\t\t\t\tif (l != link)\n+\t\t\t\t\tl->setEnabled(false);\n+\t\t\t}\n+\t\t}\n+\n+\t\t/*\n+\t\t * Next, enable the entity -> entity links, and setup the pad format.\n+\t\t *\n+\t\t * \\todo Some bridge devices may chainge the media bus code, so we\n+\t\t * ought to read the source pad format and propagate it to the sink pad.\n+\t\t */\n+\t\tlink->setEnabled(true);\n+\t\tconst MediaPad *sinkPad = link->sink();\n+\t\tret = device->setFormat(sinkPad->index(), sensorFormat);\n+\t\tif (ret) {\n+\t\t\tLOG(RPI, Error) << \"Failed to set format on \" << device->entity()->name()\n+\t\t\t\t\t<< \" pad \" << sinkPad->index()\n+\t\t\t\t\t<< \" with format  \" << *sensorFormat\n+\t\t\t\t\t<< \": \" << ret;\n+\t\t\treturn ret;\n+\t\t}\n+\n+\t\tLOG(RPI, Debug) << \"Configured media link on device \" << device->entity()->name()\n+\t\t\t\t<< \" on pad \" << sinkPad->index();\n+\t}\n+\n+\treturn ret;\n+}\n+\n } /* namespace */\n \n /*\n@@ -589,44 +634,7 @@ int PipelineHandlerBase::configure(Camera *camera, CameraConfiguration *config)\n \n \tdata->controlInfo_ = ControlInfoMap(std::move(ctrlMap), result.controlInfo.idmap());\n \n-\t/* Setup the Video Mux/Bridge entities. */\n-\tfor (auto &[device, link] : data->bridgeDevices_) {\n-\t\t/*\n-\t\t * Start by disabling all the sink pad links on the devices in the\n-\t\t * cascade, with the exception of the link connecting the device.\n-\t\t */\n-\t\tfor (const MediaPad *p : device->entity()->pads()) {\n-\t\t\tif (!(p->flags() & MEDIA_PAD_FL_SINK))\n-\t\t\t\tcontinue;\n-\n-\t\t\tfor (MediaLink *l : p->links()) {\n-\t\t\t\tif (l != link)\n-\t\t\t\t\tl->setEnabled(false);\n-\t\t\t}\n-\t\t}\n-\n-\t\t/*\n-\t\t * Next, enable the entity -> entity links, and setup the pad format.\n-\t\t *\n-\t\t * \\todo Some bridge devices may chainge the media bus code, so we\n-\t\t * ought to read the source pad format and propagate it to the sink pad.\n-\t\t */\n-\t\tlink->setEnabled(true);\n-\t\tconst MediaPad *sinkPad = link->sink();\n-\t\tret = device->setFormat(sinkPad->index(), sensorFormat);\n-\t\tif (ret) {\n-\t\t\tLOG(RPI, Error) << \"Failed to set format on \" << device->entity()->name()\n-\t\t\t\t\t<< \" pad \" << sinkPad->index()\n-\t\t\t\t\t<< \" with format  \" << *sensorFormat\n-\t\t\t\t\t<< \": \" << ret;\n-\t\t\treturn ret;\n-\t\t}\n-\n-\t\tLOG(RPI, Debug) << \"Configured media link on device \" << device->entity()->name()\n-\t\t\t\t<< \" on pad \" << sinkPad->index();\n-\t}\n-\n-\treturn 0;\n+\treturn configureMediaDevices(data->bridgeDevices_, sensorFormat);\n }\n \n int PipelineHandlerBase::exportFrameBuffers([[maybe_unused]] Camera *camera, libcamera::Stream *stream,\n",
    "prefixes": [
        "v1",
        "2/3"
    ]
}