[libcamera-devel,17/23] ipa: raspberrypi: Add mojom data definition file

Message ID 20200915142038.28757-18-paul.elder@ideasonboard.com
State Superseded
Headers show
Series
  • IPA isolation implementation
Related show

Commit Message

Paul Elder Sept. 15, 2020, 2:20 p.m. UTC
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 <paul.elder@ideasonboard.com>
---
 include/libcamera/ipa/meson.build       |   4 +-
 include/libcamera/ipa/raspberrypi.h     |  18 ----
 include/libcamera/ipa/raspberrypi.mojom | 110 ++++++++++++++++++++++++
 3 files changed, 113 insertions(+), 19 deletions(-)
 create mode 100644 include/libcamera/ipa/raspberrypi.mojom

Patch

diff --git a/include/libcamera/ipa/meson.build b/include/libcamera/ipa/meson.build
index f61a5a8f..c80594d7 100644
--- a/include/libcamera/ipa/meson.build
+++ b/include/libcamera/ipa/meson.build
@@ -13,7 +13,9 @@  install_headers(libcamera_ipa_headers,
 # Prepare IPA/IPC generation components
 #
 
-ipa_mojom_files = []
+ipa_mojom_files = [
+    'raspberrypi.mojom',
+]
 
 mojom_generator = find_program('../../../utils/ipc/generate.py')
 
diff --git a/include/libcamera/ipa/raspberrypi.h b/include/libcamera/ipa/raspberrypi.h
index ca62990e..ed2b12d5 100644
--- a/include/libcamera/ipa/raspberrypi.h
+++ b/include/libcamera/ipa/raspberrypi.h
@@ -10,24 +10,6 @@ 
 #include <libcamera/control_ids.h>
 #include <libcamera/controls.h>
 
-enum RPiConfigParameters {
-	RPI_IPA_CONFIG_LS_TABLE = (1 << 0),
-	RPI_IPA_CONFIG_STAGGERED_WRITE = (1 << 1),
-	RPI_IPA_CONFIG_SENSOR = (1 << 2),
-};
-
-enum RPiOperations {
-	RPI_IPA_ACTION_V4L2_SET_STAGGERED = 1,
-	RPI_IPA_ACTION_V4L2_SET_ISP,
-	RPI_IPA_ACTION_STATS_METADATA_COMPLETE,
-	RPI_IPA_ACTION_RUN_ISP,
-	RPI_IPA_ACTION_RUN_ISP_AND_DROP_FRAME,
-	RPI_IPA_ACTION_EMBEDDED_COMPLETE,
-	RPI_IPA_EVENT_SIGNAL_STAT_READY,
-	RPI_IPA_EVENT_SIGNAL_ISP_PREPARE,
-	RPI_IPA_EVENT_QUEUE_REQUEST,
-};
-
 enum RPiIpaMask {
 	ID		= 0x0ffff,
 	STATS		= 0x10000,
diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom
new file mode 100644
index 00000000..6e1ce8c0
--- /dev/null
+++ b/include/libcamera/ipa/raspberrypi.mojom
@@ -0,0 +1,110 @@ 
+// these should probably should be in a mojo header
+struct CameraSensorInfo {};
+struct ControlInfoMap {};
+struct ControlList {};
+struct FileDescriptor {};
+// for libcamera types, hasFd attr is needed to notify compiler that struct has fd
+[hasFd] struct IPABuffer {};
+struct IPASettings {};
+struct IPAStream {};
+
+// automatically add const and & to all inputs (that are not primitives)
+// automatically add pointer to all outputs (that are not primitives)
+// if return value is single and primitive, then return as ret value
+// if return value is multiple or non-primitive, then return as output param
+// const not allowed in array/map due to mojo parser
+// default sync
+interface IPARPiInterface {
+	init(IPASettings settings) => (int32 ret);
+	start() => (int32 ret);
+	stop();
+
+	configure(CameraSensorInfo sensorInfo,
+		  map<uint32, IPAStream> streamConfig,
+		  map<uint32, ControlInfoMap> entityControls,
+		  RPiConfigureParams ipaConfig)
+		=> (RPiConfigureParams results);
+
+	// arrays get turned into vectors
+	mapBuffers(array<IPABuffer> buffers);
+	unmapBuffers(array<uint32> ids);
+
+	[async] processEvent(RPiEventParams data);
+};
+
+// these shall not return anything
+// only async allowed (sync not allowed)
+interface IPARPiCallbackInterface {
+	queueFrameAction(uint32 frame, RPiActionParams action);
+};
+
+enum RPiConfigParameters {
+	RPI_IPA_CONFIG_LS_TABLE,
+	RPI_IPA_CONFIG_STAGGERED_WRITE,
+	RPI_IPA_CONFIG_SENSOR,
+	RPI_IPA_CONFIG_SEND_FD,
+};
+
+enum RPiEvents {
+	RPI_IPA_EVENT_SIGNAL_STAT_READY,
+	RPI_IPA_EVENT_SIGNAL_ISP_PREPARE,
+	RPI_IPA_EVENT_QUEUE_REQUEST,
+	RPI_IPA_EVENT_SEND_FD,
+};
+
+enum RPiActions {
+	RPI_IPA_ACTION_V4L2_SET_STAGGERED,
+	RPI_IPA_ACTION_V4L2_SET_ISP,
+	RPI_IPA_ACTION_STATS_METADATA_COMPLETE,
+	RPI_IPA_ACTION_RUN_ISP,
+	RPI_IPA_ACTION_RUN_ISP_AND_DROP_FRAME,
+	RPI_IPA_ACTION_EMBEDDED_COMPLETE,
+};
+
+// Custom Data containers
+
+struct RPiStaggeredWritePayload {
+	uint32 gainDelay;
+	uint32 exposureDelay;
+	uint32 sensorMetadata;
+};
+
+struct RPiIspPreparePayload {
+	uint32 embeddedbufferId;
+	uint32 bayerbufferId;
+};
+
+struct RPiStatsCompletePayload {
+	uint32 bufferId;
+	ControlList controls;
+};
+
+struct RPiConfigurePayload {
+	RPiConfigParameters op;
+	FileDescriptor lsTableHandle;
+	int32 lsTableHandleStatic = -1;
+	RPiStaggeredWritePayload staggeredWriteResult;
+	ControlList controls;
+	int32 bufferFd;
+};
+
+// First level payload
+
+struct RPiConfigureParams {
+	array<RPiConfigurePayload> payload;
+};
+
+struct RPiEventParams {
+	RPiEvents ev;
+	uint32 bufferId;
+	RPiIspPreparePayload ispPrepare;
+	ControlList controls;
+	int32 bufferFd;
+};
+
+struct RPiActionParams {
+	RPiActions op;
+	uint32 bufferId;
+	RPiStatsCompletePayload statsComplete;
+	ControlList controls;
+};