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

Commit af92c01e authored by Ramkumar Radhakrishnan's avatar Ramkumar Radhakrishnan Committed by Linux Build Service Account
Browse files

libgui: Add support to update buffer geometry.

Add native window properties NATIVE_WINDOW_UPDATE_BUFFERS_GEOMETRY
to the perform function of SurfaceTextureClient and SurfaceTexture
to update the width, height and format of the buffer dynamically
from the client before queue buffer call.

Change-Id: Ie2dde2f1c96496c9834494f3bda93aa7f1b4f8b6
parent b834da26
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -32,6 +32,20 @@

namespace android {
// ----------------------------------------------------------------------------
/*
 * Structure to hold the buffer geometry
 */
struct BufGeometry {
    int mWidth;
    int mHeight;
    int mFormat;
    BufGeometry(): mWidth(0), mHeight(0), mFormat(0) {}
    void set(int w, int h, int f) {
        mWidth = w;
        mHeight = h;
        mFormat = f;
    }
};

class BufferQueue : public BnGraphicBufferProducer {
public:
@@ -239,6 +253,11 @@ public:
    // dequeue buffer.
    virtual status_t setBuffersSize(int size);

    // update buffer width, height and format for a native buffer
    // dynamically from the client which will take effect in the next
    // queue buffer.
    virtual status_t updateBuffersGeometry(int w, int h, int f);

    // public facing structure for BufferSlot
    struct BufferItem {

@@ -638,6 +657,9 @@ private:

    // mTransformHint is used to optimize for screen rotations
    uint32_t mTransformHint;

   // holds the updated buffer geometry info of the new video resolution.
   BufGeometry mNextBufferInfo;
};

// ----------------------------------------------------------------------------
+3 −0
Original line number Diff line number Diff line
@@ -208,6 +208,9 @@ public:
    // dequeue buffer.
    virtual status_t setBuffersSize(int size) = 0;

    // update buffer width, height and format information from the client
    // which will take effect in the next queue buffer.
    virtual status_t updateBuffersGeometry(int w, int h, int f) = 0;
};

// ----------------------------------------------------------------------------
+2 −0
Original line number Diff line number Diff line
@@ -120,6 +120,7 @@ private:
    int dispatchSetBuffersSize(va_list args);
    int dispatchLock(va_list args);
    int dispatchUnlockAndPost(va_list args);
    int dispatchUpdateBuffersGeometry(va_list args);

protected:
    virtual int dequeueBuffer(ANativeWindowBuffer** buffer, int* fenceFd);
@@ -143,6 +144,7 @@ protected:
    virtual int setCrop(Rect const* rect);
    virtual int setUsage(uint32_t reqUsage);
    virtual int setBuffersSize(int size);
    virtual int updateBuffersGeometry(int w, int h, int f);

public:
    virtual int lock(ANativeWindow_Buffer* outBuffer, ARect* inOutDirtyBounds);
+3 −0
Original line number Diff line number Diff line
@@ -101,6 +101,9 @@ public:
    status_t lockYCbCr(uint32_t usage, const Rect& rect, android_ycbcr *ycbcr);
    status_t unlock();

    status_t perform(buffer_handle_t handle, int operation,
                     uint32_t w, uint32_t h, PixelFormat format);

    ANativeWindowBuffer* getNativeBuffer() const;

    void setIndex(int index);
+3 −0
Original line number Diff line number Diff line
@@ -50,6 +50,9 @@ public:

    status_t unlock(buffer_handle_t handle);
    
    status_t perform(buffer_handle_t handle, int operation,
                     uint32_t w, uint32_t h, uint32_t format);

    // dumps information about the mapping of this handle
    void dump(buffer_handle_t handle);

Loading