[libcamera-devel,4/4] android: camera_device: Add ANDROID_REQUEST_MAX_NUM_INPUT_STREAMS

Message ID 20200723173942.98182-5-niklas.soderlund@ragnatech.se
State Superseded
Headers show
Series
  • android: camera_device: Improve on format related tags
Related show

Commit Message

Niklas Söderlund July 23, 2020, 5:39 p.m. UTC
Define the ANDROID_REQUEST_MAX_NUM_INPUT_STREAMS to zero to inform users
the HAL does not support any reprocessing.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
---
 src/android/camera_device.cpp | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Niklas Söderlund July 24, 2020, 8:45 a.m. UTC | #1
Hi Jacopo,

Thanks for your work.

On 2020-07-24 10:46:09 +0200, Jacopo Mondi wrote:
> Hi Niklas,
> 
> On Thu, Jul 23, 2020 at 07:39:42PM +0200, Niklas Söderlund wrote:
> > Define the ANDROID_REQUEST_MAX_NUM_INPUT_STREAMS to zero to inform users
> > the HAL does not support any reprocessing.
> >
> > Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
> > ---
> >  src/android/camera_device.cpp | 10 ++++++++--
> >  1 file changed, 8 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> > index d9fdaf44b2803399..0e9fc216d2b54a1a 100644
> > --- a/src/android/camera_device.cpp
> > +++ b/src/android/camera_device.cpp
> > @@ -370,8 +370,8 @@ std::tuple<uint32_t, uint32_t> CameraDevice::calculateStaticMetadataSize()
> >  	 * \todo Keep this in sync with the actual number of entries.
> >  	 * Currently: 50 entries, 647 bytes of static metadata
> >  	 */
> > -	uint32_t numEntries = 49;
> > -	uint32_t byteSize = 647;
> > +	uint32_t numEntries = 50;
> > +	uint32_t byteSize = 648;
> 
> According to the above comment, this should be 651 (647 + 4)

Thanks for spotting this, will fix in next version.


> >
> >  	/*
> >  	 * Calculate space occupation in bytes for dynamically built metadata
> > @@ -699,6 +699,11 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
> >  	staticMetadata_->addEntry(ANDROID_REQUEST_PIPELINE_MAX_DEPTH,
> >  				  &maxPipelineDepth, 1);
> >
> > +	/* LIMITED does not support reprocessing. */
> > +	uint8_t maxNumInputStreams = 0;
> 
> I see this being of type int32_t
> 
> Before leaving a tag, can I ask what use cases requires this ? It's a
> tag required for FULL level, which we don't claim to support at the
> moment.

Without this tag Open Camera crashes and since I use that to verify RAW 
I thought I upstream it. As we set it to 0 I don't think it do any harm?

> 
> Thanks
>    j
> 
> > +	staticMetadata_->addEntry(ANDROID_REQUEST_MAX_NUM_INPUT_STREAMS,
> > +				  &maxNumInputStreams, 1);
> > +
> >  	std::vector<uint8_t> availableCapabilities = {
> >  		ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE,
> >  	};
> > @@ -752,6 +757,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_INPUT_STREAMS,
> >  		ANDROID_REQUEST_AVAILABLE_CAPABILITIES,
> >  	};
> >  	staticMetadata_->addEntry(ANDROID_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS,
> > --
> > 2.27.0
> >
> > _______________________________________________
> > libcamera-devel mailing list
> > libcamera-devel@lists.libcamera.org
> > https://lists.libcamera.org/listinfo/libcamera-devel
Jacopo Mondi July 24, 2020, 8:46 a.m. UTC | #2
Hi Niklas,

On Thu, Jul 23, 2020 at 07:39:42PM +0200, Niklas Söderlund wrote:
> Define the ANDROID_REQUEST_MAX_NUM_INPUT_STREAMS to zero to inform users
> the HAL does not support any reprocessing.
>
> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
> ---
>  src/android/camera_device.cpp | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> index d9fdaf44b2803399..0e9fc216d2b54a1a 100644
> --- a/src/android/camera_device.cpp
> +++ b/src/android/camera_device.cpp
> @@ -370,8 +370,8 @@ std::tuple<uint32_t, uint32_t> CameraDevice::calculateStaticMetadataSize()
>  	 * \todo Keep this in sync with the actual number of entries.
>  	 * Currently: 50 entries, 647 bytes of static metadata
>  	 */
> -	uint32_t numEntries = 49;
> -	uint32_t byteSize = 647;
> +	uint32_t numEntries = 50;
> +	uint32_t byteSize = 648;

According to the above comment, this should be 651 (647 + 4)
>
>  	/*
>  	 * Calculate space occupation in bytes for dynamically built metadata
> @@ -699,6 +699,11 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
>  	staticMetadata_->addEntry(ANDROID_REQUEST_PIPELINE_MAX_DEPTH,
>  				  &maxPipelineDepth, 1);
>
> +	/* LIMITED does not support reprocessing. */
> +	uint8_t maxNumInputStreams = 0;

I see this being of type int32_t

Before leaving a tag, can I ask what use cases requires this ? It's a
tag required for FULL level, which we don't claim to support at the
moment.

Thanks
   j

> +	staticMetadata_->addEntry(ANDROID_REQUEST_MAX_NUM_INPUT_STREAMS,
> +				  &maxNumInputStreams, 1);
> +
>  	std::vector<uint8_t> availableCapabilities = {
>  		ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE,
>  	};
> @@ -752,6 +757,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_INPUT_STREAMS,
>  		ANDROID_REQUEST_AVAILABLE_CAPABILITIES,
>  	};
>  	staticMetadata_->addEntry(ANDROID_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS,
> --
> 2.27.0
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
Jacopo Mondi July 24, 2020, 8:57 a.m. UTC | #3
On Fri, Jul 24, 2020 at 10:45:40AM +0200, Niklas Söderlund wrote:
> Hi Jacopo,
>
> Thanks for your work.
>
> On 2020-07-24 10:46:09 +0200, Jacopo Mondi wrote:
> > Hi Niklas,
> >
> > On Thu, Jul 23, 2020 at 07:39:42PM +0200, Niklas Söderlund wrote:
> > > Define the ANDROID_REQUEST_MAX_NUM_INPUT_STREAMS to zero to inform users
> > > the HAL does not support any reprocessing.
> > >
> > > Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
> > > ---
> > >  src/android/camera_device.cpp | 10 ++++++++--
> > >  1 file changed, 8 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> > > index d9fdaf44b2803399..0e9fc216d2b54a1a 100644
> > > --- a/src/android/camera_device.cpp
> > > +++ b/src/android/camera_device.cpp
> > > @@ -370,8 +370,8 @@ std::tuple<uint32_t, uint32_t> CameraDevice::calculateStaticMetadataSize()
> > >  	 * \todo Keep this in sync with the actual number of entries.
> > >  	 * Currently: 50 entries, 647 bytes of static metadata
> > >  	 */
> > > -	uint32_t numEntries = 49;
> > > -	uint32_t byteSize = 647;
> > > +	uint32_t numEntries = 50;
> > > +	uint32_t byteSize = 648;
> >
> > According to the above comment, this should be 651 (647 + 4)
>
> Thanks for spotting this, will fix in next version.
>
>
> > >
> > >  	/*
> > >  	 * Calculate space occupation in bytes for dynamically built metadata
> > > @@ -699,6 +699,11 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
> > >  	staticMetadata_->addEntry(ANDROID_REQUEST_PIPELINE_MAX_DEPTH,
> > >  				  &maxPipelineDepth, 1);
> > >
> > > +	/* LIMITED does not support reprocessing. */
> > > +	uint8_t maxNumInputStreams = 0;
> >
> > I see this being of type int32_t
> >
> > Before leaving a tag, can I ask what use cases requires this ? It's a
> > tag required for FULL level, which we don't claim to support at the
> > moment.
>
> Without this tag Open Camera crashes and since I use that to verify RAW
> I thought I upstream it. As we set it to 0 I don't think it do any harm?
>

Absolutely, just wanted to know what requires this to be present.

Please add my
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>

Thanks
  j

> >
> > Thanks
> >    j
> >
> > > +	staticMetadata_->addEntry(ANDROID_REQUEST_MAX_NUM_INPUT_STREAMS,
> > > +				  &maxNumInputStreams, 1);
> > > +
> > >  	std::vector<uint8_t> availableCapabilities = {
> > >  		ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE,
> > >  	};
> > > @@ -752,6 +757,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_INPUT_STREAMS,
> > >  		ANDROID_REQUEST_AVAILABLE_CAPABILITIES,
> > >  	};
> > >  	staticMetadata_->addEntry(ANDROID_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS,
> > > --
> > > 2.27.0
> > >
> > > _______________________________________________
> > > libcamera-devel mailing list
> > > libcamera-devel@lists.libcamera.org
> > > https://lists.libcamera.org/listinfo/libcamera-devel
>
> --
> Regards,
> Niklas Söderlund

Patch

diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index d9fdaf44b2803399..0e9fc216d2b54a1a 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -370,8 +370,8 @@  std::tuple<uint32_t, uint32_t> CameraDevice::calculateStaticMetadataSize()
 	 * \todo Keep this in sync with the actual number of entries.
 	 * Currently: 50 entries, 647 bytes of static metadata
 	 */
-	uint32_t numEntries = 49;
-	uint32_t byteSize = 647;
+	uint32_t numEntries = 50;
+	uint32_t byteSize = 648;
 
 	/*
 	 * Calculate space occupation in bytes for dynamically built metadata
@@ -699,6 +699,11 @@  const camera_metadata_t *CameraDevice::getStaticMetadata()
 	staticMetadata_->addEntry(ANDROID_REQUEST_PIPELINE_MAX_DEPTH,
 				  &maxPipelineDepth, 1);
 
+	/* LIMITED does not support reprocessing. */
+	uint8_t maxNumInputStreams = 0;
+	staticMetadata_->addEntry(ANDROID_REQUEST_MAX_NUM_INPUT_STREAMS,
+				  &maxNumInputStreams, 1);
+
 	std::vector<uint8_t> availableCapabilities = {
 		ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE,
 	};
@@ -752,6 +757,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_INPUT_STREAMS,
 		ANDROID_REQUEST_AVAILABLE_CAPABILITIES,
 	};
 	staticMetadata_->addEntry(ANDROID_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS,