[libcamera-devel] [PATCH v2 2/2] pipeline: ipu3: Skip recording timestamp for cancelled buffers

Laurent Pinchart laurent.pinchart at ideasonboard.com
Mon Aug 16 18:22:25 CEST 2021


Hello,

On Mon, Aug 16, 2021 at 05:08:22PM +0100, Kieran Bingham wrote:
> On 16/08/2021 15:35, Umang Jain wrote:
> > There is no point in recording sensor's timestamp when V4L2VideoDevice
> > has marked the frame buffers with FrameMetadata::FrameCancelled
> > (happens when the streams are stopped). The cancelled buffers
> > handling block will proceed to cleanup and cause an early
> > return in cio2BufferReady() anyway and we are sure that at this
> > point, there is no useful purposes of setting the timestamp.
> 
> The metadata of a cancelled buffer is invalid, so setting them has no
> meaning.

There's some metadata that could be valid (we could use metadata to
report failure causes for instance), but in this case, setting the
sensor timestamp is clearly invalid. The V4L2 cancelled buffer will have
no meaningful timestamp to start with.

> Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

> > Signed-off-by: Umang Jain <umang.jain at ideasonboard.com>
> > ---
> >  src/libcamera/pipeline/ipu3/ipu3.cpp | 18 +++++++++---------
> >  1 file changed, 9 insertions(+), 9 deletions(-)
> > 
> > diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
> > index 6e26a7b7..1c4776be 100644
> > --- a/src/libcamera/pipeline/ipu3/ipu3.cpp
> > +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
> > @@ -1318,15 +1318,6 @@ void IPU3CameraData::cio2BufferReady(FrameBuffer *buffer)
> >  
> >  	Request *request = info->request;
> >  
> > -	/*
> > -	 * Record the sensor's timestamp in the request metadata.
> > -	 *
> > -	 * \todo The sensor timestamp should be better estimated by connecting
> > -	 * to the V4L2Device::frameStart signal.
> > -	 */
> > -	request->metadata().set(controls::SensorTimestamp,
> > -				buffer->metadata().timestamp);
> > -
> >  	/* If the buffer is cancelled force a complete of the whole request. */
> >  	if (buffer->metadata().status == FrameMetadata::FrameCancelled) {
> >  		for (auto it : request->buffers()) {
> > @@ -1340,6 +1331,15 @@ void IPU3CameraData::cio2BufferReady(FrameBuffer *buffer)
> >  		return;
> >  	}
> >  
> > +	/*
> > +	 * Record the sensor's timestamp in the request metadata.
> > +	 *
> > +	 * \todo The sensor timestamp should be better estimated by connecting
> > +	 * to the V4L2Device::frameStart signal.
> > +	 */
> > +	request->metadata().set(controls::SensorTimestamp,
> > +				buffer->metadata().timestamp);
> > +
> >  	if (request->findBuffer(&rawStream_))
> >  		pipe_->completeBuffer(request, buffer);
> >  

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list