Camera2: Fix ZSL bugs.
The ZSL processor was discarding buffers too often, and waiting for
new buffers with mutexes held.
Also adds basic fallback to regular capture in case the ZSL queue
doesn't contain a suitable buffer.
Bug: 7147043
Change-Id: I5721267ef08dbc87ef9d8ec47f333db5f67e41c1
diff --git a/services/camera/libcameraservice/camera2/CaptureSequencer.cpp b/services/camera/libcameraservice/camera2/CaptureSequencer.cpp
index 2f8b7db..678f114 100644
--- a/services/camera/libcameraservice/camera2/CaptureSequencer.cpp
+++ b/services/camera/libcameraservice/camera2/CaptureSequencer.cpp
@@ -253,6 +253,7 @@
CaptureSequencer::CaptureState CaptureSequencer::manageZslStart(
sp<Camera2Client> &client) {
+ ALOGV("%s", __FUNCTION__);
status_t res;
sp<ZslProcessor> processor = mZslProcessor.promote();
if (processor == 0) {
@@ -271,7 +272,12 @@
return DONE;
}
// TODO: Actually select the right thing here.
- processor->pushToReprocess(mCaptureId);
+ res = processor->pushToReprocess(mCaptureId);
+ if (res != OK) {
+ ALOGW("%s: Camera %d: Failed to use ZSL queue, falling back to standard capture",
+ __FUNCTION__, client->getCameraId());
+ return STANDARD_START;
+ }
mTimeoutCount = kMaxTimeoutsForCaptureEnd;
return STANDARD_CAPTURE_WAIT;
@@ -279,11 +285,13 @@
CaptureSequencer::CaptureState CaptureSequencer::manageZslWaiting(
sp<Camera2Client> &client) {
+ ALOGV("%s", __FUNCTION__);
return DONE;
}
CaptureSequencer::CaptureState CaptureSequencer::manageZslReprocessing(
sp<Camera2Client> &client) {
+ ALOGV("%s", __FUNCTION__);
return START;
}