[libcamera-devel] android: camera_device: Temporary fix sensor properties
diff mbox series

Message ID 20201210175939.166033-1-jacopo@jmondi.org
State Accepted
Delegated to: Jacopo Mondi
Headers show
Series
  • [libcamera-devel] android: camera_device: Temporary fix sensor properties
Related show

Commit Message

Jacopo Mondi Dec. 10, 2020, 5:59 p.m. UTC
The ChromeOS camera service, which is the current main user of the
Android Camera HAL, fails to start if the pixel array properties are
not registered.

As the sensor driver for the Soraka test device have not yet been
updated to report their pixel array properties through the V4L2
selection API, temporary fix the gap by re-establishing the default
properties values removed by commit 1889cdc2e91c ("android: camera_device:
Initialize pixel array properties")

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 src/android/camera_device.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Laurent Pinchart Dec. 10, 2020, 6:03 p.m. UTC | #1
Hi Jacopo,

Thank you for the patch.

On Thu, Dec 10, 2020 at 06:59:39PM +0100, Jacopo Mondi wrote:
> The ChromeOS camera service, which is the current main user of the
> Android Camera HAL, fails to start if the pixel array properties are
> not registered.
> 
> As the sensor driver for the Soraka test device have not yet been
> updated to report their pixel array properties through the V4L2
> selection API, temporary fix the gap by re-establishing the default
> properties values removed by commit 1889cdc2e91c ("android: camera_device:
> Initialize pixel array properties")
> 
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
> ---
>  src/android/camera_device.cpp | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> index e9fb23175d27..8b46e2d1e4ba 100644
> --- a/src/android/camera_device.cpp
> +++ b/src/android/camera_device.cpp
> @@ -735,6 +735,10 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
>  		};
>  		staticMetadata_->addEntry(ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE,
>  					  data.data(), data.size());
> +	} else {

With

		/*
		 * \todo Drop the default once the ov5670 and ov13858 drivers
		 * are updated to report the pixel array size.
		 */

(and possibly the same below),

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

> +		int32_t data[] = { 2592, 1944 };
> +		staticMetadata_->addEntry(ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE,
> +					  data, 2);
>  	}
>  
>  	if (properties.contains(properties::PixelArrayActiveAreas)) {
> @@ -748,6 +752,10 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
>  		};
>  		staticMetadata_->addEntry(ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE,
>  					  data.data(), data.size());
> +	} else {
> +		int32_t data[] = { 0, 0, 2560, 1920 };
> +		staticMetadata_->addEntry(ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE,
> +					  data, 4);
>  	}
>  
>  	int32_t sensitivityRange[] = {

Patch
diff mbox series

diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index e9fb23175d27..8b46e2d1e4ba 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -735,6 +735,10 @@  const camera_metadata_t *CameraDevice::getStaticMetadata()
 		};
 		staticMetadata_->addEntry(ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE,
 					  data.data(), data.size());
+	} else {
+		int32_t data[] = { 2592, 1944 };
+		staticMetadata_->addEntry(ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE,
+					  data, 2);
 	}
 
 	if (properties.contains(properties::PixelArrayActiveAreas)) {
@@ -748,6 +752,10 @@  const camera_metadata_t *CameraDevice::getStaticMetadata()
 		};
 		staticMetadata_->addEntry(ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE,
 					  data.data(), data.size());
+	} else {
+		int32_t data[] = { 0, 0, 2560, 1920 };
+		staticMetadata_->addEntry(ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE,
+					  data, 4);
 	}
 
 	int32_t sensitivityRange[] = {