{"id":9935,"url":"https://patchwork.libcamera.org/api/1.1/patches/9935/?format=json","web_url":"https://patchwork.libcamera.org/patch/9935/","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":"<20201002143154.468162-28-paul.elder@ideasonboard.com>","date":"2020-10-02T14:31:43","name":"[libcamera-devel,v3,27/38] ipa: raspberrypi: Add mojom data definition file","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"dbf8ec4c890826f84bae62362caf2f2e0e723111","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/9935/mbox/","series":[{"id":1348,"url":"https://patchwork.libcamera.org/api/1.1/series/1348/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1348","date":"2020-10-02T14:31:16","name":"IPA isolation implementation","version":3,"mbox":"https://patchwork.libcamera.org/series/1348/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/9935/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/9935/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 A8D3AC3B5C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  2 Oct 2020 14:33:13 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7613A63BE8;\n\tFri,  2 Oct 2020 16:33:13 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DA26263B98\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  2 Oct 2020 16:33:11 +0200 (CEST)","from pyrite.rasen.tech (unknown\n\t[IPv6:2400:4051:61:600:2c71:1b79:d06d:5032])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1BB9C2A2;\n\tFri,  2 Oct 2020 16:33:09 +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=\"m4ypgw7T\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1601649191;\n\tbh=Pm1OZ25w8/uLGTSJKJLWmLNWSCbcp2Fn+Rh3AQ46Uc8=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=m4ypgw7TXDh9r8rGRH2eEjR02qngv8+7qBjObNMgj5fm8NoItuHyckfmnifCyTXwr\n\t5uG2s+yFoYYkRUB2PVh7//kFbmHDqZjF0Ar88vzCyFPgeKvhmB0AydXzOPfOG2KGo3\n\tszv0lDLROcvfGKnW68hbJuKitx1cKo7/Q58DTv4c=","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Fri,  2 Oct 2020 23:31:43 +0900","Message-Id":"<20201002143154.468162-28-paul.elder@ideasonboard.com>","X-Mailer":"git-send-email 2.27.0","In-Reply-To":"<20201002143154.468162-1-paul.elder@ideasonboard.com>","References":"<20201002143154.468162-1-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v3 27/38] ipa: raspberrypi: Add mojom data\n\tdefinition file","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":"Add a mojom data definition for raspberrypi pipeline handler's IPAs.\nThis is a direct translation of what the raspberrypi pipeline handler\nand IPA was using before with IPAOperationData.\n\nAlso move the enums from raspberrypi.h to raspberrypi.mojom\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n\n---\nChanges in v3:\n- remove stray comment about how our compiler will generate code\n- add ipa.rpi namespace\n  - not ipa.RPi, because namespace conflict\n- remove RPi prefix from struct and enum names\n- add transform parameter to struct ConfigInput\n\nChanges in v2:\n- rebased on \"libcamera: pipeline: ipa: raspberrypi: Rework drop frame\n  signalling\"\n- add license\n- move generic documentation to core.mojom\n- move documentation from IPA interface\n- customize the RPi IPA interface to make the pipeline and IPA code\n  cleaner\n---\n include/libcamera/ipa/meson.build       |   4 +-\n include/libcamera/ipa/raspberrypi.h     |  18 ---\n include/libcamera/ipa/raspberrypi.mojom | 158 ++++++++++++++++++++++++\n 3 files changed, 161 insertions(+), 19 deletions(-)\n create mode 100644 include/libcamera/ipa/raspberrypi.mojom","diff":"diff --git a/include/libcamera/ipa/meson.build b/include/libcamera/ipa/meson.build\nindex 590a1464..55c97fa5 100644\n--- a/include/libcamera/ipa/meson.build\n+++ b/include/libcamera/ipa/meson.build\n@@ -24,7 +24,9 @@ ipa_mojom_core = custom_target(core_mojom_file.split('.')[0] + '_mojom_module',\n                                    '--mojoms', '@INPUT@'\n                                ])\n \n-ipa_mojom_files = []\n+ipa_mojom_files = [\n+    'raspberrypi.mojom',\n+]\n \n ipa_mojoms = []\n \ndiff --git a/include/libcamera/ipa/raspberrypi.h b/include/libcamera/ipa/raspberrypi.h\nindex b3041591..58262f6c 100644\n--- a/include/libcamera/ipa/raspberrypi.h\n+++ b/include/libcamera/ipa/raspberrypi.h\n@@ -14,24 +14,6 @@ namespace libcamera {\n \n namespace RPi {\n \n-enum ConfigParameters {\n-\tIPA_CONFIG_LS_TABLE = (1 << 0),\n-\tIPA_CONFIG_STAGGERED_WRITE = (1 << 1),\n-\tIPA_CONFIG_SENSOR = (1 << 2),\n-\tIPA_CONFIG_DROP_FRAMES = (1 << 3),\n-};\n-\n-enum Operations {\n-\tIPA_ACTION_V4L2_SET_STAGGERED = 1,\n-\tIPA_ACTION_V4L2_SET_ISP,\n-\tIPA_ACTION_STATS_METADATA_COMPLETE,\n-\tIPA_ACTION_RUN_ISP,\n-\tIPA_ACTION_EMBEDDED_COMPLETE,\n-\tIPA_EVENT_SIGNAL_STAT_READY,\n-\tIPA_EVENT_SIGNAL_ISP_PREPARE,\n-\tIPA_EVENT_QUEUE_REQUEST,\n-};\n-\n enum BufferMask {\n \tID\t\t= 0x00ffff,\n \tSTATS\t\t= 0x010000,\ndiff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom\nnew file mode 100644\nindex 00000000..bbef5178\n--- /dev/null\n+++ b/include/libcamera/ipa/raspberrypi.mojom\n@@ -0,0 +1,158 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+\n+module ipa.rpi;\n+\n+import \"include/libcamera/ipa/core.mojom\";\n+\n+interface IPARPiInterface {\n+/**\n+ * \\fn init()\n+ * \\brief Initialise the IPAInterface\n+ * \\param[in] settings The IPA initialization settings\n+ *\n+ * This function initializes the IPA interface. It shall be called before any\n+ * other function of the IPAInterface. The \\a settings carry initialization\n+ * parameters that are valid for the whole life time of the IPA interface.\n+ */\n+\tinit(IPASettings settings) => (int32 ret);\n+\n+/**\n+ * \\fn start()\n+ * \\brief Start the IPA\n+ *\n+ * This method informs the IPA module that the camera is about to be started.\n+ * The IPA module shall prepare any resources it needs to operate.\n+ *\n+ * \\return 0 on success or a negative error code otherwise\n+ */\n+\tstart() => (int32 ret);\n+\n+/**\n+ * \\fn stop()\n+ * \\brief Stop the IPA\n+ *\n+ * This method informs the IPA module that the camera is stopped. The IPA module\n+ * shall release resources prepared in start().\n+ */\n+\tstop();\n+\n+/**\n+ * \\fn configure()\n+ * \\brief Configure the IPA stream and sensor settings\n+ * \\param[in] sensorInfo Camera sensor information\n+ * \\param[in] streamConfig Configuration of all active streams\n+ * \\param[in] entityControls Controls provided by the pipeline entities\n+ * \\param[in] ipaConfig Pipeline-handler-specific configuration data\n+ * \\param[out] result Pipeline-handler-specific configuration result\n+ *\n+ * This method shall be called when the camera is started to inform the IPA of\n+ * the camera's streams and the sensor settings. The meaning of the numerical\n+ * keys in the \\a streamConfig and \\a entityControls maps is defined by the IPA\n+ * protocol.\n+ *\n+ * The \\a sensorInfo conveys information about the camera sensor settings that\n+ * the pipeline handler has selected for the configuration. The IPA may use\n+ * that information to tune its algorithms.\n+ *\n+ * The \\a ipaConfig and \\a result parameters carry custom data passed by the\n+ * pipeline handler to the IPA and back. The pipeline handler may set the \\a\n+ * result parameter to null if the IPA protocol doesn't need to pass a result\n+ * back through the configure() function.\n+ */\n+\tconfigure(CameraSensorInfo sensorInfo,\n+\t\t  map<uint32, IPAStream> streamConfig,\n+\t\t  map<uint32, ControlInfoMap> entityControls,\n+\t\t  ConfigInput ipaConfig)\n+\t\t=> (ConfigOutput results);\n+\n+/**\n+ * \\fn mapBuffers()\n+ * \\brief Map buffers shared between the pipeline handler and the IPA\n+ * \\param[in] buffers List of buffers to map\n+ *\n+ * This method informs the IPA module of memory buffers set up by the pipeline\n+ * handler that the IPA needs to access. It provides dmabuf file handles for\n+ * each buffer, and associates the buffers with unique numerical IDs.\n+ *\n+ * IPAs shall map the dmabuf file handles to their address space and keep a\n+ * cache of the mappings, indexed by the buffer numerical IDs. The IDs are used\n+ * in all other IPA interface methods to refer to buffers, including the\n+ * unmapBuffers() method.\n+ *\n+ * All buffers that the pipeline handler wishes to share with an IPA shall be\n+ * mapped with this method. Buffers may be mapped all at once with a single\n+ * call, or mapped and unmapped dynamically at runtime, depending on the IPA\n+ * protocol. Regardless of the protocol, all buffers mapped at a given time\n+ * shall have unique numerical IDs.\n+ *\n+ * The numerical IDs have no meaning defined by the IPA interface, and IPA\n+ * protocols shall not give them any specific meaning either. They should be\n+ * treated as opaque handles by IPAs, with the only exception that ID zero is\n+ * invalid.\n+ *\n+ * \\sa unmapBuffers()\n+ *\n+ * \\todo Provide a generic implementation of mapBuffers and unmapBuffers for\n+ * IPAs\n+ */\n+\tmapBuffers(array<IPABuffer> buffers);\n+\n+/**\n+ * \\fn unmapBuffers()\n+ * \\brief Unmap buffers shared by the pipeline to the IPA\n+ * \\param[in] ids List of buffer IDs to unmap\n+ *\n+ * This method removes mappings set up with mapBuffers(). Buffers may be\n+ * unmapped all at once with a single call, or selectively at runtime, depending\n+ * on the IPA protocol. Numerical IDs of unmapped buffers may be reused when\n+ * mapping new buffers.\n+ *\n+ * \\sa mapBuffers()\n+ */\n+\tunmapBuffers(array<uint32> ids);\n+\n+\t[async] signalStatReady(uint32 bufferId);\n+\t[async] signalQueueRequest(ControlList controls);\n+\t[async] signalIspPrepare(IspPreparePayload data);\n+};\n+\n+interface IPARPiCallbackInterface {\n+\tstatsMetadataComplete(uint32 bufferId, ControlList controls);\n+\trunIsp(uint32 bufferId);\n+\tembeddedComplete(uint32 bufferId);\n+\tsetIsp(ControlList controls);\n+\tsetStaggered(ControlList controls);\n+};\n+\n+\n+enum ConfigParameters {\n+\tRPI_IPA_CONFIG_LS_TABLE = 0x01,\n+\tRPI_IPA_CONFIG_STAGGERED_WRITE = 0x02,\n+\tRPI_IPA_CONFIG_SENSOR = 0x04,\n+\tRPI_IPA_CONFIG_DROP_FRAMES = 0x08,\n+};\n+\n+struct StaggeredWritePayload {\n+\tuint32 gainDelay;\n+\tuint32 exposureDelay;\n+\tuint32 sensorMetadata;\n+};\n+\n+struct IspPreparePayload {\n+\tuint32 embeddedbufferId;\n+\tuint32 bayerbufferId;\n+};\n+\n+struct ConfigInput {\n+\tuint32 op;\n+\tuint32 transform;\n+\tFileDescriptor lsTableHandle;\n+\tint32 lsTableHandleStatic = -1;\n+};\n+\n+struct ConfigOutput {\n+\tuint32 op;\n+\tStaggeredWritePayload staggeredWriteResult;\n+\tControlList controls;\n+\tint32 dropFrameCount;\n+};\n","prefixes":["libcamera-devel","v3","27/38"]}