From 75cc24c876059d6eb183e07ed802f997fb416864 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Fri, 25 Nov 2011 11:59:02 +0800 Subject: android: add support for ICS With ICS (Android 4.0), several headers and structs are renamed. Define ANDROID_VERSION so that we can choose a different path depending on the platform version. I've tested only softpipe and llvmpipe. r600g is also reported to work. --- .../state_trackers/egl/android/native_android.cpp | 27 ++++++++++++++-------- .../state_trackers/egl/common/egl_g3d_image.c | 4 ++-- .../state_trackers/egl/common/native_buffer.h | 4 ++-- 3 files changed, 22 insertions(+), 13 deletions(-) (limited to 'src/gallium/state_trackers') diff --git a/src/gallium/state_trackers/egl/android/native_android.cpp b/src/gallium/state_trackers/egl/android/native_android.cpp index 490d6e83884..01d3a02d364 100644 --- a/src/gallium/state_trackers/egl/android/native_android.cpp +++ b/src/gallium/state_trackers/egl/android/native_android.cpp @@ -25,11 +25,20 @@ */ #define LOG_TAG "EGL-GALLIUM" -#include -#include + +#if ANDROID_VERSION >= 0x0400 +#include +#include +#else +#define android_native_buffer_t ANativeWindowBuffer +#include +#include +#endif + #include +#include +#include #include -#include extern "C" { #include "egllog.h" @@ -59,13 +68,13 @@ struct android_surface { struct native_surface base; struct android_display *adpy; - android_native_window_t *win; + ANativeWindow *win; /* staging color buffer for when buffer preserving is enabled */ struct pipe_resource *color_res; uint stamp; - android_native_buffer_t *buf; + ANativeWindowBuffer *buf; struct pipe_resource *buf_res; /* cache the current back buffers */ @@ -161,11 +170,11 @@ get_handle_name(buffer_handle_t handle) #endif /* ANDROID_BACKEND_NO_DRM */ /** - * Import an android_native_buffer_t allocated by the server. + * Import an ANativeWindowBuffer allocated by the server. */ static struct pipe_resource * import_buffer(struct android_display *adpy, const struct pipe_resource *templ, - struct android_native_buffer_t *abuf) + ANativeWindowBuffer *abuf) { struct pipe_screen *screen = adpy->base.screen; struct pipe_resource *res; @@ -232,7 +241,7 @@ android_surface_clear_cache(struct native_surface *nsurf) static struct pipe_resource * android_surface_add_cache(struct native_surface *nsurf, - struct android_native_buffer_t *abuf) + ANativeWindowBuffer *abuf) { struct android_surface *asurf = android_surface(nsurf); void *handle; @@ -716,7 +725,7 @@ android_display_import_buffer(struct native_display *ndpy, struct native_buffer *nbuf) { struct android_display *adpy = android_display(ndpy); - struct android_native_buffer_t *abuf; + ANativeWindowBuffer *abuf; enum pipe_format format; struct pipe_resource templ; diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_image.c b/src/gallium/state_trackers/egl/common/egl_g3d_image.c index 4d90c400319..cf8ec98dbba 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d_image.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d_image.c @@ -206,7 +206,7 @@ egl_g3d_reference_wl_buffer(_EGLDisplay *dpy, struct wl_buffer *buffer, static struct pipe_resource * egl_g3d_reference_android_native_buffer(_EGLDisplay *dpy, - struct android_native_buffer_t *buf) + struct ANativeWindowBuffer *buf) { struct egl_g3d_display *gdpy = egl_g3d_display(dpy); struct native_buffer nbuf; @@ -260,7 +260,7 @@ egl_g3d_create_image(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx, #ifdef EGL_ANDROID_image_native_buffer case EGL_NATIVE_BUFFER_ANDROID: ptex = egl_g3d_reference_android_native_buffer(dpy, - (struct android_native_buffer_t *) buffer); + (struct ANativeWindowBuffer *) buffer); break; #endif default: diff --git a/src/gallium/state_trackers/egl/common/native_buffer.h b/src/gallium/state_trackers/egl/common/native_buffer.h index 503ed580b05..eb161b11a3d 100644 --- a/src/gallium/state_trackers/egl/common/native_buffer.h +++ b/src/gallium/state_trackers/egl/common/native_buffer.h @@ -33,7 +33,7 @@ #include "pipe/p_state.h" struct native_display; -struct android_native_buffer_t; +struct ANativeWindowBuffer; enum native_buffer_type { NATIVE_BUFFER_DRM, @@ -53,7 +53,7 @@ struct native_buffer { unsigned stride; } drm; - struct android_native_buffer_t *android; /**< opaque native buffer */ + struct ANativeWindowBuffer *android; /**< opaque native buffer */ } u; }; -- cgit v1.2.3