[libcamera-devel] [PATCH 3/3] libcamera: raspberrypi: Fail on dmaHeaps_ open error

Jacopo Mondi jacopo at jmondi.org
Thu Aug 27 14:00:39 CEST 2020


On Thu, Aug 27, 2020 at 12:52:27PM +0100, Kieran Bingham wrote:
> Hi Jacopo,
>
> On 27/08/2020 09:20, Jacopo Mondi wrote:
> > Provide an RPiCameraData::init() method where the dmaHeaps_ member
> > is opened.
> >
> > This allows to fail earlier in case the allocator fails to open.
> >
> > Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
> > ---
> >  src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> >
> > diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> > index 42c9caa03e2e..38da45607d4b 100644
> > --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> > +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> > @@ -291,6 +291,7 @@ public:
> >  	{
> >  	}
> >
> > +	int init();
> >  	void frameStarted(uint32_t sequence);
> >
> >  	int loadIPA();
> > @@ -904,6 +905,8 @@ bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator)
> >  		return false;
> >
> >  	std::unique_ptr<RPiCameraData> data = std::make_unique<RPiCameraData>(this);
> > +	if (data->init())
> > +		return false;
> >
> >  	/* Locate and open the unicam video streams. */
> >  	data->unicam_[Unicam::Embedded] = RPiStream("Unicam Embedded", unicam_->getEntityByName("unicam-embedded"));
> > @@ -1084,6 +1087,11 @@ void PipelineHandlerRPi::freeBuffers(Camera *camera)
> >  		stream->releaseBuffers();
> >  }
> >
> > +int RPiCameraData::init()
> > +{
> > +	return dmaHeap_.open();
> > +}
> > +
>
> Should we explicitly close in RPiCameraData destructor? Perhaps not in
> fact, as the dmaHeap destructor already does that.
>

I had added a ~RPiCameraData destructor for that, but since the
DmaHeaps class destructor does the same, I then removed it.

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

Thanks
  j

> >  void RPiCameraData::frameStarted(uint32_t sequence)
> >  {
> >  	LOG(RPI, Debug) << "frame start " << sequence;
> >
>
> --
> Regards
> --
> Kieran


More information about the libcamera-devel mailing list