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

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

Camera3: Skip no-op stream configurations.

If configuring the same set of streams more than once, don't actually
call into the HAL for the second and subsequent configure calls, since
they're no-ops.

This can speed up camera operation substantially if the
HAL implementation does not detect no-ops on its own and does a full
shutdown/restart on each configure call.

Bug: 9392513
Change-Id: I23baf4acbae2304735899adcf8e17565fa94d31d
parent ba696bbf
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -170,6 +170,7 @@ status_t Camera3Device::initialize(camera_module_t *module)
    mHal3Device = device;
    mStatus = STATUS_IDLE;
    mNextStreamId = 0;
    mNeedConfig = true;

    return OK;
}
@@ -582,6 +583,7 @@ status_t Camera3Device::createStream(sp<ANativeWindow> consumer,
    }

    *id = mNextStreamId++;
    mNeedConfig = true;

    // Continue captures if active at start
    if (wasActive) {
@@ -707,6 +709,7 @@ status_t Camera3Device::deleteStream(int id) {
        // fall through since we want to still list the stream as deleted.
    }
    mDeletedStreams.add(deletedStream);
    mNeedConfig = true;

    return res;
}
@@ -1007,6 +1010,11 @@ status_t Camera3Device::configureStreamsLocked() {
        return INVALID_OPERATION;
    }

    if (!mNeedConfig) {
        ALOGV("%s: Skipping config, no stream changes", __FUNCTION__);
        return OK;
    }

    // Start configuring the streams

    camera3_stream_configuration config;
@@ -1091,6 +1099,7 @@ status_t Camera3Device::configureStreamsLocked() {
    // Finish configuring the streams lazily on first reference

    mStatus = STATUS_ACTIVE;
    mNeedConfig = false;

    return OK;
}
+1 −0
Original line number Diff line number Diff line
@@ -149,6 +149,7 @@ class Camera3Device :
    StreamSet                  mOutputStreams;
    sp<camera3::Camera3Stream> mInputStream;
    int                        mNextStreamId;
    bool                       mNeedConfig;

    // Need to hold on to stream references until configure completes.
    Vector<sp<camera3::Camera3StreamInterface> > mDeletedStreams;