{"id":13716,"url":"https://patchwork.libcamera.org/api/1.1/patches/13716/?format=json","web_url":"https://patchwork.libcamera.org/patch/13716/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210907111038.739104-5-jacopo@jmondi.org>","date":"2021-09-07T11:10:37","name":"[libcamera-devel,v2,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=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/13716/mbox/","series":[{"id":2487,"url":"https://patchwork.libcamera.org/api/1.1/series/2487/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2487","date":"2021-09-07T11:10:33","name":"libcamera: control serializer fixes","version":2,"mbox":"https://patchwork.libcamera.org/series/2487/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/13716/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/13716/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 7363FBE175\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  7 Sep 2021 11:10:02 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 400EA69179;\n\tTue,  7 Sep 2021 13:10:02 +0200 (CEST)","from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net\n\t[217.70.183.195])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A62366916C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  7 Sep 2021 13:09:59 +0200 (CEST)","(Authenticated sender: jacopo@jmondi.org)\n\tby relay3-d.mail.gandi.net (Postfix) with ESMTPSA id A199260009;\n\tTue,  7 Sep 2021 11:09:58 +0000 (UTC)"],"From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue,  7 Sep 2021 13:10:37 +0200","Message-Id":"<20210907111038.739104-5-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.32.0","In-Reply-To":"<20210907111038.739104-1-jacopo@jmondi.org>","References":"<20210907111038.739104-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 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","v2","4/5"]}