[3/6] libcamera: pipeline: ipu3: Report the first ImgU frame as an error
diff mbox series

Message ID 20261118164621.15513-4-guyliandejong@proton.me
State New
Headers show
Series
  • ipu3: Lens shading and black level fixes, OV9734 tuning
Related show

Commit Message

GuyliandeJong Nov. 18, 2026, 4:46 p.m. UTC
After the output size of the ImgU changes, the first frame it produces
is processed with parameters left over from the previous configuration
and contains horizontal bars of random colours. Applications show this
frame, for instance as a flash of pink and blue bars when a video call
preview opens.

On an OV9734, alternating between 1280x704, 640x360 and 1024x576 with
v4l2-ctl through the V4L2 compatibility layer, the first frame after
each size change has a strong colour cast (an average V offset of +24
to -41 against 0 to 3 for the following frames), and the following
frames are correct.

Report the ImgU output buffers of the first request as FrameError, so
that applications drop them. The V4L2 compatibility layer passes this
on as V4L2_BUF_FLAG_ERROR.

Signed-off-by: GuyliandeJong <guyliandejong@proton.me>
---
 src/libcamera/pipeline/ipu3/ipu3.cpp | 10 ++++++++++
 1 file changed, 10 insertions(+)

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index 46af776e..c951b49c 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -1270,6 +1270,16 @@  void IPU3CameraData::imguOutputBufferReady(FrameBuffer *buffer)
 
 	Request *request = info->request;
 
+	/*
+	 * The ImgU processes the first frame after starting with parameters
+	 * left over from the previous configuration. After a change of the
+	 * output size, this produces horizontal bars of random colours. Report
+	 * the first frame as an error so that applications drop it.
+	 */
+	if (request->sequence() == 0 &&
+	    buffer->metadata().status == FrameMetadata::FrameSuccess)
+		buffer->_d()->metadata().status = FrameMetadata::FrameError;
+
 	pipe()->completeBuffer(request, buffer);
 
 	request->_d()->metadata().set(controls::draft::PipelineDepth, 3);