Merge "Camera: Use separate lock for status tracker access sync"

gugelfrei
TreeHugger Robot 6 years ago committed by Android (Google) Code Review
commit a2a19382e5

@ -277,6 +277,7 @@ status_t Camera3Device::initializeCommonLocked() {
status_t Camera3Device::disconnect() {
ATRACE_CALL();
Mutex::Autolock il(mInterfaceLock);
Mutex::Autolock stLock(mTrackerLock);
ALOGI("%s: E", __FUNCTION__);
@ -2728,8 +2729,9 @@ status_t Camera3Device::registerInFlight(uint32_t frameNumber,
if (res < 0) return res;
if (mInFlightMap.size() == 1) {
// hold mLock to prevent race with disconnect
Mutex::Autolock l(mLock);
// Hold a separate dedicated tracker lock to prevent race with disconnect and also
// avoid a deadlock during reprocess requests.
Mutex::Autolock l(mTrackerLock);
if (mStatusTracker != nullptr) {
mStatusTracker->markComponentActive(mInFlightStatusId);
}
@ -2762,8 +2764,9 @@ void Camera3Device::removeInFlightMapEntryLocked(int idx) {
// Indicate idle inFlightMap to the status tracker
if (mInFlightMap.size() == 0) {
// hold mLock to prevent race with disconnect
Mutex::Autolock l(mLock);
// Hold a separate dedicated tracker lock to prevent race with disconnect and also
// avoid a deadlock during reprocess requests.
Mutex::Autolock l(mTrackerLock);
if (mStatusTracker != nullptr) {
mStatusTracker->markComponentIdle(mInFlightStatusId, Fence::NO_FENCE);
}

@ -1210,6 +1210,9 @@ class Camera3Device :
static callbacks_notify_t sNotify;
// Synchronizes access to status tracker between inflight updates and disconnect.
// b/79972865
Mutex mTrackerLock;
}; // class Camera3Device
}; // namespace android

Loading…
Cancel
Save