Show a patch.

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

{
    "id": 13934,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/13934/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/13934/",
    "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": "<20210924172525.160482-5-jacopo@jmondi.org>",
    "date": "2021-09-24T17:25:24",
    "name": "[libcamera-devel,v3,4/5] libcamera: control_serializer: Serialize info::def()",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "702f32f8c08aa2f8673742a3c7a428486ccc16a8",
    "submitter": {
        "id": 3,
        "url": "https://patchwork.libcamera.org/api/1.1/people/3/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo@jmondi.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/13934/mbox/",
    "series": [
        {
            "id": 2567,
            "url": "https://patchwork.libcamera.org/api/1.1/series/2567/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2567",
            "date": "2021-09-24T17:25:20",
            "name": "libcamera: control serializer fixes",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/2567/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/13934/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/13934/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 C5473BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 24 Sep 2021 17:24:50 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 63E8369196;\n\tFri, 24 Sep 2021 19:24:50 +0200 (CEST)",
            "from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net\n\t[217.70.183.201])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B83BC69188\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 24 Sep 2021 19:24:45 +0200 (CEST)",
            "(Authenticated sender: jacopo@jmondi.org)\n\tby relay8-d.mail.gandi.net (Postfix) with ESMTPSA id A6A751BF208;\n\tFri, 24 Sep 2021 17:24:44 +0000 (UTC)"
        ],
        "From": "Jacopo Mondi <jacopo@jmondi.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 24 Sep 2021 19:25:24 +0200",
        "Message-Id": "<20210924172525.160482-5-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.32.0",
        "In-Reply-To": "<20210924172525.160482-1-jacopo@jmondi.org>",
        "References": "<20210924172525.160482-1-jacopo@jmondi.org>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v3 4/5] libcamera: control_serializer:\n\tSerialize info::def()",
        "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 ControlInfo class was originally designed to only transport\nthe control's minimum and maximum values which represent the control's\nvalid limits.\n\nLater the default value of the control has been added to the ControlInfo\nclass, but the control serializer implementation has not been updated\naccordingly.\n\nThis causes issues in IPA modules making use of ControlInfo::def() as,\nwhen running in isolation, they would receive 0.\n\nFix that by serializing and deserializing the additional ControlValue\nand update the protocol description accordingly.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/control_serializer.cpp |  6 ++++--\n src/libcamera/ipa_controls.cpp       | 14 ++++++++------\n 2 files changed, 12 insertions(+), 8 deletions(-)",
    "diff": "diff --git a/src/libcamera/control_serializer.cpp b/src/libcamera/control_serializer.cpp\nindex d42840cddecb..f1245ea620ab 100644\n--- a/src/libcamera/control_serializer.cpp\n+++ b/src/libcamera/control_serializer.cpp\n@@ -105,7 +105,7 @@ size_t ControlSerializer::binarySize(const ControlValue &value)\n \n size_t ControlSerializer::binarySize(const ControlInfo &info)\n {\n-\treturn binarySize(info.min()) + binarySize(info.max());\n+\treturn binarySize(info.min()) + binarySize(info.max()) + binarySize(info.def());\n }\n \n /**\n@@ -158,6 +158,7 @@ void ControlSerializer::store(const ControlInfo &info, ByteStreamBuffer &buffer)\n {\n \tstore(info.min(), buffer);\n \tstore(info.max(), buffer);\n+\tstore(info.def(), buffer);\n }\n \n /**\n@@ -346,8 +347,9 @@ ControlInfo ControlSerializer::loadControlInfo(ControlType type,\n \n \tControlValue min = loadControlValue(type, b);\n \tControlValue max = loadControlValue(type, b);\n+\tControlValue def = loadControlValue(type, b);\n \n-\treturn ControlInfo(min, max);\n+\treturn ControlInfo(min, max, def);\n }\n \n /**\ndiff --git a/src/libcamera/ipa_controls.cpp b/src/libcamera/ipa_controls.cpp\nindex fb98cda30ede..c3489bbff646 100644\n--- a/src/libcamera/ipa_controls.cpp\n+++ b/src/libcamera/ipa_controls.cpp\n@@ -108,17 +108,19 @@\n  *           +-------------------------+       .\n  *         / | ...                     |       | entry[n].offset\n  *         | +-------------------------+ <-----´\n- *    Data | | minimum value (#n)      | \\\n- * section | +-------------------------+ | Entry #n\n- *         | | maximum value (#n)      | /\n+ *         | | minimum value (#n)      | \\\n+ *    Data | +-------------------------+ |\n+ * section | | maximum value (#n)      | | Entry #n\n+ *         | +-------------------------+ |\n+ *         | | default value (#n)      | /\n  *         | +-------------------------+\n  *         \\ | ...                     |\n  *           +-------------------------+\n  * ~~~~\n  *\n- * The minimum and maximum value are stored in the platform's native data\n- * format. The ipa_control_info_entry::offset field stores the offset from the\n- * beginning of the data section to the info data.\n+ * The minimum, maximum and default values are stored in the platform's native\n+ * data format. The ipa_control_info_entry::offset field stores the offset from\n+ * the beginning of the data section to the info data.\n  *\n  * Info data in the data section shall be stored in the same order as the\n  * entries array, shall be aligned to a multiple of 8 bytes, and shall be\n",
    "prefixes": [
        "libcamera-devel",
        "v3",
        "4/5"
    ]
}