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 <benjaminfranzke@googlemail.com>
Reviewed-by: Chad Versace <chad@chad-versace.us>
[olv: with assorted minor changes, mostly suggested during the review]
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index ba728a1..4aa1df0 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -577,6 +577,12 @@
return dri2_initialize_wayland(drv, disp);
#endif
#endif
+#ifdef HAVE_ANDROID_PLATFORM
+ case _EGL_PLATFORM_ANDROID:
+ if (disp->Options.TestOnly)
+ return EGL_TRUE;
+ return dri2_initialize_android(drv, disp);
+#endif
default:
return EGL_FALSE;
@@ -1323,7 +1329,11 @@
{
struct dri2_egl_driver *dri2_drv = dri2_egl_driver(drv);
#ifdef HAVE_SHARED_GLAPI
+#ifdef HAVE_ANDROID_PLATFORM
+ const char *libname = "libglapi.so";
+#else
const char *libname = "libglapi.so.0";
+#endif
#else
/*
* Both libGL.so and libglapi.so are glapi providers. There is no way to