summaryrefslogtreecommitdiff
path: root/src/ipa/rkisp1/rkisp1.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ipa/rkisp1/rkisp1.cpp')
-rw-r--r--src/ipa/rkisp1/rkisp1.cpp34
1 files changed, 29 insertions, 5 deletions
diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
index 6687c91e..05e5ed26 100644
--- a/src/ipa/rkisp1/rkisp1.cpp
+++ b/src/ipa/rkisp1/rkisp1.cpp
@@ -325,16 +325,40 @@ void IPARkISP1::queueRequest(const uint32_t frame, const ControlList &controls)
void IPARkISP1::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId)
{
IPAFrameContext &frameContext = context_.frameContexts.get(frame);
+ rkisp1_ext_params_block_header *block;
+ size_t totalSize = 0;
- rkisp1_params_cfg *params =
- reinterpret_cast<rkisp1_params_cfg *>(
- mappedBuffers_.at(bufferId).planes()[0].data());
+ rkisp1_ext_params_cfg *params =
+ reinterpret_cast<rkisp1_ext_params_cfg *>(
+ mappedBuffers_.at(bufferId).planes()[0].data());
/* Prepare parameters buffer. */
memset(params, 0, sizeof(*params));
- for (auto const &algo : algorithms())
- algo->prepare(context_, frame, frameContext, params);
+ params->version = RKISP1_EXT_PARAM_BUFFER_V1;
+
+ block = reinterpret_cast<rkisp1_ext_params_block_header *>(params->data);
+ for (auto const &algo : algorithms()) {
+
+ algo->prepare(context_, frame, frameContext, block);
+
+ /*
+ * Each algorithm could add multiple parameter blocks, each of
+ * which will have its own embedded header struct with the size
+ * of that block. We need to iterate through them, sum all of
+ * the block sizes and advance the 'block' pointer to the next
+ * empty one.
+ */
+ while (totalSize < RKISP1_EXT_PARAMS_MAX_SIZE && block->size) {
+ totalSize += block->size;
+ block = reinterpret_cast<rkisp1_ext_params_block_header *>
+ (params->data + totalSize);
+ }
+
+ ASSERT(totalSize <= RKISP1_EXT_PARAMS_MAX_SIZE);
+ }
+
+ params->total_size = totalSize;
paramsBufferReady.emit(frame);
}