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

Commit bbf70c51 authored by Eino-Ville Talvala's avatar Eino-Ville Talvala Committed by Gerrit Code Review
Browse files

Merge "Camera3: don't let dequeueBuffer block indefinitely"

parents bcd87f59 f81b009d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3052,7 +3052,7 @@ bool Camera3Device::RequestThread::threadLoop() {
        mFlushLock.lock();
    }

    ALOGVV("%s: %d: submitting %d requests in a batch.", __FUNCTION__, __LINE__,
    ALOGVV("%s: %d: submitting %zu requests in a batch.", __FUNCTION__, __LINE__,
            mNextRequests.size());
    for (auto& nextRequest : mNextRequests) {
        // Submit request and block until ready for next one
+17 −0
Original line number Diff line number Diff line
@@ -435,6 +435,12 @@ status_t Camera3OutputStream::configureQueueLocked() {
                __FUNCTION__, mTransform, strerror(-res), res);
    }

    // Set dequeueBuffer/attachBuffer timeout if the consumer is not hw composer or hw texture.
    // We need skip these cases as timeout will disable the non-blocking (async) mode.
    if (!(isConsumedByHWComposer() || isConsumedByHWTexture())) {
        mConsumer->setDequeueTimeout(kDequeueBufferTimeout);
    }

    /**
     * Camera3 Buffer manager is only supported by HAL3.3 onwards, as the older HALs requires
     * buffers to be statically allocated for internal static buffer registration, while the
@@ -633,6 +639,17 @@ bool Camera3OutputStream::isConsumedByHWComposer() const {
    return (usage & GRALLOC_USAGE_HW_COMPOSER) != 0;
}

bool Camera3OutputStream::isConsumedByHWTexture() const {
    uint32_t usage = 0;
    status_t res = getEndpointUsage(&usage);
    if (res != OK) {
        ALOGE("%s: getting end point usage failed: %s (%d).", __FUNCTION__, strerror(-res), res);
        return false;
    }

    return (usage & GRALLOC_USAGE_HW_TEXTURE) != 0;
}

}; // namespace camera3

}; // namespace android
+8 −0
Original line number Diff line number Diff line
@@ -117,6 +117,11 @@ class Camera3OutputStream :
     */
    bool isConsumedByHWComposer() const;

    /**
     * Return if this output stream is consumed by hardware texture.
     */
    bool isConsumedByHWTexture() const;

    class BufferReleasedListener : public BnProducerListener {
        public:
          BufferReleasedListener(wp<Camera3OutputStream> parent) : mParent(parent) {}
@@ -160,6 +165,9 @@ class Camera3OutputStream :

    sp<Surface> mConsumer;
  private:

    static const nsecs_t       kDequeueBufferTimeout   = 1000000000; // 1 sec

    int               mTransform;

    virtual status_t  setTransformLocked(int transform);