[Mesa-dev] [PATCH] glx: Refactor the configure options for glx implementation choice
Chuck Atkins
chuck.atkins at kitware.com
Thu Apr 14 19:44:48 UTC 2016
Instead of cascading support for various different implementations of
GLX, all three options are now mutually exclusive top level options:
--enable-glx : Enable the DRI-based GLX
--enable-xlib-glx : Enable the classic Xlib-based GLX
--enable-gallium-xlib-glx: Enable the gallium Xlib-based GLX
---
configure.ac | 120
++++++++++++++++++++++++++++--------------------
src/gallium/Makefile.am | 2 +-
src/mesa/Makefile.am | 2 +-
3 files changed, 72 insertions(+), 52 deletions(-)
diff --git a/configure.ac b/configure.ac
index 8c82c43..9c76646 100644
--- a/configure.ac
+++ b/configure.ac
@@ -857,11 +857,35 @@ AC_ARG_ENABLE([dri3],
[enable DRI3 @<:@default=auto@:>@])],
[enable_dri3="$enableval"],
[enable_dri3="$dri3_default"])
+
+if test "x$enable_dri" = xyes; then
+ glx_default="$enableval"
+ xlib_glx_default=no
+ gallium_xlib_glx_default=no
+elif test -n "$with_gallium_drivers"; then
+ glx_default=no
+ xlib_glx_default=no
+ gallium_xlib_glx_default="$enableval"
+else
+ glx_default=no
+ xlib_glx_default="$enableval"
+ gallium_xlib_glx_default=no
+fi
AC_ARG_ENABLE([glx],
[AS_HELP_STRING([--enable-glx],
- [enable GLX library @<:@default=enabled@:>@])],
+ [enable DRI-based GLX library @<:@default=enabled if dri is
enabled@:>@])],
[enable_glx="$enableval"],
- [enable_glx=yes])
+ [enable_glx="$glx_default"])
+AC_ARG_ENABLE([xlib-glx],
+ [AS_HELP_STRING([--enable-xlib-glx],
+ [enable classic Xlib-based GLX library @<:@default=enabled if
neither dri or gallium is enabled@:>@])],
+ [enable_xlib_glx="$enableval"],
+ [enable_xlib_glx="$xlib_glx_default"])
+AC_ARG_ENABLE([gallium-xlib-glx],
+ [AS_HELP_STRING([--enable-gallium-xlib-glx],
+ [enable gallium Xlib-based GLX library @<:@default=enabled if
gallium without dri is enabled@:>@])],
+ [enable_gallium_xlib_glx="$enableval"],
+ [enable_gallium_xlib_glx="$gallium_xlib_glx_default"])
AC_ARG_ENABLE([osmesa],
[AS_HELP_STRING([--enable-osmesa],
[enable OSMesa library @<:@default=disabled@:>@])],
@@ -925,11 +949,6 @@ AC_ARG_ENABLE([opencl_icd],
@<:@default=disabled@:>@])],
[enable_opencl_icd="$enableval"],
[enable_opencl_icd=no])
-AC_ARG_ENABLE([xlib-glx],
- [AS_HELP_STRING([--enable-xlib-glx],
- [make GLX library Xlib-based instead of DRI-based
@<:@default=disabled@:>@])],
- [enable_xlib_glx="$enableval"],
- [enable_xlib_glx=no])
AC_ARG_ENABLE([gallium-tests],
[AS_HELP_STRING([--enable-gallium-tests],
@@ -988,35 +1007,39 @@ AM_CONDITIONAL(NEED_OPENGL_COMMON, test
"x$enable_opengl" = xyes -o \
"x$enable_gles1" = xyes -o \
"x$enable_gles2" = xyes)
-if test "x$enable_glx" = xno; then
- AC_MSG_WARN([GLX disabled, disabling Xlib-GLX])
- enable_xlib_glx=no
-fi
-if test "x$enable_dri$enable_xlib_glx" = xyesyes; then
- AC_MSG_ERROR([DRI and Xlib-GLX cannot be built together])
-fi
-
-if test "x$enable_opengl$enable_xlib_glx" = xnoyes; then
- AC_MSG_ERROR([Xlib-GLX cannot be built without OpenGL])
-fi
+# Error if more than one GLX implementation is specified
+case "x$enable_glx$enable_xlib_glx$enable_gallium_xlib_glx" in
+xyesyesno)
+ AC_MSG_ERROR([Only one GLX implementation at a time can be enabled.
DRI-based GLX cannot be built with classic Xlib-based GLX.]) ;;
+xnoyesyes)
+ AC_MSG_ERROR([Only one GLX implementation at a time can be enabled.
Classic Xlib-based GLX cannot be built with gallium Xlib-based GLX.]) ;;
+xyesnoyes)
+ AC_MSG_ERROR([Only one GLX implementation at a time can be enabled.
DRI-based GLX cannot be built with gallium Xlib-based GLX.]) ;;
+xyesyesyes)
+ AC_MSG_ERROR([Only one GLX implementation at a time can be enabled.]) ;;
+xyesnono|xnoyesno|xnonoyes)
+ enable_any_glx=yes
+ # Error if GLX is enabled but not OpenGL
+ if test "x$enable_opengl" = xno; then
+ AC_MSG_ERROR([GLX cannot be built without OpenGL])
+ fi
+ ;;
+esac
-# Disable GLX if OpenGL is not enabled
-if test "x$enable_glx$enable_opengl" = xyesno; then
- AC_MSG_WARN([OpenGL not enabled, disabling GLX])
- enable_glx=no
+# DRI is incompatible with both Xlib-GLX configurations
+if test "x$enable_dri$enable_xlib_glx" = xyesyes -o \
+ "x$enable_dri$enable_gallium_xlib_glx" = xyesyes; then
+ AC_MSG_ERROR([DRI and Xlib-GLX (classic or gallium) cannot be built
together])
fi
-# Disable GLX if DRI and Xlib-GLX are not enabled
-if test "x$enable_glx" = xyes -a \
- "x$enable_dri" = xno -a \
- "x$enable_xlib_glx" = xno; then
- AC_MSG_WARN([Neither DRI nor Xlib-GLX enabled, disabling GLX])
- enable_glx=no
+# DRI-GLX requires DRI
+if test "x$enable_dri$enable_glx" = xnoyes; then
+ AC_MSG_ERROR([DRI-GLX cannot be built without DRI])
fi
-
-AM_CONDITIONAL(HAVE_DRI_GLX, test "x$enable_glx" = xyes -a \
- "x$enable_dri" = xyes)
+AM_CONDITIONAL(HAVE_DRI_GLX, test "x$enable_glx" = xyes)
+AM_CONDITIONAL(HAVE_XLIB_GLX, test "x$enable_xlib_glx" = xyes)
+AM_CONDITIONAL(HAVE_GALLIUM_XLIB_GLX, test "x$enable_gallium_xlib_glx" =
xyes)
# Check for libdrm
PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED],
@@ -1072,7 +1095,7 @@ dnl
dnl Driver specific build directories
dnl
-if test -n "$with_gallium_drivers" -a "x$enable_glx$enable_xlib_glx" =
xyesyes; then
+if test -n "$with_gallium_drivers" -a "x$enable_gallium_xlib_glx" =
xyesyes; then
NEED_WINSYS_XLIB="yes"
fi
@@ -1268,8 +1291,8 @@ AC_ARG_ENABLE([driglx-direct],
dnl
dnl libGL configuration per driver
dnl
-case "x$enable_glx$enable_xlib_glx" in
-xyesyes)
+case "x$enable_glx$enable_xlib_glx$enable_gallium_glx" in
+xnoyesno|xnonoyes)
# Xlib-based GLX
dri_modules="x11 xext xcb"
PKG_CHECK_MODULES([XLIBGL], [$dri_modules])
@@ -1279,7 +1302,7 @@ xyesyes)
GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm $PTHREAD_LIBS"
;;
-xyesno)
+xyesnono)
# DRI-based GLX
PKG_CHECK_MODULES([GLPROTO], [glproto >= $GLPROTO_REQUIRED])
@@ -1368,11 +1391,11 @@ AC_SUBST([HAVE_XF86VIDMODE])
dnl
dnl More GLX setup
dnl
-case "x$enable_glx$enable_xlib_glx" in
-xyesyes)
+case "x$enable_glx$enable_xlib_glx$enable_gallium_xlib_glx" in
+xnoyesno|xnonoyes)
DEFINES="$DEFINES -DUSE_XSHM"
;;
-xyesno)
+xyesnono)
DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
if test "x$driglx_direct" = xyes; then
DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
@@ -1547,6 +1570,7 @@ fi
AM_CONDITIONAL(NEED_MEGADRIVER, test -n "$DRI_DIRS")
AM_CONDITIONAL(NEED_LIBMESA, test "x$enable_xlib_glx" = xyes -o \
+ "x$enable_gallium_xlib_glx" = xyes \
"x$enable_osmesa" = xyes -o \
-n "$DRI_DIRS")
@@ -1561,7 +1585,7 @@ AC_ARG_WITH([osmesa-bits],
[osmesa_bits="$withval"],
[osmesa_bits=8])
if test "x$osmesa_bits" != x8; then
- if test "x$enable_dri" = xyes -o "x$enable_glx" = xyes; then
+ if test "x$enable_dri" = xyes -o "x$enable_any_glx" = xyes; then
AC_MSG_WARN([Ignoring OSMesa channel bits because of non-OSMesa
driver])
osmesa_bits=8
fi
@@ -2412,7 +2436,6 @@ if test "x$USE_VC4_SIMULATOR" = xyes -a
"x$HAVE_GALLIUM_ILO" = xyes; then
fi
AM_CONDITIONAL(HAVE_LIBDRM, test "x$have_libdrm" = xyes)
-AM_CONDITIONAL(HAVE_X11_DRIVER, test "x$enable_xlib_glx" = xyes)
AM_CONDITIONAL(HAVE_OSMESA, test "x$enable_osmesa" = xyes)
AM_CONDITIONAL(HAVE_GALLIUM_OSMESA, test "x$enable_gallium_osmesa" = xyes)
@@ -2602,16 +2625,13 @@ if test "x$enable_dri" != xno; then
echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
fi
-case "x$enable_glx$enable_xlib_glx" in
-xyesyes)
- echo " GLX: Xlib-based"
- ;;
-xyesno)
- echo " GLX: DRI-based"
- ;;
-*)
- echo " GLX: $enable_glx"
- ;;
+case "x$enable_glx$enable_xlib_glx$enable_gallium_glx" in
+xyesnono)
+ echo " GLX: DRI-based" ;;
+xnoyesno)
+ echo " GLX: Xlib-based" ;;
+xnonoyes)
+ echo " GLX: Xlib-based (Gallium)" ;;
esac
dnl EGL
diff --git a/src/gallium/Makefile.am b/src/gallium/Makefile.am
index ef2bc10..34671ca 100644
--- a/src/gallium/Makefile.am
+++ b/src/gallium/Makefile.am
@@ -138,7 +138,7 @@ if HAVE_DRICOMMON
SUBDIRS += state_trackers/dri targets/dri
endif
-if HAVE_X11_DRIVER
+if HAVE_GALLIUM_XLIB_GLX
SUBDIRS += state_trackers/glx/xlib targets/libgl-xlib
endif
diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am
index 3903818..2c77fa8 100644
--- a/src/mesa/Makefile.am
+++ b/src/mesa/Makefile.am
@@ -21,7 +21,7 @@
SUBDIRS = . main/tests
-if HAVE_X11_DRIVER
+if HAVE_XLIB_GLX
SUBDIRS += drivers/x11
endif
--
2.5.5
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160414/8fbb3469/attachment.html>
More information about the mesa-dev
mailing list