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

Commit d6eecf50 authored by Ramkumar Radhakrishnan's avatar Ramkumar Radhakrishnan Committed by Manish Kumar
Browse files

Add support for custom buffer sizes..

Add native window properties NATIVE_WINDOW_SET_BUFFERS_SIZE to the
perform function of Surface to set the user defined size
of graphic buffers. This is needed for adding support for
the playback of interlaced content.

Change-Id: I8354c29d2ffcc03178fae86dfa449cbefd24ae55

Conflicts:

	include/gui/BufferQueue.h
	include/ui/GraphicBuffer.h
	libs/gui/IGraphicBufferProducer.cpp
	libs/ui/GraphicBuffer.cpp
(cherry picked from commit 989265bbdcaeab8ae59e8615aebc3a20b2775436)
(cherry picked from commit 25c5de066d911c4720cc6570a8bb9e21e899e4fb)
(cherry picked from commit e9a8f7b1f1334d4a36eebde3b3f7ff141ae26bc7)
parent 3a7b2870
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -207,10 +207,17 @@ public:
    // connected to the specified producer API.
    virtual status_t disconnect(int api);

    // setBufferSize enables us to specify user defined sizes for the buffers
    // that need to be allocated by surfaceflinger for its client. This is
    // useful for cases where the client doesn't want the gralloc to calculate
    // buffer size. client should reset this value to 0, if it wants gralloc
    // to calculate the size for the buffer. this will take effect from next
    // dequeue buffer.
    virtual status_t setBuffersSize(int size);

    /*
     * IGraphicBufferConsumer interface
     */

    // acquireBuffer attempts to acquire ownership of the next pending buffer in
    // the BufferQueue.  If no buffer is pending then it returns -EINVAL.  If a
    // buffer is successfully acquired, the information about the buffer is
+3 −0
Original line number Diff line number Diff line
@@ -35,6 +35,9 @@ public:
    virtual ~GraphicBufferAlloc();
    virtual sp<GraphicBuffer> createGraphicBuffer(uint32_t w, uint32_t h,
        PixelFormat format, uint32_t usage, status_t* error);
    virtual void setGraphicBufferSize(int size);
private:
    int mBufferSize;
};


+1 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ public:
     */
    virtual sp<GraphicBuffer> createGraphicBuffer(uint32_t w, uint32_t h,
            PixelFormat format, uint32_t usage, status_t* error) = 0;
    virtual void setGraphicBufferSize(int size) = 0;
};

// ----------------------------------------------------------------------------
+9 −0
Original line number Diff line number Diff line
@@ -204,6 +204,15 @@ public:
    // This method will fail if the the IGraphicBufferProducer is not currently
    // connected to the specified client API.
    virtual status_t disconnect(int api) = 0;

    // setBufferSize enables to specify the user defined size of the buffer
    // that needs to be allocated by surfaceflinger for its client. This is
    // useful for cases where the client doesn't want the gralloc to calculate
    // buffer size. client should reset this value to 0, if it wants gralloc to
    // calculate the size for the buffer. this will take effect from next
    // dequeue buffer.
    virtual status_t setBuffersSize(int size) = 0;

};

// ----------------------------------------------------------------------------
+6 −0
Original line number Diff line number Diff line
@@ -119,6 +119,7 @@ private:
    int dispatchSetCrop(va_list args);
    int dispatchSetPostTransformCrop(va_list args);
    int dispatchSetUsage(va_list args);
    int dispatchSetBuffersSize(va_list args);
    int dispatchLock(va_list args);
    int dispatchUnlockAndPost(va_list args);

@@ -143,6 +144,7 @@ protected:
    virtual int setBuffersTimestamp(int64_t timestamp);
    virtual int setCrop(Rect const* rect);
    virtual int setUsage(uint32_t reqUsage);
    virtual int setBuffersSize(int size);

public:
    virtual int lock(ANativeWindow_Buffer* outBuffer, ARect* inOutDirtyBounds);
@@ -191,6 +193,10 @@ private:
    // at the next deuque operation. It is initialized to 0.
    uint32_t mReqUsage;

    // mReqSize is the size of the buffer that will be requested
    // at the next dequeue operation. It is initialized to 0.
    uint32_t mReqSize;

    // mTimestamp is the timestamp that will be used for the next buffer queue
    // operation. It defaults to NATIVE_WINDOW_TIMESTAMP_AUTO, which means that
    // a timestamp is auto-generated when queueBuffer is called.
Loading