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

Commit 453effd1 authored by Mathias Agopian's avatar Mathias Agopian
Browse files

Add VNDK API to access AHardwareBuffer from ANativeWindowBuffer

this is to allow vendors to use AHardwareBuffer’s 
lock/unlock on buffer dequeued from an
ANativeWindow.

Test: compiled
Bug: 36866217
Change-Id: If630105572ae0e57f6fda19c13e82150f415ed6b
parent 62391218
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -25,6 +25,8 @@

#include <private/android/AHardwareBufferHelpers.h>

#include <ui/GraphicBuffer.h>

using namespace android;

static int32_t query(ANativeWindow* window, int what) {
@@ -105,6 +107,10 @@ int32_t ANativeWindow_setBuffersTransform(ANativeWindow* window, int32_t transfo
 * vndk-stable
 **************************************************************************************************/

AHardwareBuffer* ANativeWindowBuffer_getHardwareBuffer(ANativeWindowBuffer* anwb) {
    return AHardwareBuffer_from_GraphicBuffer(static_cast<GraphicBuffer*>(anwb));
}

int ANativeWindow_OemStorageSet(ANativeWindow* window, uint32_t slot, intptr_t value) {
    if (slot < 4) {
        window->oem[slot] = value;
+5 −1
Original line number Diff line number Diff line
@@ -99,8 +99,12 @@ typedef struct ANativeWindowBuffer

typedef struct ANativeWindowBuffer ANativeWindowBuffer;

/*****************************************************************************/
/*
 * Convert this ANativeWindowBuffer into a AHardwareBuffer
 */
AHardwareBuffer* ANativeWindowBuffer_getHardwareBuffer(ANativeWindowBuffer* anwb);

/*****************************************************************************/

/*
 * Stores a value into one of the 4 available slots