[libcamera-devel,RFC,7/8] android: camera_device: Add AWB mode off to available AWB modes
diff mbox series

Message ID 20210401101340.160590-8-paul.elder@ideasonboard.com
State Superseded
Delegated to: Paul Elder
Headers show
Series
  • android: First set of FULL fixes
Related show

Commit Message

Paul Elder April 1, 2021, 10:13 a.m. UTC
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@ideasonboard.com>
---
 src/android/camera_device.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Patch
diff mbox series

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);