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

Commit 1c19ca68 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes from topic 'b/62420820' into oc-dr1-dev

* changes:
  Camera: Device 3: Ignore buffer limits when clearing request queue
  Camera: fix status tracker race condition
parents f3ffd1ce ba435258
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -2326,8 +2326,12 @@ 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);
        if (mStatusTracker != nullptr) {
            mStatusTracker->markComponentActive(mInFlightStatusId);
        }
    }

    return OK;
}
@@ -2353,9 +2357,13 @@ 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);
        if (mStatusTracker != nullptr) {
            mStatusTracker->markComponentIdle(mInFlightStatusId, Fence::NO_FENCE);
        }
    }
}

void Camera3Device::removeInFlightRequestIfReadyLocked(int idx) {

@@ -3590,7 +3598,8 @@ status_t Camera3Device::RequestThread::clear(
            // Abort the input buffers for reprocess requests.
            if ((*it)->mInputStream != NULL) {
                camera3_stream_buffer_t inputBuffer;
                status_t res = (*it)->mInputStream->getInputBuffer(&inputBuffer);
                status_t res = (*it)->mInputStream->getInputBuffer(&inputBuffer,
                        /*respectHalLimit*/ false);
                if (res != OK) {
                    ALOGW("%s: %d: couldn't get input buffer while clearing the request "
                            "list: %s (%d)", __FUNCTION__, __LINE__, strerror(-res), res);
+2 −2
Original line number Diff line number Diff line
@@ -544,7 +544,7 @@ status_t Camera3Stream::returnBuffer(const camera3_stream_buffer &buffer,
    return res;
}

status_t Camera3Stream::getInputBuffer(camera3_stream_buffer *buffer) {
status_t Camera3Stream::getInputBuffer(camera3_stream_buffer *buffer, bool respectHalLimit) {
    ATRACE_CALL();
    Mutex::Autolock l(mLock);
    status_t res = OK;
@@ -557,7 +557,7 @@ status_t Camera3Stream::getInputBuffer(camera3_stream_buffer *buffer) {
    }

    // Wait for new buffer returned back if we are running into the limit.
    if (getHandoutInputBufferCountLocked() == camera3_stream::max_buffers) {
    if (getHandoutInputBufferCountLocked() == camera3_stream::max_buffers && respectHalLimit) {
        ALOGV("%s: Already dequeued max input buffers (%d), wait for next returned one.",
                __FUNCTION__, camera3_stream::max_buffers);
        res = mInputBufferReturnedSignal.waitRelative(mLock, kWaitForBufferDuration);
+3 −1
Original line number Diff line number Diff line
@@ -308,8 +308,10 @@ class Camera3Stream :
     * For bidirectional streams, this method applies to the input-side
     * buffers.
     *
     * Normally this call will block until the handed out buffer count is less than the stream
     * max buffer count; if respectHalLimit is set to false, this is ignored.
     */
    status_t         getInputBuffer(camera3_stream_buffer *buffer);
    status_t         getInputBuffer(camera3_stream_buffer *buffer, bool respectHalLimit = true);

    /**
     * Return a buffer to the stream after use by the HAL.
+3 −1
Original line number Diff line number Diff line
@@ -232,8 +232,10 @@ class Camera3StreamInterface : public virtual RefBase {
     * For bidirectional streams, this method applies to the input-side
     * buffers.
     *
     * Normally this call will block until the handed out buffer count is less than the stream
     * max buffer count; if respectHalLimit is set to false, this is ignored.
     */
    virtual status_t getInputBuffer(camera3_stream_buffer *buffer) = 0;
    virtual status_t getInputBuffer(camera3_stream_buffer *buffer, bool respectHalLimit = true) = 0;

    /**
     * Return a buffer to the stream after use by the HAL.