[Glamor] [PATCH v2 1/3] autoconf: configuration for egl, gbm and dri3 support

Gaetan Nadon memsize at videotron.ca
Mon Dec 16 17:16:58 PST 2013


Additional tests have been added for the dri3 glamor code to use:
    Declaration of DRM_FORMAT_ARGB8888 (libdrm >= 2.4.30)
    Declaration of EGL_EXT_image_dma_buf_import (libegl >= 9.2)
    Declaration of GBM_FORMAT_ARGB8888 (libgbm >= 9)

The tests are performed if the libraries/headers are present, they are not
limited to the dri3 support context. They are reusable.

One missing behaviour has been added. When the user explicitly requests
dri3 support and it can not be provided, abort the configuration.
This is the case when user types "--enable-glamor-dri3".

Summary of the test scenarios:
EGL:no	GBM:no	--enable-glamor-dri3=auto|no
EGL:no	GBM:v8	--enable-glamor-dri3=auto|no
EGL:yes	GBM:no	--enable-glamor-dri3=auto|no
EGL:yes	GBM:no	--enable-glamor-dri3=yes
EGL:yes	GBM:v8	--enable-glamor-dri3=auto|no
EGL:yes	GBM:v9	--enable-glamor-dri3=auto
EGL:yes	GBM:v9	--enable-glamor-dri3=no
EGL:yes	GBM:v9	--enable-glamor-dri3=auto EGL_EXT_image_dma_buf_import missing
EGL:yes	GBM:v9	--enable-glamor-dri3=auto DRM_FORMAT_ARGB8888 is missing

Reported-by: Axel Davy <axel.davy at ens.fr>
Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
---
 configure.ac |   98 +++++++++++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 76 insertions(+), 22 deletions(-)

diff --git a/configure.ac b/configure.ac
index b1c4c7f..e57401f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -56,13 +56,9 @@ PKG_PROG_PKG_CONFIG
 PKG_CHECK_MODULES(XORG, [xorg-server >= 1.10])
 PKG_CHECK_MODULES(DRI2, [dri2proto >= 2.6])
 
-LIBDRM="libdrm >= 2.4.23"
 LIBGL="gl >= 7.1.0"
 LIBPIXMAN="pixman-1 >= 0.21.8"
-LIBEGL="egl"
 LIBGLESV2="glesv2"
-LIBGBM="gbm"
-LIBGBMv9="gbm >= 9"
 
 # Define a configure option for an alternate input module directory
 AC_ARG_WITH(xorg-module-dir,
@@ -123,33 +119,91 @@ if test "x$GLAMOR_XV" = xyes; then
    AC_DEFINE(GLAMOR_XV,1,[Build Xv support])
 fi
 
-PKG_CHECK_MODULES([LIBDRM], $LIBDRM)
-PKG_CHECK_MODULES(EGL, $LIBEGL, [EGL=yes], [EGL=no])
-AM_CONDITIONAL([EGL], [test "x$EGL" = xyes])
+# ---------------------------------------------------------------------
+#     Configuration for LIBDRM
+# ---------------------------------------------------------------------
 
-if test "x$EGL = xyes"; then
-   PKG_CHECK_MODULES(GBM, $LIBGBM, [GBM=yes], [GBM=no])
-   if test "x$GBM" = xyes; then
-     AC_DEFINE(GLAMOR_HAS_GBM, 1, [Use GBM.])
-     AC_DEFINE(GLX_USE_SHARED_DISPATCH, 1, [GLX and GLAMOR share the glapi dispatch table.])
-   fi
-fi
+PKG_CHECK_MODULES([LIBDRM], [libdrm >= 2.4.23])
+
+# DRI3 support requires drm_fourcc.h which includes the surface formats
+AC_MSG_CHECKING([for LIBDRM >= 2.4.30])
+PKG_CHECK_EXISTS([libdrm >= 2.4.30], [have_libdrm30=yes], [have_libdrm30=no])
+AC_MSG_RESULT([$have_libdrm30])
+
+# ---------------------------------------------------------------------
+#     Configuration for Glamor EGL
+# ---------------------------------------------------------------------
+
+# The EGL library is required to build the glamor egl support library
+PKG_CHECK_MODULES(EGL, [egl], [have_egl=yes], [have_egl=no])
+AM_CONDITIONAL([EGL], [test "x$have_egl" = xyes])
 
-PKG_CHECK_MODULES(GBMv9, $LIBGBMv9, [GBMv9=yes], [GBMv9=no])
+# DRI3 support requires the EGL_EXT_image_dma_buf_import extension
+AC_MSG_CHECKING([for EGL >= 9.2])
+PKG_CHECK_EXISTS([egl >= 9.2], [have_egl9_2=yes], [have_egl9_2=no])
+AC_MSG_RESULT([$have_egl9_2])
 
-AC_MSG_CHECKING([Enable Glamor Dri3 helpers])
-AC_ARG_ENABLE(glamor-dri3, AS_HELP_STRING([--enable-glamor-dri3], [Build glamor Dri3 helpers (default: yes if libgbm >= 9 is detected)]), [GLAMOR_DRI3_HELPERS="$enableval"], [GLAMOR_DRI3_HELPERS=yes])
+# ---------------------------------------------------------------------
+#     Configuration for Glamor GBM
+# ---------------------------------------------------------------------
 
-if test "x$GLAMOR_DRI3_HELPERS" = xyes -a "x$GBMv9" = xno; then
-   GLAMOR_DRI3_HELPERS=no
+# Check for the Graphics Buffer Management library
+PKG_CHECK_MODULES(GBM, [gbm], [have_gbm=yes], [have_gbm=no])
+
+# Both EGL and GBM libraries are required for glamor to use GBM
+if test "x$have_egl" = xyes; then
+    if test "x$have_gbm" = xyes; then
+        AC_DEFINE(GLAMOR_HAS_GBM, 1, [Use GBM.])
+        AC_DEFINE(GLX_USE_SHARED_DISPATCH, 1, [GLX and GLAMOR share the glapi dispatch table.])
+    fi
 fi
 
-AC_MSG_RESULT([$GLAMOR_DRI3_HELPERS])
+# DRI3 support requires symbols like GBM_FORMAT_ARGB8888
+if test "x$have_gbm" = xyes; then
+    AC_MSG_CHECKING([for GBM >= 9])
+    PKG_CHECK_EXISTS([gbm >= 9], [have_gbm9=yes], [have_gbm9=no])
+    AC_MSG_RESULT([$have_gbm9])
+fi
 
-if test "x$GLAMOR_DRI3_HELPERS" = xyes; then
-    AC_DEFINE(GLAMOR_HAS_DRI3_SUPPORT, 1, [Enable Dri3 helpers])
+# ---------------------------------------------------------------------
+#     Configure Glamor for DRI3 Support
+# ---------------------------------------------------------------------
+
+# Define a configure option for DRI3 support
+AC_ARG_ENABLE(glamor-dri3,
+    AS_HELP_STRING([--enable-glamor-dri3],
+                   [Build glamor DRI3 helpers (default: auto)]),
+                   [request_dri3="$enableval"],
+                   [request_dri3=auto])
+
+# Check for missing dependencies for DRI3 support
+have_dri3=yes
+if test "x$have_egl" = xno ||
+   test "x$have_egl9_2" = xno ||
+   test "x$have_libdrm30" = xno ||
+   test "x$have_gbm" = xno ||
+   test "x$have_gbm9" = xno; then
+    have_dri3=no;
 fi
 
+# Enable DRI3 support based on previous tests and user's request
+AC_MSG_CHECKING([whether to include GLAMOR DRI3 helpers])
+case $request_dri3,$have_dri3 in
+    auto,yes | yes,yes)
+            AC_MSG_RESULT([yes])
+            AC_DEFINE([GLAMOR_HAS_DRI3_SUPPORT], 1, [Enable DRI3 helpers])
+        ;;
+    yes,no)
+            AC_MSG_RESULT([no])
+            AC_MSG_ERROR([DRI3 support requested, but some dependencies are missing.])
+        ;;
+    *)
+        AC_MSG_RESULT([no])
+        ;;
+esac
+
+# ---------------------------------------------------------------------
+
 dnl
 dnl TLS detection
 dnl
-- 
1.7.9.5



More information about the Glamor mailing list