Message ID | 20220921080258.5268-3-naush@raspberrypi.com |
---|---|
State | Accepted |
Commit | a64d17b9cff1b7361ebea31b7ae1dc1357493670 |
Headers | show |
Series |
|
Related | show |
Hi Naush On Wed, 21 Sept 2022 at 09:03, Naushir Patuck via libcamera-devel <libcamera-devel@lists.libcamera.org> wrote: > > Currently, if a Unicam timeout is signalled, the pipeline handler only raises > an error message. Update the error handling to put the pipeline handler in an > internal error state, disable all device streams, and return all outstanding > requests as cancelled. Any subsequent requests that come into the pipeline > handler will also be returned as cancelled. > > Any further error handling (e.g. a reset with camera stop()/start()) is up to > the application to perform as it requires. > > Signed-off-by: Naushir Patuck <naush@raspberrypi.com> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Thanks! David > --- > src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp > index 5c8c89585200..dcd81650c32d 100644 > --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp > +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp > @@ -1823,6 +1823,17 @@ void RPiCameraData::unicamTimeout() > LOG(RPI, Error) << "Unicam has timed out!"; > LOG(RPI, Error) << "Please check that your camera sensor connector is attached securely."; > LOG(RPI, Error) << "Alternatively, try another cable and/or sensor."; > + > + state_ = RPiCameraData::State::Error; > + /* > + * To allow the application to attempt a recovery from this timeout, > + * stop all devices streaming, and return any outstanding requests as > + * incomplete and cancelled. > + */ > + for (auto const stream : streams_) > + stream->dev()->streamOff(); > + > + clearIncompleteRequests(); > } > > void RPiCameraData::unicamBufferDequeue(FrameBuffer *buffer) > -- > 2.25.1 >
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 5c8c89585200..dcd81650c32d 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1823,6 +1823,17 @@ void RPiCameraData::unicamTimeout() LOG(RPI, Error) << "Unicam has timed out!"; LOG(RPI, Error) << "Please check that your camera sensor connector is attached securely."; LOG(RPI, Error) << "Alternatively, try another cable and/or sensor."; + + state_ = RPiCameraData::State::Error; + /* + * To allow the application to attempt a recovery from this timeout, + * stop all devices streaming, and return any outstanding requests as + * incomplete and cancelled. + */ + for (auto const stream : streams_) + stream->dev()->streamOff(); + + clearIncompleteRequests(); } void RPiCameraData::unicamBufferDequeue(FrameBuffer *buffer)