Show a patch.

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

{
    "id": 27166,
    "url": "https://patchwork.libcamera.org/api/patches/27166/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/27166/",
    "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": "<20260703122543.1991189-8-paul.elder@ideasonboard.com>",
    "date": "2026-07-03T12:25:13",
    "name": "[RFC,07/19] pipeline: rkisp2: Support shared media graph",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "2546b508c61f6029ea1c483cf8e4e3da6d6cd12a",
    "submitter": {
        "id": 17,
        "url": "https://patchwork.libcamera.org/api/people/17/?format=api",
        "name": "Paul Elder",
        "email": "paul.elder@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/27166/mbox/",
    "series": [
        {
            "id": 6035,
            "url": "https://patchwork.libcamera.org/api/series/6035/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=6035",
            "date": "2026-07-03T12:25:06",
            "name": "Add support for rkisp2",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/6035/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/27166/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/27166/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 C884BC328C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  3 Jul 2026 12:26:26 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 83E2965FD9;\n\tFri,  3 Jul 2026 14:26:26 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4440C65FCA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  3 Jul 2026 14:26:25 +0200 (CEST)",
            "from neptunite.hamster-moth.ts.net (unknown\n\t[IPv6:2404:7a81:160:2100:a2cc:2f45:3bd7:2589])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 636208E0;\n\tFri,  3 Jul 2026 14:25:36 +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=\"GirQS2Hz\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1783081539;\n\tbh=0ERL9+WoD24amxrnY2dQ9id8zeeBTQq6BFut/3mpeKA=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=GirQS2HzD7jv2uBdsioD4VXb7Tgb+9A25oEi07ZJM2oAVS0fVC3ytH9/mBJZtjBtR\n\tyiWiA4kY4NoDnLSxCbu8ZdPbttTG+6d+VNFhV0hiG/Vo9M7ZLrNKfoHyA9YAdgCYSR\n\tACtpj3IkpwAtHLHwWuHq9uA/m34NZbTAh9JV35OQ=",
        "From": "Paul Elder <paul.elder@ideasonboard.com>",
        "To": "laurent.pinchart@ideasonboard.com",
        "Cc": "Paul Elder <paul.elder@ideasonboard.com>, michael.riesch@collabora.com, \n\txuhf@rock-chips.com, stefan.klug@ideasonboard.com,\n\tkieran.bingham@ideasonboard.com, dan.scally@ideasonboard.com,\n\tjacopo.mondi@ideasonboard.com, nicolas.dufresne@collabora.com,\n\tlibcamera-devel@lists.libcamera.org",
        "Subject": "[RFC PATCH 07/19] pipeline: rkisp2: Support shared media graph",
        "Date": "Fri,  3 Jul 2026 21:25:13 +0900",
        "Message-ID": "<20260703122543.1991189-8-paul.elder@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.47.2",
        "In-Reply-To": "<20260703122543.1991189-1-paul.elder@ideasonboard.com>",
        "References": "<20260703122543.1991189-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": "Make the rkisp2 pipeline handler use the shared media graph instead of\nseparate graphs. This makes the rkisp2 pipeline handler incompatible\nwith kernels that do not have shared media graph.\n\nShared media graph puts the VICAP and the ISP in the same media graph,\nso that it can be switched between inline mode and memory-to-memory\nmode. The rkisp2 pipeline handler currently does not support inline\nmode however, so it will only function in memory-to-memory-mode.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n\n---\nI put this in a separate patch so that it's easily revertible.\n\nShared media graph patches for the kernel are here:\nhttps://lore.kernel.org/all/20260619052637.1110672-5-paul.elder@ideasonboard.com/\n---\n src/libcamera/pipeline/rkisp2/rkisp2.cpp | 67 ++++++++++++++++--------\n 1 file changed, 46 insertions(+), 21 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/rkisp2/rkisp2.cpp b/src/libcamera/pipeline/rkisp2/rkisp2.cpp\nindex 0d335a980e32..a89672075f40 100644\n--- a/src/libcamera/pipeline/rkisp2/rkisp2.cpp\n+++ b/src/libcamera/pipeline/rkisp2/rkisp2.cpp\n@@ -255,7 +255,6 @@ private:\n \tstd::unique_ptr<V4L2Subdevice> cif_;\n \tstd::unique_ptr<V4L2VideoDevice> video_;\n \n-\tstd::shared_ptr<MediaDevice> ispMedia_;\n \tstd::unique_ptr<V4L2VideoDevice> rawrd_;\n \tstd::unique_ptr<V4L2Subdevice> isp_;\n \tstd::unique_ptr<V4L2VideoDevice> mainPath_;\n@@ -717,6 +716,36 @@ int PipelineHandlerRkISP2::configure(Camera *camera,\n \tconst PixelFormatInfo &info = PixelFormatInfo::info(cfg.pixelFormat);\n \tdata->isRaw_ = info.colourEncoding == PixelFormatInfo::ColourEncodingRAW;\n \n+\t/*\n+\t * No need to check usingIsp_ || isRaw_, since if we're capturing from\n+\t * just VICAP we still don't want the link to the ISP, and if we're\n+\t * using the ISP then we don't support inline mode yet.\n+\t * \\todo Support inline mode\n+\t */\n+\tLOG(RkISP2, Debug) << \"Disabling link from VICAP to ISP\";\n+\tMediaLink *link = media_->link(cif_->entity(), 2, isp_->entity(), 4);\n+\tret = link->setEnabled(false);\n+\tif (ret < 0) {\n+\t\tLOG(RkISP2, Error) << \"Failed to disable link between VICAP and ISP\";\n+\t\treturn ret;\n+\t}\n+\n+\tLOG(RkISP2, Debug) << \"Enabling link from VICAP to capture node\";\n+\tlink = media_->link(\"rkcif-mipi2\", 1, \"rkcif-mipi2-id0\", 0);\n+\tret = link->setEnabled(true);\n+\tif (ret < 0) {\n+\t\tLOG(RkISP2, Error) << \"Failed to enable link between VICAP and capture node\";\n+\t\treturn ret;\n+\t}\n+\n+\tLOG(RkISP2, Debug) << \"Enabling link from rawrd to ISP\";\n+\tlink = media_->link(\"rkisp2_rawrd0\", 0, \"rkisp2_isp\", 0);\n+\tret = link->setEnabled(true);\n+\tif (ret < 0) {\n+\t\tLOG(RkISP2, Error) << \"Failed to enable link between rawrd and ISP\";\n+\t\treturn ret;\n+\t}\n+\n \tV4L2SubdeviceFormat format = config->sensorFormat();\n \tLOG(RkISP2, Debug) << \"Configuring sensor with \" << format;\n \n@@ -1124,6 +1153,10 @@ bool PipelineHandlerRkISP2::createCamera(bool usingIsp)\n \n bool PipelineHandlerRkISP2::match(DeviceEnumerator *enumerator)\n {\n+\t/*\n+\t * \\todo This needs to be reconciled with how shared media graphs are\n+\t * named\n+\t */\n \tDeviceMatch dm(\"rockchip-cif\");\n \t/* \\todo Generalize this for the other csi ports */\n \t/*\n@@ -1136,6 +1169,12 @@ bool PipelineHandlerRkISP2::match(DeviceEnumerator *enumerator)\n \tdm.add(\"rkcif-mipi2-id0\");\n \tdm.add(\"dw-mipi-csi2rx fdd30000.csi\");\n \n+\tdm.add(\"rkisp2_isp\");\n+\t/* \\todo Generalize this for the other channels */\n+\tdm.add(\"rkisp2_rawrd0\");\n+\t/* \\todo Support self path */\n+\tdm.add(\"rkisp2_mainpath\");\n+\n \tmedia_ = acquireMediaDevice(enumerator, dm);\n \tif (!media_)\n \t\treturn false;\n@@ -1179,49 +1218,35 @@ bool PipelineHandlerRkISP2::match(DeviceEnumerator *enumerator)\n \t\treturn createCamera(usingIsp);\n \t}\n \n-\t/* Match ISP */\n-\n-\tDeviceMatch dmIsp(\"rkisp2\");\n-\tdmIsp.add(\"rkisp2_isp\");\n-\t/* \\todo Generalize this for the other channels */\n-\tdmIsp.add(\"rkisp2_rawrd0\");\n-\t/* \\todo Support self path */\n-\tdmIsp.add(\"rkisp2_mainpath\");\n-\n-\tispMedia_ = acquireMediaDevice(enumerator, dmIsp);\n-\tif (!ispMedia_) {\n-\t\tusingIsp = false;\n-\t\tLOG(RkISP2, Debug) << \"ISP not found\";\n-\t\treturn createCamera(usingIsp);\n-\t}\n+\t/* Acquire ISP */\n \n \t/* \\todo Support the other rawrd nodes */\n-\trawrd_ = V4L2VideoDevice::fromEntityName(ispMedia_.get(), \"rkisp2_rawrd0\");\n+\trawrd_ = V4L2VideoDevice::fromEntityName(media_.get(), \"rkisp2_rawrd0\");\n \tif (!rawrd_ || rawrd_->open() < 0) {\n \t\tLOG(RkISP2, Error) << \"Failed to open rkisp2 rawrd device\";\n \t\treturn false;\n \t}\n \n-\tisp_ = V4L2Subdevice::fromEntityName(ispMedia_.get(), \"rkisp2_isp\");\n+\tisp_ = V4L2Subdevice::fromEntityName(media_.get(), \"rkisp2_isp\");\n \tif (!isp_ || isp_->open() < 0) {\n \t\tLOG(RkISP2, Error) << \"Failed to open rkisp2 isp\";\n \t\treturn false;\n \t}\n \n \t/* \\todo Support self path */\n-\tmainPath_ = V4L2VideoDevice::fromEntityName(ispMedia_.get(), \"rkisp2_mainpath\");\n+\tmainPath_ = V4L2VideoDevice::fromEntityName(media_.get(), \"rkisp2_mainpath\");\n \tif (!mainPath_ || mainPath_->open() < 0) {\n \t\tLOG(RkISP2, Error) << \"Failed to open rkisp2 main path\";\n \t\treturn false;\n \t}\n \n-\tparam_ = V4L2VideoDevice::fromEntityName(ispMedia_.get(), \"rkisp2_params\");\n+\tparam_ = V4L2VideoDevice::fromEntityName(media_.get(), \"rkisp2_params\");\n \tif (!param_ || param_->open() < 0) {\n \t\tLOG(RkISP2, Error) << \"Failed to open rkisp2 params\";\n \t\treturn false;\n \t}\n \n-\tstat_ = V4L2VideoDevice::fromEntityName(ispMedia_.get(), \"rkisp2_stats\");\n+\tstat_ = V4L2VideoDevice::fromEntityName(media_.get(), \"rkisp2_stats\");\n \tif (!stat_ || stat_->open() < 0) {\n \t\tLOG(RkISP2, Error) << \"Failed to open rkisp2 stats\";\n \t\treturn false;\n",
    "prefixes": [
        "RFC",
        "07/19"
    ]
}