frameworks/base: android_native_buffer_t -> ANativeWindowBuffer
Change-Id: Idc2eabaa805bb6d308ebb315872623f28d428417 Signed-off-by: Iliyan Malchev <malchev@google.com>
This commit is contained in:
parent
ec10d231c0
commit
697526bc9e
@ -45,20 +45,20 @@ private:
|
||||
SurfaceTextureClient(const SurfaceTextureClient& rhs);
|
||||
|
||||
// ANativeWindow hooks
|
||||
static int cancelBuffer(ANativeWindow* window, android_native_buffer_t* buffer);
|
||||
static int dequeueBuffer(ANativeWindow* window, android_native_buffer_t** buffer);
|
||||
static int lockBuffer(ANativeWindow* window, android_native_buffer_t* buffer);
|
||||
static int cancelBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer);
|
||||
static int dequeueBuffer(ANativeWindow* window, ANativeWindowBuffer** buffer);
|
||||
static int lockBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer);
|
||||
static int perform(ANativeWindow* window, int operation, ...);
|
||||
static int query(const ANativeWindow* window, int what, int* value);
|
||||
static int queueBuffer(ANativeWindow* window, android_native_buffer_t* buffer);
|
||||
static int queueBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer);
|
||||
static int setSwapInterval(ANativeWindow* window, int interval);
|
||||
|
||||
int cancelBuffer(android_native_buffer_t* buffer);
|
||||
int dequeueBuffer(android_native_buffer_t** buffer);
|
||||
int lockBuffer(android_native_buffer_t* buffer);
|
||||
int cancelBuffer(ANativeWindowBuffer* buffer);
|
||||
int dequeueBuffer(ANativeWindowBuffer** buffer);
|
||||
int lockBuffer(ANativeWindowBuffer* buffer);
|
||||
int perform(int operation, va_list args);
|
||||
int query(int what, int* value) const;
|
||||
int queueBuffer(android_native_buffer_t* buffer);
|
||||
int queueBuffer(ANativeWindowBuffer* buffer);
|
||||
int setSwapInterval(int interval);
|
||||
|
||||
int dispatchConnect(va_list args);
|
||||
|
@ -202,17 +202,17 @@ private:
|
||||
* ANativeWindow hooks
|
||||
*/
|
||||
static int setSwapInterval(ANativeWindow* window, int interval);
|
||||
static int dequeueBuffer(ANativeWindow* window, android_native_buffer_t** buffer);
|
||||
static int cancelBuffer(ANativeWindow* window, android_native_buffer_t* buffer);
|
||||
static int lockBuffer(ANativeWindow* window, android_native_buffer_t* buffer);
|
||||
static int queueBuffer(ANativeWindow* window, android_native_buffer_t* buffer);
|
||||
static int dequeueBuffer(ANativeWindow* window, ANativeWindowBuffer** buffer);
|
||||
static int cancelBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer);
|
||||
static int lockBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer);
|
||||
static int queueBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer);
|
||||
static int query(const ANativeWindow* window, int what, int* value);
|
||||
static int perform(ANativeWindow* window, int operation, ...);
|
||||
|
||||
int dequeueBuffer(android_native_buffer_t** buffer);
|
||||
int lockBuffer(android_native_buffer_t* buffer);
|
||||
int queueBuffer(android_native_buffer_t* buffer);
|
||||
int cancelBuffer(android_native_buffer_t* buffer);
|
||||
int dequeueBuffer(ANativeWindowBuffer** buffer);
|
||||
int lockBuffer(ANativeWindowBuffer* buffer);
|
||||
int queueBuffer(ANativeWindowBuffer* buffer);
|
||||
int cancelBuffer(ANativeWindowBuffer* buffer);
|
||||
int query(int what, int* value) const;
|
||||
int perform(int operation, va_list args);
|
||||
|
||||
|
@ -67,9 +67,9 @@ private:
|
||||
friend class LightRefBase<FramebufferNativeWindow>;
|
||||
~FramebufferNativeWindow(); // this class cannot be overloaded
|
||||
static int setSwapInterval(ANativeWindow* window, int interval);
|
||||
static int dequeueBuffer(ANativeWindow* window, android_native_buffer_t** buffer);
|
||||
static int lockBuffer(ANativeWindow* window, android_native_buffer_t* buffer);
|
||||
static int queueBuffer(ANativeWindow* window, android_native_buffer_t* buffer);
|
||||
static int dequeueBuffer(ANativeWindow* window, ANativeWindowBuffer** buffer);
|
||||
static int lockBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer);
|
||||
static int queueBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer);
|
||||
static int query(const ANativeWindow* window, int what, int* value);
|
||||
static int perform(ANativeWindow* window, int operation, ...);
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <utils/Flattenable.h>
|
||||
#include <pixelflinger/pixelflinger.h>
|
||||
|
||||
struct android_native_buffer_t;
|
||||
struct ANativeWindowBuffer;
|
||||
|
||||
namespace android {
|
||||
|
||||
@ -38,7 +38,7 @@ class GraphicBufferMapper;
|
||||
|
||||
class GraphicBuffer
|
||||
: public EGLNativeBase<
|
||||
android_native_buffer_t,
|
||||
ANativeWindowBuffer,
|
||||
GraphicBuffer,
|
||||
LightRefBase<GraphicBuffer> >, public Flattenable
|
||||
{
|
||||
@ -74,8 +74,8 @@ public:
|
||||
GraphicBuffer(uint32_t w, uint32_t h, PixelFormat format, uint32_t usage,
|
||||
uint32_t stride, native_handle_t* handle, bool keepOwnership);
|
||||
|
||||
// create a buffer from an existing android_native_buffer_t
|
||||
GraphicBuffer(android_native_buffer_t* buffer, bool keepOwnership);
|
||||
// create a buffer from an existing ANativeWindowBuffer
|
||||
GraphicBuffer(ANativeWindowBuffer* buffer, bool keepOwnership);
|
||||
|
||||
// return status
|
||||
status_t initCheck() const;
|
||||
@ -94,7 +94,7 @@ public:
|
||||
status_t lock(GGLSurface* surface, uint32_t usage);
|
||||
status_t unlock();
|
||||
|
||||
android_native_buffer_t* getNativeBuffer() const;
|
||||
ANativeWindowBuffer* getNativeBuffer() const;
|
||||
|
||||
void setIndex(int index);
|
||||
int getIndex() const;
|
||||
@ -149,7 +149,7 @@ private:
|
||||
|
||||
// If we're wrapping another buffer then this reference will make sure it
|
||||
// doesn't get freed.
|
||||
sp<android_native_buffer_t> mWrappedBuffer;
|
||||
sp<ANativeWindowBuffer> mWrappedBuffer;
|
||||
};
|
||||
|
||||
}; // namespace android
|
||||
|
@ -513,25 +513,25 @@ int Surface::setSwapInterval(ANativeWindow* window, int interval) {
|
||||
}
|
||||
|
||||
int Surface::dequeueBuffer(ANativeWindow* window,
|
||||
android_native_buffer_t** buffer) {
|
||||
ANativeWindowBuffer** buffer) {
|
||||
Surface* self = getSelf(window);
|
||||
return self->dequeueBuffer(buffer);
|
||||
}
|
||||
|
||||
int Surface::cancelBuffer(ANativeWindow* window,
|
||||
android_native_buffer_t* buffer) {
|
||||
ANativeWindowBuffer* buffer) {
|
||||
Surface* self = getSelf(window);
|
||||
return self->cancelBuffer(buffer);
|
||||
}
|
||||
|
||||
int Surface::lockBuffer(ANativeWindow* window,
|
||||
android_native_buffer_t* buffer) {
|
||||
ANativeWindowBuffer* buffer) {
|
||||
Surface* self = getSelf(window);
|
||||
return self->lockBuffer(buffer);
|
||||
}
|
||||
|
||||
int Surface::queueBuffer(ANativeWindow* window,
|
||||
android_native_buffer_t* buffer) {
|
||||
ANativeWindowBuffer* buffer) {
|
||||
Surface* self = getSelf(window);
|
||||
return self->queueBuffer(buffer);
|
||||
}
|
||||
@ -570,7 +570,7 @@ bool Surface::needNewBuffer(int bufIdx,
|
||||
return newNeewBuffer;
|
||||
}
|
||||
|
||||
int Surface::dequeueBuffer(android_native_buffer_t** buffer)
|
||||
int Surface::dequeueBuffer(ANativeWindowBuffer** buffer)
|
||||
{
|
||||
status_t err = validate();
|
||||
if (err != NO_ERROR)
|
||||
@ -624,7 +624,7 @@ int Surface::dequeueBuffer(android_native_buffer_t** buffer)
|
||||
return err;
|
||||
}
|
||||
|
||||
int Surface::cancelBuffer(android_native_buffer_t* buffer)
|
||||
int Surface::cancelBuffer(ANativeWindowBuffer* buffer)
|
||||
{
|
||||
status_t err = validate(true);
|
||||
switch (err) {
|
||||
@ -651,7 +651,7 @@ int Surface::cancelBuffer(android_native_buffer_t* buffer)
|
||||
}
|
||||
|
||||
|
||||
int Surface::lockBuffer(android_native_buffer_t* buffer)
|
||||
int Surface::lockBuffer(ANativeWindowBuffer* buffer)
|
||||
{
|
||||
status_t err = validate();
|
||||
if (err != NO_ERROR)
|
||||
@ -670,7 +670,7 @@ int Surface::lockBuffer(android_native_buffer_t* buffer)
|
||||
return err;
|
||||
}
|
||||
|
||||
int Surface::queueBuffer(android_native_buffer_t* buffer)
|
||||
int Surface::queueBuffer(ANativeWindowBuffer* buffer)
|
||||
{
|
||||
status_t err = validate();
|
||||
if (err != NO_ERROR)
|
||||
@ -969,7 +969,7 @@ status_t Surface::lock(SurfaceInfo* other, Region* dirtyIn, bool blocking)
|
||||
// we're intending to do software rendering from this point
|
||||
setUsage(GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN);
|
||||
|
||||
android_native_buffer_t* out;
|
||||
ANativeWindowBuffer* out;
|
||||
status_t err = dequeueBuffer(&out);
|
||||
LOGE_IF(err, "dequeueBuffer failed (%s)", strerror(-err));
|
||||
if (err == NO_ERROR) {
|
||||
@ -1063,7 +1063,7 @@ int Surface::getBufferIndex(const sp<GraphicBuffer>& buffer) const
|
||||
if (idx < 0) {
|
||||
// The buffer doesn't have an index set. See if the handle the same as
|
||||
// one of the buffers for which we do know the index. This can happen
|
||||
// e.g. if GraphicBuffer is used to wrap an android_native_buffer_t that
|
||||
// e.g. if GraphicBuffer is used to wrap an ANativeWindowBuffer that
|
||||
// was dequeued from an ANativeWindow.
|
||||
for (size_t i = 0; i < mBuffers.size(); i++) {
|
||||
if (mBuffers[i] != 0 && buffer->handle == mBuffers[i]->handle) {
|
||||
|
@ -53,25 +53,25 @@ int SurfaceTextureClient::setSwapInterval(ANativeWindow* window, int interval) {
|
||||
}
|
||||
|
||||
int SurfaceTextureClient::dequeueBuffer(ANativeWindow* window,
|
||||
android_native_buffer_t** buffer) {
|
||||
ANativeWindowBuffer** buffer) {
|
||||
SurfaceTextureClient* c = getSelf(window);
|
||||
return c->dequeueBuffer(buffer);
|
||||
}
|
||||
|
||||
int SurfaceTextureClient::cancelBuffer(ANativeWindow* window,
|
||||
android_native_buffer_t* buffer) {
|
||||
ANativeWindowBuffer* buffer) {
|
||||
SurfaceTextureClient* c = getSelf(window);
|
||||
return c->cancelBuffer(buffer);
|
||||
}
|
||||
|
||||
int SurfaceTextureClient::lockBuffer(ANativeWindow* window,
|
||||
android_native_buffer_t* buffer) {
|
||||
ANativeWindowBuffer* buffer) {
|
||||
SurfaceTextureClient* c = getSelf(window);
|
||||
return c->lockBuffer(buffer);
|
||||
}
|
||||
|
||||
int SurfaceTextureClient::queueBuffer(ANativeWindow* window,
|
||||
android_native_buffer_t* buffer) {
|
||||
ANativeWindowBuffer* buffer) {
|
||||
SurfaceTextureClient* c = getSelf(window);
|
||||
return c->queueBuffer(buffer);
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ TEST_F(SurfaceTextureClientTest, BufferGeometryInvalidSizesFail) {
|
||||
|
||||
TEST_F(SurfaceTextureClientTest, DefaultGeometryValues) {
|
||||
sp<ANativeWindow> anw(mSTC);
|
||||
android_native_buffer_t* buf;
|
||||
ANativeWindowBuffer* buf;
|
||||
ASSERT_EQ(OK, anw->dequeueBuffer(anw.get(), &buf));
|
||||
EXPECT_EQ(1, buf->width);
|
||||
EXPECT_EQ(1, buf->height);
|
||||
@ -123,7 +123,7 @@ TEST_F(SurfaceTextureClientTest, DefaultGeometryValues) {
|
||||
|
||||
TEST_F(SurfaceTextureClientTest, BufferGeometryCanBeSet) {
|
||||
sp<ANativeWindow> anw(mSTC);
|
||||
android_native_buffer_t* buf;
|
||||
ANativeWindowBuffer* buf;
|
||||
EXPECT_EQ(OK, native_window_set_buffers_geometry(anw.get(), 16, 8, PIXEL_FORMAT_RGB_565));
|
||||
ASSERT_EQ(OK, anw->dequeueBuffer(anw.get(), &buf));
|
||||
EXPECT_EQ(16, buf->width);
|
||||
@ -134,7 +134,7 @@ TEST_F(SurfaceTextureClientTest, BufferGeometryCanBeSet) {
|
||||
|
||||
TEST_F(SurfaceTextureClientTest, BufferGeometryDefaultSizeSetFormat) {
|
||||
sp<ANativeWindow> anw(mSTC);
|
||||
android_native_buffer_t* buf;
|
||||
ANativeWindowBuffer* buf;
|
||||
EXPECT_EQ(OK, native_window_set_buffers_geometry(anw.get(), 0, 0, PIXEL_FORMAT_RGB_565));
|
||||
ASSERT_EQ(OK, anw->dequeueBuffer(anw.get(), &buf));
|
||||
EXPECT_EQ(1, buf->width);
|
||||
@ -145,7 +145,7 @@ TEST_F(SurfaceTextureClientTest, BufferGeometryDefaultSizeSetFormat) {
|
||||
|
||||
TEST_F(SurfaceTextureClientTest, BufferGeometrySetSizeDefaultFormat) {
|
||||
sp<ANativeWindow> anw(mSTC);
|
||||
android_native_buffer_t* buf;
|
||||
ANativeWindowBuffer* buf;
|
||||
EXPECT_EQ(OK, native_window_set_buffers_geometry(anw.get(), 16, 8, 0));
|
||||
ASSERT_EQ(OK, anw->dequeueBuffer(anw.get(), &buf));
|
||||
EXPECT_EQ(16, buf->width);
|
||||
@ -156,7 +156,7 @@ TEST_F(SurfaceTextureClientTest, BufferGeometrySetSizeDefaultFormat) {
|
||||
|
||||
TEST_F(SurfaceTextureClientTest, BufferGeometrySizeCanBeUnset) {
|
||||
sp<ANativeWindow> anw(mSTC);
|
||||
android_native_buffer_t* buf;
|
||||
ANativeWindowBuffer* buf;
|
||||
EXPECT_EQ(OK, native_window_set_buffers_geometry(anw.get(), 16, 8, 0));
|
||||
ASSERT_EQ(OK, anw->dequeueBuffer(anw.get(), &buf));
|
||||
EXPECT_EQ(16, buf->width);
|
||||
@ -173,7 +173,7 @@ TEST_F(SurfaceTextureClientTest, BufferGeometrySizeCanBeUnset) {
|
||||
|
||||
TEST_F(SurfaceTextureClientTest, BufferGeometrySizeCanBeChangedWithoutFormat) {
|
||||
sp<ANativeWindow> anw(mSTC);
|
||||
android_native_buffer_t* buf;
|
||||
ANativeWindowBuffer* buf;
|
||||
EXPECT_EQ(OK, native_window_set_buffers_geometry(anw.get(), 0, 0, PIXEL_FORMAT_RGB_565));
|
||||
ASSERT_EQ(OK, anw->dequeueBuffer(anw.get(), &buf));
|
||||
EXPECT_EQ(1, buf->width);
|
||||
@ -191,7 +191,7 @@ TEST_F(SurfaceTextureClientTest, BufferGeometrySizeCanBeChangedWithoutFormat) {
|
||||
TEST_F(SurfaceTextureClientTest, SurfaceTextureSetDefaultSize) {
|
||||
sp<ANativeWindow> anw(mSTC);
|
||||
sp<SurfaceTexture> st(mST);
|
||||
android_native_buffer_t* buf;
|
||||
ANativeWindowBuffer* buf;
|
||||
EXPECT_EQ(OK, st->setDefaultBufferSize(16, 8));
|
||||
ASSERT_EQ(OK, anw->dequeueBuffer(anw.get(), &buf));
|
||||
EXPECT_EQ(16, buf->width);
|
||||
@ -203,7 +203,7 @@ TEST_F(SurfaceTextureClientTest, SurfaceTextureSetDefaultSize) {
|
||||
TEST_F(SurfaceTextureClientTest, SurfaceTextureSetDefaultSizeAfterDequeue) {
|
||||
sp<ANativeWindow> anw(mSTC);
|
||||
sp<SurfaceTexture> st(mST);
|
||||
android_native_buffer_t* buf[2];
|
||||
ANativeWindowBuffer* buf[2];
|
||||
ASSERT_EQ(OK, anw->dequeueBuffer(anw.get(), &buf[0]));
|
||||
ASSERT_EQ(OK, anw->dequeueBuffer(anw.get(), &buf[1]));
|
||||
EXPECT_NE(buf[0], buf[1]);
|
||||
@ -224,7 +224,7 @@ TEST_F(SurfaceTextureClientTest, SurfaceTextureSetDefaultSizeAfterDequeue) {
|
||||
TEST_F(SurfaceTextureClientTest, SurfaceTextureSetDefaultSizeVsGeometry) {
|
||||
sp<ANativeWindow> anw(mSTC);
|
||||
sp<SurfaceTexture> st(mST);
|
||||
android_native_buffer_t* buf[2];
|
||||
ANativeWindowBuffer* buf[2];
|
||||
EXPECT_EQ(OK, st->setDefaultBufferSize(16, 8));
|
||||
ASSERT_EQ(OK, anw->dequeueBuffer(anw.get(), &buf[0]));
|
||||
ASSERT_EQ(OK, anw->dequeueBuffer(anw.get(), &buf[1]));
|
||||
|
@ -476,7 +476,7 @@ TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledYV12BufferNpot) {
|
||||
ASSERT_EQ(NO_ERROR, native_window_set_usage(mANW.get(),
|
||||
GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN));
|
||||
|
||||
android_native_buffer_t* anb;
|
||||
ANativeWindowBuffer* anb;
|
||||
ASSERT_EQ(NO_ERROR, mANW->dequeueBuffer(mANW.get(), &anb));
|
||||
ASSERT_TRUE(anb != NULL);
|
||||
|
||||
@ -524,7 +524,7 @@ TEST_F(SurfaceTextureGLTest, DISABLED_TexturingFromCpuFilledYV12BufferPow2) {
|
||||
ASSERT_EQ(NO_ERROR, native_window_set_usage(mANW.get(),
|
||||
GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN));
|
||||
|
||||
android_native_buffer_t* anb;
|
||||
ANativeWindowBuffer* anb;
|
||||
ASSERT_EQ(NO_ERROR, mANW->dequeueBuffer(mANW.get(), &anb));
|
||||
ASSERT_TRUE(anb != NULL);
|
||||
|
||||
@ -583,7 +583,7 @@ TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledYV12BufferWithCrop) {
|
||||
|
||||
ASSERT_EQ(NO_ERROR, native_window_set_crop(mANW.get(), &crop));
|
||||
|
||||
android_native_buffer_t* anb;
|
||||
ANativeWindowBuffer* anb;
|
||||
ASSERT_EQ(NO_ERROR, mANW->dequeueBuffer(mANW.get(), &anb));
|
||||
ASSERT_TRUE(anb != NULL);
|
||||
|
||||
|
@ -93,7 +93,7 @@ TEST_F(SurfaceTest, ScreenshotsOfProtectedBuffersFail) {
|
||||
ASSERT_EQ(NO_ERROR, native_window_set_usage(anw.get(),
|
||||
GRALLOC_USAGE_PROTECTED));
|
||||
ASSERT_EQ(NO_ERROR, native_window_set_buffer_count(anw.get(), 3));
|
||||
android_native_buffer_t* buf = 0;
|
||||
ANativeWindowBuffer* buf = 0;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
// Loop to make sure SurfaceFlinger has retired a protected buffer.
|
||||
ASSERT_EQ(NO_ERROR, anw->dequeueBuffer(anw.get(), &buf));
|
||||
|
@ -47,16 +47,16 @@ namespace android {
|
||||
|
||||
class NativeBuffer
|
||||
: public EGLNativeBase<
|
||||
android_native_buffer_t,
|
||||
ANativeWindowBuffer,
|
||||
NativeBuffer,
|
||||
LightRefBase<NativeBuffer> >
|
||||
{
|
||||
public:
|
||||
NativeBuffer(int w, int h, int f, int u) : BASE() {
|
||||
android_native_buffer_t::width = w;
|
||||
android_native_buffer_t::height = h;
|
||||
android_native_buffer_t::format = f;
|
||||
android_native_buffer_t::usage = u;
|
||||
ANativeWindowBuffer::width = w;
|
||||
ANativeWindowBuffer::height = h;
|
||||
ANativeWindowBuffer::format = f;
|
||||
ANativeWindowBuffer::usage = u;
|
||||
}
|
||||
private:
|
||||
friend class LightRefBase<NativeBuffer>;
|
||||
@ -201,7 +201,7 @@ int FramebufferNativeWindow::getCurrentBufferIndex() const
|
||||
}
|
||||
|
||||
int FramebufferNativeWindow::dequeueBuffer(ANativeWindow* window,
|
||||
android_native_buffer_t** buffer)
|
||||
ANativeWindowBuffer** buffer)
|
||||
{
|
||||
FramebufferNativeWindow* self = getSelf(window);
|
||||
Mutex::Autolock _l(self->mutex);
|
||||
@ -229,7 +229,7 @@ int FramebufferNativeWindow::dequeueBuffer(ANativeWindow* window,
|
||||
}
|
||||
|
||||
int FramebufferNativeWindow::lockBuffer(ANativeWindow* window,
|
||||
android_native_buffer_t* buffer)
|
||||
ANativeWindowBuffer* buffer)
|
||||
{
|
||||
FramebufferNativeWindow* self = getSelf(window);
|
||||
Mutex::Autolock _l(self->mutex);
|
||||
@ -249,7 +249,7 @@ int FramebufferNativeWindow::lockBuffer(ANativeWindow* window,
|
||||
}
|
||||
|
||||
int FramebufferNativeWindow::queueBuffer(ANativeWindow* window,
|
||||
android_native_buffer_t* buffer)
|
||||
ANativeWindowBuffer* buffer)
|
||||
{
|
||||
FramebufferNativeWindow* self = getSelf(window);
|
||||
Mutex::Autolock _l(self->mutex);
|
||||
|
@ -33,7 +33,7 @@
|
||||
namespace android {
|
||||
|
||||
// ===========================================================================
|
||||
// Buffer and implementation of android_native_buffer_t
|
||||
// Buffer and implementation of ANativeWindowBuffer
|
||||
// ===========================================================================
|
||||
|
||||
GraphicBuffer::GraphicBuffer()
|
||||
@ -77,7 +77,7 @@ GraphicBuffer::GraphicBuffer(uint32_t w, uint32_t h,
|
||||
handle = inHandle;
|
||||
}
|
||||
|
||||
GraphicBuffer::GraphicBuffer(android_native_buffer_t* buffer, bool keepOwnership)
|
||||
GraphicBuffer::GraphicBuffer(ANativeWindowBuffer* buffer, bool keepOwnership)
|
||||
: BASE(), mOwner(keepOwnership ? ownHandle : ownNone),
|
||||
mBufferMapper(GraphicBufferMapper::get()),
|
||||
mInitCheck(NO_ERROR), mIndex(-1), mWrappedBuffer(buffer)
|
||||
@ -119,9 +119,9 @@ void GraphicBuffer::dumpAllocationsToSystemLog()
|
||||
GraphicBufferAllocator::dumpToSystemLog();
|
||||
}
|
||||
|
||||
android_native_buffer_t* GraphicBuffer::getNativeBuffer() const
|
||||
ANativeWindowBuffer* GraphicBuffer::getNativeBuffer() const
|
||||
{
|
||||
return static_cast<android_native_buffer_t*>(
|
||||
return static_cast<ANativeWindowBuffer*>(
|
||||
const_cast<GraphicBuffer*>(this));
|
||||
}
|
||||
|
||||
|
@ -225,7 +225,7 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGL
|
||||
|
||||
#ifndef EGL_ANDROID_image_native_buffer
|
||||
#define EGL_ANDROID_image_native_buffer 1
|
||||
struct android_native_buffer_t;
|
||||
struct ANativeWindowBuffer;
|
||||
#define EGL_NATIVE_BUFFER_ANDROID 0x3140 /* eglCreateImageKHR target */
|
||||
#endif
|
||||
|
||||
|
@ -145,7 +145,7 @@ status_t EGLTextureObject::setSurface(GGLSurface const* s)
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
status_t EGLTextureObject::setImage(android_native_buffer_t* native_buffer)
|
||||
status_t EGLTextureObject::setImage(ANativeWindowBuffer* native_buffer)
|
||||
{
|
||||
GGLSurface sur;
|
||||
sur.version = sizeof(GGLSurface);
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
~EGLTextureObject();
|
||||
|
||||
status_t setSurface(GGLSurface const* s);
|
||||
status_t setImage(android_native_buffer_t* buffer);
|
||||
status_t setImage(ANativeWindowBuffer* buffer);
|
||||
void setImageBits(void* vaddr) { surface.data = (GGLubyte*)vaddr; }
|
||||
|
||||
status_t reallocate(GLint level,
|
||||
@ -80,7 +80,7 @@ public:
|
||||
GLint crop_rect[4];
|
||||
GLint generate_mipmap;
|
||||
GLint direct;
|
||||
android_native_buffer_t* buffer;
|
||||
ANativeWindowBuffer* buffer;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -230,11 +230,11 @@ struct egl_window_surface_v2_t : public egl_surface_t
|
||||
virtual EGLBoolean setSwapRectangle(EGLint l, EGLint t, EGLint w, EGLint h);
|
||||
|
||||
private:
|
||||
status_t lock(android_native_buffer_t* buf, int usage, void** vaddr);
|
||||
status_t unlock(android_native_buffer_t* buf);
|
||||
status_t lock(ANativeWindowBuffer* buf, int usage, void** vaddr);
|
||||
status_t unlock(ANativeWindowBuffer* buf);
|
||||
ANativeWindow* nativeWindow;
|
||||
android_native_buffer_t* buffer;
|
||||
android_native_buffer_t* previousBuffer;
|
||||
ANativeWindowBuffer* buffer;
|
||||
ANativeWindowBuffer* previousBuffer;
|
||||
gralloc_module_t const* module;
|
||||
int width;
|
||||
int height;
|
||||
@ -322,8 +322,8 @@ private:
|
||||
};
|
||||
|
||||
void copyBlt(
|
||||
android_native_buffer_t* dst, void* dst_vaddr,
|
||||
android_native_buffer_t* src, void const* src_vaddr,
|
||||
ANativeWindowBuffer* dst, void* dst_vaddr,
|
||||
ANativeWindowBuffer* src, void const* src_vaddr,
|
||||
const Region& clip);
|
||||
|
||||
Rect dirtyRegion;
|
||||
@ -415,7 +415,7 @@ void egl_window_surface_v2_t::disconnect()
|
||||
}
|
||||
|
||||
status_t egl_window_surface_v2_t::lock(
|
||||
android_native_buffer_t* buf, int usage, void** vaddr)
|
||||
ANativeWindowBuffer* buf, int usage, void** vaddr)
|
||||
{
|
||||
int err;
|
||||
|
||||
@ -425,7 +425,7 @@ status_t egl_window_surface_v2_t::lock(
|
||||
return err;
|
||||
}
|
||||
|
||||
status_t egl_window_surface_v2_t::unlock(android_native_buffer_t* buf)
|
||||
status_t egl_window_surface_v2_t::unlock(ANativeWindowBuffer* buf)
|
||||
{
|
||||
if (!buf) return BAD_VALUE;
|
||||
int err = NO_ERROR;
|
||||
@ -436,8 +436,8 @@ status_t egl_window_surface_v2_t::unlock(android_native_buffer_t* buf)
|
||||
}
|
||||
|
||||
void egl_window_surface_v2_t::copyBlt(
|
||||
android_native_buffer_t* dst, void* dst_vaddr,
|
||||
android_native_buffer_t* src, void const* src_vaddr,
|
||||
ANativeWindowBuffer* dst, void* dst_vaddr,
|
||||
ANativeWindowBuffer* src, void const* src_vaddr,
|
||||
const Region& clip)
|
||||
{
|
||||
// NOTE: dst and src must be the same format
|
||||
@ -2003,12 +2003,12 @@ EGLImageKHR eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target,
|
||||
return setError(EGL_BAD_PARAMETER, EGL_NO_IMAGE_KHR);
|
||||
}
|
||||
|
||||
android_native_buffer_t* native_buffer = (android_native_buffer_t*)buffer;
|
||||
ANativeWindowBuffer* native_buffer = (ANativeWindowBuffer*)buffer;
|
||||
|
||||
if (native_buffer->common.magic != ANDROID_NATIVE_BUFFER_MAGIC)
|
||||
return setError(EGL_BAD_PARAMETER, EGL_NO_IMAGE_KHR);
|
||||
|
||||
if (native_buffer->common.version != sizeof(android_native_buffer_t))
|
||||
if (native_buffer->common.version != sizeof(ANativeWindowBuffer))
|
||||
return setError(EGL_BAD_PARAMETER, EGL_NO_IMAGE_KHR);
|
||||
|
||||
switch (native_buffer->format) {
|
||||
@ -2034,12 +2034,12 @@ EGLBoolean eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR img)
|
||||
return setError(EGL_BAD_DISPLAY, EGL_FALSE);
|
||||
}
|
||||
|
||||
android_native_buffer_t* native_buffer = (android_native_buffer_t*)img;
|
||||
ANativeWindowBuffer* native_buffer = (ANativeWindowBuffer*)img;
|
||||
|
||||
if (native_buffer->common.magic != ANDROID_NATIVE_BUFFER_MAGIC)
|
||||
return setError(EGL_BAD_PARAMETER, EGL_FALSE);
|
||||
|
||||
if (native_buffer->common.version != sizeof(android_native_buffer_t))
|
||||
if (native_buffer->common.version != sizeof(ANativeWindowBuffer))
|
||||
return setError(EGL_BAD_PARAMETER, EGL_FALSE);
|
||||
|
||||
native_buffer->common.decRef(&native_buffer->common);
|
||||
|
@ -126,7 +126,7 @@ void ogles_lock_textures(ogles_context_t* c)
|
||||
for (int i=0 ; i<GGL_TEXTURE_UNIT_COUNT ; i++) {
|
||||
if (c->rasterizer.state.texture[i].enable) {
|
||||
texture_unit_t& u(c->textures.tmu[i]);
|
||||
android_native_buffer_t* native_buffer = u.texture->buffer;
|
||||
ANativeWindowBuffer* native_buffer = u.texture->buffer;
|
||||
if (native_buffer) {
|
||||
c->rasterizer.procs.activeTexture(c, i);
|
||||
hw_module_t const* pModule;
|
||||
@ -154,7 +154,7 @@ void ogles_unlock_textures(ogles_context_t* c)
|
||||
for (int i=0 ; i<GGL_TEXTURE_UNIT_COUNT ; i++) {
|
||||
if (c->rasterizer.state.texture[i].enable) {
|
||||
texture_unit_t& u(c->textures.tmu[i]);
|
||||
android_native_buffer_t* native_buffer = u.texture->buffer;
|
||||
ANativeWindowBuffer* native_buffer = u.texture->buffer;
|
||||
if (native_buffer) {
|
||||
c->rasterizer.procs.activeTexture(c, i);
|
||||
hw_module_t const* pModule;
|
||||
@ -1615,12 +1615,12 @@ void glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image)
|
||||
return;
|
||||
}
|
||||
|
||||
android_native_buffer_t* native_buffer = (android_native_buffer_t*)image;
|
||||
ANativeWindowBuffer* native_buffer = (ANativeWindowBuffer*)image;
|
||||
if (native_buffer->common.magic != ANDROID_NATIVE_BUFFER_MAGIC) {
|
||||
ogles_error(c, GL_INVALID_VALUE);
|
||||
return;
|
||||
}
|
||||
if (native_buffer->common.version != sizeof(android_native_buffer_t)) {
|
||||
if (native_buffer->common.version != sizeof(ANativeWindowBuffer)) {
|
||||
ogles_error(c, GL_INVALID_VALUE);
|
||||
return;
|
||||
}
|
||||
@ -1643,12 +1643,12 @@ void glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image)
|
||||
return;
|
||||
}
|
||||
|
||||
android_native_buffer_t* native_buffer = (android_native_buffer_t*)image;
|
||||
ANativeWindowBuffer* native_buffer = (ANativeWindowBuffer*)image;
|
||||
if (native_buffer->common.magic != ANDROID_NATIVE_BUFFER_MAGIC) {
|
||||
ogles_error(c, GL_INVALID_VALUE);
|
||||
return;
|
||||
}
|
||||
if (native_buffer->common.version != sizeof(android_native_buffer_t)) {
|
||||
if (native_buffer->common.version != sizeof(ANativeWindowBuffer)) {
|
||||
ogles_error(c, GL_INVALID_VALUE);
|
||||
return;
|
||||
}
|
||||
|
@ -211,11 +211,11 @@ struct egl_window_surface_v2_t : public egl_surface_t {
|
||||
virtual EGLBoolean setSwapRectangle(EGLint l, EGLint t, EGLint w, EGLint h);
|
||||
|
||||
private:
|
||||
status_t lock(android_native_buffer_t* buf, int usage, void** vaddr);
|
||||
status_t unlock(android_native_buffer_t* buf);
|
||||
status_t lock(ANativeWindowBuffer* buf, int usage, void** vaddr);
|
||||
status_t unlock(ANativeWindowBuffer* buf);
|
||||
ANativeWindow* nativeWindow;
|
||||
android_native_buffer_t* buffer;
|
||||
android_native_buffer_t* previousBuffer;
|
||||
ANativeWindowBuffer* buffer;
|
||||
ANativeWindowBuffer* previousBuffer;
|
||||
gralloc_module_t const* module;
|
||||
int width;
|
||||
int height;
|
||||
@ -307,8 +307,8 @@ private:
|
||||
};
|
||||
|
||||
void copyBlt(
|
||||
android_native_buffer_t* dst, void* dst_vaddr,
|
||||
android_native_buffer_t* src, void const* src_vaddr,
|
||||
ANativeWindowBuffer* dst, void* dst_vaddr,
|
||||
ANativeWindowBuffer* src, void const* src_vaddr,
|
||||
const Region& clip);
|
||||
|
||||
Rect dirtyRegion;
|
||||
@ -407,7 +407,7 @@ void egl_window_surface_v2_t::disconnect()
|
||||
}
|
||||
|
||||
status_t egl_window_surface_v2_t::lock(
|
||||
android_native_buffer_t* buf, int usage, void** vaddr)
|
||||
ANativeWindowBuffer* buf, int usage, void** vaddr)
|
||||
{
|
||||
int err;
|
||||
|
||||
@ -417,7 +417,7 @@ status_t egl_window_surface_v2_t::lock(
|
||||
return err;
|
||||
}
|
||||
|
||||
status_t egl_window_surface_v2_t::unlock(android_native_buffer_t* buf)
|
||||
status_t egl_window_surface_v2_t::unlock(ANativeWindowBuffer* buf)
|
||||
{
|
||||
if (!buf) return BAD_VALUE;
|
||||
int err = NO_ERROR;
|
||||
@ -428,8 +428,8 @@ status_t egl_window_surface_v2_t::unlock(android_native_buffer_t* buf)
|
||||
}
|
||||
|
||||
void egl_window_surface_v2_t::copyBlt(
|
||||
android_native_buffer_t* dst, void* dst_vaddr,
|
||||
android_native_buffer_t* src, void const* src_vaddr,
|
||||
ANativeWindowBuffer* dst, void* dst_vaddr,
|
||||
ANativeWindowBuffer* src, void const* src_vaddr,
|
||||
const Region& clip)
|
||||
{
|
||||
// NOTE: dst and src must be the same format
|
||||
@ -2105,12 +2105,12 @@ EGLImageKHR eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target,
|
||||
return setError(EGL_BAD_PARAMETER, EGL_NO_IMAGE_KHR);
|
||||
}
|
||||
|
||||
android_native_buffer_t* native_buffer = (android_native_buffer_t*)buffer;
|
||||
ANativeWindowBuffer* native_buffer = (ANativeWindowBuffer*)buffer;
|
||||
|
||||
if (native_buffer->common.magic != ANDROID_NATIVE_BUFFER_MAGIC)
|
||||
return setError(EGL_BAD_PARAMETER, EGL_NO_IMAGE_KHR);
|
||||
|
||||
if (native_buffer->common.version != sizeof(android_native_buffer_t))
|
||||
if (native_buffer->common.version != sizeof(ANativeWindowBuffer))
|
||||
return setError(EGL_BAD_PARAMETER, EGL_NO_IMAGE_KHR);
|
||||
|
||||
switch (native_buffer->format) {
|
||||
@ -2136,12 +2136,12 @@ EGLBoolean eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR img)
|
||||
return setError(EGL_BAD_DISPLAY, EGL_FALSE);
|
||||
}
|
||||
|
||||
android_native_buffer_t* native_buffer = (android_native_buffer_t*)img;
|
||||
ANativeWindowBuffer* native_buffer = (ANativeWindowBuffer*)img;
|
||||
|
||||
if (native_buffer->common.magic != ANDROID_NATIVE_BUFFER_MAGIC)
|
||||
return setError(EGL_BAD_PARAMETER, EGL_FALSE);
|
||||
|
||||
if (native_buffer->common.version != sizeof(android_native_buffer_t))
|
||||
if (native_buffer->common.version != sizeof(ANativeWindowBuffer))
|
||||
return setError(EGL_BAD_PARAMETER, EGL_FALSE);
|
||||
|
||||
native_buffer->common.decRef(&native_buffer->common);
|
||||
|
@ -144,7 +144,7 @@ status_t TextureManager::initEglImage(Image* pImage,
|
||||
}
|
||||
|
||||
// construct an EGL_NATIVE_BUFFER_ANDROID
|
||||
android_native_buffer_t* clientBuf = buffer->getNativeBuffer();
|
||||
ANativeWindowBuffer* clientBuf = buffer->getNativeBuffer();
|
||||
|
||||
// create the new EGLImageKHR
|
||||
const EGLint attrs[] = {
|
||||
|
@ -53,7 +53,7 @@ int main(int argc, char** argv)
|
||||
printf("window=%p\n", window);
|
||||
|
||||
int err = native_window_set_buffer_count(window, 8);
|
||||
android_native_buffer_t* buffer;
|
||||
ANativeWindowBuffer* buffer;
|
||||
|
||||
for (int i=0 ; i<8 ; i++) {
|
||||
window->dequeueBuffer(window, &buffer);
|
||||
|
Loading…
Reference in New Issue
Block a user