Show a patch.

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

{
    "id": 18939,
    "url": "https://patchwork.libcamera.org/api/patches/18939/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/18939/",
    "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": "<20230814112849.176943-3-gabbymg94@gmail.com>",
    "date": "2023-08-14T11:28:46",
    "name": "[libcamera-devel,RFC,2/5] libcamera: MappedFrameBuffer: Use stored plane offset",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "06068363a6eef3733ca98e190915f9ff7d2c2428",
    "submitter": {
        "id": 160,
        "url": "https://patchwork.libcamera.org/api/people/160/?format=api",
        "name": "Gabrielle George",
        "email": "gabbymg94@gmail.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/18939/mbox/",
    "series": [
        {
            "id": 4003,
            "url": "https://patchwork.libcamera.org/api/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/18939/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/18939/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 2BAE0BF415\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 027F1628E2;\n\tMon, 14 Aug 2023 13:28:59 +0200 (CEST)",
            "from mail-ot1-x331.google.com (mail-ot1-x331.google.com\n\t[IPv6:2607:f8b0:4864:20::331])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4566761E0B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 14 Aug 2023 13:28:55 +0200 (CEST)",
            "by mail-ot1-x331.google.com with SMTP id\n\t46e09a7af769-6bd0a0a6766so3376165a34.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 14 Aug 2023 04:28:55 -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.52\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 14 Aug 2023 04:28:53 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1692012540;\n\tbh=rW76to3CewSxJAQvDPi+DUc/D/dhgJYr6JQ8WoIjpTg=;\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=pWJb8VAUmS9xCWpqYPs+Jm+Rm29cCNU0blTTqEC4DvYgk8ZY5m4hw1O/dVpbycefe\n\t1K+lhcO6hcNXlFEjW1uOwxxmnK3Nl21fZyt50vVPjQ66gp6FPR9S/1oRKZhrVo22Xs\n\tZhw4ueR71CWKZ+0893UhWpWdeOzQqwqYRx7NKTIFD9Y0HU+7DEaDgyTM+Xe3KQVMIi\n\t7MMwIj92ujGvaTwEx+sAe1JzyNHXnluPyTNG97KbhIPc/fZLFljY7Kh+FQBNxev+21\n\t3Xb9scJK4sowju3+nEpSP4k8yS0TPRYp6Pujb5VaFeO0I3cqxmnEQbMGppjHwkr2PO\n\tFNYpZFkT1Fy9A==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=gmail.com; s=20221208; t=1692012534; x=1692617334;\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=71lcLD82o1iAaxJ3Re4tzyvkOeuk5oyOwipvfyqdST0=;\n\tb=rY8pnJ5Mi2DyNfkXS2wigqfEe/vtvH3t+Go/DGs2PCfQpOotuUnAl6KGv2P9NaxYg7\n\tcYQuEy4M0yMwkF6kRkGDVnmiZS10HIS0Xfc1newMZMJv2iS8eCA5t7p6wisF8zc+mM3V\n\tL6JrG9LGhAP0+ik3Rw0Phhn4Bq5OW5iFK3AONxvL3dNUwyeJXpzTcvxt07uQ54Fhy9e8\n\tR3hAKSFawgyDT/tT0NJ1gPq/ARiyG4MGA8UEz/nn8nahnj0jwDakDf1duFnXya7nmi34\n\tmX1ksCw7GdovYSFBGq2z3QdpRNs7fH4SQLPrRustsnRRSK2rLLGKTNxgee1yFi4moYs8\n\t+Y0g=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"rY8pnJ5M\"; dkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20221208; t=1692012534; x=1692617334;\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=71lcLD82o1iAaxJ3Re4tzyvkOeuk5oyOwipvfyqdST0=;\n\tb=HNgm7IASyqaIURPqDZEp628Rur7khxLK6t9J6N0JOL6DWdqO/vItCQI+WV7biUah+4\n\t38uGpqygKVeMmtY2w8qpBZ83kK950sRfPE5fs6BqBa77xHqcBEXt4jxLaKIcOhVZ/1ni\n\t5/3j7BougkN6/72B9rcMUloYSsoSsZ4Rn0uujj/767NwpSneM+Y6jZvfcC9jcP9gEkNK\n\t8PeZtsKJTmk2Q45FXqPgDXnZTq9NiNCbxODVBUnE12vdvJeQBsBSzP53v3M103/krZ75\n\tx+9FlvsBl+7vhFHUKRwg+xV7BV5b+VSbYIWLXuEYXOHA7KjjeLm8ERnoLj3wXPOi91Fo\n\tGscg==",
        "X-Gm-Message-State": "AOJu0YyYR944pjo3Nskdx4vRTyopT0X/L3gR7zyy3/PUQaGmLUtS2SER\n\t7D/a9K1vyzXotZg4iPsgNait2b5z8/4HTQ==",
        "X-Google-Smtp-Source": "AGHT+IFv6cfQhSTa63M6Aj8mwrEdcXweH6Asj5AUdP5Dxu3PXz3DHGYt+yr7U/WrcPbgBlQU3wqCzg==",
        "X-Received": "by 2002:a05:6830:1007:b0:6b9:6712:d4ad with SMTP id\n\ta7-20020a056830100700b006b96712d4admr7951864otp.36.1692012533808; \n\tMon, 14 Aug 2023 04:28:53 -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:46 -0700",
        "Message-Id": "<20230814112849.176943-3-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 2/5] libcamera: MappedFrameBuffer: Use\n\tstored plane offset",
        "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": "When calling mmap, the mapped frame buffer class hard-codes the offset value to 0. TODO: EDIT ME WHEN YOU HAVE MORE VERBAL REASONING SKILLS\n\nSigned-off-by: Gabby George <gabbymg94@gmail.com>\n---\n include/libcamera/internal/mapped_framebuffer.h |  2 +-\n src/libcamera/mapped_framebuffer.cpp            | 16 ++++++++++++----\n 2 files changed, 13 insertions(+), 5 deletions(-)",
    "diff": "diff --git a/include/libcamera/internal/mapped_framebuffer.h b/include/libcamera/internal/mapped_framebuffer.h\nindex fb39adbf..fac86344 100644\n--- a/include/libcamera/internal/mapped_framebuffer.h\n+++ b/include/libcamera/internal/mapped_framebuffer.h\n@@ -54,7 +54,7 @@ public:\n \n \tusing MapFlags = Flags<MapFlag>;\n \n-\tMappedFrameBuffer(const FrameBuffer *buffer, MapFlags flags);\n+\tMappedFrameBuffer(const FrameBuffer *buffer, MapFlags flags, bool usePlaneOffset = false);\n };\n \n LIBCAMERA_FLAGS_ENABLE_OPERATORS(MappedFrameBuffer::MapFlag)\ndiff --git a/src/libcamera/mapped_framebuffer.cpp b/src/libcamera/mapped_framebuffer.cpp\nindex 6860069b..fcbb38ec 100644\n--- a/src/libcamera/mapped_framebuffer.cpp\n+++ b/src/libcamera/mapped_framebuffer.cpp\n@@ -172,12 +172,13 @@ MappedBuffer::~MappedBuffer()\n  * \\brief Map all planes of a FrameBuffer\n  * \\param[in] buffer FrameBuffer to be mapped\n  * \\param[in] flags Protection flags to apply to map\n+ * \\param[in] usePlaneOffset Use offset stored in buffer's plane; default false\n  *\n  * Construct an object to map a frame buffer for CPU access. The mapping can be\n  * made as Read only, Write only or support Read and Write operations by setting\n  * the MapFlag flags accordingly.\n  */\n-MappedFrameBuffer::MappedFrameBuffer(const FrameBuffer *buffer, MapFlags flags)\n+MappedFrameBuffer::MappedFrameBuffer(const FrameBuffer *buffer, MapFlags flags, bool usePlaneOffset)\n {\n \tASSERT(!buffer->planes().empty());\n \tplanes_.reserve(buffer->planes().size());\n@@ -223,8 +224,14 @@ MappedFrameBuffer::MappedFrameBuffer(const FrameBuffer *buffer, MapFlags flags)\n \t\tconst int fd = plane.fd.get();\n \t\tauto &info = mappedBuffers[fd];\n \t\tif (!info.address) {\n-\t\t\tvoid *address = mmap(nullptr, info.mapLength, mmapFlags,\n-\t\t\t\t\t     MAP_SHARED, fd, 0);\n+\t\t\tvoid *address;\n+\t\t\tif (usePlaneOffset) {\n+\t\t\t\taddress = mmap(nullptr, plane.length, mmapFlags,\n+\t\t\t\t\t       MAP_SHARED, fd, plane.offset);\n+\t\t\t} else {\n+\t\t\t\taddress = mmap(nullptr, info.mapLength, mmapFlags,\n+\t\t\t\t\t       MAP_SHARED, fd, 0);\n+\t\t\t}\n \t\t\tif (address == MAP_FAILED) {\n \t\t\t\terror_ = -errno;\n \t\t\t\tLOG(Buffer, Error) << \"Failed to mmap plane: \"\n@@ -236,7 +243,8 @@ MappedFrameBuffer::MappedFrameBuffer(const FrameBuffer *buffer, MapFlags flags)\n \t\t\tmaps_.emplace_back(info.address, info.mapLength);\n \t\t}\n \n-\t\tplanes_.emplace_back(info.address + plane.offset, plane.length);\n+\t\tuint8_t *storedAddress = usePlaneOffset ? info.address : info.address + plane.offset;\n+\t\tplanes_.emplace_back(storedAddress, plane.length);\n \t}\n }\n \n",
    "prefixes": [
        "libcamera-devel",
        "RFC",
        "2/5"
    ]
}