Show a patch.

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

{
    "id": 15243,
    "url": "https://patchwork.libcamera.org/api/patches/15243/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/15243/",
    "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": "<20220104125709.1273546-2-naush@raspberrypi.com>",
    "date": "2022-01-04T12:57:08",
    "name": "[libcamera-devel,v5,1/2] pipeline: raspberrypi: Move sensor entity detection out of registerCamera()",
    "commit_ref": "8400cb07117f1ebc51db2a66d9f62211a764a096",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "36450bd158321de60381eab163eaabf7e81cd383",
    "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/15243/mbox/",
    "series": [
        {
            "id": 2875,
            "url": "https://patchwork.libcamera.org/api/series/2875/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2875",
            "date": "2022-01-04T12:57:07",
            "name": "Raspberry Pi: Add video mux and bridge support",
            "version": 5,
            "mbox": "https://patchwork.libcamera.org/series/2875/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/15243/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/15243/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 C936CC3258\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  4 Jan 2022 12:57:20 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 671886092F;\n\tTue,  4 Jan 2022 13:57:19 +0100 (CET)",
            "from mail-wm1-x335.google.com (mail-wm1-x335.google.com\n\t[IPv6:2a00:1450:4864:20::335])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 04D44604F4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  4 Jan 2022 13:57:17 +0100 (CET)",
            "by mail-wm1-x335.google.com with SMTP id\n\tp1-20020a1c7401000000b00345c2d068bdso20139909wmc.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 04 Jan 2022 04:57:17 -0800 (PST)",
            "from naush-laptop.pitowers.org\n\t([2a00:1098:3142:14:cf71:3c12:f0dd:e082])\n\tby smtp.gmail.com with ESMTPSA id\n\tp15sm35673753wmj.46.2022.01.04.04.57.15\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 04 Jan 2022 04:57:16 -0800 (PST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"ChhKve4S\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=isbLew+Hfz3OpvSyqfWQp0MtX+L2fQ4xOz39/GgziQQ=;\n\tb=ChhKve4SPkNEedsSBhMdCHBx5YIxKVm+SUjemYATuT4M7+tyebaUtp3GUp1a1glUTo\n\tGXS0AsOhJABIPsRBst2yAMXJm3Ow/nWmO9Fj0hw0MVtlpqyVZ6mUSqkRdjscTpAWg11B\n\tycFQnFwvq9IU3sVvI73X6AmhMD3ZZ5SV0MP2iw+CNZhodky8zxAN0+WrhSDaujrOSYOH\n\tf91KrLHb73lVtVAGnQnvJx+L00nR3ghWuwWGKNVoJ3ba7moWIvQ7pSBLd10HhJmZRvEy\n\t+YUwcSc0vkspWJnBvnWfG/wXMPLTAltJ8JSjf0/Ak4g0q5Vc4SEBFSUKTHs/tLPVoWYv\n\tygLg==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=isbLew+Hfz3OpvSyqfWQp0MtX+L2fQ4xOz39/GgziQQ=;\n\tb=2MoYHtIwuxwSVSO5buMT6tPd94EB7+bL/4Xpkgh76OXTk2Ndvqnh1nTJ34Va6k9KPh\n\tampPcqGCwbylH67dgEuoyeAAdGSkQ6zhIERFQ+U4xGAgttrZey7rP67X/Ud1KZJXq90E\n\tS+FdG4it5jxMYCnKQzdNGQu0Z9dKu1iTx5vXrMWOO26MkjRoyDcc/aZlGJsgfAaIdmZ9\n\tTSO9E+zro+LsAB56ButiZN+GIcZNe44ES/muhKWkXbSSgjF7kZFue2KdjavZySKHYcRX\n\tG1U6BY+JRSKOVb+dL9aM6YZJVaK6S0R+C6OxHB6wUg6qvMigPGAh97CLFo9EWcfQR9nC\n\ttKWQ==",
        "X-Gm-Message-State": "AOAM5326tS29EJ6UyIWKbFf4rC9jpJMUXVSvIlJLx39+8VtqA5yY9xqb\n\tG5qKdE3K2OHEkFbgOYxhWrbOMBBSfEaVmg==",
        "X-Google-Smtp-Source": "ABdhPJzegxBGYBEIqKtylSQQNFA7M1i84Oo1F3oP6o3JAwnTyXRotEutTBcpFveu0SPq7x/0PbXZSg==",
        "X-Received": "by 2002:a7b:c007:: with SMTP id c7mr42423899wmb.27.1641301036525;\n\tTue, 04 Jan 2022 04:57:16 -0800 (PST)",
        "From": "Naushir Patuck <naush@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue,  4 Jan 2022 12:57:08 +0000",
        "Message-Id": "<20220104125709.1273546-2-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20220104125709.1273546-1-naush@raspberrypi.com>",
        "References": "<20220104125709.1273546-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v5 1/2] pipeline: raspberrypi: Move sensor\n\tentity detection out of registerCamera()",
        "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": "Enumerate the sensor device entities in PipelineHandlerRPi::match() and loop\nover PipelineHandlerRPi::registerCamera() for each sensor found. This will\nallow the pipeline handler to register multiple cameras attached to a single\nUnicam instance with a Video Mux device.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n .../pipeline/raspberrypi/raspberrypi.cpp      | 35 +++++++++++--------\n 1 file changed, 20 insertions(+), 15 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex b5c687da467f..a6d1e8570abf 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -312,7 +312,7 @@ private:\n \t\treturn static_cast<RPiCameraData *>(camera->_d());\n \t}\n \n-\tint registerCamera(MediaDevice *unicam, MediaDevice *isp);\n+\tint registerCamera(MediaDevice *unicam, MediaDevice *isp, MediaEntity *sensorEntity);\n \tint queueAllBuffers(Camera *camera);\n \tint prepareBuffers(Camera *camera);\n \tvoid freeBuffers(Camera *camera);\n@@ -1069,16 +1069,28 @@ bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator)\n \t\treturn false;\n \t}\n \n-\tint ret = registerCamera(unicamDevice, ispDevice);\n-\tif (ret) {\n-\t\tLOG(RPI, Error) << \"Failed to register camera: \" << ret;\n-\t\treturn false;\n+\t/*\n+\t * The loop below is used to register multiple cameras behind one or more\n+\t * video mux devices that are attached to a particular Unicam instance.\n+\t * Obviously these cameras cannot be used simultaneously.\n+\t */\n+\tunsigned int numCameras = 0;\n+\tfor (MediaEntity *entity : unicamDevice->entities()) {\n+\t\tif (entity->function() != MEDIA_ENT_F_CAM_SENSOR)\n+\t\t\tcontinue;\n+\n+\t\tint ret = registerCamera(unicamDevice, ispDevice, entity);\n+\t\tif (ret)\n+\t\t\tLOG(RPI, Error) << \"Failed to register camera \"\n+\t\t\t\t\t<< entity->name() << \": \" << ret;\n+\t\telse\n+\t\t\tnumCameras++;\n \t}\n \n-\treturn true;\n+\treturn !!numCameras;\n }\n \n-int PipelineHandlerRPi::registerCamera(MediaDevice *unicam, MediaDevice *isp)\n+int PipelineHandlerRPi::registerCamera(MediaDevice *unicam, MediaDevice *isp, MediaEntity *sensorEntity)\n {\n \tstd::unique_ptr<RPiCameraData> data = std::make_unique<RPiCameraData>(this);\n \n@@ -1119,14 +1131,7 @@ int PipelineHandlerRPi::registerCamera(MediaDevice *unicam, MediaDevice *isp)\n \tdata->isp_[Isp::Output1].dev()->bufferReady.connect(data.get(), &RPiCameraData::ispOutputDequeue);\n \tdata->isp_[Isp::Stats].dev()->bufferReady.connect(data.get(), &RPiCameraData::ispOutputDequeue);\n \n-\t/* Identify the sensor. */\n-\tfor (MediaEntity *entity : unicam->entities()) {\n-\t\tif (entity->function() == MEDIA_ENT_F_CAM_SENSOR) {\n-\t\t\tdata->sensor_ = std::make_unique<CameraSensor>(entity);\n-\t\t\tbreak;\n-\t\t}\n-\t}\n-\n+\tdata->sensor_ = std::make_unique<CameraSensor>(sensorEntity);\n \tif (!data->sensor_)\n \t\treturn -EINVAL;\n \n",
    "prefixes": [
        "libcamera-devel",
        "v5",
        "1/2"
    ]
}