[libcamera-devel] [RFC PATCH 7/8] android: camera_device: Add AWB mode off to available AWB modes

Paul Elder paul.elder at ideasonboard.com
Thu Apr 1 12:13:39 CEST 2021


Hardware level FULL requires AWB mode off to be an available AWB mode.
Add it.

Hardware level FULL additionally requires the AWB mode of the result
metadata to be what was provided in the request metadata. Do this.

This allows the following CTS test to pass:
- android.hardware.camera2.cts.CaptureRequestTest#testAwbModeAndLock

Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>
---
 src/android/camera_device.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index 584c3c4a..a187beff 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -859,9 +859,11 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
 
 	/*
 	 * \todo Inspect the Camera capabilities to report the available
-	 * AWB modes. Default to AUTO as CTS tests require it.
+	 * AWB modes. Default to AUTO as CTS tests require it. FULL requires
+	 * OFF.
 	 */
 	std::vector<uint8_t> availableAwbModes = {
+		ANDROID_CONTROL_AWB_MODE_OFF,
 		ANDROID_CONTROL_AWB_MODE_AUTO,
 	};
 	staticMetadata_->addEntry(ANDROID_CONTROL_AWB_AVAILABLE_MODES,
@@ -2141,7 +2143,9 @@ CameraDevice::getResultMetadata(const Camera3RequestDescriptor &descriptor,
 	resultMetadata->addEntry(ANDROID_CONTROL_AF_TRIGGER, &value, 1);
 
 	value = ANDROID_CONTROL_AWB_MODE_AUTO;
-	resultMetadata->addEntry(ANDROID_CONTROL_AWB_MODE, &value, 1);
+	found = settings.getEntry(ANDROID_CONTROL_AWB_MODE, &entry);
+	resultMetadata->addEntry(ANDROID_CONTROL_AWB_MODE,
+				 found ? entry.data.u8 : &value, 1);
 
 	value = ANDROID_CONTROL_AWB_LOCK_OFF;
 	resultMetadata->addEntry(ANDROID_CONTROL_AWB_LOCK, &value, 1);
-- 
2.27.0



More information about the libcamera-devel mailing list