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

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

CameraService: ZslProcessor: Don't call back into BQ from callback

This causes a deadlock.

Test: Camera1 CTS passes
Bug: 62648829
Change-Id: I88aed08fe952fead2b356861ba0a9e24c0535e92
parent 17d79b7d
Loading
Loading
Loading
Loading
+19 −4
Original line number Diff line number Diff line
@@ -138,7 +138,8 @@ ZslProcessor::ZslProcessor(
        mInputBuffer(nullptr),
        mProducer(nullptr),
        mInputProducer(nullptr),
        mInputProducerSlot(-1) {
        mInputProducerSlot(-1),
        mBuffersToDetach(0) {
    // Initialize buffer queue and frame list based on pipeline max depth.
    size_t pipelineMaxDepth = kDefaultMaxPipelineDepth;
    if (client != 0) {
@@ -430,6 +431,11 @@ status_t ZslProcessor::updateRequestWithDefaultStillRequest(CameraMetadata &requ
void ZslProcessor::notifyInputReleased() {
    Mutex::Autolock l(mInputMutex);

    mBuffersToDetach++;
    mBuffersToDetachSignal.signal();
}

void ZslProcessor::doNotifyInputReleasedLocked() {
    assert(nullptr != mInputBuffer.get());
    assert(nullptr != mInputProducer.get());

@@ -736,9 +742,18 @@ void ZslProcessor::dump(int fd, const Vector<String16>& /*args*/) const {
}

bool ZslProcessor::threadLoop() {
    // TODO: remove dependency on thread. For now, shut thread down right
    // away.
    return false;
    Mutex::Autolock l(mInputMutex);

    if (mBuffersToDetach == 0) {
        status_t res = mBuffersToDetachSignal.waitRelative(mInputMutex, kWaitDuration);
        if (res == TIMED_OUT) return true;
    }
    while (mBuffersToDetach > 0) {
        doNotifyInputReleasedLocked();
        mBuffersToDetach--;
    }

    return true;
}

void ZslProcessor::dumpZslQueue(int fd) const {
+4 −0
Original line number Diff line number Diff line
@@ -142,6 +142,9 @@ class ZslProcessor :
    sp<IGraphicBufferProducer>               mInputProducer;
    int                                      mInputProducerSlot;

    Condition                                mBuffersToDetachSignal;
    int                                      mBuffersToDetach;

    virtual bool threadLoop();

    status_t clearZslQueueLocked();
@@ -156,6 +159,7 @@ class ZslProcessor :
        nsecs_t* actualTimestamp);
    status_t clearInputRingBufferLocked(nsecs_t* latestTimestamp);
    void notifyInputReleased();
    void doNotifyInputReleasedLocked();

    bool isFixedFocusMode(uint8_t afMode) const;