summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-10-13 01:25:03 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-11-20 21:47:59 +0200
commitbc9527de454670445a8d69b039e65c0e5c7a699e (patch)
treeadf86f3510db4421b58507d7c4ac97171e49bec8 /include
parent5f90d52d6e36c7d1c77717d026d0e7413d597d5e (diff)
ipa: Define a plain C API
The C++ objects that are expected to convey data through the IPA API will have associated methods that would require IPAs to link to libcamera. Even though the libcamera license allows this, suppliers of closed-source IPAs may have a different interpretation. To ease their mind and clearly separate vendor code and libcamera code, define a plain C IPA API. The corresponding C objects are stored in plain C structures or have their binary format documented, removing the need for linking to libcamera code on the IPA side. The C API adds three new C structures, ipa_context, ipa_context_ops and ipa_callback_ops. The ipa_context_ops and ipa_callback_ops contain function pointers for all the IPA interface methods and signals, respectively. The ipa_context represents a context of operation for the IPA, and is passed to the IPA oparations. The IPAInterface class is retained as it is easier to use than a plain C API for pipeline handlers, and wrappers will be developed to translate between the C and C++ APIs. Switching to the C API internally will be done in a second step. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'include')
-rw-r--r--include/ipa/ipa_interface.h77
1 files changed, 77 insertions, 0 deletions
diff --git a/include/ipa/ipa_interface.h b/include/ipa/ipa_interface.h
index 35dc4b4e..3a423e37 100644
--- a/include/ipa/ipa_interface.h
+++ b/include/ipa/ipa_interface.h
@@ -7,6 +7,82 @@
#ifndef __LIBCAMERA_IPA_INTERFACE_H__
#define __LIBCAMERA_IPA_INTERFACE_H__
+#include <stddef.h>
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct ipa_context {
+ const struct ipa_context_ops *ops;
+};
+
+struct ipa_stream {
+ unsigned int id;
+ unsigned int pixel_format;
+ unsigned int width;
+ unsigned int height;
+};
+
+struct ipa_control_info_map {
+ unsigned int id;
+ const uint8_t *data;
+ size_t size;
+};
+
+struct ipa_buffer_plane {
+ int dmabuf;
+ size_t length;
+};
+
+struct ipa_buffer {
+ unsigned int id;
+ unsigned int num_planes;
+ struct ipa_buffer_plane planes[3];
+};
+
+struct ipa_control_list {
+ const uint8_t *data;
+ unsigned int size;
+};
+
+struct ipa_operation_data {
+ unsigned int operation;
+ const uint32_t *data;
+ unsigned int num_data;
+ const struct ipa_control_list *lists;
+ unsigned int num_lists;
+};
+
+struct ipa_callback_ops {
+ void (*queue_frame_action)(void *cb_ctx, unsigned int frame,
+ struct ipa_operation_data &data);
+};
+
+struct ipa_context_ops {
+ void (*destroy)(struct ipa_context *ctx);
+ void (*init)(struct ipa_context *ctx);
+ void (*register_callbacks)(struct ipa_context *ctx,
+ const struct ipa_callback_ops *callbacks,
+ void *cb_ctx);
+ void (*configure)(struct ipa_context *ctx,
+ const struct ipa_stream *streams,
+ unsigned int num_streams,
+ const struct ipa_control_info_map *maps,
+ unsigned int num_maps);
+ void (*map_buffers)(struct ipa_context *ctx,
+ const struct ipa_buffer *buffers,
+ size_t num_buffers);
+ void (*unmap_buffers)(struct ipa_context *ctx, const unsigned int *ids,
+ size_t num_buffers);
+ void (*process_event)(struct ipa_context *ctx,
+ const struct ipa_operation_data *data);
+};
+
+#ifdef __cplusplus
+}
+
#include <map>
#include <vector>
@@ -53,5 +129,6 @@ public:
};
} /* namespace libcamera */
+#endif
#endif /* __LIBCAMERA_IPA_INTERFACE_H__ */