Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e4df8abe authored by Eino-Ville Talvala's avatar Eino-Ville Talvala
Browse files

Camera3Device: Wait for empty in-flight map when waiting for idle

Currently we only wait for the request queue to be idle, and for
all outstanding buffers to be returned to their queues and their
fences triggered.

But we also need to wait for result metadata to arrive for all
in-flight requests.  This is simplest to check for by monitoring
entries in the in-flight map and signaling idle/active to the
status tracker when the map becomes empty/nonempty.

Bug: 30282459
Change-Id: I34275b0fdb4f279783291d300707ac21a6aa5249
parent a6c2f960
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -169,6 +169,9 @@ status_t Camera3Device::initialize(CameraModule *module)
        return res;
    }

    /** Register in-flight map to the status tracker */
    mInFlightStatusId = mStatusTracker->addComponent();

    /** Create buffer manager */
    mBufferManager = new Camera3BufferManager();

@@ -2198,6 +2201,10 @@ status_t Camera3Device::registerInFlight(uint32_t frameNumber,
            aeTriggerCancelOverride));
    if (res < 0) return res;

    if (mInFlightMap.size() == 1) {
        mStatusTracker->markComponentActive(mInFlightStatusId);
    }

    return OK;
}

@@ -2254,6 +2261,11 @@ void Camera3Device::removeInFlightRequestIfReadyLocked(int idx) {

        mInFlightMap.removeItemsAt(idx, 1);

        // Indicate idle inFlightMap to the status tracker
        if (mInFlightMap.size() == 0) {
            mStatusTracker->markComponentIdle(mInFlightStatusId, Fence::NO_FENCE);
        }

        ALOGVV("%s: removed frame %d from InFlightMap", __FUNCTION__, frameNumber);
     }

+1 −0
Original line number Diff line number Diff line
@@ -727,6 +727,7 @@ class Camera3Device :

    Mutex                  mInFlightLock; // Protects mInFlightMap
    InFlightMap            mInFlightMap;
    int                    mInFlightStatusId;

    status_t registerInFlight(uint32_t frameNumber,
            int32_t numBuffers, CaptureResultExtras resultExtras, bool hasInput,