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

Commit 0525359d authored by Jim Shargo's avatar Jim Shargo
Browse files

BufferQueues: privatize ConsumerBase constructors

Evertyrhing's been migrated to *::create methods

BYPASS_IGBP_IGBC_API_REASON=warren buffers

Bug: 398822412
Flag: EXEMPT refactor
Test: builds, presubmit
Change-Id: I76046013c1e2dd6c8ce28d4bd5f30da0c5776722
parent a9836bdb
Loading
Loading
Loading
Loading
+14 −12
Original line number Diff line number Diff line
@@ -47,6 +47,12 @@ class BufferItemConsumer: public ConsumerBase
    enum { INVALID_BUFFER_SLOT = BufferQueue::INVALID_BUFFER_SLOT };
    enum { NO_BUFFER_AVAILABLE = BufferQueue::NO_BUFFER_AVAILABLE };

    // Create a new buffer item consumer. The consumerUsage parameter determines
    // the consumer usage flags passed to the graphics allocator. The
    // bufferCount parameter specifies how many buffers can be locked for user
    // access at the same time.
    // controlledByApp tells whether this consumer is controlled by the
    // application.
    static std::tuple<sp<BufferItemConsumer>, sp<Surface>> create(
            uint64_t consumerUsage, int bufferCount = DEFAULT_MAX_BUFFERS,
            bool controlledByApp = false, bool isConsumerSurfaceFlinger = false);
@@ -57,18 +63,6 @@ class BufferItemConsumer: public ConsumerBase
                                         bool controlledByApp = false)
            __attribute((deprecated("Prefer ctors that create their own surface and consumer.")));

    // Create a new buffer item consumer. The consumerUsage parameter determines
    // the consumer usage flags passed to the graphics allocator. The
    // bufferCount parameter specifies how many buffers can be locked for user
    // access at the same time.
    // controlledByApp tells whether this consumer is controlled by the
    // application.
    BufferItemConsumer(uint64_t consumerUsage, int bufferCount = DEFAULT_MAX_BUFFERS,
                       bool controlledByApp = false, bool isConsumerSurfaceFlinger = false);
    BufferItemConsumer(const sp<IGraphicBufferConsumer>& consumer, uint64_t consumerUsage,
                       int bufferCount = DEFAULT_MAX_BUFFERS, bool controlledByApp = false)
            __attribute((deprecated("Prefer ctors that create their own surface and consumer.")));

    ~BufferItemConsumer() override;

    // setBufferFreedListener sets the listener object that will be notified
@@ -116,7 +110,15 @@ protected:
                       const sp<IGraphicBufferConsumer>& consumer, uint64_t consumerUsage,
                       int bufferCount = DEFAULT_MAX_BUFFERS, bool controlledByApp = false);

    BufferItemConsumer(uint64_t consumerUsage, int bufferCount = DEFAULT_MAX_BUFFERS,
                       bool controlledByApp = false, bool isConsumerSurfaceFlinger = false);
    BufferItemConsumer(const sp<IGraphicBufferConsumer>& consumer, uint64_t consumerUsage,
                       int bufferCount = DEFAULT_MAX_BUFFERS, bool controlledByApp = false)
            __attribute((deprecated("Prefer ctors that create their own surface and consumer.")));

private:
    friend sp<BufferItemConsumer>;

    void initialize(uint64_t consumerUsage, int bufferCount);

    status_t releaseBufferSlotLocked(int slotIndex, const sp<GraphicBuffer>& buffer,
+10 −11
Original line number Diff line number Diff line
@@ -100,13 +100,6 @@ class CpuConsumer : public ConsumerBase
                                  bool controlledByApp = false)
            __attribute((deprecated("Prefer ctors that create their own surface and consumer.")));

    CpuConsumer(size_t maxLockedBuffers, bool controlledByApp = false,
                bool isConsumerSurfaceFlinger = false);

    CpuConsumer(const sp<IGraphicBufferConsumer>& bq, size_t maxLockedBuffers,
                bool controlledByApp = false)
            __attribute((deprecated("Prefer ctors that create their own surface and consumer.")));

    // Gets the next graphics buffer from the producer and locks it for CPU use,
    // filling out the passed-in locked buffer structure with the native pointer
    // and metadata. Returns BAD_VALUE if no new buffer is available, and
@@ -125,6 +118,15 @@ class CpuConsumer : public ConsumerBase
    status_t unlockBuffer(const LockedBuffer &nativeBuffer);

  private:
    friend class sp<CpuConsumer>;

    CpuConsumer(size_t maxLockedBuffers, bool controlledByApp = false,
                bool isConsumerSurfaceFlinger = false);

    CpuConsumer(const sp<IGraphicBufferConsumer>& bq, size_t maxLockedBuffers,
                bool controlledByApp = false)
            __attribute((deprecated("Prefer ctors that create their own surface and consumer.")));

    // Maximum number of buffers that can be locked at a time
    const size_t mMaxLockedBuffers;

@@ -139,10 +141,7 @@ class CpuConsumer : public ConsumerBase
        sp<GraphicBuffer> mGraphicBuffer;
        uintptr_t mLockedBufferId;

        AcquiredBuffer() :
                mSlot(BufferQueue::INVALID_BUFFER_SLOT),
                mLockedBufferId(kUnusedId) {
        }
        AcquiredBuffer() : mSlot(BufferQueue::INVALID_BUFFER_SLOT), mLockedBufferId(kUnusedId) {}

        void reset() {
            mSlot = BufferQueue::INVALID_BUFFER_SLOT;
+14 −12
Original line number Diff line number Diff line
@@ -97,18 +97,6 @@ public:
            __attribute((deprecated(
                    "Prefer create functions that create their own surface and consumer.")));

    GLConsumer(uint32_t tex, uint32_t textureTarget, bool useFenceSync, bool isControlledByApp);

    GLConsumer(uint32_t textureTarget, bool useFenceSync, bool isControlledByApp);

    GLConsumer(const sp<IGraphicBufferConsumer>& bq, uint32_t tex, uint32_t textureTarget,
               bool useFenceSync, bool isControlledByApp)
            __attribute((deprecated("Prefer ctors that create their own surface and consumer.")));

    GLConsumer(const sp<IGraphicBufferConsumer>& bq, uint32_t textureTarget, bool useFenceSync,
               bool isControlledByApp)
            __attribute((deprecated("Prefer ctors that create their own surface and consumer.")));

    // updateTexImage acquires the most recently queued buffer, and sets the
    // image contents of the target texture to it.
    //
@@ -319,6 +307,20 @@ protected:
    status_t checkAndUpdateEglStateLocked(bool contextCheck = false);

private:
    friend class sp<GLConsumer>;

    GLConsumer(uint32_t tex, uint32_t textureTarget, bool useFenceSync, bool isControlledByApp);

    GLConsumer(uint32_t textureTarget, bool useFenceSync, bool isControlledByApp);

    GLConsumer(const sp<IGraphicBufferConsumer>& bq, uint32_t tex, uint32_t textureTarget,
               bool useFenceSync, bool isControlledByApp)
            __attribute((deprecated("Prefer ctors that create their own surface and consumer.")));

    GLConsumer(const sp<IGraphicBufferConsumer>& bq, uint32_t textureTarget, bool useFenceSync,
               bool isControlledByApp)
            __attribute((deprecated("Prefer ctors that create their own surface and consumer.")));

    // EglImage is a utility class for tracking and creating EGLImageKHRs. There
    // is primarily just one image per slot, but there is also special cases:
    //  - For releaseTexImage, we use a debug image (mReleasedTexImage)