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

Commit c300a07b authored by Yin-Chia Yeh's avatar Yin-Chia Yeh
Browse files

Camera: fix signalStreamFlush logic

1. Fix off by one error in signalStreamFlush call
2. Make sure signalStreamFlush is called before we toggle request
   thread idle (which might cause another thread finishing
   waitUntilIdle() and thus start calling configureStreams)

Test: Pixel 3 + camera CTS
Bug: 120986771
Change-Id: Ifd6f77ef628ee200c024c7c6a05bde20937c745d
parent 7e5a2042
Loading
Loading
Loading
Loading
+11 −11
Original line number Original line Diff line number Diff line
@@ -4511,7 +4511,7 @@ void Camera3Device::HalInterface::signalPipelineDrain(const std::vector<int>& st
        return;
        return;
    }
    }


    auto err = mHidlSession_3_5->signalStreamFlush(streamIds, mNextStreamConfigCounter);
    auto err = mHidlSession_3_5->signalStreamFlush(streamIds, mNextStreamConfigCounter - 1);
    if (!err.isOk()) {
    if (!err.isOk()) {
        ALOGE("%s: Transaction error: %s", __FUNCTION__, err.description().c_str());
        ALOGE("%s: Transaction error: %s", __FUNCTION__, err.description().c_str());
        return;
        return;
@@ -5833,16 +5833,16 @@ sp<Camera3Device::CaptureRequest>
            if (mPaused == false) {
            if (mPaused == false) {
                ALOGV("%s: RequestThread: Going idle", __FUNCTION__);
                ALOGV("%s: RequestThread: Going idle", __FUNCTION__);
                mPaused = true;
                mPaused = true;
                // Let the tracker know
                sp<StatusTracker> statusTracker = mStatusTracker.promote();
                if (statusTracker != 0) {
                    statusTracker->markComponentIdle(mStatusId, Fence::NO_FENCE);
                }
                if (mNotifyPipelineDrain) {
                if (mNotifyPipelineDrain) {
                    mInterface->signalPipelineDrain(mStreamIdsToBeDrained);
                    mInterface->signalPipelineDrain(mStreamIdsToBeDrained);
                    mNotifyPipelineDrain = false;
                    mNotifyPipelineDrain = false;
                    mStreamIdsToBeDrained.clear();
                    mStreamIdsToBeDrained.clear();
                }
                }
                // Let the tracker know
                sp<StatusTracker> statusTracker = mStatusTracker.promote();
                if (statusTracker != 0) {
                    statusTracker->markComponentIdle(mStatusId, Fence::NO_FENCE);
                }
                sp<Camera3Device> parent = mParent.promote();
                sp<Camera3Device> parent = mParent.promote();
                if (parent != nullptr) {
                if (parent != nullptr) {
                    parent->mRequestBufferSM.onRequestThreadPaused();
                    parent->mRequestBufferSM.onRequestThreadPaused();
@@ -5926,16 +5926,16 @@ bool Camera3Device::RequestThread::waitIfPaused() {
        if (mPaused == false) {
        if (mPaused == false) {
            mPaused = true;
            mPaused = true;
            ALOGV("%s: RequestThread: Paused", __FUNCTION__);
            ALOGV("%s: RequestThread: Paused", __FUNCTION__);
            // Let the tracker know
            sp<StatusTracker> statusTracker = mStatusTracker.promote();
            if (statusTracker != 0) {
                statusTracker->markComponentIdle(mStatusId, Fence::NO_FENCE);
            }
            if (mNotifyPipelineDrain) {
            if (mNotifyPipelineDrain) {
                mInterface->signalPipelineDrain(mStreamIdsToBeDrained);
                mInterface->signalPipelineDrain(mStreamIdsToBeDrained);
                mNotifyPipelineDrain = false;
                mNotifyPipelineDrain = false;
                mStreamIdsToBeDrained.clear();
                mStreamIdsToBeDrained.clear();
            }
            }
            // Let the tracker know
            sp<StatusTracker> statusTracker = mStatusTracker.promote();
            if (statusTracker != 0) {
                statusTracker->markComponentIdle(mStatusId, Fence::NO_FENCE);
            }
            sp<Camera3Device> parent = mParent.promote();
            sp<Camera3Device> parent = mParent.promote();
            if (parent != nullptr) {
            if (parent != nullptr) {
                parent->mRequestBufferSM.onRequestThreadPaused();
                parent->mRequestBufferSM.onRequestThreadPaused();