summaryrefslogtreecommitdiff
path: root/src/ipa
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2020-04-24 12:01:49 +0200
committerJacopo Mondi <jacopo@jmondi.org>2020-04-28 22:25:23 +0200
commitfd554f9dba3171b624e584d50c7554f9c5f9cc52 (patch)
tree2c2cdf6a92aeed7de55107333f51be1f2ce3ca78 /src/ipa
parentee4bb92aaeefaed04603d0b0c279d0d4f0be0197 (diff)
libcamera: ipa: Add support for CameraSensorInfo
Add support for camera sensor information in the libcamera IPA protocol. Define a new 'struct ipa_sensor_info' structure in the IPA context and use it to perform translation between the C and the C++ API. Update the IPAInterface::configure() operation to accept a new CameraSensorInfo parameter and port all users of that function to the new interface. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/ipa')
-rw-r--r--src/ipa/libipa/ipa_interface_wrapper.cpp19
-rw-r--r--src/ipa/libipa/ipa_interface_wrapper.h1
-rw-r--r--src/ipa/rkisp1/rkisp1.cpp12
-rw-r--r--src/ipa/vimc/vimc.cpp3
4 files changed, 31 insertions, 4 deletions
diff --git a/src/ipa/libipa/ipa_interface_wrapper.cpp b/src/ipa/libipa/ipa_interface_wrapper.cpp
index 9596cb20..21d8c98b 100644
--- a/src/ipa/libipa/ipa_interface_wrapper.cpp
+++ b/src/ipa/libipa/ipa_interface_wrapper.cpp
@@ -15,6 +15,7 @@
#include <ipa/ipa_interface.h>
#include "byte_stream_buffer.h"
+#include "camera_sensor.h"
/**
* \file ipa_interface_wrapper.h
@@ -115,6 +116,7 @@ void IPAInterfaceWrapper::register_callbacks(struct ipa_context *_ctx,
}
void IPAInterfaceWrapper::configure(struct ipa_context *_ctx,
+ const struct ipa_sensor_info *sensor_info,
const struct ipa_stream *streams,
unsigned int num_streams,
const struct ipa_control_info_map *maps,
@@ -124,6 +126,21 @@ void IPAInterfaceWrapper::configure(struct ipa_context *_ctx,
ctx->serializer_.reset();
+ /* Translate the IPA sensor info. */
+ CameraSensorInfo sensorInfo{};
+ sensorInfo.model = sensor_info->model;
+ sensorInfo.bitsPerPixel = sensor_info->bits_per_pixel;
+ sensorInfo.activeAreaSize = { sensor_info->active_area.width,
+ sensor_info->active_area.height };
+ sensorInfo.analogCrop = { sensor_info->analog_crop.left,
+ sensor_info->analog_crop.top,
+ sensor_info->analog_crop.width,
+ sensor_info->analog_crop.height };
+ sensorInfo.outputSize = { sensor_info->output_size.width,
+ sensor_info->output_size.height };
+ sensorInfo.pixelRate = sensor_info->pixel_rate;
+ sensorInfo.lineLength = sensor_info->line_length;
+
/* Translate the IPA stream configurations map. */
std::map<unsigned int, IPAStream> ipaStreams;
@@ -149,7 +166,7 @@ void IPAInterfaceWrapper::configure(struct ipa_context *_ctx,
entityControls.emplace(id, infoMaps[id]);
}
- ctx->ipa_->configure(ipaStreams, entityControls);
+ ctx->ipa_->configure(sensorInfo, ipaStreams, entityControls);
}
void IPAInterfaceWrapper::map_buffers(struct ipa_context *_ctx,
diff --git a/src/ipa/libipa/ipa_interface_wrapper.h b/src/ipa/libipa/ipa_interface_wrapper.h
index 78ccf0f5..56507aaf 100644
--- a/src/ipa/libipa/ipa_interface_wrapper.h
+++ b/src/ipa/libipa/ipa_interface_wrapper.h
@@ -31,6 +31,7 @@ private:
const struct ipa_callback_ops *callbacks,
void *cb_ctx);
static void configure(struct ipa_context *ctx,
+ const struct ipa_sensor_info *sensor_info,
const struct ipa_stream *streams,
unsigned int num_streams,
const struct ipa_control_info_map *maps,
diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
index 9a347e52..bfa88418 100644
--- a/src/ipa/rkisp1/rkisp1.cpp
+++ b/src/ipa/rkisp1/rkisp1.cpp
@@ -36,7 +36,8 @@ public:
int start() override { return 0; }
void stop() override {}
- void configure(const std::map<unsigned int, IPAStream> &streamConfig,
+ void configure(const CameraSensorInfo &info,
+ const std::map<unsigned int, IPAStream> &streamConfig,
const std::map<unsigned int, const ControlInfoMap &> &entityControls) override;
void mapBuffers(const std::vector<IPABuffer> &buffers) override;
void unmapBuffers(const std::vector<unsigned int> &ids) override;
@@ -66,7 +67,14 @@ private:
uint32_t maxGain_;
};
-void IPARkISP1::configure(const std::map<unsigned int, IPAStream> &streamConfig,
+/**
+ * \todo The RkISP1 pipeline currently provides an empty CameraSensorInfo
+ * if the connected sensor does not provide enough information to properly
+ * assemble one. Make sure the reported sensor information are relevant
+ * before accessing them.
+ */
+void IPARkISP1::configure(const CameraSensorInfo &info,
+ const std::map<unsigned int, IPAStream> &streamConfig,
const std::map<unsigned int, const ControlInfoMap &> &entityControls)
{
if (entityControls.empty())
diff --git a/src/ipa/vimc/vimc.cpp b/src/ipa/vimc/vimc.cpp
index f29bc504..9271f2d8 100644
--- a/src/ipa/vimc/vimc.cpp
+++ b/src/ipa/vimc/vimc.cpp
@@ -37,7 +37,8 @@ public:
int start() override;
void stop() override;
- void configure(const std::map<unsigned int, IPAStream> &streamConfig,
+ void configure(const CameraSensorInfo &sensorInfo,
+ const std::map<unsigned int, IPAStream> &streamConfig,
const std::map<unsigned int, const ControlInfoMap &> &entityControls) override {}
void mapBuffers(const std::vector<IPABuffer> &buffers) override {}
void unmapBuffers(const std::vector<unsigned int> &ids) override {}