Show a patch.

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

{
    "id": 18940,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/18940/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/18940/",
    "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": "<20230814112849.176943-4-gabbymg94@gmail.com>",
    "date": "2023-08-14T11:28:47",
    "name": "[libcamera-devel,RFC,3/5] libcamera: v4l2 device: Store buffer info in planes",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "1bdeafc98fc57bbe0e8abbffd8d69cdcc28b1104",
    "submitter": {
        "id": 160,
        "url": "https://patchwork.libcamera.org/api/1.1/people/160/?format=api",
        "name": "Gabrielle George",
        "email": "gabbymg94@gmail.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/18940/mbox/",
    "series": [
        {
            "id": 4003,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4003/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4003",
            "date": "2023-08-14T11:28:44",
            "name": "RFC:Add UVC Metadata buffer timestamp support",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/4003/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/18940/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/18940/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 D6AE7C32B0\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 14 Aug 2023 11:29:02 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7C255628E4;\n\tMon, 14 Aug 2023 13:29:00 +0200 (CEST)",
            "from mail-oa1-x30.google.com (mail-oa1-x30.google.com\n\t[IPv6:2001:4860:4864:20::30])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 76E2C61E0B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 14 Aug 2023 13:28:56 +0200 (CEST)",
            "by mail-oa1-x30.google.com with SMTP id\n\t586e51a60fabf-1c4d67f493bso826148fac.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 14 Aug 2023 04:28:56 -0700 (PDT)",
            "from localhost.localdomain (97-115-76-16.ptld.qwest.net.\n\t[97.115.76.16]) by smtp.gmail.com with ESMTPSA id\n\tc3-20020a9d6c83000000b006b92509e76esm4163817otr.32.2023.08.14.04.28.53\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 14 Aug 2023 04:28:54 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1692012540;\n\tbh=267zk0bj+HNkmSZr/ZXjLE2OK+LNcaCshBj12zeX6rY=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=uMrkP/3mq+ET60L50/Bg1o0T1wDt1G0iFaogUtLAO4bk/21JQ7rg8uOlgnPHtyxfU\n\tQmbhhKNlH5vkAilO7xRayzoBX+M7oxYAZTBQZSUFRnRHVIRUmAdD8OTCO6qGyqibe5\n\tJWGaf+wQkXGsSJkGMa9RA77ZN62egRUuQzKGfOO5x1xTj+/1Q6QWhIXCsvoEE1NbvX\n\tBEJZ5LgFAPjZwvg5RI3/niG4h/t2krjnlRddp+Q99/jAFvg5yjm7lN42EcAQAjQQVJ\n\t49Kangqg8y5IZo7wi/s2Z331fPYUUHsNwhOq4QRVJgU2L+MWzdCv1TEsC4jO8Z+shp\n\tk/gICcieAo9mg==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=gmail.com; s=20221208; t=1692012535; x=1692617335;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:to:from:from:to:cc:subject:date:message-id\n\t:reply-to; bh=6tSJ7JOO2z+X4Zmaf/GuvpJdVyVmlcb8Z4R8sdhfdp0=;\n\tb=QVT6zUUqZwnTsMh30wZpvk+vfMd6edwdSTgs/oYPitNFB1+0gM/xLRgudF0+L5foMT\n\tcEWmnnbURBgwjUTfBE3XSNhV4405xPAUH46CSKy+Q/g9tn137MJw5CgWeg71ng6ZiW9h\n\tuS/r2haaN21xB+FpjFZwXVTm874z8cCG5AhbEJfKFctqqF41lrGX5YPIoMJFRhMcs3y5\n\tTnBVnr6l5VLInEs6Zi8tv1N6RaPnidGjNKCErBbhSwsNz9gTK/fee06/puQUNCthJ0f2\n\tBZpYtk3ehte+vnD6mbK4C7NbG1dZI/NubZrwLTnDTkxuiOJFWr6D93bAZ7ZPILeJ8HHL\n\tkn9w=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"QVT6zUUq\"; dkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20221208; t=1692012535; x=1692617335;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=6tSJ7JOO2z+X4Zmaf/GuvpJdVyVmlcb8Z4R8sdhfdp0=;\n\tb=ipUkByu9k0JsO1o4wqYp7ksIxKuLWmUtRWLrtJ6oynmHiozgkMHkZdPiUERXXuwh4s\n\t7pzY/a5Hj7i4A1umqdmuGbosjVyJCuKJDFO/rWh0sUH86+SIJaffSJjhHh+9+YAUXjYI\n\tXIdnWahQtJSwOp5iAZ1JhTIhK5BUhyhGgzXtd7oxF9g4mR05mTTN2OAlyC7iqAKE15Hh\n\tJIIgNht39tgGs5Qy01KkfmQ7shXxWv89Gk1k0YCULcdH4vIgNKVFtr/sCK3QLH8wop9e\n\tjUeOmMZatjKuwIspkRx2EUPAxiroD+GDY8kkAukKt7udnYTNz2eOfywxyrbpDi0wBOaR\n\tHkLA==",
        "X-Gm-Message-State": "AOJu0YwtKxY4c6Aj/S/JyuSMg2xsLSd7RQFir7bPseT8uZhgGXVav6Be\n\t9qo10qtJRy9KoiJENfgBuzWw7RZN34L7FQ==",
        "X-Google-Smtp-Source": "AGHT+IGe7Gn43V1JUUIxPdiMSegfVqXn6us7yfiXzI4QExjH9pwI0ateCkZPZaMcR6EqEa4qqQcc6w==",
        "X-Received": "by 2002:a05:6871:886:b0:1c4:ee87:d3ea with SMTP id\n\tr6-20020a056871088600b001c4ee87d3eamr3424797oaq.36.1692012534860; \n\tMon, 14 Aug 2023 04:28:54 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org, kieran.bingham@ideasonboard.com,\n\tvedantparanjape160201@gmail.com, gabbymg94@gmail.com",
        "Date": "Mon, 14 Aug 2023 04:28:47 -0700",
        "Message-Id": "<20230814112849.176943-4-gabbymg94@gmail.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20230814112849.176943-1-gabbymg94@gmail.com>",
        "References": "<20230814112849.176943-1-gabbymg94@gmail.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [RFC PATCH 3/5] libcamera: v4l2 device: Store\n\tbuffer info in planes",
        "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>",
        "From": "Gabby George via libcamera-devel <libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Gabby George <gabbymg94@gmail.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "To perform a memory mapping using mmap, the MappedFrameBuffer class needs the plane offset and file descriptor information of the frame buffer's plane(s). This information is provided in the response to REQBUF, which happens during buffer allocation. Store the plane offset and file descriptor information in the buffer's plane at the time of allocation.\n\nCurrently, there is a metadata buffer type (metadata format UVCH) that does not support exporting buffers using EXPBUF, so this should only be done if the buffer type is metadata capture.\n\nSigned-off-by: Gabby George <gabbymg94@gmail.com>\n---\n src/libcamera/v4l2_videodevice.cpp | 32 ++++++++++++++++++++----------\n 1 file changed, 21 insertions(+), 11 deletions(-)",
    "diff": "diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex a72ef64d..8cf427c0 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -1402,18 +1402,28 @@ std::unique_ptr<FrameBuffer> V4L2VideoDevice::createBuffer(unsigned int index)\n \n \tstd::vector<FrameBuffer::Plane> planes;\n \tfor (unsigned int nplane = 0; nplane < numPlanes; nplane++) {\n-\t\tUniqueFD fd = exportDmabufFd(buf.index, nplane);\n-\t\tif (!fd.isValid())\n-\t\t\treturn nullptr;\n-\n \t\tFrameBuffer::Plane plane;\n-\t\tplane.fd = SharedFD(std::move(fd));\n-\t\t/*\n-\t\t * V4L2 API doesn't provide dmabuf offset information of plane.\n-\t\t * Set 0 as a placeholder offset.\n-\t\t * \\todo Set the right offset once V4L2 API provides a way.\n-\t\t */\n-\t\tplane.offset = 0;\n+\n+\t\tif (buf.type != V4L2_BUF_TYPE_META_CAPTURE) {\n+\t\t\tUniqueFD fd = exportDmabufFd(buf.index, nplane);\n+\t\t\tif (!fd.isValid())\n+\t\t\t\treturn nullptr;\n+\t\t\tplane.fd = SharedFD(std::move(fd));\n+\n+\t\t\t/*\n+\t\t\t* V4L2 API doesn't provide dmabuf offset information of plane.\n+\t\t\t* Set 0 as a placeholder offset.\n+\t\t\t* \\todo Set the right offset once V4L2 API provides a way.\n+\t\t\t*/\n+\t\t\tplane.offset = 0;\n+\t\t} else {\n+\t\t\t/* Dmabuf fd is not exported for metadata, so store\n+\t\t\t * the offset from the querybuf call and this device's fd.\n+\t\t\t */\n+\t\t\tSharedFD tmp(this->fd());\n+\t\t\tplane.fd = tmp;\n+\t\t\tplane.offset = buf.m.offset;\n+\t\t}\n \t\tplane.length = multiPlanar ? buf.m.planes[nplane].length : buf.length;\n \n \t\tplanes.push_back(std::move(plane));\n",
    "prefixes": [
        "libcamera-devel",
        "RFC",
        "3/5"
    ]
}