summaryrefslogtreecommitdiffstats
path: root/src/egl/drivers/dri2/egl_dri2.h
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2011-08-05 14:39:18 +0900
committerChia-I Wu <[email protected]>2011-08-28 21:56:23 +0800
commit9779f6f5c143506d71420d78bb51b2fa7c995378 (patch)
treea2e1fe1c5f410341daa38c85120921c56a1f3730 /src/egl/drivers/dri2/egl_dri2.h
parent58911b86a15676f116c693e84ea6b9ebabb906ed (diff)
egl_dri2: add support for Android
Add platform_android.c that supports _EGL_PLAFORM_ANDROID. It works with drm_gralloc, where back buffers of windows are backed by GEM objects. In Android a native window has a queue of back buffers allocated by the server, through drm_gralloc. For each frame, EGL needs to dequeue the next back buffer render to the buffer enqueue the buffer After enqueuing, the buffer is no longer valid to EGL. A window has no depth buffer or other aux buffers. They need to be allocated locally by EGL. Reviewed-by: Benjamin Franzke <[email protected]> Reviewed-by: Chad Versace <[email protected]> [olv: with assorted minor changes, mostly suggested during the review]
Diffstat (limited to 'src/egl/drivers/dri2/egl_dri2.h')
-rw-r--r--src/egl/drivers/dri2/egl_dri2.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index be272f9bb25..2f03445ba38 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -48,6 +48,14 @@
#include <gbm_driint.h>
#endif
+#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>
+#endif
+
#include "eglconfig.h"
#include "eglcontext.h"
#include "egldisplay.h"
@@ -162,6 +170,14 @@ struct dri2_egl_surface
__DRIbuffer *pending_buffer;
EGLBoolean block_swap_buffers;
#endif
+
+#ifdef HAVE_ANDROID_PLATFORM
+ android_native_window_t *window;
+ android_native_buffer_t *buffer;
+
+ /* EGL-owned buffers */
+ __DRIbuffer *local_buffers[__DRI_BUFFER_COUNT];
+#endif
};
struct dri2_egl_buffer {
@@ -225,6 +241,9 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp);
EGLBoolean
dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp);
+EGLBoolean
+dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *disp);
+
char *
dri2_get_driver_for_fd(int fd);
char *