[libcamera-devel] [RFC PATCH 08/14] android: Plumb AwbMode control

Paul Elder paul.elder at ideasonboard.com
Fri Jun 18 12:33:45 CEST 2021


Plumb the AwbMode control into the HAL for
CONTROL_AWB_AVAILABLE_MODES for static metadata.

Bug: https://bugs.libcamera.org/show_bug.cgi?id=44
Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>

---
TODO: plumb result metadata
---
 src/android/camera_device.cpp | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index 3add5bc6..a8b6fa38 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -985,15 +985,25 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
 	staticMetadata_->addEntry(ANDROID_CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES,
 				  availableStabilizationModes);
 
-	/*
-	 * \todo Inspect the Camera capabilities to report the available
-	 * AWB modes. Default to AUTO as CTS tests require it.
-	 */
-	std::vector<uint8_t> availableAwbModes = {
-		ANDROID_CONTROL_AWB_MODE_AUTO,
-	};
+	std::vector<uint8_t> awbAvailableModes;
+	awbAvailableModes.reserve(2);
+	const auto &awbModesInfo = controlsInfo.find(&controls::AwbMode);
+	if (awbModesInfo != controlsInfo.end()) {
+		for (const auto &value : awbModesInfo->second.values())
+			awbAvailableModes.push_back(value.get<int32_t>());
+	} else {
+		awbAvailableModes.push_back(ANDROID_CONTROL_AWB_MODE_AUTO);
+	}
+
+	if (std::find(awbAvailableModes.begin(),
+		      awbAvailableModes.end(),
+		      ANDROID_CONTROL_AWB_MODE_OFF) == awbAvailableModes.end()) {
+		fullSupport = false;
+		/* \todo Double check if this is the correct capability */
+		capabilities[ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING] = false;
+	}
 	staticMetadata_->addEntry(ANDROID_CONTROL_AWB_AVAILABLE_MODES,
-				  availableAwbModes);
+				  awbAvailableModes);
 
 	std::vector<int32_t> availableMaxRegions = {
 		0, 0, 0,
-- 
2.27.0



More information about the libcamera-devel mailing list