[Glamor] [PATCH 13/15] glamor_egl: Add support for the platform doesn't have gbm.

zhigang.gong at linux.intel.com zhigang.gong at linux.intel.com
Fri Jan 20 00:52:11 PST 2012


From: Zhigang Gong <zhigang.gong at linux.intel.com>

Maybe we should use eglGetDisplayDRM to get display, but current
PVR's driver is using eglGetDisplay.

Signed-off-by: Peng Li <peng.li at intel.com>
Signed-off-by: Zhigang Gong <zhigang.gong at linux.intel.com>
---
 configure.ac     |    5 ++++-
 src/glamor_egl.c |    8 ++++++++
 2 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index e0723eb..f283d4f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -103,7 +103,10 @@ PKG_CHECK_MODULES(EGL, $LIBEGL, [EGL=yes], [EGL=no])
 AM_CONDITIONAL([EGL], [test "x$EGL" = xyes])
 
 if test "x$EGL = xyes"; then
-   PKG_CHECK_MODULES(GBM, $LIBGBM)
+   PKG_CHECK_MODULES(GBM, $LIBGBM, [GBM=yes], [GBM=no])
+   if test "x$GBM" = xyes; then
+     AC_DEFINE(GLAMOR_HAS_GBM, 1, [Use GBM.])
+   fi
 fi
 
 AC_OUTPUT([Makefile
diff --git a/src/glamor_egl.c b/src/glamor_egl.c
index 1b18c4c..c273e8a 100644
--- a/src/glamor_egl.c
+++ b/src/glamor_egl.c
@@ -46,7 +46,9 @@
 #define EGL_EGLEXT_PROTOTYPES
 #define EGL_DISPLAY_NO_X_MESA
 
+#ifdef GLAMOR_HAS_GBM
 #include <gbm.h>
+#endif
 
 #if GLAMOR_GLES2
 #include <GLES2/gl2.h>
@@ -84,7 +86,9 @@ struct glamor_egl_screen_private {
 	int fd;
 	int front_buffer_handle;
 	int cpp;
+#ifdef GLAMOR_HAS_GBM
 	struct gbm_device *gbm;
+#endif
 
 	PFNEGLCREATEIMAGEKHRPROC egl_create_image_khr;
 	PFNEGLDESTROYIMAGEKHRPROC egl_destroy_image_khr;
@@ -297,12 +301,16 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
 
 	scrn->privates[xf86GlamorEGLPrivateIndex].ptr = glamor_egl;
 	glamor_egl->fd = fd;
+#ifdef GLAMOR_HAS_GBM
 	glamor_egl->gbm = gbm_create_device(glamor_egl->fd);
 	if (glamor_egl->gbm == NULL) {
 		ErrorF("couldn't get display device\n");
 		return FALSE;
 	}
 	glamor_egl->display = eglGetDisplay(glamor_egl->gbm);
+#else
+	glamor_egl->display = eglGetDisplay((EGLNativeDisplayType)fd);
+#endif
 
 #ifndef GLAMOR_GLES2
 	eglBindAPI(EGL_OPENGL_API);
-- 
1.7.4.4



More information about the Glamor mailing list