From d477ee97bc2a086b5f486e4a967a08fcf68c35c9 Mon Sep 17 00:00:00 2001 From: William Vinnicombe Date: Wed, 18 Oct 2023 13:52:41 +0100 Subject: 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 Reviewed-by: Naushir Patuck Reviewed-by: Kieran Bingham Signed-off-by: Kieran Bingham --- src/libcamera/pipeline/rpi/vc4/vc4.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/libcamera/pipeline') 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, -- cgit v1.2.1