ipa: ipu3: Don't set sensor controls from an unprepared frame context
diff mbox series

Message ID 20261112092031.21810-1-guyliandejong@proton.me
State New
Headers show
Series
  • ipa: ipu3: Don't set sensor controls from an unprepared frame context
Related show

Commit Message

GuyliandeJong Nov. 12, 2026, 9:20 a.m. UTC
IPAIPU3::start() calls setControls(0) to apply known sensor controls
before the first frame. Since the AGC was ported to AgcAlgorithm,
setControls() takes the exposure and gain from the frame context
instead of the active state. At start() time no request has been
queued yet, so frame context 0 has not been prepared and the exposure,
gain and vertical blanking values are all 0.

DelayedControls then writes these values to the sensor, and reports
them back as the effective values two frames later. The AGC logs
"Effective exposure value is 0. This is a bug in AGC and must be fixed
for proper operation." for these frames.

Don't set the controls in start(), as the RkISP1 IPA does. The sensor
keeps its current exposure and gain until the AGC computes new values
from the first statistics.

Reported-by: Afonso Figuinha <afonso.figuinha@gmail.com>
Fixes: 78683043e35f ("ipa: ipu3: agc: Port to `AgcAlgorithm`")
Signed-off-by: GuyliandeJong <guyliandejong@proton.me>
---
Tested on a Surface Laptop 2 (OV9734), on top of the "ipu3: Fix support
for small sensors such as the OV9734" series, as master has no OV9734
helper. Without this patch, "Effective exposure value is 0" is logged
twice in each of 6 runs of cam -C10, and exposure, gain and vertical
blanking 0 are written to the sensor at start. With it, 6 out of 6 runs
log nothing, and the first values written are the AGC's.

An alternative would be to keep setControls(0) and prepare frame context
0 from the active state in start(), but frame context 0 would then be
prepared again when the first request is queued. I went with matching
RkISP1, but I'm happy to change it.

 src/ipa/ipu3/ipu3.cpp | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Patch
diff mbox series

diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp
index e4333539..aab11f2f 100644
--- a/src/ipa/ipu3/ipu3.cpp
+++ b/src/ipa/ipu3/ipu3.cpp
@@ -276,12 +276,7 @@  int IPAIPU3::init(const IPASettings &settings,
  */
 int IPAIPU3::start()
 {
-	/*
-	 * Set the sensors V4L2 controls before the first frame to ensure that
-	 * we have an expected and known configuration from the start.
-	 */
-	setControls(0);
-
+	/* \todo Properly handle startup controls. */
 	return 0;
 }