[libcamera-devel,v5,2/2] libcamera: ipu3: Try queuing pending requests if a buffer is available
diff mbox series

Message ID 20210513022946.2194341-2-hiroh@chromium.org
State Accepted
Headers show
Series
  • [libcamera-devel,v5,1/2] pipeline: ipu3: Store requests in the case a buffer shortage
Related show

Commit Message

Hirokazu Honda May 13, 2021, 2:29 a.m. UTC
IPU3CameraData stores requests that have been failed due to a
buffer shortage. The requests should be retried once enough
buffers are available. This sets the retry function as signal to
CIO2Device and IPU3Frame, and invokes it from
CIO2Device::tryReturnBuffer() and IPU3Frame::remove().

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
---
 src/libcamera/pipeline/ipu3/cio2.cpp   | 2 ++
 src/libcamera/pipeline/ipu3/cio2.h     | 2 ++
 src/libcamera/pipeline/ipu3/frames.cpp | 2 ++
 src/libcamera/pipeline/ipu3/frames.h   | 4 ++++
 src/libcamera/pipeline/ipu3/ipu3.cpp   | 4 ++++
 5 files changed, 14 insertions(+)

Comments

Jacopo Mondi May 13, 2021, 10:01 a.m. UTC | #1
Hi Hiro,

On Thu, May 13, 2021 at 11:29:46AM +0900, Hirokazu Honda wrote:
> IPU3CameraData stores requests that have been failed due to a
> buffer shortage. The requests should be retried once enough
> buffers are available. This sets the retry function as signal to
> CIO2Device and IPU3Frame, and invokes it from
> CIO2Device::tryReturnBuffer() and IPU3Frame::remove().
>
> Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
> ---
>  src/libcamera/pipeline/ipu3/cio2.cpp   | 2 ++
>  src/libcamera/pipeline/ipu3/cio2.h     | 2 ++
>  src/libcamera/pipeline/ipu3/frames.cpp | 2 ++
>  src/libcamera/pipeline/ipu3/frames.h   | 4 ++++
>  src/libcamera/pipeline/ipu3/ipu3.cpp   | 4 ++++
>  5 files changed, 14 insertions(+)
>
> diff --git a/src/libcamera/pipeline/ipu3/cio2.cpp b/src/libcamera/pipeline/ipu3/cio2.cpp
> index 8bbef174..1be2cbcd 100644
> --- a/src/libcamera/pipeline/ipu3/cio2.cpp
> +++ b/src/libcamera/pipeline/ipu3/cio2.cpp
> @@ -302,6 +302,8 @@ void CIO2Device::tryReturnBuffer(FrameBuffer *buffer)
>  			break;
>  		}
>  	}
> +
> +	bufferAvailable.emit();
>  }
>
>  void CIO2Device::freeBuffers()
> diff --git a/src/libcamera/pipeline/ipu3/cio2.h b/src/libcamera/pipeline/ipu3/cio2.h
> index 5ecc4f47..d8d4a181 100644
> --- a/src/libcamera/pipeline/ipu3/cio2.h
> +++ b/src/libcamera/pipeline/ipu3/cio2.h
> @@ -56,6 +56,8 @@ public:
>  	Signal<FrameBuffer *> &bufferReady() { return output_->bufferReady; }
>  	Signal<uint32_t> &frameStart() { return csi2_->frameStart; }
>
> +	Signal<> bufferAvailable;
> +
>  private:
>  	void freeBuffers();
>
> diff --git a/src/libcamera/pipeline/ipu3/frames.cpp b/src/libcamera/pipeline/ipu3/frames.cpp
> index 29d9aafc..d9a2249b 100644
> --- a/src/libcamera/pipeline/ipu3/frames.cpp
> +++ b/src/libcamera/pipeline/ipu3/frames.cpp
> @@ -103,6 +103,8 @@ bool IPU3Frames::tryComplete(IPU3Frames::Info *info)
>
>  	remove(info);
>
> +	bufferAvailable.emit();
> +
>  	return true;
>  }
>
> diff --git a/src/libcamera/pipeline/ipu3/frames.h b/src/libcamera/pipeline/ipu3/frames.h
> index 4acdf48e..59e64e81 100644
> --- a/src/libcamera/pipeline/ipu3/frames.h
> +++ b/src/libcamera/pipeline/ipu3/frames.h
> @@ -12,6 +12,8 @@
>  #include <queue>
>  #include <vector>
>
> +#include <libcamera/signal.h>
> +
>  namespace libcamera {
>
>  class FrameBuffer;
> @@ -49,6 +51,8 @@ public:
>  	Info *find(unsigned int id);
>  	Info *find(FrameBuffer *buffer);
>
> +	Signal<> bufferAvailable;
> +
>  private:
>  	std::queue<FrameBuffer *> availableParamBuffers_;
>  	std::queue<FrameBuffer *> availableStatBuffers_;
> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
> index 6961d498..8ae47c6d 100644
> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp
> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
> @@ -701,6 +701,8 @@ int PipelineHandlerIPU3::allocateBuffers(Camera *camera)
>  	data->ipa_->mapBuffers(ipaBuffers_);
>
>  	data->frameInfos_.init(imgu->paramBuffers_, imgu->statBuffers_);
> +	data->frameInfos_.bufferAvailable.connect(
> +		data, &IPU3CameraData::queuePendingRequests);
>
>  	return 0;
>  }
> @@ -1147,6 +1149,8 @@ int PipelineHandlerIPU3::registerCameras()
>  		 */
>  		data->cio2_.bufferReady().connect(data.get(),
>  					&IPU3CameraData::cio2BufferReady);
> +		data->cio2_.bufferAvailable.connect(
> +			data.get(), &IPU3CameraData::queuePendingRequests);

Looks good
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>

Thanks
  j

>  		data->imgu_->input_->bufferReady.connect(&data->cio2_,
>  					&CIO2Device::tryReturnBuffer);
>  		data->imgu_->output_->bufferReady.connect(data.get(),
> --
> 2.31.1.607.g51e8a6a459-goog
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
Hirokazu Honda May 20, 2021, 9:02 a.m. UTC | #2
Gentle ping for review, or would this patch series be merged?

On Thu, May 13, 2021 at 7:00 PM Jacopo Mondi <jacopo@jmondi.org> wrote:

> Hi Hiro,
>
> On Thu, May 13, 2021 at 11:29:46AM +0900, Hirokazu Honda wrote:
> > IPU3CameraData stores requests that have been failed due to a
> > buffer shortage. The requests should be retried once enough
> > buffers are available. This sets the retry function as signal to
> > CIO2Device and IPU3Frame, and invokes it from
> > CIO2Device::tryReturnBuffer() and IPU3Frame::remove().
> >
> > Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
> > ---
> >  src/libcamera/pipeline/ipu3/cio2.cpp   | 2 ++
> >  src/libcamera/pipeline/ipu3/cio2.h     | 2 ++
> >  src/libcamera/pipeline/ipu3/frames.cpp | 2 ++
> >  src/libcamera/pipeline/ipu3/frames.h   | 4 ++++
> >  src/libcamera/pipeline/ipu3/ipu3.cpp   | 4 ++++
> >  5 files changed, 14 insertions(+)
> >
> > diff --git a/src/libcamera/pipeline/ipu3/cio2.cpp
> b/src/libcamera/pipeline/ipu3/cio2.cpp
> > index 8bbef174..1be2cbcd 100644
> > --- a/src/libcamera/pipeline/ipu3/cio2.cpp
> > +++ b/src/libcamera/pipeline/ipu3/cio2.cpp
> > @@ -302,6 +302,8 @@ void CIO2Device::tryReturnBuffer(FrameBuffer *buffer)
> >                       break;
> >               }
> >       }
> > +
> > +     bufferAvailable.emit();
> >  }
> >
> >  void CIO2Device::freeBuffers()
> > diff --git a/src/libcamera/pipeline/ipu3/cio2.h
> b/src/libcamera/pipeline/ipu3/cio2.h
> > index 5ecc4f47..d8d4a181 100644
> > --- a/src/libcamera/pipeline/ipu3/cio2.h
> > +++ b/src/libcamera/pipeline/ipu3/cio2.h
> > @@ -56,6 +56,8 @@ public:
> >       Signal<FrameBuffer *> &bufferReady() { return
> output_->bufferReady; }
> >       Signal<uint32_t> &frameStart() { return csi2_->frameStart; }
> >
> > +     Signal<> bufferAvailable;
> > +
> >  private:
> >       void freeBuffers();
> >
> > diff --git a/src/libcamera/pipeline/ipu3/frames.cpp
> b/src/libcamera/pipeline/ipu3/frames.cpp
> > index 29d9aafc..d9a2249b 100644
> > --- a/src/libcamera/pipeline/ipu3/frames.cpp
> > +++ b/src/libcamera/pipeline/ipu3/frames.cpp
> > @@ -103,6 +103,8 @@ bool IPU3Frames::tryComplete(IPU3Frames::Info *info)
> >
> >       remove(info);
> >
> > +     bufferAvailable.emit();
> > +
> >       return true;
> >  }
> >
> > diff --git a/src/libcamera/pipeline/ipu3/frames.h
> b/src/libcamera/pipeline/ipu3/frames.h
> > index 4acdf48e..59e64e81 100644
> > --- a/src/libcamera/pipeline/ipu3/frames.h
> > +++ b/src/libcamera/pipeline/ipu3/frames.h
> > @@ -12,6 +12,8 @@
> >  #include <queue>
> >  #include <vector>
> >
> > +#include <libcamera/signal.h>
> > +
> >  namespace libcamera {
> >
> >  class FrameBuffer;
> > @@ -49,6 +51,8 @@ public:
> >       Info *find(unsigned int id);
> >       Info *find(FrameBuffer *buffer);
> >
> > +     Signal<> bufferAvailable;
> > +
> >  private:
> >       std::queue<FrameBuffer *> availableParamBuffers_;
> >       std::queue<FrameBuffer *> availableStatBuffers_;
> > diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp
> b/src/libcamera/pipeline/ipu3/ipu3.cpp
> > index 6961d498..8ae47c6d 100644
> > --- a/src/libcamera/pipeline/ipu3/ipu3.cpp
> > +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
> > @@ -701,6 +701,8 @@ int PipelineHandlerIPU3::allocateBuffers(Camera
> *camera)
> >       data->ipa_->mapBuffers(ipaBuffers_);
> >
> >       data->frameInfos_.init(imgu->paramBuffers_, imgu->statBuffers_);
> > +     data->frameInfos_.bufferAvailable.connect(
> > +             data, &IPU3CameraData::queuePendingRequests);
> >
> >       return 0;
> >  }
> > @@ -1147,6 +1149,8 @@ int PipelineHandlerIPU3::registerCameras()
> >                */
> >               data->cio2_.bufferReady().connect(data.get(),
> >                                       &IPU3CameraData::cio2BufferReady);
> > +             data->cio2_.bufferAvailable.connect(
> > +                     data.get(), &IPU3CameraData::queuePendingRequests);
>
> Looks good
> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
>
> Thanks
>   j
>
> >               data->imgu_->input_->bufferReady.connect(&data->cio2_,
> >                                       &CIO2Device::tryReturnBuffer);
> >               data->imgu_->output_->bufferReady.connect(data.get(),
> > --
> > 2.31.1.607.g51e8a6a459-goog
> >
> > _______________________________________________
> > libcamera-devel mailing list
> > libcamera-devel@lists.libcamera.org
> > https://lists.libcamera.org/listinfo/libcamera-devel
>
Laurent Pinchart May 24, 2021, 2:54 a.m. UTC | #3
Hi Hiro,

Thank you for the patch.

On Thu, May 13, 2021 at 11:29:46AM +0900, Hirokazu Honda wrote:
> IPU3CameraData stores requests that have been failed due to a
> buffer shortage. The requests should be retried once enough
> buffers are available. This sets the retry function as signal to
> CIO2Device and IPU3Frame, and invokes it from
> CIO2Device::tryReturnBuffer() and IPU3Frame::remove().
> 
> Signed-off-by: Hirokazu Honda <hiroh@chromium.org>

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

> ---
>  src/libcamera/pipeline/ipu3/cio2.cpp   | 2 ++
>  src/libcamera/pipeline/ipu3/cio2.h     | 2 ++
>  src/libcamera/pipeline/ipu3/frames.cpp | 2 ++
>  src/libcamera/pipeline/ipu3/frames.h   | 4 ++++
>  src/libcamera/pipeline/ipu3/ipu3.cpp   | 4 ++++
>  5 files changed, 14 insertions(+)
> 
> diff --git a/src/libcamera/pipeline/ipu3/cio2.cpp b/src/libcamera/pipeline/ipu3/cio2.cpp
> index 8bbef174..1be2cbcd 100644
> --- a/src/libcamera/pipeline/ipu3/cio2.cpp
> +++ b/src/libcamera/pipeline/ipu3/cio2.cpp
> @@ -302,6 +302,8 @@ void CIO2Device::tryReturnBuffer(FrameBuffer *buffer)
>  			break;
>  		}
>  	}
> +
> +	bufferAvailable.emit();
>  }
>  
>  void CIO2Device::freeBuffers()
> diff --git a/src/libcamera/pipeline/ipu3/cio2.h b/src/libcamera/pipeline/ipu3/cio2.h
> index 5ecc4f47..d8d4a181 100644
> --- a/src/libcamera/pipeline/ipu3/cio2.h
> +++ b/src/libcamera/pipeline/ipu3/cio2.h
> @@ -56,6 +56,8 @@ public:
>  	Signal<FrameBuffer *> &bufferReady() { return output_->bufferReady; }
>  	Signal<uint32_t> &frameStart() { return csi2_->frameStart; }
>  
> +	Signal<> bufferAvailable;
> +
>  private:
>  	void freeBuffers();
>  
> diff --git a/src/libcamera/pipeline/ipu3/frames.cpp b/src/libcamera/pipeline/ipu3/frames.cpp
> index 29d9aafc..d9a2249b 100644
> --- a/src/libcamera/pipeline/ipu3/frames.cpp
> +++ b/src/libcamera/pipeline/ipu3/frames.cpp
> @@ -103,6 +103,8 @@ bool IPU3Frames::tryComplete(IPU3Frames::Info *info)
>  
>  	remove(info);
>  
> +	bufferAvailable.emit();
> +
>  	return true;
>  }
>  
> diff --git a/src/libcamera/pipeline/ipu3/frames.h b/src/libcamera/pipeline/ipu3/frames.h
> index 4acdf48e..59e64e81 100644
> --- a/src/libcamera/pipeline/ipu3/frames.h
> +++ b/src/libcamera/pipeline/ipu3/frames.h
> @@ -12,6 +12,8 @@
>  #include <queue>
>  #include <vector>
>  
> +#include <libcamera/signal.h>
> +
>  namespace libcamera {
>  
>  class FrameBuffer;
> @@ -49,6 +51,8 @@ public:
>  	Info *find(unsigned int id);
>  	Info *find(FrameBuffer *buffer);
>  
> +	Signal<> bufferAvailable;
> +
>  private:
>  	std::queue<FrameBuffer *> availableParamBuffers_;
>  	std::queue<FrameBuffer *> availableStatBuffers_;
> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
> index 6961d498..8ae47c6d 100644
> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp
> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
> @@ -701,6 +701,8 @@ int PipelineHandlerIPU3::allocateBuffers(Camera *camera)
>  	data->ipa_->mapBuffers(ipaBuffers_);
>  
>  	data->frameInfos_.init(imgu->paramBuffers_, imgu->statBuffers_);
> +	data->frameInfos_.bufferAvailable.connect(
> +		data, &IPU3CameraData::queuePendingRequests);
>  
>  	return 0;
>  }
> @@ -1147,6 +1149,8 @@ int PipelineHandlerIPU3::registerCameras()
>  		 */
>  		data->cio2_.bufferReady().connect(data.get(),
>  					&IPU3CameraData::cio2BufferReady);
> +		data->cio2_.bufferAvailable.connect(
> +			data.get(), &IPU3CameraData::queuePendingRequests);
>  		data->imgu_->input_->bufferReady.connect(&data->cio2_,
>  					&CIO2Device::tryReturnBuffer);
>  		data->imgu_->output_->bufferReady.connect(data.get(),
Laurent Pinchart May 24, 2021, 2:59 a.m. UTC | #4
Hi Hiro,

On Thu, May 20, 2021 at 06:02:05PM +0900, Hirokazu Honda wrote:
> Gentle ping for review, or would this patch series be merged?

It all looks good. I've applied the series to my tree, it's undergoing
testing and I'll merge it shortly. Sorry for the delay.

> On Thu, May 13, 2021 at 7:00 PM Jacopo Mondi wrote:
> > On Thu, May 13, 2021 at 11:29:46AM +0900, Hirokazu Honda wrote:
> > > IPU3CameraData stores requests that have been failed due to a
> > > buffer shortage. The requests should be retried once enough
> > > buffers are available. This sets the retry function as signal to
> > > CIO2Device and IPU3Frame, and invokes it from
> > > CIO2Device::tryReturnBuffer() and IPU3Frame::remove().
> > >
> > > Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
> > > ---
> > >  src/libcamera/pipeline/ipu3/cio2.cpp   | 2 ++
> > >  src/libcamera/pipeline/ipu3/cio2.h     | 2 ++
> > >  src/libcamera/pipeline/ipu3/frames.cpp | 2 ++
> > >  src/libcamera/pipeline/ipu3/frames.h   | 4 ++++
> > >  src/libcamera/pipeline/ipu3/ipu3.cpp   | 4 ++++
> > >  5 files changed, 14 insertions(+)
> > >
> > > diff --git a/src/libcamera/pipeline/ipu3/cio2.cpp b/src/libcamera/pipeline/ipu3/cio2.cpp
> > > index 8bbef174..1be2cbcd 100644
> > > --- a/src/libcamera/pipeline/ipu3/cio2.cpp
> > > +++ b/src/libcamera/pipeline/ipu3/cio2.cpp
> > > @@ -302,6 +302,8 @@ void CIO2Device::tryReturnBuffer(FrameBuffer *buffer)
> > >                       break;
> > >               }
> > >       }
> > > +
> > > +     bufferAvailable.emit();
> > >  }
> > >
> > >  void CIO2Device::freeBuffers()
> > > diff --git a/src/libcamera/pipeline/ipu3/cio2.h b/src/libcamera/pipeline/ipu3/cio2.h
> > > index 5ecc4f47..d8d4a181 100644
> > > --- a/src/libcamera/pipeline/ipu3/cio2.h
> > > +++ b/src/libcamera/pipeline/ipu3/cio2.h
> > > @@ -56,6 +56,8 @@ public:
> > >       Signal<FrameBuffer *> &bufferReady() { return output_->bufferReady; }
> > >       Signal<uint32_t> &frameStart() { return csi2_->frameStart; }
> > >
> > > +     Signal<> bufferAvailable;
> > > +
> > >  private:
> > >       void freeBuffers();
> > >
> > > diff --git a/src/libcamera/pipeline/ipu3/frames.cpp b/src/libcamera/pipeline/ipu3/frames.cpp
> > > index 29d9aafc..d9a2249b 100644
> > > --- a/src/libcamera/pipeline/ipu3/frames.cpp
> > > +++ b/src/libcamera/pipeline/ipu3/frames.cpp
> > > @@ -103,6 +103,8 @@ bool IPU3Frames::tryComplete(IPU3Frames::Info *info)
> > >
> > >       remove(info);
> > >
> > > +     bufferAvailable.emit();
> > > +
> > >       return true;
> > >  }
> > >
> > > diff --git a/src/libcamera/pipeline/ipu3/frames.h b/src/libcamera/pipeline/ipu3/frames.h
> > > index 4acdf48e..59e64e81 100644
> > > --- a/src/libcamera/pipeline/ipu3/frames.h
> > > +++ b/src/libcamera/pipeline/ipu3/frames.h
> > > @@ -12,6 +12,8 @@
> > >  #include <queue>
> > >  #include <vector>
> > >
> > > +#include <libcamera/signal.h>
> > > +
> > >  namespace libcamera {
> > >
> > >  class FrameBuffer;
> > > @@ -49,6 +51,8 @@ public:
> > >       Info *find(unsigned int id);
> > >       Info *find(FrameBuffer *buffer);
> > >
> > > +     Signal<> bufferAvailable;
> > > +
> > >  private:
> > >       std::queue<FrameBuffer *> availableParamBuffers_;
> > >       std::queue<FrameBuffer *> availableStatBuffers_;
> > > diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
> > > index 6961d498..8ae47c6d 100644
> > > --- a/src/libcamera/pipeline/ipu3/ipu3.cpp
> > > +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
> > > @@ -701,6 +701,8 @@ int PipelineHandlerIPU3::allocateBuffers(Camera *camera)
> > >       data->ipa_->mapBuffers(ipaBuffers_);
> > >
> > >       data->frameInfos_.init(imgu->paramBuffers_, imgu->statBuffers_);
> > > +     data->frameInfos_.bufferAvailable.connect(
> > > +             data, &IPU3CameraData::queuePendingRequests);
> > >
> > >       return 0;
> > >  }
> > > @@ -1147,6 +1149,8 @@ int PipelineHandlerIPU3::registerCameras()
> > >                */
> > >               data->cio2_.bufferReady().connect(data.get(),
> > >                                       &IPU3CameraData::cio2BufferReady);
> > > +             data->cio2_.bufferAvailable.connect(
> > > +                     data.get(), &IPU3CameraData::queuePendingRequests);
> >
> > Looks good
> > Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
> >
> > >               data->imgu_->input_->bufferReady.connect(&data->cio2_,
> > >                                       &CIO2Device::tryReturnBuffer);
> > >               data->imgu_->output_->bufferReady.connect(data.get(),
Hirokazu Honda May 24, 2021, 4:45 a.m. UTC | #5
Hi Laurent,

On Mon, May 24, 2021 at 11:59 AM Laurent Pinchart <
laurent.pinchart@ideasonboard.com> wrote:

> Hi Hiro,
>
> On Thu, May 20, 2021 at 06:02:05PM +0900, Hirokazu Honda wrote:
> > Gentle ping for review, or would this patch series be merged?
>
> It all looks good. I've applied the series to my tree, it's undergoing
> testing and I'll merge it shortly. Sorry for the delay.
>
>
I got it. I saw they have been merged. Thanks for reviewing and applying.

-Hiro


> > On Thu, May 13, 2021 at 7:00 PM Jacopo Mondi wrote:
> > > On Thu, May 13, 2021 at 11:29:46AM +0900, Hirokazu Honda wrote:
> > > > IPU3CameraData stores requests that have been failed due to a
> > > > buffer shortage. The requests should be retried once enough
> > > > buffers are available. This sets the retry function as signal to
> > > > CIO2Device and IPU3Frame, and invokes it from
> > > > CIO2Device::tryReturnBuffer() and IPU3Frame::remove().
> > > >
> > > > Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
> > > > ---
> > > >  src/libcamera/pipeline/ipu3/cio2.cpp   | 2 ++
> > > >  src/libcamera/pipeline/ipu3/cio2.h     | 2 ++
> > > >  src/libcamera/pipeline/ipu3/frames.cpp | 2 ++
> > > >  src/libcamera/pipeline/ipu3/frames.h   | 4 ++++
> > > >  src/libcamera/pipeline/ipu3/ipu3.cpp   | 4 ++++
> > > >  5 files changed, 14 insertions(+)
> > > >
> > > > diff --git a/src/libcamera/pipeline/ipu3/cio2.cpp
> b/src/libcamera/pipeline/ipu3/cio2.cpp
> > > > index 8bbef174..1be2cbcd 100644
> > > > --- a/src/libcamera/pipeline/ipu3/cio2.cpp
> > > > +++ b/src/libcamera/pipeline/ipu3/cio2.cpp
> > > > @@ -302,6 +302,8 @@ void CIO2Device::tryReturnBuffer(FrameBuffer
> *buffer)
> > > >                       break;
> > > >               }
> > > >       }
> > > > +
> > > > +     bufferAvailable.emit();
> > > >  }
> > > >
> > > >  void CIO2Device::freeBuffers()
> > > > diff --git a/src/libcamera/pipeline/ipu3/cio2.h
> b/src/libcamera/pipeline/ipu3/cio2.h
> > > > index 5ecc4f47..d8d4a181 100644
> > > > --- a/src/libcamera/pipeline/ipu3/cio2.h
> > > > +++ b/src/libcamera/pipeline/ipu3/cio2.h
> > > > @@ -56,6 +56,8 @@ public:
> > > >       Signal<FrameBuffer *> &bufferReady() { return
> output_->bufferReady; }
> > > >       Signal<uint32_t> &frameStart() { return csi2_->frameStart; }
> > > >
> > > > +     Signal<> bufferAvailable;
> > > > +
> > > >  private:
> > > >       void freeBuffers();
> > > >
> > > > diff --git a/src/libcamera/pipeline/ipu3/frames.cpp
> b/src/libcamera/pipeline/ipu3/frames.cpp
> > > > index 29d9aafc..d9a2249b 100644
> > > > --- a/src/libcamera/pipeline/ipu3/frames.cpp
> > > > +++ b/src/libcamera/pipeline/ipu3/frames.cpp
> > > > @@ -103,6 +103,8 @@ bool IPU3Frames::tryComplete(IPU3Frames::Info
> *info)
> > > >
> > > >       remove(info);
> > > >
> > > > +     bufferAvailable.emit();
> > > > +
> > > >       return true;
> > > >  }
> > > >
> > > > diff --git a/src/libcamera/pipeline/ipu3/frames.h
> b/src/libcamera/pipeline/ipu3/frames.h
> > > > index 4acdf48e..59e64e81 100644
> > > > --- a/src/libcamera/pipeline/ipu3/frames.h
> > > > +++ b/src/libcamera/pipeline/ipu3/frames.h
> > > > @@ -12,6 +12,8 @@
> > > >  #include <queue>
> > > >  #include <vector>
> > > >
> > > > +#include <libcamera/signal.h>
> > > > +
> > > >  namespace libcamera {
> > > >
> > > >  class FrameBuffer;
> > > > @@ -49,6 +51,8 @@ public:
> > > >       Info *find(unsigned int id);
> > > >       Info *find(FrameBuffer *buffer);
> > > >
> > > > +     Signal<> bufferAvailable;
> > > > +
> > > >  private:
> > > >       std::queue<FrameBuffer *> availableParamBuffers_;
> > > >       std::queue<FrameBuffer *> availableStatBuffers_;
> > > > diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp
> b/src/libcamera/pipeline/ipu3/ipu3.cpp
> > > > index 6961d498..8ae47c6d 100644
> > > > --- a/src/libcamera/pipeline/ipu3/ipu3.cpp
> > > > +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
> > > > @@ -701,6 +701,8 @@ int PipelineHandlerIPU3::allocateBuffers(Camera
> *camera)
> > > >       data->ipa_->mapBuffers(ipaBuffers_);
> > > >
> > > >       data->frameInfos_.init(imgu->paramBuffers_,
> imgu->statBuffers_);
> > > > +     data->frameInfos_.bufferAvailable.connect(
> > > > +             data, &IPU3CameraData::queuePendingRequests);
> > > >
> > > >       return 0;
> > > >  }
> > > > @@ -1147,6 +1149,8 @@ int PipelineHandlerIPU3::registerCameras()
> > > >                */
> > > >               data->cio2_.bufferReady().connect(data.get(),
> > > >
>  &IPU3CameraData::cio2BufferReady);
> > > > +             data->cio2_.bufferAvailable.connect(
> > > > +                     data.get(),
> &IPU3CameraData::queuePendingRequests);
> > >
> > > Looks good
> > > Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
> > >
> > > >               data->imgu_->input_->bufferReady.connect(&data->cio2_,
> > > >                                       &CIO2Device::tryReturnBuffer);
> > > >               data->imgu_->output_->bufferReady.connect(data.get(),
>
> --
> Regards,
>
> Laurent Pinchart
>

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/ipu3/cio2.cpp b/src/libcamera/pipeline/ipu3/cio2.cpp
index 8bbef174..1be2cbcd 100644
--- a/src/libcamera/pipeline/ipu3/cio2.cpp
+++ b/src/libcamera/pipeline/ipu3/cio2.cpp
@@ -302,6 +302,8 @@  void CIO2Device::tryReturnBuffer(FrameBuffer *buffer)
 			break;
 		}
 	}
+
+	bufferAvailable.emit();
 }
 
 void CIO2Device::freeBuffers()
diff --git a/src/libcamera/pipeline/ipu3/cio2.h b/src/libcamera/pipeline/ipu3/cio2.h
index 5ecc4f47..d8d4a181 100644
--- a/src/libcamera/pipeline/ipu3/cio2.h
+++ b/src/libcamera/pipeline/ipu3/cio2.h
@@ -56,6 +56,8 @@  public:
 	Signal<FrameBuffer *> &bufferReady() { return output_->bufferReady; }
 	Signal<uint32_t> &frameStart() { return csi2_->frameStart; }
 
+	Signal<> bufferAvailable;
+
 private:
 	void freeBuffers();
 
diff --git a/src/libcamera/pipeline/ipu3/frames.cpp b/src/libcamera/pipeline/ipu3/frames.cpp
index 29d9aafc..d9a2249b 100644
--- a/src/libcamera/pipeline/ipu3/frames.cpp
+++ b/src/libcamera/pipeline/ipu3/frames.cpp
@@ -103,6 +103,8 @@  bool IPU3Frames::tryComplete(IPU3Frames::Info *info)
 
 	remove(info);
 
+	bufferAvailable.emit();
+
 	return true;
 }
 
diff --git a/src/libcamera/pipeline/ipu3/frames.h b/src/libcamera/pipeline/ipu3/frames.h
index 4acdf48e..59e64e81 100644
--- a/src/libcamera/pipeline/ipu3/frames.h
+++ b/src/libcamera/pipeline/ipu3/frames.h
@@ -12,6 +12,8 @@ 
 #include <queue>
 #include <vector>
 
+#include <libcamera/signal.h>
+
 namespace libcamera {
 
 class FrameBuffer;
@@ -49,6 +51,8 @@  public:
 	Info *find(unsigned int id);
 	Info *find(FrameBuffer *buffer);
 
+	Signal<> bufferAvailable;
+
 private:
 	std::queue<FrameBuffer *> availableParamBuffers_;
 	std::queue<FrameBuffer *> availableStatBuffers_;
diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index 6961d498..8ae47c6d 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -701,6 +701,8 @@  int PipelineHandlerIPU3::allocateBuffers(Camera *camera)
 	data->ipa_->mapBuffers(ipaBuffers_);
 
 	data->frameInfos_.init(imgu->paramBuffers_, imgu->statBuffers_);
+	data->frameInfos_.bufferAvailable.connect(
+		data, &IPU3CameraData::queuePendingRequests);
 
 	return 0;
 }
@@ -1147,6 +1149,8 @@  int PipelineHandlerIPU3::registerCameras()
 		 */
 		data->cio2_.bufferReady().connect(data.get(),
 					&IPU3CameraData::cio2BufferReady);
+		data->cio2_.bufferAvailable.connect(
+			data.get(), &IPU3CameraData::queuePendingRequests);
 		data->imgu_->input_->bufferReady.connect(&data->cio2_,
 					&CIO2Device::tryReturnBuffer);
 		data->imgu_->output_->bufferReady.connect(data.get(),