Show a patch.

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

{
    "id": 9070,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/9070/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/9070/",
    "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": "<20200729112524.498276-1-kieran.bingham@ideasonboard.com>",
    "date": "2020-07-29T11:25:24",
    "name": "[libcamera-devel] libcamera: formats: add planeCount helper",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "0324cde1563d5b320669de72b8c4c1ce5b8d1e3c",
    "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/9070/mbox/",
    "series": [
        {
            "id": 1162,
            "url": "https://patchwork.libcamera.org/api/1.1/series/1162/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1162",
            "date": "2020-07-29T11:25:24",
            "name": "[libcamera-devel] libcamera: formats: add planeCount helper",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/1162/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/9070/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/9070/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 7CF43BD86F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 29 Jul 2020 11:25:30 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E99FA613C6;\n\tWed, 29 Jul 2020 13:25:29 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B94DC6039D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 29 Jul 2020 13:25:28 +0200 (CEST)",
            "from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net\n\t[86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 3783231F;\n\tWed, 29 Jul 2020 13:25:28 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"aSOr9iE7\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1596021928;\n\tbh=g9HHEzOn2o5jDpI2r9rI/lRulfkHTPZVImGukbpkles=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=aSOr9iE7nt3CvgkyzZQPXUONB/aNWEzRlQYNf14DDGW+G5CSzyULTGNUeajnKLBK5\n\tA1SR6St5X1CeWzNJEXbjbmEw2NWHFb70PUQqqg9OfG5ReE/JK6brFCcuvzrf8JuxSc\n\t5QtV1uEwM0rY9RIcWldkSqm/My9RRqMG+okqvE1E=",
        "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>",
        "To": "libcamera devel <libcamera-devel@lists.libcamera.org>",
        "Date": "Wed, 29 Jul 2020 12:25:24 +0100",
        "Message-Id": "<20200729112524.498276-1-kieran.bingham@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH] libcamera: formats: add planeCount helper",
        "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>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Determine the number of planes used by a format by counting the number\nof PxielFormatPlaneInfo entries with a valid entry.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n include/libcamera/internal/formats.h |  2 ++\n src/libcamera/formats.cpp            | 22 ++++++++++++++++++++++\n 2 files changed, 24 insertions(+)",
    "diff": "diff --git a/include/libcamera/internal/formats.h b/include/libcamera/internal/formats.h\nindex 0bb151044294..beeaab1ae2f5 100644\n--- a/include/libcamera/internal/formats.h\n+++ b/include/libcamera/internal/formats.h\n@@ -45,6 +45,8 @@ public:\n \tunsigned int frameSize(const Size &size,\n \t\t\t       const std::array<unsigned int, 3> &strides) const;\n \n+\tunsigned int planeCount() const;\n+\n \t/* \\todo Add support for non-contiguous memory planes */\n \tconst char *name;\n \tPixelFormat format;\ndiff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp\nindex cd63c15cb926..70d31fb36c37 100644\n--- a/src/libcamera/formats.cpp\n+++ b/src/libcamera/formats.cpp\n@@ -805,4 +805,26 @@ PixelFormatInfo::frameSize(const Size &size,\n \treturn sum;\n }\n \n+/**\n+ * \\brief Identify the number of planes represented by the format\n+ *\n+ * This function counts the number of planes which have a valid configuration\n+ * and uses that to determine the number of planes used by the format.\n+ *\n+ * \\return The number of planes used by the format\n+ */\n+unsigned int PixelFormatInfo::planeCount() const\n+{\n+\tunsigned int count = 0;\n+\n+\tfor (const PixelFormatPlaneInfo &p : planes) {\n+\t\tif (p.bytesPerGroup == 0)\n+\t\t\tbreak;\n+\n+\t\tcount++;\n+\t}\n+\n+\treturn count;\n+}\n+\n } /* namespace libcamera */\n",
    "prefixes": [
        "libcamera-devel"
    ]
}