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

Niklas Söderlund niklas.soderlund at ragnatech.se
Fri Dec 18 15:54:50 CET 2020


Hi Jacopo,

On 2020-12-18 15:49:43 +0100, Jacopo Mondi wrote:
> Hi Niklas,
> 
> On Fri, Dec 18, 2020 at 03:44:16PM +0100, Niklas Söderlund wrote:
> > Hi Jacopo,
> >
> > Thanks for your patch.
> >
> > On 2020-12-17 15:03:58 +0100, 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 optional RAW stream
> > > - 2 YUV streams
> > > - 1 JPEG stream
> > >
> > > Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> > > Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> > > Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
> > > ---
> > >  src/android/camera_device.cpp | 17 +++++++++++++----
> > >  1 file changed, 13 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> > > index 26aa3bc4b123..b4618a680f41 100644
> > > --- a/src/android/camera_device.cpp
> > > +++ b/src/android/camera_device.cpp
> > > @@ -675,10 +675,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
> > > @@ -1090,15 +1090,23 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
> > >  	};
> > >
> > >  	/* Report if camera supports RAW. */
> > > +	bool rawStreamAvailable = false;
> > >  	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)
> > > +		if (info.colourEncoding == PixelFormatInfo::ColourEncodingRAW) {
> > > +			rawStreamAvailable = true;
> >
> > I wonder if we should make this check more restrictive and check for
> > RAW16 instead of any RAW format?
> 
> 
> Yes, probably, that's related to the question of which formats should
> be supported in order to claim support for RAW to Android.
> 
> I think this is unrelated to this patch, isn't it ?

Maybe it is, I was just thinking a head as I hope to soon tackle RAW and 
CTS so the tests for RAW that require RAW16 are skipped correctly. But 
as I don't know yet how to best do that this is a good step in the right 
direction.

Reviewed-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>

> 
> >
> > >  			availableCapabilities.push_back(ANDROID_REQUEST_AVAILABLE_CAPABILITIES_RAW);
> > > +		}
> > >  	}
> > >
> > > +	/* Number of { RAW, YUV, JPEG } supported output streams */
> > > +	int32_t numOutStreams[] = { rawStreamAvailable, 2, 1 };
> > > +	staticMetadata_->addEntry(ANDROID_REQUEST_MAX_NUM_OUTPUT_STREAMS,
> > > +				  &numOutStreams, 3);
> > > +
> > >  	staticMetadata_->addEntry(ANDROID_REQUEST_AVAILABLE_CAPABILITIES,
> > >  				  availableCapabilities.data(),
> > >  				  availableCapabilities.size());
> > > @@ -1150,6 +1158,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,
> > >  	};
> > > --
> > > 2.29.2
> > >
> > > _______________________________________________
> > > libcamera-devel mailing list
> > > libcamera-devel at lists.libcamera.org
> > > https://lists.libcamera.org/listinfo/libcamera-devel
> >
> > --
> > Regards,
> > Niklas Söderlund

-- 
Regards,
Niklas Söderlund


More information about the libcamera-devel mailing list