Commit e0774b4a authored by Jasmine Chen's avatar Jasmine Chen Committed by Commit Bot

Skip 3A for still capture if ZSL is enabled

This CL skips the wait for 3A-convergence (AE, AF, AWB) when
Zero-Shutter Lag (ZSL) is enabled. When configuring streams, camera HAL
adapter would add a private usage flag to the configured still capture
streams. Video Capture Device (VCD) would then use this private usage
flag to determine if ZSL is enabled. If ZSL is enabled, we skip 3A when
trying to construct a capture request.

This is a reland of crrev.com/c/1919530. In
Camera3AControllerTest.Stabilize3AForStillCaptureTest, we didn't
initialize zero_shutter_lag_enabled causing 3A stabilization to be
skipped randomly, failing postsubmit.

BUG=b:130851309
TEST=Tested on kukui and verified VCD is able to get ZSL availability
through the private usage flag && capture_unittests.

Change-Id: I8717dec6210151242240502ebd37c68c43c530ed
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2066410
Auto-Submit: Jasmine Chen <lnishan@google.com>
Reviewed-by: default avatarShik Chen <shik@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Commit-Queue: Jasmine Chen <lnishan@google.com>
Cr-Commit-Position: refs/heads/master@{#743471}
parent 9405e2e6
...@@ -49,7 +49,8 @@ Camera3AController::Camera3AController( ...@@ -49,7 +49,8 @@ Camera3AController::Camera3AController(
ANDROID_CONTROL_AWB_STATE_INACTIVE), ANDROID_CONTROL_AWB_STATE_INACTIVE),
awb_mode_set_(false), awb_mode_set_(false),
set_point_of_interest_running_(false), set_point_of_interest_running_(false),
ae_locked_for_point_of_interest_(false) { ae_locked_for_point_of_interest_(false),
zero_shutter_lag_enabled_(false) {
DCHECK(task_runner_->BelongsToCurrentThread()); DCHECK(task_runner_->BelongsToCurrentThread());
capture_metadata_dispatcher_->AddResultMetadataObserver(this); capture_metadata_dispatcher_->AddResultMetadataObserver(this);
...@@ -181,7 +182,7 @@ void Camera3AController::Stabilize3AForStillCapture( ...@@ -181,7 +182,7 @@ void Camera3AController::Stabilize3AForStillCapture(
return; return;
} }
if (Is3AStabilized()) { if (Is3AStabilized() || zero_shutter_lag_enabled_) {
std::move(on_3a_stabilized_callback).Run(); std::move(on_3a_stabilized_callback).Run();
return; return;
} }
...@@ -501,6 +502,10 @@ void Camera3AController::SetPointOfInterestUnlockAe() { ...@@ -501,6 +502,10 @@ void Camera3AController::SetPointOfInterestUnlockAe() {
ClearRepeatingCaptureMetadata(); ClearRepeatingCaptureMetadata();
} }
void Camera3AController::UpdateZeroShutterLagAvailability(bool enabled) {
zero_shutter_lag_enabled_ = enabled;
}
base::WeakPtr<Camera3AController> Camera3AController::GetWeakPtr() { base::WeakPtr<Camera3AController> Camera3AController::GetWeakPtr() {
DCHECK(task_runner_->BelongsToCurrentThread()); DCHECK(task_runner_->BelongsToCurrentThread());
......
...@@ -47,6 +47,10 @@ class CAPTURE_EXPORT Camera3AController ...@@ -47,6 +47,10 @@ class CAPTURE_EXPORT Camera3AController
// pixel array. // pixel array.
void SetPointOfInterest(gfx::Point point); void SetPointOfInterest(gfx::Point point);
// Updates the availability of Zero-Shutter Lag (ZSL). We skip 3A (AE, AF,
// AWB) if ZSL is enabled.
void UpdateZeroShutterLagAvailability(bool enabled);
base::WeakPtr<Camera3AController> GetWeakPtr(); base::WeakPtr<Camera3AController> GetWeakPtr();
private: private:
...@@ -114,6 +118,8 @@ class CAPTURE_EXPORT Camera3AController ...@@ -114,6 +118,8 @@ class CAPTURE_EXPORT Camera3AController
bool ae_locked_for_point_of_interest_; bool ae_locked_for_point_of_interest_;
bool zero_shutter_lag_enabled_;
base::TimeDelta latest_sensor_timestamp_; base::TimeDelta latest_sensor_timestamp_;
std::unordered_set<cros::mojom::CameraMetadataTag> repeating_metadata_tags_; std::unordered_set<cros::mojom::CameraMetadataTag> repeating_metadata_tags_;
......
...@@ -732,6 +732,16 @@ void CameraDeviceDelegate::OnConfiguredStreams( ...@@ -732,6 +732,16 @@ void CameraDeviceDelegate::OnConfiguredStreams(
return; return;
} }
bool zero_shutter_lag_enabled = false;
for (const auto& stream : updated_config->streams) {
if (stream->usage & cros::mojom::GRALLOC_USAGE_ZERO_SHUTTER_LAG_ENABLED) {
zero_shutter_lag_enabled = true;
break;
}
}
camera_3a_controller_->UpdateZeroShutterLagAvailability(
zero_shutter_lag_enabled);
current_blob_resolution_.SetSize(blob_resolution.width(), current_blob_resolution_.SetSize(blob_resolution.width(),
blob_resolution.height()); blob_resolution.height());
......
...@@ -27,6 +27,10 @@ const uint32 GRALLOC_USAGE_FORCE_I420 = 0x10000000; ...@@ -27,6 +27,10 @@ const uint32 GRALLOC_USAGE_FORCE_I420 = 0x10000000;
// into a new HAL request for Zero-Shutter Lag (ZSL). See crrev.com/c/1877636 // into a new HAL request for Zero-Shutter Lag (ZSL). See crrev.com/c/1877636
// for the CL that does the aforementioned things. // for the CL that does the aforementioned things.
const uint32 GRALLOC_USAGE_STILL_CAPTURE = 0x20000000; const uint32 GRALLOC_USAGE_STILL_CAPTURE = 0x20000000;
// Flag to indicate ZSL is enabled for this session. Returned in the updated
// stream configuration returned from configure_streams(). Refer to
// crrev.com/c/2055927 which returns this flag.
const uint32 GRALLOC_USAGE_ZERO_SHUTTER_LAG_ENABLED = 0x40000000;
[Extensible] [Extensible]
enum HalPixelFormat { enum HalPixelFormat {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment