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

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

Merge "Camera: Mark streams unpreparable when using HAL buffer management"

parents a1640782 f0348aef
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -4694,6 +4694,10 @@ status_t Camera3Device::RequestThread::prepareHalRequests() {
                buffer.status = CAMERA_BUFFER_STATUS_OK;
                buffer.acquire_fence = -1;
                buffer.release_fence = -1;
                // Mark the output stream as unpreparable to block clients from calling
                // 'prepare' after this request reaches CameraHal and before the respective
                // buffers are requested.
                outputStream->markUnpreparable();
            } else {
                res = outputStream->getBuffer(&outputBuffers->editItemAt(j),
                        waitDuration,
+7 −0
Original line number Diff line number Diff line
@@ -417,6 +417,13 @@ bool Camera3Stream::isUnpreparable() {
    return mStreamUnpreparable;
}

void Camera3Stream::markUnpreparable() {
    ATRACE_CALL();

    Mutex::Autolock l(mLock);
    mStreamUnpreparable = true;
}

status_t Camera3Stream::startPrepare(int maxCount, bool blockRequest) {
    ATRACE_CALL();

+5 −0
Original line number Diff line number Diff line
@@ -222,6 +222,11 @@ class Camera3Stream :
     */
    bool             isUnpreparable();

    /**
     * Mark the stream as unpreparable.
     */
    void             markUnpreparable() override;

    /**
     * Start stream preparation. May only be called in the CONFIGURED state,
     * when no valid buffers have yet been returned to this stream. Prepares
+5 −0
Original line number Diff line number Diff line
@@ -206,6 +206,11 @@ class Camera3StreamInterface : public virtual RefBase {
     */
    virtual bool     isUnpreparable() = 0;

    /**
     * Mark the stream as unpreparable.
     */
    virtual void     markUnpreparable() = 0;

    /**
     * Start stream preparation. May only be called in the CONFIGURED state,
     * when no valid buffers have yet been returned to this stream. Prepares