summaryrefslogtreecommitdiffstats
path: root/src/egl
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2011-11-25 11:59:02 +0800
committerChia-I Wu <[email protected]>2011-11-25 12:34:33 +0800
commit75cc24c876059d6eb183e07ed802f997fb416864 (patch)
treed54eaf925a263684e7086a8671db540636e0660d /src/egl
parent42c2c371d6c4c82c3e9176e028281a91edfadafd (diff)
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.
Diffstat (limited to 'src/egl')
-rw-r--r--src/egl/drivers/dri2/egl_dri2.h21
-rw-r--r--src/egl/drivers/dri2/platform_android.c6
2 files changed, 18 insertions, 9 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index 1c2c7fe5a64..95b87b87500 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -50,12 +50,21 @@
#ifdef HAVE_ANDROID_PLATFORM
#define LOG_TAG "EGL-DRI2"
-#include <ui/egl/android_natives.h>
-#include <ui/android_native_buffer.h>
-#include <cutils/log.h>
-#include <gralloc_drm_handle.h>
+
+#if ANDROID_VERSION >= 0x0400
+# include <system/window.h>
+#else
+# define android_native_buffer_t ANativeWindowBuffer
+# include <ui/egl/android_natives.h>
+# include <ui/android_native_buffer.h>
#endif
+#include <hardware/gralloc.h>
+#include <gralloc_drm_handle.h>
+#include <cutils/log.h>
+
+#endif /* HAVE_ANDROID_PLATFORM */
+
#include "eglconfig.h"
#include "eglcontext.h"
#include "egldisplay.h"
@@ -167,8 +176,8 @@ struct dri2_egl_surface
#endif
#ifdef HAVE_ANDROID_PLATFORM
- android_native_window_t *window;
- android_native_buffer_t *buffer;
+ struct ANativeWindow *window;
+ struct ANativeWindowBuffer *buffer;
/* EGL-owned buffers */
__DRIbuffer *local_buffers[__DRI_BUFFER_COUNT];
diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
index 3abd5363692..1998941f829 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -66,7 +66,7 @@ get_format_bpp(int native)
}
static int
-get_native_buffer_name(struct android_native_buffer_t *buf)
+get_native_buffer_name(struct ANativeWindowBuffer *buf)
{
struct gralloc_drm_handle_t *handle;
@@ -280,7 +280,7 @@ droid_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
static _EGLImage *
dri2_create_image_android_native_buffer(_EGLDisplay *disp,
- struct android_native_buffer_t *buf)
+ struct ANativeWindowBuffer *buf)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_image *dri2_img;
@@ -357,7 +357,7 @@ droid_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp,
switch (target) {
case EGL_NATIVE_BUFFER_ANDROID:
return dri2_create_image_android_native_buffer(disp,
- (struct android_native_buffer_t *) buffer);
+ (struct ANativeWindowBuffer *) buffer);
default:
return dri2_create_image_khr(drv, disp, ctx, target, buffer, attr_list);
}