Introduce official public NativeWindow type.
Not yet hooked up to anything in the NDK, but requires renaming the existing android_native_window_t type everywhere. Change-Id: Iffee6ea39c93b8b34e20fb69e4d2c7c837e5ea2e
This commit is contained in:
parent
189ed23c10
commit
4b5e91e482
|
@ -131,7 +131,7 @@ private:
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
class Surface
|
class Surface
|
||||||
: public EGLNativeBase<android_native_window_t, Surface, RefBase>
|
: public EGLNativeBase<ANativeWindow, Surface, RefBase>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct SurfaceInfo {
|
struct SurfaceInfo {
|
||||||
|
@ -195,14 +195,14 @@ private:
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* android_native_window_t hooks
|
* ANativeWindow hooks
|
||||||
*/
|
*/
|
||||||
static int setSwapInterval(android_native_window_t* window, int interval);
|
static int setSwapInterval(ANativeWindow* window, int interval);
|
||||||
static int dequeueBuffer(android_native_window_t* window, android_native_buffer_t** buffer);
|
static int dequeueBuffer(ANativeWindow* window, android_native_buffer_t** buffer);
|
||||||
static int lockBuffer(android_native_window_t* window, android_native_buffer_t* buffer);
|
static int lockBuffer(ANativeWindow* window, android_native_buffer_t* buffer);
|
||||||
static int queueBuffer(android_native_window_t* window, android_native_buffer_t* buffer);
|
static int queueBuffer(ANativeWindow* window, android_native_buffer_t* buffer);
|
||||||
static int query(android_native_window_t* window, int what, int* value);
|
static int query(ANativeWindow* window, int what, int* value);
|
||||||
static int perform(android_native_window_t* window, int operation, ...);
|
static int perform(ANativeWindow* window, int operation, ...);
|
||||||
|
|
||||||
int dequeueBuffer(android_native_buffer_t** buffer);
|
int dequeueBuffer(android_native_buffer_t** buffer);
|
||||||
int lockBuffer(android_native_buffer_t* buffer);
|
int lockBuffer(android_native_buffer_t* buffer);
|
||||||
|
|
|
@ -43,7 +43,7 @@ class NativeBuffer;
|
||||||
|
|
||||||
class FramebufferNativeWindow
|
class FramebufferNativeWindow
|
||||||
: public EGLNativeBase<
|
: public EGLNativeBase<
|
||||||
android_native_window_t,
|
ANativeWindow,
|
||||||
FramebufferNativeWindow,
|
FramebufferNativeWindow,
|
||||||
LightRefBase<FramebufferNativeWindow> >
|
LightRefBase<FramebufferNativeWindow> >
|
||||||
{
|
{
|
||||||
|
@ -59,12 +59,12 @@ public:
|
||||||
private:
|
private:
|
||||||
friend class LightRefBase<FramebufferNativeWindow>;
|
friend class LightRefBase<FramebufferNativeWindow>;
|
||||||
~FramebufferNativeWindow(); // this class cannot be overloaded
|
~FramebufferNativeWindow(); // this class cannot be overloaded
|
||||||
static int setSwapInterval(android_native_window_t* window, int interval);
|
static int setSwapInterval(ANativeWindow* window, int interval);
|
||||||
static int dequeueBuffer(android_native_window_t* window, android_native_buffer_t** buffer);
|
static int dequeueBuffer(ANativeWindow* window, android_native_buffer_t** buffer);
|
||||||
static int lockBuffer(android_native_window_t* window, android_native_buffer_t* buffer);
|
static int lockBuffer(ANativeWindow* window, android_native_buffer_t* buffer);
|
||||||
static int queueBuffer(android_native_window_t* window, android_native_buffer_t* buffer);
|
static int queueBuffer(ANativeWindow* window, android_native_buffer_t* buffer);
|
||||||
static int query(android_native_window_t* window, int what, int* value);
|
static int query(ANativeWindow* window, int what, int* value);
|
||||||
static int perform(android_native_window_t* window, int operation, ...);
|
static int perform(ANativeWindow* window, int operation, ...);
|
||||||
|
|
||||||
framebuffer_device_t* fbDev;
|
framebuffer_device_t* fbDev;
|
||||||
alloc_device_t* grDev;
|
alloc_device_t* grDev;
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
|
|
||||||
#include <hardware/gralloc.h>
|
#include <hardware/gralloc.h>
|
||||||
|
|
||||||
|
#include <android/native_window.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
@ -90,19 +92,19 @@ enum {
|
||||||
NATIVE_WINDOW_API_EGL = 1
|
NATIVE_WINDOW_API_EGL = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct android_native_window_t
|
struct ANativeWindow
|
||||||
{
|
{
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
android_native_window_t()
|
ANativeWindow()
|
||||||
: flags(0), minSwapInterval(0), maxSwapInterval(0), xdpi(0), ydpi(0)
|
: flags(0), minSwapInterval(0), maxSwapInterval(0), xdpi(0), ydpi(0)
|
||||||
{
|
{
|
||||||
common.magic = ANDROID_NATIVE_WINDOW_MAGIC;
|
common.magic = ANDROID_NATIVE_WINDOW_MAGIC;
|
||||||
common.version = sizeof(android_native_window_t);
|
common.version = sizeof(ANativeWindow);
|
||||||
memset(common.reserved, 0, sizeof(common.reserved));
|
memset(common.reserved, 0, sizeof(common.reserved));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implement the methods that sp<android_native_window_t> expects so that it
|
// Implement the methods that sp<ANativeWindow> expects so that it
|
||||||
// can be used to automatically refcount android_native_window_t's.
|
// can be used to automatically refcount ANativeWindow's.
|
||||||
void incStrong(const void* id) const {
|
void incStrong(const void* id) const {
|
||||||
common.incRef(const_cast<android_native_base_t*>(&common));
|
common.incRef(const_cast<android_native_base_t*>(&common));
|
||||||
}
|
}
|
||||||
|
@ -135,7 +137,7 @@ typedef struct android_native_window_t
|
||||||
*
|
*
|
||||||
* Returns 0 on success or -errno on error.
|
* Returns 0 on success or -errno on error.
|
||||||
*/
|
*/
|
||||||
int (*setSwapInterval)(struct android_native_window_t* window,
|
int (*setSwapInterval)(struct ANativeWindow* window,
|
||||||
int interval);
|
int interval);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -145,7 +147,7 @@ typedef struct android_native_window_t
|
||||||
*
|
*
|
||||||
* Returns 0 on success or -errno on error.
|
* Returns 0 on success or -errno on error.
|
||||||
*/
|
*/
|
||||||
int (*dequeueBuffer)(struct android_native_window_t* window,
|
int (*dequeueBuffer)(struct ANativeWindow* window,
|
||||||
struct android_native_buffer_t** buffer);
|
struct android_native_buffer_t** buffer);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -155,7 +157,7 @@ typedef struct android_native_window_t
|
||||||
*
|
*
|
||||||
* Returns 0 on success or -errno on error.
|
* Returns 0 on success or -errno on error.
|
||||||
*/
|
*/
|
||||||
int (*lockBuffer)(struct android_native_window_t* window,
|
int (*lockBuffer)(struct ANativeWindow* window,
|
||||||
struct android_native_buffer_t* buffer);
|
struct android_native_buffer_t* buffer);
|
||||||
/*
|
/*
|
||||||
* hook called by EGL when modifications to the render buffer are done.
|
* hook called by EGL when modifications to the render buffer are done.
|
||||||
|
@ -165,7 +167,7 @@ typedef struct android_native_window_t
|
||||||
*
|
*
|
||||||
* Returns 0 on success or -errno on error.
|
* Returns 0 on success or -errno on error.
|
||||||
*/
|
*/
|
||||||
int (*queueBuffer)(struct android_native_window_t* window,
|
int (*queueBuffer)(struct ANativeWindow* window,
|
||||||
struct android_native_buffer_t* buffer);
|
struct android_native_buffer_t* buffer);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -173,13 +175,13 @@ typedef struct android_native_window_t
|
||||||
*
|
*
|
||||||
* Returns 0 on success or -errno on error.
|
* Returns 0 on success or -errno on error.
|
||||||
*/
|
*/
|
||||||
int (*query)(struct android_native_window_t* window,
|
int (*query)(struct ANativeWindow* window,
|
||||||
int what, int* value);
|
int what, int* value);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* hook used to perform various operations on the surface.
|
* hook used to perform various operations on the surface.
|
||||||
* (*perform)() is a generic mechanism to add functionality to
|
* (*perform)() is a generic mechanism to add functionality to
|
||||||
* android_native_window_t while keeping backward binary compatibility.
|
* ANativeWindow while keeping backward binary compatibility.
|
||||||
*
|
*
|
||||||
* This hook should not be called directly, instead use the helper functions
|
* This hook should not be called directly, instead use the helper functions
|
||||||
* defined below.
|
* defined below.
|
||||||
|
@ -197,12 +199,14 @@ typedef struct android_native_window_t
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int (*perform)(struct android_native_window_t* window,
|
int (*perform)(struct ANativeWindow* window,
|
||||||
int operation, ... );
|
int operation, ... );
|
||||||
|
|
||||||
void* reserved_proc[3];
|
void* reserved_proc[3];
|
||||||
} android_native_window_t;
|
};
|
||||||
|
|
||||||
|
// Backwards compatibility... please switch to ANativeWindow.
|
||||||
|
typedef struct ANativeWindow android_native_window_t;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* native_window_set_usage(..., usage)
|
* native_window_set_usage(..., usage)
|
||||||
|
@ -216,7 +220,7 @@ typedef struct android_native_window_t
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static inline int native_window_set_usage(
|
static inline int native_window_set_usage(
|
||||||
android_native_window_t* window, int usage)
|
ANativeWindow* window, int usage)
|
||||||
{
|
{
|
||||||
return window->perform(window, NATIVE_WINDOW_SET_USAGE, usage);
|
return window->perform(window, NATIVE_WINDOW_SET_USAGE, usage);
|
||||||
}
|
}
|
||||||
|
@ -228,7 +232,7 @@ static inline int native_window_set_usage(
|
||||||
* can happen if it's connected to some other API.
|
* can happen if it's connected to some other API.
|
||||||
*/
|
*/
|
||||||
static inline int native_window_connect(
|
static inline int native_window_connect(
|
||||||
android_native_window_t* window, int api)
|
ANativeWindow* window, int api)
|
||||||
{
|
{
|
||||||
return window->perform(window, NATIVE_WINDOW_CONNECT, api);
|
return window->perform(window, NATIVE_WINDOW_CONNECT, api);
|
||||||
}
|
}
|
||||||
|
@ -240,7 +244,7 @@ static inline int native_window_connect(
|
||||||
* first place.
|
* first place.
|
||||||
*/
|
*/
|
||||||
static inline int native_window_disconnect(
|
static inline int native_window_disconnect(
|
||||||
android_native_window_t* window, int api)
|
ANativeWindow* window, int api)
|
||||||
{
|
{
|
||||||
return window->perform(window, NATIVE_WINDOW_DISCONNECT, api);
|
return window->perform(window, NATIVE_WINDOW_DISCONNECT, api);
|
||||||
}
|
}
|
||||||
|
@ -258,7 +262,7 @@ static inline int native_window_disconnect(
|
||||||
* out of the buffer's bound or if the window is invalid.
|
* out of the buffer's bound or if the window is invalid.
|
||||||
*/
|
*/
|
||||||
static inline int native_window_set_crop(
|
static inline int native_window_set_crop(
|
||||||
android_native_window_t* window,
|
ANativeWindow* window,
|
||||||
android_native_rect_t const * crop)
|
android_native_rect_t const * crop)
|
||||||
{
|
{
|
||||||
return window->perform(window, NATIVE_WINDOW_SET_CROP, crop);
|
return window->perform(window, NATIVE_WINDOW_SET_CROP, crop);
|
||||||
|
@ -269,7 +273,7 @@ static inline int native_window_set_crop(
|
||||||
* Sets the number of buffers associated with this native window.
|
* Sets the number of buffers associated with this native window.
|
||||||
*/
|
*/
|
||||||
static inline int native_window_set_buffer_count(
|
static inline int native_window_set_buffer_count(
|
||||||
android_native_window_t* window,
|
ANativeWindow* window,
|
||||||
size_t bufferCount)
|
size_t bufferCount)
|
||||||
{
|
{
|
||||||
return window->perform(window, NATIVE_WINDOW_SET_BUFFER_COUNT, bufferCount);
|
return window->perform(window, NATIVE_WINDOW_SET_BUFFER_COUNT, bufferCount);
|
||||||
|
@ -287,7 +291,7 @@ static inline int native_window_set_buffer_count(
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static inline int native_window_set_buffers_geometry(
|
static inline int native_window_set_buffers_geometry(
|
||||||
android_native_window_t* window,
|
ANativeWindow* window,
|
||||||
int w, int h, int format)
|
int w, int h, int format)
|
||||||
{
|
{
|
||||||
return window->perform(window, NATIVE_WINDOW_SET_BUFFERS_GEOMETRY,
|
return window->perform(window, NATIVE_WINDOW_SET_BUFFERS_GEOMETRY,
|
||||||
|
|
|
@ -387,21 +387,21 @@ sp<Surface> Surface::readFromParcel(
|
||||||
|
|
||||||
void Surface::init()
|
void Surface::init()
|
||||||
{
|
{
|
||||||
android_native_window_t::setSwapInterval = setSwapInterval;
|
ANativeWindow::setSwapInterval = setSwapInterval;
|
||||||
android_native_window_t::dequeueBuffer = dequeueBuffer;
|
ANativeWindow::dequeueBuffer = dequeueBuffer;
|
||||||
android_native_window_t::lockBuffer = lockBuffer;
|
ANativeWindow::lockBuffer = lockBuffer;
|
||||||
android_native_window_t::queueBuffer = queueBuffer;
|
ANativeWindow::queueBuffer = queueBuffer;
|
||||||
android_native_window_t::query = query;
|
ANativeWindow::query = query;
|
||||||
android_native_window_t::perform = perform;
|
ANativeWindow::perform = perform;
|
||||||
|
|
||||||
DisplayInfo dinfo;
|
DisplayInfo dinfo;
|
||||||
SurfaceComposerClient::getDisplayInfo(0, &dinfo);
|
SurfaceComposerClient::getDisplayInfo(0, &dinfo);
|
||||||
const_cast<float&>(android_native_window_t::xdpi) = dinfo.xdpi;
|
const_cast<float&>(ANativeWindow::xdpi) = dinfo.xdpi;
|
||||||
const_cast<float&>(android_native_window_t::ydpi) = dinfo.ydpi;
|
const_cast<float&>(ANativeWindow::ydpi) = dinfo.ydpi;
|
||||||
// FIXME: set real values here
|
// FIXME: set real values here
|
||||||
const_cast<int&>(android_native_window_t::minSwapInterval) = 1;
|
const_cast<int&>(ANativeWindow::minSwapInterval) = 1;
|
||||||
const_cast<int&>(android_native_window_t::maxSwapInterval) = 1;
|
const_cast<int&>(ANativeWindow::maxSwapInterval) = 1;
|
||||||
const_cast<uint32_t&>(android_native_window_t::flags) = 0;
|
const_cast<uint32_t&>(ANativeWindow::flags) = 0;
|
||||||
|
|
||||||
mConnected = 0;
|
mConnected = 0;
|
||||||
mSwapRectangle.makeInvalid();
|
mSwapRectangle.makeInvalid();
|
||||||
|
@ -485,35 +485,35 @@ sp<ISurface> Surface::getISurface() const {
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
int Surface::setSwapInterval(android_native_window_t* window, int interval) {
|
int Surface::setSwapInterval(ANativeWindow* window, int interval) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Surface::dequeueBuffer(android_native_window_t* window,
|
int Surface::dequeueBuffer(ANativeWindow* window,
|
||||||
android_native_buffer_t** buffer) {
|
android_native_buffer_t** buffer) {
|
||||||
Surface* self = getSelf(window);
|
Surface* self = getSelf(window);
|
||||||
return self->dequeueBuffer(buffer);
|
return self->dequeueBuffer(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Surface::lockBuffer(android_native_window_t* window,
|
int Surface::lockBuffer(ANativeWindow* window,
|
||||||
android_native_buffer_t* buffer) {
|
android_native_buffer_t* buffer) {
|
||||||
Surface* self = getSelf(window);
|
Surface* self = getSelf(window);
|
||||||
return self->lockBuffer(buffer);
|
return self->lockBuffer(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Surface::queueBuffer(android_native_window_t* window,
|
int Surface::queueBuffer(ANativeWindow* window,
|
||||||
android_native_buffer_t* buffer) {
|
android_native_buffer_t* buffer) {
|
||||||
Surface* self = getSelf(window);
|
Surface* self = getSelf(window);
|
||||||
return self->queueBuffer(buffer);
|
return self->queueBuffer(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Surface::query(android_native_window_t* window,
|
int Surface::query(ANativeWindow* window,
|
||||||
int what, int* value) {
|
int what, int* value) {
|
||||||
Surface* self = getSelf(window);
|
Surface* self = getSelf(window);
|
||||||
return self->query(what, value);
|
return self->query(what, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Surface::perform(android_native_window_t* window,
|
int Surface::perform(ANativeWindow* window,
|
||||||
int operation, ...) {
|
int operation, ...) {
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, operation);
|
va_start(args, operation);
|
||||||
|
@ -803,7 +803,7 @@ status_t Surface::lock(SurfaceInfo* other, Region* dirtyIn, bool blocking)
|
||||||
{
|
{
|
||||||
if (getConnectedApi()) {
|
if (getConnectedApi()) {
|
||||||
LOGE("Surface::lock(%p) failed. Already connected to another API",
|
LOGE("Surface::lock(%p) failed. Already connected to another API",
|
||||||
(android_native_window_t*)this);
|
(ANativeWindow*)this);
|
||||||
CallStack stack;
|
CallStack stack;
|
||||||
stack.update();
|
stack.update();
|
||||||
stack.dump("");
|
stack.dump("");
|
||||||
|
|
|
@ -67,7 +67,7 @@ private:
|
||||||
* This implements the (main) framebuffer management. This class is used
|
* This implements the (main) framebuffer management. This class is used
|
||||||
* mostly by SurfaceFlinger, but also by command line GL application.
|
* mostly by SurfaceFlinger, but also by command line GL application.
|
||||||
*
|
*
|
||||||
* In fact this is an implementation of android_native_window_t on top of
|
* In fact this is an implementation of ANativeWindow on top of
|
||||||
* the framebuffer.
|
* the framebuffer.
|
||||||
*
|
*
|
||||||
* Currently it is pretty simple, it manages only two buffers (the front and
|
* Currently it is pretty simple, it manages only two buffers (the front and
|
||||||
|
@ -117,23 +117,23 @@ FramebufferNativeWindow::FramebufferNativeWindow()
|
||||||
LOGE_IF(err, "fb buffer 1 allocation failed w=%d, h=%d, err=%s",
|
LOGE_IF(err, "fb buffer 1 allocation failed w=%d, h=%d, err=%s",
|
||||||
fbDev->width, fbDev->height, strerror(-err));
|
fbDev->width, fbDev->height, strerror(-err));
|
||||||
|
|
||||||
const_cast<uint32_t&>(android_native_window_t::flags) = fbDev->flags;
|
const_cast<uint32_t&>(ANativeWindow::flags) = fbDev->flags;
|
||||||
const_cast<float&>(android_native_window_t::xdpi) = fbDev->xdpi;
|
const_cast<float&>(ANativeWindow::xdpi) = fbDev->xdpi;
|
||||||
const_cast<float&>(android_native_window_t::ydpi) = fbDev->ydpi;
|
const_cast<float&>(ANativeWindow::ydpi) = fbDev->ydpi;
|
||||||
const_cast<int&>(android_native_window_t::minSwapInterval) =
|
const_cast<int&>(ANativeWindow::minSwapInterval) =
|
||||||
fbDev->minSwapInterval;
|
fbDev->minSwapInterval;
|
||||||
const_cast<int&>(android_native_window_t::maxSwapInterval) =
|
const_cast<int&>(ANativeWindow::maxSwapInterval) =
|
||||||
fbDev->maxSwapInterval;
|
fbDev->maxSwapInterval;
|
||||||
} else {
|
} else {
|
||||||
LOGE("Couldn't get gralloc module");
|
LOGE("Couldn't get gralloc module");
|
||||||
}
|
}
|
||||||
|
|
||||||
android_native_window_t::setSwapInterval = setSwapInterval;
|
ANativeWindow::setSwapInterval = setSwapInterval;
|
||||||
android_native_window_t::dequeueBuffer = dequeueBuffer;
|
ANativeWindow::dequeueBuffer = dequeueBuffer;
|
||||||
android_native_window_t::lockBuffer = lockBuffer;
|
ANativeWindow::lockBuffer = lockBuffer;
|
||||||
android_native_window_t::queueBuffer = queueBuffer;
|
ANativeWindow::queueBuffer = queueBuffer;
|
||||||
android_native_window_t::query = query;
|
ANativeWindow::query = query;
|
||||||
android_native_window_t::perform = perform;
|
ANativeWindow::perform = perform;
|
||||||
}
|
}
|
||||||
|
|
||||||
FramebufferNativeWindow::~FramebufferNativeWindow()
|
FramebufferNativeWindow::~FramebufferNativeWindow()
|
||||||
|
@ -168,13 +168,13 @@ status_t FramebufferNativeWindow::compositionComplete()
|
||||||
}
|
}
|
||||||
|
|
||||||
int FramebufferNativeWindow::setSwapInterval(
|
int FramebufferNativeWindow::setSwapInterval(
|
||||||
android_native_window_t* window, int interval)
|
ANativeWindow* window, int interval)
|
||||||
{
|
{
|
||||||
framebuffer_device_t* fb = getSelf(window)->fbDev;
|
framebuffer_device_t* fb = getSelf(window)->fbDev;
|
||||||
return fb->setSwapInterval(fb, interval);
|
return fb->setSwapInterval(fb, interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
int FramebufferNativeWindow::dequeueBuffer(android_native_window_t* window,
|
int FramebufferNativeWindow::dequeueBuffer(ANativeWindow* window,
|
||||||
android_native_buffer_t** buffer)
|
android_native_buffer_t** buffer)
|
||||||
{
|
{
|
||||||
FramebufferNativeWindow* self = getSelf(window);
|
FramebufferNativeWindow* self = getSelf(window);
|
||||||
|
@ -196,7 +196,7 @@ int FramebufferNativeWindow::dequeueBuffer(android_native_window_t* window,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int FramebufferNativeWindow::lockBuffer(android_native_window_t* window,
|
int FramebufferNativeWindow::lockBuffer(ANativeWindow* window,
|
||||||
android_native_buffer_t* buffer)
|
android_native_buffer_t* buffer)
|
||||||
{
|
{
|
||||||
FramebufferNativeWindow* self = getSelf(window);
|
FramebufferNativeWindow* self = getSelf(window);
|
||||||
|
@ -210,7 +210,7 @@ int FramebufferNativeWindow::lockBuffer(android_native_window_t* window,
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
int FramebufferNativeWindow::queueBuffer(android_native_window_t* window,
|
int FramebufferNativeWindow::queueBuffer(ANativeWindow* window,
|
||||||
android_native_buffer_t* buffer)
|
android_native_buffer_t* buffer)
|
||||||
{
|
{
|
||||||
FramebufferNativeWindow* self = getSelf(window);
|
FramebufferNativeWindow* self = getSelf(window);
|
||||||
|
@ -224,7 +224,7 @@ int FramebufferNativeWindow::queueBuffer(android_native_window_t* window,
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
int FramebufferNativeWindow::query(android_native_window_t* window,
|
int FramebufferNativeWindow::query(ANativeWindow* window,
|
||||||
int what, int* value)
|
int what, int* value)
|
||||||
{
|
{
|
||||||
FramebufferNativeWindow* self = getSelf(window);
|
FramebufferNativeWindow* self = getSelf(window);
|
||||||
|
@ -245,7 +245,7 @@ int FramebufferNativeWindow::query(android_native_window_t* window,
|
||||||
return BAD_VALUE;
|
return BAD_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int FramebufferNativeWindow::perform(android_native_window_t* window,
|
int FramebufferNativeWindow::perform(ANativeWindow* window,
|
||||||
int operation, ...)
|
int operation, ...)
|
||||||
{
|
{
|
||||||
switch (operation) {
|
switch (operation) {
|
||||||
|
|
|
@ -91,10 +91,11 @@ typedef Window EGLNativeWindowType;
|
||||||
|
|
||||||
#elif defined(ANDROID)
|
#elif defined(ANDROID)
|
||||||
|
|
||||||
struct android_native_window_t;
|
#include <android/native_window.h>
|
||||||
|
|
||||||
struct egl_native_pixmap_t;
|
struct egl_native_pixmap_t;
|
||||||
|
|
||||||
typedef struct android_native_window_t* EGLNativeWindowType;
|
typedef struct ANativeWindow* EGLNativeWindowType;
|
||||||
typedef struct egl_native_pixmap_t* EGLNativePixmapType;
|
typedef struct egl_native_pixmap_t* EGLNativePixmapType;
|
||||||
typedef void* EGLNativeDisplayType;
|
typedef void* EGLNativeDisplayType;
|
||||||
|
|
||||||
|
|
|
@ -213,7 +213,7 @@ struct egl_window_surface_v2_t : public egl_surface_t
|
||||||
egl_window_surface_v2_t(
|
egl_window_surface_v2_t(
|
||||||
EGLDisplay dpy, EGLConfig config,
|
EGLDisplay dpy, EGLConfig config,
|
||||||
int32_t depthFormat,
|
int32_t depthFormat,
|
||||||
android_native_window_t* window);
|
ANativeWindow* window);
|
||||||
|
|
||||||
~egl_window_surface_v2_t();
|
~egl_window_surface_v2_t();
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ struct egl_window_surface_v2_t : public egl_surface_t
|
||||||
private:
|
private:
|
||||||
status_t lock(android_native_buffer_t* buf, int usage, void** vaddr);
|
status_t lock(android_native_buffer_t* buf, int usage, void** vaddr);
|
||||||
status_t unlock(android_native_buffer_t* buf);
|
status_t unlock(android_native_buffer_t* buf);
|
||||||
android_native_window_t* nativeWindow;
|
ANativeWindow* nativeWindow;
|
||||||
android_native_buffer_t* buffer;
|
android_native_buffer_t* buffer;
|
||||||
android_native_buffer_t* previousBuffer;
|
android_native_buffer_t* previousBuffer;
|
||||||
gralloc_module_t const* module;
|
gralloc_module_t const* module;
|
||||||
|
@ -355,7 +355,7 @@ private:
|
||||||
egl_window_surface_v2_t::egl_window_surface_v2_t(EGLDisplay dpy,
|
egl_window_surface_v2_t::egl_window_surface_v2_t(EGLDisplay dpy,
|
||||||
EGLConfig config,
|
EGLConfig config,
|
||||||
int32_t depthFormat,
|
int32_t depthFormat,
|
||||||
android_native_window_t* window)
|
ANativeWindow* window)
|
||||||
: egl_surface_t(dpy, config, depthFormat),
|
: egl_surface_t(dpy, config, depthFormat),
|
||||||
nativeWindow(window), buffer(0), previousBuffer(0), module(0),
|
nativeWindow(window), buffer(0), previousBuffer(0), module(0),
|
||||||
blitengine(0), bits(NULL)
|
blitengine(0), bits(NULL)
|
||||||
|
@ -1300,7 +1300,7 @@ static EGLSurface createWindowSurface(EGLDisplay dpy, EGLConfig config,
|
||||||
if (!(surfaceType & EGL_WINDOW_BIT))
|
if (!(surfaceType & EGL_WINDOW_BIT))
|
||||||
return setError(EGL_BAD_MATCH, EGL_NO_SURFACE);
|
return setError(EGL_BAD_MATCH, EGL_NO_SURFACE);
|
||||||
|
|
||||||
if (static_cast<android_native_window_t*>(window)->common.magic !=
|
if (static_cast<ANativeWindow*>(window)->common.magic !=
|
||||||
ANDROID_NATIVE_WINDOW_MAGIC) {
|
ANDROID_NATIVE_WINDOW_MAGIC) {
|
||||||
return setError(EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE);
|
return setError(EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE);
|
||||||
}
|
}
|
||||||
|
@ -1323,7 +1323,7 @@ static EGLSurface createWindowSurface(EGLDisplay dpy, EGLConfig config,
|
||||||
|
|
||||||
egl_surface_t* surface;
|
egl_surface_t* surface;
|
||||||
surface = new egl_window_surface_v2_t(dpy, config, depthFormat,
|
surface = new egl_window_surface_v2_t(dpy, config, depthFormat,
|
||||||
static_cast<android_native_window_t*>(window));
|
static_cast<ANativeWindow*>(window));
|
||||||
|
|
||||||
if (!surface->initCheck()) {
|
if (!surface->initCheck()) {
|
||||||
// there was a problem in the ctor, the error
|
// there was a problem in the ctor, the error
|
||||||
|
|
Loading…
Reference in New Issue