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

Commit 3bd2531a authored by Igor Murashkin's avatar Igor Murashkin Committed by Android (Google) Code Review
Browse files

Merge "camera3: Remove BufferQueue::MIN_UNDEQUEUED_BUFFERS references"

parents ca22dd5d 054aab34
Loading
Loading
Loading
Loading
+22 −2
Original line number Diff line number Diff line
@@ -199,13 +199,33 @@ status_t Camera3InputStream::configureQueueLocked() {
    assert(mMaxSize == 0);
    assert(camera3_stream::format != HAL_PIXEL_FORMAT_BLOB);

    mTotalBufferCount = BufferQueue::MIN_UNDEQUEUED_BUFFERS +
                        camera3_stream::max_buffers;
    mDequeuedBufferCount = 0;
    mFrameCount = 0;

    if (mConsumer.get() == 0) {
        sp<BufferQueue> bq = new BufferQueue();

        int minUndequeuedBuffers = 0;
        res = bq->query(NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS, &minUndequeuedBuffers);
        if (res != OK || minUndequeuedBuffers < 0) {
            ALOGE("%s: Stream %d: Could not query min undequeued buffers (error %d, bufCount %d)",
                  __FUNCTION__, mId, res, minUndequeuedBuffers);
            return res;
        }
        size_t minBufs = static_cast<size_t>(minUndequeuedBuffers);
        /*
         * We promise never to 'acquire' more than camera3_stream::max_buffers
         * at any one time.
         *
         * Boost the number up to meet the minimum required buffer count.
         *
         * (Note that this sets consumer-side buffer count only,
         * and not the sum of producer+consumer side as in other camera streams).
         */
        mTotalBufferCount = camera3_stream::max_buffers > minBufs ?
            camera3_stream::max_buffers : minBufs;
        // TODO: somehow set the total buffer count when producer connects?

        mConsumer = new BufferItemConsumer(bq, camera3_stream::usage,
                                           mTotalBufferCount);
        mConsumer->setName(String8::format("Camera3-InputStream-%d", mId));
+2 −0
Original line number Diff line number Diff line
@@ -44,6 +44,8 @@ class Camera3InputStream : public Camera3IOStreamBase {

    virtual void     dump(int fd, const Vector<String16> &args) const;

    // TODO: expose an interface to get the IGraphicBufferProducer

  private:

    typedef BufferItemConsumer::BufferItem BufferItem;
+3 −3
Original line number Diff line number Diff line
@@ -109,14 +109,14 @@ struct TimestampFinder : public RingBufferConsumer::RingBufferComparator {
} // namespace anonymous

Camera3ZslStream::Camera3ZslStream(int id, uint32_t width, uint32_t height,
        int depth) :
        int bufferCount) :
        Camera3OutputStream(id, CAMERA3_STREAM_BIDIRECTIONAL,
                            width, height,
                            HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED),
        mDepth(depth) {
        mDepth(bufferCount) {

    sp<BufferQueue> bq = new BufferQueue();
    mProducer = new RingBufferConsumer(bq, GRALLOC_USAGE_HW_CAMERA_ZSL, depth);
    mProducer = new RingBufferConsumer(bq, GRALLOC_USAGE_HW_CAMERA_ZSL, bufferCount);
    mConsumer = new Surface(bq);
}

+2 −2
Original line number Diff line number Diff line
@@ -37,10 +37,10 @@ class Camera3ZslStream :
        public Camera3OutputStream {
  public:
    /**
     * Set up a ZSL stream of a given resolution. Depth is the number of buffers
     * Set up a ZSL stream of a given resolution. bufferCount is the number of buffers
     * cached within the stream that can be retrieved for input.
     */
    Camera3ZslStream(int id, uint32_t width, uint32_t height, int depth);
    Camera3ZslStream(int id, uint32_t width, uint32_t height, int bufferCount);
    ~Camera3ZslStream();

    virtual void     dump(int fd, const Vector<String16> &args) const;
+1 −1
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ class RingBufferConsumer : public ConsumerBase,
    // bufferCount parameter specifies how many buffers can be pinned for user
    // access at the same time.
    RingBufferConsumer(const sp<IGraphicBufferConsumer>& consumer, uint32_t consumerUsage,
            int bufferCount = BufferQueue::MIN_UNDEQUEUED_BUFFERS);
            int bufferCount);

    virtual ~RingBufferConsumer();