{"id":16937,"url":"https://patchwork.libcamera.org/api/1.1/patches/16937/?format=json","web_url":"https://patchwork.libcamera.org/patch/16937/","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":"<20220803112150.3040287-3-paul.elder@ideasonboard.com>","date":"2022-08-03T11:21:43","name":"[libcamera-devel,2/9] utils: ipc: Add support for enums in function parameters","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"308dd2ca0888bde76b273c7fb7ed33ed67dd1729","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/1.1/people/17/?format=json","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/16937/mbox/","series":[{"id":3367,"url":"https://patchwork.libcamera.org/api/1.1/series/3367/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3367","date":"2022-08-03T11:21:41","name":"utils: ipc: Add support for enums and Flags","version":1,"mbox":"https://patchwork.libcamera.org/series/3367/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16937/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16937/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 B9507BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  3 Aug 2022 11:22:05 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D2646603E6;\n\tWed,  3 Aug 2022 13:22:04 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 82C07603E6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  3 Aug 2022 13:22:03 +0200 (CEST)","from pyrite.rasen.tech (h175-177-042-159.catv02.itscom.jp\n\t[175.177.42.159])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 54CA98B;\n\tWed,  3 Aug 2022 13:22:02 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1659525724;\n\tbh=a1zdUdGwfXBQbb4g0Vs1xAJ5GlDVFdqWiJB6wDxV0G8=;\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=Es0x/UqhSvO1ki9CxsFCVonj8GlrOesHv8iNlvZBhVwuqblJhzkJclHakhMOwxTxC\n\tgWXrb7IF/WainnkLE7aCNyNzWZePyC0ZbrL8a8DTSfAPUzSpaaSPAqWijDjuQEAmSd\n\tYwvRV/fGc9hs+yHBq4NiduCo4aAfGVRCx7Yw/cAk6GHxH+U9wDMUnKdGk5VcmgXDaX\n\toe5QIoCVrTnKo8ezpGiJJUefgTF4AJ+S8adx7SNG+jMI7WDNt/19X39diSfEHoXcdg\n\tVwGiohr2ZYXjQrSQnt2tFB1wAoRh8lvD54GnI6/66tEOBUBPLv3wd5gOk00P/p5FRj\n\tJ7Zso9fCXXRRg==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1659525723;\n\tbh=a1zdUdGwfXBQbb4g0Vs1xAJ5GlDVFdqWiJB6wDxV0G8=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=NeC1ahirX5iagmOTlt6M2b4vlEgIhQAa+ce9RhVxMtRmz/WgEPjqJc2WuhBl+G9XZ\n\tEYA5/hzYtWeJDaKDz5UgXKQnYvoNw9F0lDsPgMEkuHukgme57RKtPKY6x09VyGZu63\n\tt5pt4Jl3DYV9VcxKhsF24FF9+W2v+bStFx+hGm4o="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"NeC1ahir\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  3 Aug 2022 20:21:43 +0900","Message-Id":"<20220803112150.3040287-3-paul.elder@ideasonboard.com>","X-Mailer":"git-send-email 2.30.2","In-Reply-To":"<20220803112150.3040287-1-paul.elder@ideasonboard.com>","References":"<20220803112150.3040287-1-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 2/9] utils: ipc: Add support for enums in\n\tfunction parameters","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":"Paul Elder via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Paul Elder <paul.elder@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"There is already support for enums as struct members, but there was no\nsupport for enums in function parameters. Add it.\n\nThis does not add support for returning enums as direct return values.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n---\n .../libcamera_templates/proxy_functions.tmpl        | 13 +++++++++++--\n 1 file changed, 11 insertions(+), 2 deletions(-)","diff":"diff --git a/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl b/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl\nindex bac826a7..dc35620f 100644\n--- a/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl\n+++ b/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl\n@@ -59,7 +59,11 @@\n {%- else %}\n \tstd::tie({{param.mojom_name}}Buf, std::ignore) =\n {%- endif %}\n+{%- if param|is_enum %}\n+\t\tIPADataSerializer<uint32_t>::serialize(static_cast<uint32_t>({{param.mojom_name}})\n+{%- else %}\n \t\tIPADataSerializer<{{param|name}}>::serialize({{param.mojom_name}}\n+{% endif -%}\n {{- \", &controlSerializer_\" if param|needs_control_serializer -}}\n );\n {%- endfor %}\n@@ -97,7 +101,12 @@\n  # This code is meant to be used by macro deserialize_call.\n  #}\n {%- macro deserialize_param(param, pointer, loop, buf, fds, iter, data_size) -%}\n-{{\"*\" if pointer}}{{param.mojom_name}} = IPADataSerializer<{{param|name}}>::deserialize(\n+{{\"*\" if pointer}}{{param.mojom_name}} =\n+{%- if param|is_enum %}\n+static_cast<{{param|name_full}}>(IPADataSerializer<uint32_t>::deserialize(\n+{%- else %}\n+IPADataSerializer<{{param|name}}>::deserialize(\n+{%- endif %}\n \t{{buf}}{{- \".cbegin()\" if not iter}} + {{param.mojom_name}}Start,\n {%- if loop.last and not iter %}\n \t{{buf}}.cend()\n@@ -121,7 +130,7 @@\n {%- if param|needs_control_serializer %}\n \t&controlSerializer_\n {%- endif -%}\n-);\n+){{\")\" if param|is_enum}};\n {%- endmacro -%}\n \n \n","prefixes":["libcamera-devel","2/9"]}