Show a patch.

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

{
    "id": 13508,
    "url": "https://patchwork.libcamera.org/api/patches/13508/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/13508/",
    "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": "<20210826112539.170694-10-hiroh@chromium.org>",
    "date": "2021-08-26T11:25:39",
    "name": "[libcamera-devel,v3,9/9] libcamera: framebuffer: Add assertion to detect offset is unfilled",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "56e6ba927067fcacb59d5010b740ba8ab36cd894",
    "submitter": {
        "id": 63,
        "url": "https://patchwork.libcamera.org/api/people/63/?format=api",
        "name": "Hirokazu Honda",
        "email": "hiroh@chromium.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/13508/mbox/",
    "series": [
        {
            "id": 2398,
            "url": "https://patchwork.libcamera.org/api/series/2398/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2398",
            "date": "2021-08-26T11:25:30",
            "name": "Add offset to FrameBuffer::Plane",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/2398/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/13508/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/13508/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 87683C3245\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 26 Aug 2021 11:26:10 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 31D3B688A6;\n\tThu, 26 Aug 2021 13:26:06 +0200 (CEST)",
            "from mail-pf1-x430.google.com (mail-pf1-x430.google.com\n\t[IPv6:2607:f8b0:4864:20::430])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 256A868921\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Aug 2021 13:26:04 +0200 (CEST)",
            "by mail-pf1-x430.google.com with SMTP id e16so2065587pfc.6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Aug 2021 04:26:04 -0700 (PDT)",
            "from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:203:a5bc:b3dd:7208:bec1])\n\tby smtp.gmail.com with ESMTPSA id\n\ts29sm3472057pgl.38.2021.08.26.04.26.00\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 26 Aug 2021 04:26:02 -0700 (PDT)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"cgnYyoLO\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=sdvZj+O5ZkY80gq4NQVCkYqBtQlsOOMwEm2QRiBE960=;\n\tb=cgnYyoLObtc085VnCPEwb+lmNyUJnzIkEUMWmhJ2YO84fxbVuFWU72vOoqMZ2/hpXl\n\tAMOVHrlzxpo3ne3PmSkVH4mtuE49ljA6Aj5J0iKr7qrY7vrVQh5D2PIYH4RNfIsjME0B\n\t3+VZJEmnSS0/K+Dt2y0ruQAcBt9DqL5vW9dZc=",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\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=sdvZj+O5ZkY80gq4NQVCkYqBtQlsOOMwEm2QRiBE960=;\n\tb=o+91DBFfk9QQ6Os/yybUxM8qU54sKJ4SxQBvGqjeVCHwGpLjgyBtXasBvYzdNXduDu\n\tsF8qowVFGnazzjRbHnhleA6SRUOcpnYyhCCPCKRgsDZi9Ecr/XEmhA7C9wzbiOBpR7+v\n\tJPGH7gTzpt57kfvQKhjNBrK7O4xdayjWVfFwQ4SVZhHHrdBcs4xBLgFxhbTTgltmEgZx\n\tIKxBAFmpHLCeVhuTotOQBkYqzf+L0EsoKxOYVrnc7WIXrRX9Fda3ejIDdrK2q2dVXiHJ\n\tk4G2CziHx0hXn9GH9wwiiSsuIADN4R4vhFpd8uMF8y2sD0+3lIpgEBSErDw8hWge0SpV\n\tFCLQ==",
        "X-Gm-Message-State": "AOAM531okg3nT9qLmSseJ6jp/CpkVPJKM8JzPuVPf+IgTtqQhc+MoUpC\n\tCyNGprmOuqfH130NdGeqDSPtAkelToLwXw==",
        "X-Google-Smtp-Source": "ABdhPJxU9steJFMtAaJUKs0h0THz0NMBkm0+TgtqRfyhNc3+yRFsrd0CA9xxt/o6XWpcpEb+mFOCpg==",
        "X-Received": "by 2002:a63:d250:: with SMTP id t16mr2975281pgi.95.1629977162480;\n\tThu, 26 Aug 2021 04:26:02 -0700 (PDT)",
        "From": "Hirokazu Honda <hiroh@chromium.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu, 26 Aug 2021 20:25:39 +0900",
        "Message-Id": "<20210826112539.170694-10-hiroh@chromium.org>",
        "X-Mailer": "git-send-email 2.33.0.rc2.250.ged5fa647cd-goog",
        "In-Reply-To": "<20210826112539.170694-1-hiroh@chromium.org>",
        "References": "<20210826112539.170694-1-hiroh@chromium.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v3 9/9] libcamera: framebuffer: Add\n\tassertion to detect offset is unfilled",
        "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": "The offset variable is introduced to FrameBuffer::Plane. In order to\ndetect that the plane is used while the offset is not set, this adds\nthe assertion to FrameBuffer::planes(). It should be removed in the\nfuture.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/framebuffer.h | 13 +++++++++++--\n src/libcamera/framebuffer.cpp   |  5 +++++\n 2 files changed, 16 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/include/libcamera/framebuffer.h b/include/libcamera/framebuffer.h\nindex 5de3c744..d5aeff00 100644\n--- a/include/libcamera/framebuffer.h\n+++ b/include/libcamera/framebuffer.h\n@@ -7,6 +7,8 @@\n #ifndef __LIBCAMERA_FRAMEBUFFER_H__\n #define __LIBCAMERA_FRAMEBUFFER_H__\n \n+#include <assert.h>\n+#include <limits>\n #include <stdint.h>\n #include <vector>\n \n@@ -41,14 +43,21 @@ class FrameBuffer final : public Extensible\n \n public:\n \tstruct Plane {\n+\t\tstatic constexpr unsigned int kInvalidOffset = std::numeric_limits<unsigned int>::max();\n \t\tFileDescriptor fd;\n-\t\tunsigned int offset;\n+\t\tunsigned int offset = kInvalidOffset;\n \t\tunsigned int length;\n \t};\n \n \tFrameBuffer(const std::vector<Plane> &planes, unsigned int cookie = 0);\n \n-\tconst std::vector<Plane> &planes() const { return planes_; }\n+\tconst std::vector<Plane> &planes() const\n+\t{\n+\t\t/* \\todo Remove the assertions after sufficient testing */\n+\t\tfor (const auto &plane : planes_)\n+\t\t\tassert(plane.offset != Plane::kInvalidOffset);\n+\t\treturn planes_;\n+\t}\n \n \tRequest *request() const;\n \tconst FrameMetadata &metadata() const { return metadata_; }\ndiff --git a/src/libcamera/framebuffer.cpp b/src/libcamera/framebuffer.cpp\nindex bf7a52ad..c99f5b15 100644\n--- a/src/libcamera/framebuffer.cpp\n+++ b/src/libcamera/framebuffer.cpp\n@@ -170,6 +170,11 @@ FrameBuffer::Private::Private()\n  * multiple dmabufs, based on the camera requirements.\n  */\n \n+/**\n+ * \\var FrameBuffer::Plane::kInvalidOffset\n+ * \\brief Invalid offset value, to identify uninitialized planes\n+ */\n+\n /**\n  * \\var FrameBuffer::Plane::fd\n  * \\brief The dmabuf file descriptor\n",
    "prefixes": [
        "libcamera-devel",
        "v3",
        "9/9"
    ]
}