From patchwork Sat Dec 5 10:30:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 10579 X-Patchwork-Delegate: paul.elder@ideasonboard.com Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 713E2BDB20 for ; Sat, 5 Dec 2020 10:31:54 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3C6EB6360A; Sat, 5 Dec 2020 11:31:54 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="tf7PL/Wy"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 485D36360A for ; Sat, 5 Dec 2020 11:31:53 +0100 (CET) Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id AF37A2A4; Sat, 5 Dec 2020 11:31:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1607164312; bh=jkMmEfmBZu75bYo9vyv++4LTDqQ7RFD8v5WM+5tUKO4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tf7PL/Wyoam7SiXAg1DjG8D+Md5w1+NXJuRIqL5NvTgYaMMj0xaCRDT80w/PG+z1A v5+2/RzKCtot4xCRFS1Vbfi9mRU7gyn+G+y2jRgOXCi0Ds4ceIJ/Td4rzlbIrVUelm rlwG7DOubvdcAXsHt7ZrzogyfGXweUubcAr3s8g0= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Sat, 5 Dec 2020 19:30:59 +0900 Message-Id: <20201205103106.242080-17-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201205103106.242080-1-paul.elder@ideasonboard.com> References: <20201205103106.242080-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 16/23] ipa: raspberrypi: Add mojom data definition file X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add a mojom data definition for raspberrypi pipeline handler's IPAs. This is a direct translation of what the raspberrypi pipeline handler and IPA was using before with IPAOperationData. Also move the enums from raspberrypi.h to raspberrypi.mojom Signed-off-by: Paul Elder --- Changes in v5: - rename some structs Changes in v4: - rename IPARPiCallbackInterface to IPARPiEventInterface Changes in v3: - remove stray comment about how our compiler will generate code - add ipa.rpi namespace - not ipa.RPi, because namespace conflict - remove RPi prefix from struct and enum names - add transform parameter to struct ConfigInput Changes in v2: - rebased on "libcamera: pipeline: ipa: raspberrypi: Rework drop frame signalling" - add license - move generic documentation to core.mojom - move documentation from IPA interface - customize the RPi IPA interface to make the pipeline and IPA code cleaner --- include/libcamera/ipa/meson.build | 4 +- include/libcamera/ipa/raspberrypi.h | 18 ---- include/libcamera/ipa/raspberrypi.mojom | 119 ++++++++++++++++++++++++ 3 files changed, 122 insertions(+), 19 deletions(-) create mode 100644 include/libcamera/ipa/raspberrypi.mojom diff --git a/include/libcamera/ipa/meson.build b/include/libcamera/ipa/meson.build index 087f5bbd..5c838d5c 100644 --- a/include/libcamera/ipa/meson.build +++ b/include/libcamera/ipa/meson.build @@ -24,7 +24,9 @@ ipa_mojom_core = custom_target(core_mojom_file.split('.')[0] + '_mojom_module', '--mojoms', '@INPUT@' ]) -ipa_mojom_files = [] +ipa_mojom_files = [ + 'raspberrypi.mojom', +] ipa_mojoms = [] diff --git a/include/libcamera/ipa/raspberrypi.h b/include/libcamera/ipa/raspberrypi.h index 2b55dbfc..df30b4a2 100644 --- a/include/libcamera/ipa/raspberrypi.h +++ b/include/libcamera/ipa/raspberrypi.h @@ -16,24 +16,6 @@ namespace libcamera { namespace RPi { -enum ConfigParameters { - IPA_CONFIG_LS_TABLE = (1 << 0), - IPA_CONFIG_STAGGERED_WRITE = (1 << 1), - IPA_CONFIG_SENSOR = (1 << 2), - IPA_CONFIG_DROP_FRAMES = (1 << 3), -}; - -enum Operations { - IPA_ACTION_V4L2_SET_STAGGERED = 1, - IPA_ACTION_V4L2_SET_ISP, - IPA_ACTION_STATS_METADATA_COMPLETE, - IPA_ACTION_RUN_ISP, - IPA_ACTION_EMBEDDED_COMPLETE, - IPA_EVENT_SIGNAL_STAT_READY, - IPA_EVENT_SIGNAL_ISP_PREPARE, - IPA_EVENT_QUEUE_REQUEST, -}; - enum BufferMask { ID = 0x00ffff, STATS = 0x010000, diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom new file mode 100644 index 00000000..81744ac6 --- /dev/null +++ b/include/libcamera/ipa/raspberrypi.mojom @@ -0,0 +1,119 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ + +module ipa.rpi; + +import "include/libcamera/ipa/core.mojom"; + +enum ConfigParameters { + ConfigLsTable = 0x01, + ConfigStaggeredWrite = 0x02, + ConfigSensor = 0x04, + ConfigDropFrames = 0x08, +}; + +struct SensorConfig { + uint32 gainDelay; + uint32 exposureDelay; + uint32 sensorMetadata; +}; + +struct ISPConfig { + uint32 embeddedbufferId; + uint32 bayerbufferId; +}; + +struct ConfigInput { + uint32 op; + uint32 transform; + FileDescriptor lsTableHandle; + int32 lsTableHandleStatic = -1; +}; + +struct ConfigOutput { + uint32 op; + SensorConfig sensorConfig; + ControlList controls; + int32 dropFrameCount; +}; + +interface IPARPiInterface { + init(IPASettings settings) => (int32 ret); + start() => (int32 ret); + stop(); + + /** + * \fn configure() + * \brief Configure the IPA stream and sensor settings + * \param[in] sensorInfo Camera sensor information + * \param[in] streamConfig Configuration of all active streams + * \param[in] entityControls Controls provided by the pipeline entities + * \param[in] ipaConfig Pipeline-handler-specific configuration data + * \param[out] result Pipeline-handler-specific configuration result + * + * This method shall be called when the camera is started to inform the IPA of + * the camera's streams and the sensor settings. + * + * The \a sensorInfo conveys information about the camera sensor settings that + * the pipeline handler has selected for the configuration. + * + * The \a ipaConfig and \a result parameters carry data passed by the + * pipeline handler to the IPA and back. + */ + configure(CameraSensorInfo sensorInfo, + map streamConfig, + map entityControls, + ConfigInput ipaConfig) + => (ConfigOutput results); + + /** + * \fn mapBuffers() + * \brief Map buffers shared between the pipeline handler and the IPA + * \param[in] buffers List of buffers to map + * + * This method informs the IPA module of memory buffers set up by the pipeline + * handler that the IPA needs to access. It provides dmabuf file handles for + * each buffer, and associates the buffers with unique numerical IDs. + * + * IPAs shall map the dmabuf file handles to their address space and keep a + * cache of the mappings, indexed by the buffer numerical IDs. The IDs are used + * in all other IPA interface methods to refer to buffers, including the + * unmapBuffers() method. + * + * All buffers that the pipeline handler wishes to share with an IPA shall be + * mapped with this method. Buffers may be mapped all at once with a single + * call, or mapped and unmapped dynamically at runtime, depending on the IPA + * protocol. Regardless of the protocol, all buffers mapped at a given time + * shall have unique numerical IDs. + * + * The numerical IDs have no meaning defined by the IPA interface, and + * should be treated as opaque handles by IPAs, with the only exception + * that ID zero is invalid. + * + * \sa unmapBuffers() + */ + mapBuffers(array buffers); + + /** + * \fn unmapBuffers() + * \brief Unmap buffers shared by the pipeline to the IPA + * \param[in] ids List of buffer IDs to unmap + * + * This method removes mappings set up with mapBuffers(). Numerical IDs + * of unmapped buffers may be reused when mapping new buffers. + * + * \sa mapBuffers() + */ + unmapBuffers(array ids); + + [async] signalStatReady(uint32 bufferId); + [async] signalQueueRequest(ControlList controls); + [async] signalIspPrepare(ISPConfig data); +}; + +interface IPARPiEventInterface { + statsMetadataComplete(uint32 bufferId, ControlList controls); + runIsp(uint32 bufferId); + embeddedComplete(uint32 bufferId); + setIsp(ControlList controls); + setStaggered(ControlList controls); +};