[libcamera-devel] [RFC PATCH 02/14] android, controls: Add and plumb MaxLatency control

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


Add a MaxLatency control, and plumb it into the HAL accordingly.

Bug: https://bugs.libcamera.org/show_bug.cgi?id=50
Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>
---
 src/android/camera_device.cpp  |  8 ++++++++
 src/libcamera/control_ids.yaml | 10 ++++++++++
 2 files changed, 18 insertions(+)

diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index 25dd2569..86f47e00 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -1187,6 +1187,14 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
 
 	/* Sync static metadata. */
 	int32_t maxLatency = ANDROID_SYNC_MAX_LATENCY_UNKNOWN;
+	const auto &maxLatencyInfo = controlsInfo.find(&controls::draft::MaxLatency);
+	if (maxLatencyInfo != controlsInfo.end())
+		maxLatency = maxLatencyInfo->second.def().get<int32_t>();
+	if (maxLatency < 0 && 4 < maxLatency)
+		capabilities[ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE] = false;
+	/* \todo Double check if this is the case */
+	if (maxLatency != 0)
+		fullSupport = false;
 	staticMetadata_->addEntry(ANDROID_SYNC_MAX_LATENCY, maxLatency);
 
 	/* Flash static metadata. */
diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml
index d92f29f5..9d4638ae 100644
--- a/src/libcamera/control_ids.yaml
+++ b/src/libcamera/control_ids.yaml
@@ -622,6 +622,16 @@ controls:
         detection, additional format conversions etc) count as an additional
         pipeline stage.
 
+  - MaxLatency:
+      type: int32_t
+      draft: true
+      description: |
+        The maximum number of frames that can occur after a request (different
+        than the previous) has been submitted, and before the result's state
+        becomes synchronized. A value of -1 indicates unknown latency, and 0
+        indicates per-frame control. Currently identical to
+        ANDROID_SYNC_MAX_LATENCY.
+
   - TestPatternMode:
       type: int32_t
       draft: true
-- 
2.27.0



More information about the libcamera-devel mailing list