[RFC PATCH] ipa: rkisp1: Initialize lsc tables on first frame
Stefan Klug
stefan.klug at ideasonboard.com
Mon Dec 16 16:33:02 CET 2024
When sending the parameters for lens shading correction to the ISP on
frame x (in the test mostly frame 4) stalls of the ISP were observed.
>From userland the symptom is that no buffers get returned anymore.
Kernel wise the ISP constantly produces interrupts with
RKISP1_CIF_ISP_V_START being set but no interrupts with
RKISP1_CIF_ISP_FRAME. It turned out that this behavior wasn't observed
when the lens shading correction parameters were written before
receiving the first frame. Ensure that behavior in the lsc algorithm by
unconditionally filling the params buffer on frame 0.
Unfortunately there were also cases were no stalls were observed even
though the lsc tables were not written on frame 0. So it is not clear
if this fix fixes the actual root cause.
Another reason for that change is that it is sensible to write the lsc
data on frame 0, to minimize the flicker in the image when the first
statistics come in (where they would have been written otherwise).
Signed-off-by: Stefan Klug <stefan.klug at ideasonboard.com>
---
src/ipa/rkisp1/algorithms/lsc.cpp | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/ipa/rkisp1/algorithms/lsc.cpp b/src/ipa/rkisp1/algorithms/lsc.cpp
index e47aa2f0727e..15a43799ae27 100644
--- a/src/ipa/rkisp1/algorithms/lsc.cpp
+++ b/src/ipa/rkisp1/algorithms/lsc.cpp
@@ -410,12 +410,20 @@ void LensShadingCorrection::prepare(IPAContext &context,
RkISP1Params *params)
{
uint32_t ct = context.activeState.awb.temperatureK;
- if (std::abs(static_cast<int>(ct) - static_cast<int>(lastAppliedCt_)) <
+ /*
+ * The ISP in the imx8mp using linux 6.12 has a high probability for a
+ * stall when the lsc module isn't configured in the first frame.
+ * Therefore ensure that a lsc table is written unconditionally at the
+ * first frame.
+ */
+ if (frame > 0 &&
+ std::abs(static_cast<int>(ct) - static_cast<int>(lastAppliedCt_)) <
kColourTemperatureChangeThreshhold)
return;
+
unsigned int quantizedCt;
const Components &set = sets_.getInterpolated(ct, &quantizedCt);
- if (lastAppliedQuantizedCt_ == quantizedCt)
+ if (frame > 0 && lastAppliedQuantizedCt_ == quantizedCt)
return;
auto config = params->block<BlockType::Lsc>();
--
2.43.0
More information about the libcamera-devel
mailing list