Show a patch.

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

{
    "id": 21284,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/21284/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/21284/",
    "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": "<20240916140241.47845-5-kieran.bingham@ideasonboard.com>",
    "date": "2024-09-16T14:02:41",
    "name": "[4/4] libcamera: pipeline: rkisp1: Convert to use MediaPipeline",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "9899b442b3e4d8e22cb97c0540486cc3023b0c69",
    "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/21284/mbox/",
    "series": [
        {
            "id": 4601,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4601/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4601",
            "date": "2024-09-16T14:02:37",
            "name": "MediaPipeline: Complex input device support",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/4601/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/21284/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/21284/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 0A4FFC3261\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 16 Sep 2024 14:02:59 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 06BC663502;\n\tMon, 16 Sep 2024 16:02:59 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E7380634F5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Sep 2024 16:02:50 +0200 (CEST)",
            "from charm.lan (unknown\n\t[IPv6:2001:4bc9:a45:b0af:726e:a88f:9f07:34be])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id BD9F882A;\n\tMon, 16 Sep 2024 16:01:29 +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=\"BVdPu6R/\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1726495289;\n\tbh=knY69wIVrTmSm8+G44lJgwCYK/KEGjz87/uwNLrxMYs=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=BVdPu6R/1Wp1jn1Bw5BDhCwKG3avik+VCLj0V+Y64o5h/Y3z+guYPI+qhybxaLHKK\n\tUKDPwNngHSnG0Xx6+/pZdXLVufosBKyZcDCyTscCJ9i/bInJ39fGL3ewCFZ7Dmry+y\n\tXQqDAhVI2/CnF8OGPugIB0L4JI1eh4gtrXCv1nXU=",
        "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>",
        "To": "libcamera devel <libcamera-devel@lists.libcamera.org>",
        "Cc": "Kieran Bingham <kieran.bingham@ideasonboard.com>",
        "Subject": "[PATCH 4/4] libcamera: pipeline: rkisp1: Convert to use\n\tMediaPipeline",
        "Date": "Mon, 16 Sep 2024 16:02:41 +0200",
        "Message-ID": "<20240916140241.47845-5-kieran.bingham@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.46.0",
        "In-Reply-To": "<20240916140241.47845-1-kieran.bingham@ideasonboard.com>",
        "References": "<20240916140241.47845-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": "Use the new MediaPipeline to manage and identify all sensors connected\nto complex pipelines that can connect to the CSI2 receiver before the\nISP.\n\nThis can include chained multiplexors that supply multiple cameras, so\nmake use of the MediaDevice::locateEntities to search for all cameras\nand construct a pipeline for each.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/libcamera/pipeline/rkisp1/rkisp1.cpp | 65 ++++++++++++------------\n 1 file changed, 32 insertions(+), 33 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 2fee84e56d4d..914f5181b51d 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -37,6 +37,7 @@\n #include \"libcamera/internal/framebuffer.h\"\n #include \"libcamera/internal/ipa_manager.h\"\n #include \"libcamera/internal/media_device.h\"\n+#include \"libcamera/internal/media_pipeline.h\"\n #include \"libcamera/internal/pipeline_handler.h\"\n #include \"libcamera/internal/v4l2_subdevice.h\"\n #include \"libcamera/internal/v4l2_videodevice.h\"\n@@ -108,6 +109,11 @@ public:\n \n \tstd::unique_ptr<ipa::rkisp1::IPAProxyRkISP1> ipa_;\n \n+\t/*\n+\t * All entities in the pipeline, from the camera sensor to the RKISP1.\n+\t */\n+\tMediaPipeline pipe_;\n+\n private:\n \tvoid paramFilled(unsigned int frame, unsigned int bytesused);\n \tvoid setSensorControls(unsigned int frame,\n@@ -171,8 +177,7 @@ private:\n \tfriend RkISP1CameraData;\n \tfriend RkISP1Frames;\n \n-\tint initLinks(Camera *camera, const CameraSensor *sensor,\n-\t\t      const RkISP1CameraConfiguration &config);\n+\tint initLinks(Camera *camera, const RkISP1CameraConfiguration &config);\n \tint createCamera(MediaEntity *sensor);\n \tvoid tryCompleteRequest(RkISP1FrameInfo *info);\n \tvoid bufferReady(FrameBuffer *buffer);\n@@ -712,7 +717,7 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c)\n \tCameraSensor *sensor = data->sensor_.get();\n \tint ret;\n \n-\tret = initLinks(camera, sensor, *config);\n+\tret = initLinks(camera, *config);\n \tif (ret)\n \t\treturn ret;\n \n@@ -729,12 +734,12 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c)\n \n \tLOG(RkISP1, Debug) << \"Sensor configured with \" << format;\n \n-\tif (csi_) {\n-\t\tret = csi_->setFormat(0, &format);\n-\t\tif (ret < 0)\n-\t\t\treturn ret;\n-\t}\n+\t/* Propagate format through the internal media pipeline up to the ISP */\n+\tret = data->pipe_.configure(sensor, &format);\n+\tif (ret < 0)\n+\t\treturn ret;\n \n+\tLOG(RkISP1, Debug) << \"Configuring ISP with : \" << format;\n \tret = isp_->setFormat(0, &format);\n \tif (ret < 0)\n \t\treturn ret;\n@@ -1035,7 +1040,6 @@ int PipelineHandlerRkISP1::queueRequestDevice(Camera *camera, Request *request)\n  */\n \n int PipelineHandlerRkISP1::initLinks(Camera *camera,\n-\t\t\t\t     const CameraSensor *sensor,\n \t\t\t\t     const RkISP1CameraConfiguration &config)\n {\n \tRkISP1CameraData *data = cameraData(camera);\n@@ -1046,31 +1050,16 @@ int PipelineHandlerRkISP1::initLinks(Camera *camera,\n \t\treturn ret;\n \n \t/*\n-\t * Configure the sensor links: enable the link corresponding to this\n-\t * camera.\n+\t * Configure the sensor links: enable the links corresponding to this\n+\t * pipeline all the way up to the ISP, through any connected CSI receiver.\n \t */\n-\tfor (MediaLink *link : ispSink_->links()) {\n-\t\tif (link->source()->entity() != sensor->entity())\n-\t\t\tcontinue;\n-\n-\t\tLOG(RkISP1, Debug)\n-\t\t\t<< \"Enabling link from sensor '\"\n-\t\t\t<< link->source()->entity()->name()\n-\t\t\t<< \"' to ISP\";\n-\n-\t\tret = link->setEnabled(true);\n-\t\tif (ret < 0)\n-\t\t\treturn ret;\n-\t}\n-\n-\tif (csi_) {\n-\t\tMediaLink *link = isp_->entity()->getPadByIndex(0)->links().at(0);\n-\n-\t\tret = link->setEnabled(true);\n-\t\tif (ret < 0)\n-\t\t\treturn ret;\n+\tret = data->pipe_.initLinks();\n+\tif (ret) {\n+\t\tLOG(RkISP1, Error) << \"Failed to set up pipe links\";\n+\t\treturn ret;\n \t}\n \n+\t/* Configure the paths after the ISP */\n \tfor (const StreamConfiguration &cfg : config) {\n \t\tif (cfg.stream() == &data->mainPathStream_)\n \t\t\tret = data->mainPath_->setEnabled(true);\n@@ -1094,6 +1083,13 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor)\n \t\tstd::make_unique<RkISP1CameraData>(this, &mainPath_,\n \t\t\t\t\t\t   hasSelfPath_ ? &selfPath_ : nullptr);\n \n+\t/* Identify the pipeline path between the sensor and the rkisp1_isp */\n+\tret = data->pipe_.init(sensor, \"rkisp1_isp\");\n+\tif (ret) {\n+\t\tLOG(RkISP1, Error) << \"Failed to identify path from sensor to sink\";\n+\t\treturn ret;\n+\t}\n+\n \tdata->sensor_ = std::make_unique<CameraSensor>(sensor);\n \tret = data->sensor_->init();\n \tif (ret)\n@@ -1129,6 +1125,7 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor)\n \tconst std::string &id = data->sensor_->id();\n \tstd::shared_ptr<Camera> camera =\n \t\tCamera::create(std::move(data), id, streams);\n+\n \tregisterCamera(std::move(camera));\n \n \treturn 0;\n@@ -1205,8 +1202,10 @@ bool PipelineHandlerRkISP1::match(DeviceEnumerator *enumerator)\n \t * camera instance for each of them.\n \t */\n \tbool registered = false;\n-\tfor (MediaLink *link : ispSink_->links()) {\n-\t\tif (!createCamera(link->source()->entity()))\n+\n+\tfor (MediaEntity *entity : media_->locateEntities(MEDIA_ENT_F_CAM_SENSOR)) {\n+\t\tLOG(RkISP1, Info) << \"Identified \" << entity->name();\n+\t\tif (!createCamera(entity))\n \t\t\tregistered = true;\n \t}\n \n",
    "prefixes": [
        "4/4"
    ]
}