[libcamera-devel] [PATCH 3/3] android: camera_device: Report number of out streams

Laurent Pinchart laurent.pinchart at ideasonboard.com
Thu Dec 10 19:34:29 CET 2020


Hi Jacopo,

On Thu, Dec 10, 2020 at 11:34:22AM +0100, Jacopo Mondi wrote:
> On Thu, Dec 10, 2020 at 09:54:37AM +0000, Kieran Bingham wrote:
> > On 09/12/2020 17:35, Jacopo Mondi wrote:
> > > Report the number of supported output streams through the
> > > ANDROID_REQUEST_MAX_NUM_OUTPUT_STREAMS static metadata.
> > >
> > > The camera HAL currently supports:
> > > - 1 RAW stream
> > > - 2 YUV streams
> > > - 1 JPEG stream
> > >
> > > Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
> > > ---
> > >  src/android/camera_device.cpp | 12 +++++++++---
> > >  1 file changed, 9 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> > > index 13194d1ea5cc..e9fb23175d27 100644
> > > --- a/src/android/camera_device.cpp
> > > +++ b/src/android/camera_device.cpp
> > > @@ -550,10 +550,10 @@ std::tuple<uint32_t, uint32_t> CameraDevice::calculateStaticMetadataSize()
> > >  {
> > >  	/*
> > >  	 * \todo Keep this in sync with the actual number of entries.
> > > -	 * Currently: 52 entries, 698 bytes of static metadata
> > > +	 * Currently: 53 entries, 714 bytes of static metadata
> > >  	 */
> > > -	uint32_t numEntries = 52;
> > > -	uint32_t byteSize = 698;
> > > +	uint32_t numEntries = 53;
> > > +	uint32_t byteSize = 714;
> > >
> > >  	/*
> > >  	 * Calculate space occupation in bytes for dynamically built metadata
> > > @@ -939,6 +939,11 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
> > >  					  &maxPipelineDepth, 1);
> > >  	}
> > >
> > > +	/* Number of { RAW, YUV, JPEG } supported output streams */
> > > +	int32_t numOutStreams[] = { 1, 2, 1 };
> >
> > Is this constant? or pipeline handler specific?
> 
> It will be a mix of pipeline capabilities + HAL post-processing
> capabilities.
> 
> > I guess constant is ok for now - but if we need to update this to query
> > the pipeline handler perhaps we need a todo.
> 
> Currently is constant. As soon as we add post-processing beside JPEG
> this will need to be updated to some different values. Not only for

That's a good enough reason to not address the problem right now :-)

> YUV streams but also for RAW, which is something that could be done at
> right away as we already have:
> 
> 	/* Report if camera supports RAW. */
> 	std::unique_ptr<CameraConfiguration> cameraConfig =
> 		camera_->generateConfiguration({ StreamRole::Raw });
> 	if (cameraConfig && !cameraConfig->empty()) {
> 		const PixelFormatInfo &info =
> 			PixelFormatInfo::info(cameraConfig->at(0).pixelFormat);
> 		if (info.colourEncoding == PixelFormatInfo::ColourEncodingRAW)
> 			availableCapabilities.push_back(ANDROID_REQUEST_AVAILABLE_CAPABILITIES_RAW);
> 	}

That would be a nice and simple enough addition to this patch. With
this,

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


> > Aside from that.
> >
> > Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> >
> > > +	staticMetadata_->addEntry(ANDROID_REQUEST_MAX_NUM_OUTPUT_STREAMS,
> > > +				  &numOutStreams, 3);
> > > +
> > >  	/* LIMITED does not support reprocessing. */
> > >  	uint32_t maxNumInputStreams = 0;
> > >  	staticMetadata_->addEntry(ANDROID_REQUEST_MAX_NUM_INPUT_STREAMS,
> > > @@ -1009,6 +1014,7 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
> > >  		ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL,
> > >  		ANDROID_REQUEST_PARTIAL_RESULT_COUNT,
> > >  		ANDROID_REQUEST_PIPELINE_MAX_DEPTH,
> > > +		ANDROID_REQUEST_MAX_NUM_OUTPUT_STREAMS,
> > >  		ANDROID_REQUEST_MAX_NUM_INPUT_STREAMS,
> > >  		ANDROID_REQUEST_AVAILABLE_CAPABILITIES,
> > >  	};

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list