summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Vinnicombe <william.vinnicombe@raspberrypi.com>2023-10-18 13:52:41 +0100
committerKieran Bingham <kieran.bingham@ideasonboard.com>2023-10-18 14:23:23 +0100
commitd477ee97bc2a086b5f486e4a967a08fcf68c35c9 (patch)
tree85e05146d5e1df5dc3df2587e1cd538c0111b907
parentd2094a0185647666ca8f810265521f0b892c4646 (diff)
pipeline: rpi: vc4: Allocate more embedded data buffers
If the pipeline runs out of embedded data buffers, then it will pass the frame to the IPA without the metadata. The IPA then has to use the delayed controls as inputs to the algorithms. This can cause problems with the subsequent algorithms if the sensor did not action the controls, especially with the autofocus as that doesn't have controls which can be passed in lieu of the metadata. Reduce the likelihood of this by increasing the number of embedded data buffers, as they are small so a generous number can be allocated. Signed-off-by: William Vinnicombe <william.vinnicombe@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
-rw-r--r--src/libcamera/pipeline/rpi/vc4/vc4.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/libcamera/pipeline/rpi/vc4/vc4.cpp b/src/libcamera/pipeline/rpi/vc4/vc4.cpp
index 425ab9ae..616e0bc9 100644
--- a/src/libcamera/pipeline/rpi/vc4/vc4.cpp
+++ b/src/libcamera/pipeline/rpi/vc4/vc4.cpp
@@ -258,10 +258,21 @@ int PipelineHandlerVc4::prepareBuffers(Camera *camera)
} else if (stream == &data->unicam_[Unicam::Embedded]) {
/*
- * Embedded data buffers are (currently) for internal use,
- * so allocate the minimum required to avoid frame drops.
+ * Embedded data buffers are (currently) for internal use, and
+ * are small enough (typically 1-2KB) that we can
+ * allocate them generously to avoid causing problems in the
+ * IPA when we cannot supply the metadata.
+ *
+ * 12 are allocated as a typical application will have 8-10
+ * input buffers, so allocating more embedded buffers than that
+ * is a sensible choice.
+ *
+ * The lifetimes of these buffers are smaller than those of the
+ * raw buffers, so allocating a fixed number will still suffice
+ * if the application requests a greater number of raw
+ * buffers, as these will be recycled quicker.
*/
- numBuffers = minBuffers;
+ numBuffers = 12;
} else {
/*
* Since the ISP runs synchronous with the IPA and requests,