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

Commit 6689f2e8 authored by Yin-Chia Yeh's avatar Yin-Chia Yeh Committed by android-build-merger
Browse files

Merge "Camera: extend getBuffer wait timeout" am: a8fb86eb am: 453a3787

am: fd9ed407

Change-Id: I0409acec970e4d2a94c596ef9f888e43029897aa
parents 603414d5 fd9ed407
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -4891,6 +4891,15 @@ status_t Camera3Device::RequestThread::prepareHalRequests() {
                captureRequest->mOutputStreams.size());
        halRequest->output_buffers = outputBuffers->array();
        std::set<String8> requestedPhysicalCameras;

        sp<Camera3Device> parent = mParent.promote();
        if (parent == NULL) {
            // Should not happen, and nowhere to send errors to, so just log it
            CLOGE("RequestThread: Parent is gone");
            return INVALID_OPERATION;
        }
        nsecs_t waitDuration = kBaseGetBufferWait + parent->getExpectedInFlightDuration();

        for (size_t j = 0; j < captureRequest->mOutputStreams.size(); j++) {
            sp<Camera3OutputStreamInterface> outputStream = captureRequest->mOutputStreams.editItemAt(j);

@@ -4911,6 +4920,7 @@ status_t Camera3Device::RequestThread::prepareHalRequests() {
            }

            res = outputStream->getBuffer(&outputBuffers->editItemAt(j),
                    waitDuration,
                    captureRequest->mOutputSurfaces[j]);
            if (res != OK) {
                // Can't get output buffer from gralloc queue - this could be due to
@@ -4937,13 +4947,6 @@ status_t Camera3Device::RequestThread::prepareHalRequests() {
        totalNumBuffers += halRequest->num_output_buffers;

        // Log request in the in-flight queue
        sp<Camera3Device> parent = mParent.promote();
        if (parent == NULL) {
            // Should not happen, and nowhere to send errors to, so just log it
            CLOGE("RequestThread: Parent is gone");
            return INVALID_OPERATION;
        }

        // If this request list is for constrained high speed recording (not
        // preview), and the current request is not the last one in the batch,
        // do not send callback to the app.
+1 −0
Original line number Diff line number Diff line
@@ -223,6 +223,7 @@ class Camera3Device :
    static const size_t        kInFlightWarnLimitHighSpeed = 256; // batch size 32 * pipe depth 8
    static const nsecs_t       kDefaultExpectedDuration = 100000000; // 100 ms
    static const nsecs_t       kMinInflightDuration = 5000000000; // 5 s
    static const nsecs_t       kBaseGetBufferWait = 3000000000; // 3 sec.
    // SCHED_FIFO priority for request submission thread in HFR mode
    static const int           kRequestThreadPriority = 1;

+6 −2
Original line number Diff line number Diff line
@@ -577,6 +577,7 @@ status_t Camera3Stream::tearDown() {
}

status_t Camera3Stream::getBuffer(camera3_stream_buffer *buffer,
        nsecs_t waitBufferTimeout,
        const std::vector<size_t>& surface_ids) {
    ATRACE_CALL();
    Mutex::Autolock l(mLock);
@@ -594,13 +595,16 @@ status_t Camera3Stream::getBuffer(camera3_stream_buffer *buffer,
        ALOGV("%s: Already dequeued max output buffers (%d), wait for next returned one.",
                        __FUNCTION__, camera3_stream::max_buffers);
        nsecs_t waitStart = systemTime(SYSTEM_TIME_MONOTONIC);
        res = mOutputBufferReturnedSignal.waitRelative(mLock, kWaitForBufferDuration);
        if (waitBufferTimeout < kWaitForBufferDuration) {
            waitBufferTimeout = kWaitForBufferDuration;
        }
        res = mOutputBufferReturnedSignal.waitRelative(mLock, waitBufferTimeout);
        nsecs_t waitEnd = systemTime(SYSTEM_TIME_MONOTONIC);
        mBufferLimitLatency.add(waitStart, waitEnd);
        if (res != OK) {
            if (res == TIMED_OUT) {
                ALOGE("%s: wait for output buffer return timed out after %lldms (max_buffers %d)",
                        __FUNCTION__, kWaitForBufferDuration / 1000000LL,
                        __FUNCTION__, waitBufferTimeout / 1000000LL,
                        camera3_stream::max_buffers);
            }
            return res;
+1 −0
Original line number Diff line number Diff line
@@ -311,6 +311,7 @@ class Camera3Stream :
     *
     */
    status_t         getBuffer(camera3_stream_buffer *buffer,
            nsecs_t waitBufferTimeout,
            const std::vector<size_t>& surface_ids = std::vector<size_t>());

    /**
+1 −0
Original line number Diff line number Diff line
@@ -237,6 +237,7 @@ class Camera3StreamInterface : public virtual RefBase {
     *
     */
    virtual status_t getBuffer(camera3_stream_buffer *buffer,
            nsecs_t waitBufferTimeout,
            const std::vector<size_t>& surface_ids = std::vector<size_t>()) = 0;

    /**