[libcamera-devel] [PATCH v2 2/2] pipeline: raspberrypi: Allow registration of multiple cameras

Sakari Ailus sakari.ailus at iki.fi
Tue Nov 23 17:28:56 CET 2021


Hi Laurent, Naushir,

On Mon, Nov 22, 2021 at 03:00:40PM +0200, Laurent Pinchart wrote:
> > -bool PipelineHandlerRPi::registerCameras()
> > +int PipelineHandlerRPi::registerCameras(MediaDevice *unicam, MediaDevice *isp,
> > +					const std::string &deviceId)
> >  {
> >  	std::unique_ptr<RPiCameraData> data = std::make_unique<RPiCameraData>(this);
> > +
> >  	if (!data->dmaHeap_.isValid())
> > -		return false;
> > +		return -ENOMEM;
> > +
> > +	MediaEntity *unicamImage = unicam->getEntityByName("unicam" + deviceId + "-image");
> > +	MediaEntity *ispOutput0 = isp->getEntityByName("bcm2835-isp" + deviceId + "-output0");
> > +	MediaEntity *ispCapture1 = isp->getEntityByName("bcm2835-isp" + deviceId + "-capture1");
> > +	MediaEntity *ispCapture2 = isp->getEntityByName("bcm2835-isp" + deviceId + "-capture2");
> > +	MediaEntity *ispCapture3 = isp->getEntityByName("bcm2835-isp" + deviceId + "-capture3");
> 
> I'm wondering if wildcards would be nice here too, but maybe a simpler
> option would be to not include the device ID in the entity names in the
> driver ? We have a bus info field that the kernel reports for the media
> device, to differentiate between multiple instances of the same device.
> I suppose we are missing guidelines on the kernel side regarding entity
> naming. Sakari, any opinion on this ?

I think it'd be best to be able to match multiple fields, not just entity
name. But I guess a regex goes a long way already.

There are some (unwritten?) rules for naming devices and they mostly work.

What's deviceId here? Would you need that as these are on separate MC
devices? (I suppose it's up to the driver thought.)

-- 
Regards,

Sakari Ailus


More information about the libcamera-devel mailing list