<div dir="ltr"><div dir="ltr">Hi Kieran,<div><br></div><div>Thanks for the review!</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 16 Sept 2022 at 14:31, Kieran Bingham <<a href="mailto:kieran.bingham@ideasonboard.com">kieran.bingham@ideasonboard.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Naush,<br>
<br>
Quoting Naushir Patuck via libcamera-devel (2022-09-16 11:05:16)<br>
> Add an error state used internally in the Raspberry Pi pipeline handler.<br>
> Currently this state is never set, but will be in a subsequent commit when a<br>
> device timeout has been signalled.<br>
> <br>
> Signed-off-by: Naushir Patuck <<a href="mailto:naush@raspberrypi.com" target="_blank">naush@raspberrypi.com</a>><br>
> ---<br>
>  .../pipeline/raspberrypi/raspberrypi.cpp       | 18 ++++++++++--------<br>
>  1 file changed, 10 insertions(+), 8 deletions(-)<br>
> <br>
> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp<br>
> index b4094898ca6c..d429cb444d58 100644<br>
> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp<br>
> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp<br>
> @@ -253,7 +253,7 @@ public:<br>
>          * thread. So, we do not need to have any mutex to protect access to any<br>
>          * of the variables below.<br>
>          */<br>
> -       enum class State { Stopped, Idle, Busy, IpaComplete };<br>
> +       enum class State { Stopped, Idle, Busy, IpaComplete, Error };<br>
>         State state_;<br>
>  <br>
>         struct BayerFrame {<br>
> @@ -1109,7 +1109,8 @@ int PipelineHandlerRPi::queueRequestDevice(Camera *camera, Request *request)<br>
>  {<br>
>         RPiCameraData *data = cameraData(camera);<br>
>  <br>
> -       if (data->state_ == RPiCameraData::State::Stopped)<br>
> +       if (data->state_ == RPiCameraData::State::Stopped ||<br>
> +           data->state_ == RPiCameraData::State::Error)<br>
<br>
This is fine I think, but is it worth an 'isRunning()' state helper?</blockquote><div><br></div><div>I can do that for v2, it would probably look cleaner!</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <br>
<br>
Does the state match the state machine of the Camera object? (I.e.<br>
should we expose the states/helpers more conveniently to the pipeline<br>
handlers so that you don't have to manage it separately?<br></blockquote><div><br></div><div>This state is internal the the rpi pipeline handler really, so not the same</div><div>as the Camera object - although the common start/stop states would</div><div>probably match. As such, it's not going to help me here if the Camera object</div><div>state was exposed to us.</div><div><br></div><div>Regards,</div><div>Naush</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
As this updates the existing state machine though, I think this is<br>
fine...<br>
<br>
<br>
Reviewed-by: Kieran Bingham <<a href="mailto:kieran.bingham@ideasonboard.com" target="_blank">kieran.bingham@ideasonboard.com</a>><br>
<br>
>                 return -EINVAL;<br>
>  <br>
>         LOG(RPI, Debug) << "queueRequestDevice: New request.";<br>
> @@ -1708,7 +1709,7 @@ void RPiCameraData::enumerateVideoDevices(MediaLink *link)<br>
>  <br>
>  void RPiCameraData::statsMetadataComplete(uint32_t bufferId, const ControlList &controls)<br>
>  {<br>
> -       if (state_ == State::Stopped)<br>
> +       if (state_ == State::Stopped || state_ == State::Error)<br>
>                 return;<br>
>  <br>
>         FrameBuffer *buffer = isp_[Isp::Stats].getBuffers().at(bufferId);<br>
> @@ -1744,7 +1745,7 @@ void RPiCameraData::statsMetadataComplete(uint32_t bufferId, const ControlList &<br>
>  <br>
>  void RPiCameraData::runIsp(uint32_t bufferId)<br>
>  {<br>
> -       if (state_ == State::Stopped)<br>
> +       if (state_ == State::Stopped || state_ == State::Error)<br>
>                 return;<br>
>  <br>
>         FrameBuffer *buffer = unicam_[Unicam::Image].getBuffers().at(bufferId);<br>
> @@ -1759,7 +1760,7 @@ void RPiCameraData::runIsp(uint32_t bufferId)<br>
>  <br>
>  void RPiCameraData::embeddedComplete(uint32_t bufferId)<br>
>  {<br>
> -       if (state_ == State::Stopped)<br>
> +       if (state_ == State::Stopped || state_ == State::Error)<br>
>                 return;<br>
>  <br>
>         FrameBuffer *buffer = unicam_[Unicam::Embedded].getBuffers().at(bufferId);<br>
> @@ -1825,7 +1826,7 @@ void RPiCameraData::unicamBufferDequeue(FrameBuffer *buffer)<br>
>         RPi::Stream *stream = nullptr;<br>
>         int index;<br>
>  <br>
> -       if (state_ == State::Stopped)<br>
> +       if (state_ == State::Stopped || state_ == State::Error)<br>
>                 return;<br>
>  <br>
>         for (RPi::Stream &s : unicam_) {<br>
> @@ -1864,7 +1865,7 @@ void RPiCameraData::unicamBufferDequeue(FrameBuffer *buffer)<br>
>  <br>
>  void RPiCameraData::ispInputDequeue(FrameBuffer *buffer)<br>
>  {<br>
> -       if (state_ == State::Stopped)<br>
> +       if (state_ == State::Stopped || state_ == State::Error)<br>
>                 return;<br>
>  <br>
>         LOG(RPI, Debug) << "Stream ISP Input buffer complete"<br>
> @@ -1881,7 +1882,7 @@ void RPiCameraData::ispOutputDequeue(FrameBuffer *buffer)<br>
>         RPi::Stream *stream = nullptr;<br>
>         int index;<br>
>  <br>
> -       if (state_ == State::Stopped)<br>
> +       if (state_ == State::Stopped || state_ == State::Error)<br>
>                 return;<br>
>  <br>
>         for (RPi::Stream &s : isp_) {<br>
> @@ -1991,6 +1992,7 @@ void RPiCameraData::handleState()<br>
>         switch (state_) {<br>
>         case State::Stopped:<br>
>         case State::Busy:<br>
> +       case State::Error:<br>
>                 break;<br>
>  <br>
>         case State::IpaComplete:<br>
> -- <br>
> 2.25.1<br>
><br>
</blockquote></div></div>