[libcamera-devel,v6,10/10] android: camera_device: Do not default pixel array properties
diff mbox series

Message ID 20210107094735.11673-11-jacopo@jmondi.org
State Accepted
Delegated to: Jacopo Mondi
Headers show
Series
  • libcamera: camera_sensor: Make validation more strict
Related show

Commit Message

Jacopo Mondi Jan. 7, 2021, 9:47 a.m. UTC
Now that the pixel array properties have been defaulted in the
CameraSensor class (or in the pipeline handler, for the UVC use case),
they will always be reported by the libcamera::Camera and there's no
need to default them in the Camera HAL.

Remove defaults and assume properties are always there.

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 src/android/camera_device.cpp | 20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)

Comments

Niklas Söderlund Jan. 13, 2021, 1:04 p.m. UTC | #1
Hi Jacopo,

On 2021-01-07 10:47:35 +0100, Jacopo Mondi wrote:
> Now that the pixel array properties have been defaulted in the
> CameraSensor class (or in the pipeline handler, for the UVC use case),
> they will always be reported by the libcamera::Camera and there's no
> need to default them in the Camera HAL.
> 
> Remove defaults and assume properties are always there.
> 
> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se

:-)

> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
> ---
>  src/android/camera_device.cpp | 20 ++------------------
>  1 file changed, 2 insertions(+), 18 deletions(-)
> 
> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> index 23be2a593a2a..a136f8e33843 100644
> --- a/src/android/camera_device.cpp
> +++ b/src/android/camera_device.cpp
> @@ -851,7 +851,7 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
>  	staticMetadata_->addEntry(ANDROID_JPEG_MAX_SIZE, &maxJpegBufferSize_, 1);
>  
>  	/* Sensor static metadata. */
> -	if (properties.contains(properties::PixelArraySize)) {
> +	{
>  		const Size &size =
>  			properties.get(properties::PixelArraySize);
>  		std::vector<int32_t> data{
> @@ -860,17 +860,9 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
>  		};
>  		staticMetadata_->addEntry(ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE,
>  					  data.data(), data.size());
> -	} else {
> -		/*
> -		 * \todo Drop the default once the ov5670 and ov13858 drivers
> -		 * are updated to report the pixel array size.
> -		 */
> -		int32_t data[] = { 2592, 1944 };
> -		staticMetadata_->addEntry(ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE,
> -					  data, 2);
>  	}
>  
> -	if (properties.contains(properties::PixelArrayActiveAreas)) {
> +	{
>  		const Span<const Rectangle> &rects =
>  			properties.get(properties::PixelArrayActiveAreas);
>  		std::vector<int32_t> data{
> @@ -881,14 +873,6 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
>  		};
>  		staticMetadata_->addEntry(ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE,
>  					  data.data(), data.size());
> -	} else {
> -		/*
> -		 * \todo Drop the default once the ov5670 and ov13858 drivers
> -		 * are updated to report the pixel array size.
> -		 */
> -		int32_t data[] = { 0, 0, 2560, 1920 };
> -		staticMetadata_->addEntry(ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE,
> -					  data, 4);
>  	}
>  
>  	int32_t sensitivityRange[] = {
> -- 
> 2.29.2
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
Jacopo Mondi Jan. 13, 2021, 3:39 p.m. UTC | #2
Hi Niklas,

On Wed, Jan 13, 2021 at 02:04:31PM +0100, Niklas Söderlund wrote:
> Hi Jacopo,
>
> On 2021-01-07 10:47:35 +0100, Jacopo Mondi wrote:
> > Now that the pixel array properties have been defaulted in the
> > CameraSensor class (or in the pipeline handler, for the UVC use case),
> > they will always be reported by the libcamera::Camera and there's no
> > need to default them in the Camera HAL.
> >
> > Remove defaults and assume properties are always there.
> >
> > Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se
>
> :-)
>

Ups, bad copy&paste... I'll fix

Thanks
   j

> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
> > ---
> >  src/android/camera_device.cpp | 20 ++------------------
> >  1 file changed, 2 insertions(+), 18 deletions(-)
> >
> > diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> > index 23be2a593a2a..a136f8e33843 100644
> > --- a/src/android/camera_device.cpp
> > +++ b/src/android/camera_device.cpp
> > @@ -851,7 +851,7 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
> >  	staticMetadata_->addEntry(ANDROID_JPEG_MAX_SIZE, &maxJpegBufferSize_, 1);
> >
> >  	/* Sensor static metadata. */
> > -	if (properties.contains(properties::PixelArraySize)) {
> > +	{
> >  		const Size &size =
> >  			properties.get(properties::PixelArraySize);
> >  		std::vector<int32_t> data{
> > @@ -860,17 +860,9 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
> >  		};
> >  		staticMetadata_->addEntry(ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE,
> >  					  data.data(), data.size());
> > -	} else {
> > -		/*
> > -		 * \todo Drop the default once the ov5670 and ov13858 drivers
> > -		 * are updated to report the pixel array size.
> > -		 */
> > -		int32_t data[] = { 2592, 1944 };
> > -		staticMetadata_->addEntry(ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE,
> > -					  data, 2);
> >  	}
> >
> > -	if (properties.contains(properties::PixelArrayActiveAreas)) {
> > +	{
> >  		const Span<const Rectangle> &rects =
> >  			properties.get(properties::PixelArrayActiveAreas);
> >  		std::vector<int32_t> data{
> > @@ -881,14 +873,6 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
> >  		};
> >  		staticMetadata_->addEntry(ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE,
> >  					  data.data(), data.size());
> > -	} else {
> > -		/*
> > -		 * \todo Drop the default once the ov5670 and ov13858 drivers
> > -		 * are updated to report the pixel array size.
> > -		 */
> > -		int32_t data[] = { 0, 0, 2560, 1920 };
> > -		staticMetadata_->addEntry(ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE,
> > -					  data, 4);
> >  	}
> >
> >  	int32_t sensitivityRange[] = {
> > --
> > 2.29.2
> >
> > _______________________________________________
> > libcamera-devel mailing list
> > libcamera-devel@lists.libcamera.org
> > https://lists.libcamera.org/listinfo/libcamera-devel
>
> --
> Regards,
> Niklas Söderlund

Patch
diff mbox series

diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index 23be2a593a2a..a136f8e33843 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -851,7 +851,7 @@  const camera_metadata_t *CameraDevice::getStaticMetadata()
 	staticMetadata_->addEntry(ANDROID_JPEG_MAX_SIZE, &maxJpegBufferSize_, 1);
 
 	/* Sensor static metadata. */
-	if (properties.contains(properties::PixelArraySize)) {
+	{
 		const Size &size =
 			properties.get(properties::PixelArraySize);
 		std::vector<int32_t> data{
@@ -860,17 +860,9 @@  const camera_metadata_t *CameraDevice::getStaticMetadata()
 		};
 		staticMetadata_->addEntry(ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE,
 					  data.data(), data.size());
-	} else {
-		/*
-		 * \todo Drop the default once the ov5670 and ov13858 drivers
-		 * are updated to report the pixel array size.
-		 */
-		int32_t data[] = { 2592, 1944 };
-		staticMetadata_->addEntry(ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE,
-					  data, 2);
 	}
 
-	if (properties.contains(properties::PixelArrayActiveAreas)) {
+	{
 		const Span<const Rectangle> &rects =
 			properties.get(properties::PixelArrayActiveAreas);
 		std::vector<int32_t> data{
@@ -881,14 +873,6 @@  const camera_metadata_t *CameraDevice::getStaticMetadata()
 		};
 		staticMetadata_->addEntry(ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE,
 					  data.data(), data.size());
-	} else {
-		/*
-		 * \todo Drop the default once the ov5670 and ov13858 drivers
-		 * are updated to report the pixel array size.
-		 */
-		int32_t data[] = { 0, 0, 2560, 1920 };
-		staticMetadata_->addEntry(ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE,
-					  data, 4);
 	}
 
 	int32_t sensitivityRange[] = {