<div dir="ltr">Thinking more about this, would it be better to implement as a single --enable-glx=dri|xlib|gallium-xlib option instead of three separate conflicting options?  Most of the implementation would remain the same but it would certainly simplify the set of configure options a bit.<br></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr">- Chuck<br></div></div></div>
<br><div class="gmail_quote">On Thu, Apr 14, 2016 at 3:44 PM, Chuck Atkins <span dir="ltr"><<a href="mailto:chuck.atkins@kitware.com" target="_blank">chuck.atkins@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Instead of cascading support for various different implementations of<br>GLX, all three options are now mutually exclusive top level options:<br><br>--enable-glx             : Enable the DRI-based GLX<br>--enable-xlib-glx        : Enable the classic Xlib-based GLX<br>--enable-gallium-xlib-glx: Enable the gallium Xlib-based GLX<br>---<br> <a href="http://configure.ac" target="_blank">configure.ac</a>            | 120 ++++++++++++++++++++++++++++--------------------<br> src/gallium/Makefile.am |   2 +-<br> src/mesa/Makefile.am    |   2 +-<br> 3 files changed, 72 insertions(+), 52 deletions(-)<br><br>diff --git a/<a href="http://configure.ac" target="_blank">configure.ac</a> b/<a href="http://configure.ac" target="_blank">configure.ac</a><br>index 8c82c43..9c76646 100644<br>--- a/<a href="http://configure.ac" target="_blank">configure.ac</a><br>+++ b/<a href="http://configure.ac" target="_blank">configure.ac</a><br>@@ -857,11 +857,35 @@ AC_ARG_ENABLE([dri3],<br>         [enable DRI3 @<:@default=auto@:>@])],<br>     [enable_dri3="$enableval"],<br>     [enable_dri3="$dri3_default"])<br>+<br>+if test "x$enable_dri" = xyes; then<br>+  glx_default="$enableval"<br>+  xlib_glx_default=no<br>+  gallium_xlib_glx_default=no<br>+elif test -n "$with_gallium_drivers"; then<br>+  glx_default=no<br>+  xlib_glx_default=no<br>+  gallium_xlib_glx_default="$enableval"<br>+else<br>+  glx_default=no<br>+  xlib_glx_default="$enableval"<br>+  gallium_xlib_glx_default=no<br>+fi<br> AC_ARG_ENABLE([glx],<br>     [AS_HELP_STRING([--enable-glx],<br>-        [enable GLX library @<:@default=enabled@:>@])],<br>+        [enable DRI-based GLX library @<:@default=enabled if dri is enabled@:>@])],<br>     [enable_glx="$enableval"],<br>-    [enable_glx=yes])<br>+    [enable_glx="$glx_default"])<br>+AC_ARG_ENABLE([xlib-glx],<br>+    [AS_HELP_STRING([--enable-xlib-glx],<br>+        [enable classic Xlib-based GLX library @<:@default=enabled if neither dri or gallium is enabled@:>@])],<br>+    [enable_xlib_glx="$enableval"],<br>+    [enable_xlib_glx="$xlib_glx_default"])<br>+AC_ARG_ENABLE([gallium-xlib-glx],<br>+    [AS_HELP_STRING([--enable-gallium-xlib-glx],<br>+        [enable gallium Xlib-based GLX library @<:@default=enabled if gallium without dri is enabled@:>@])],<br>+    [enable_gallium_xlib_glx="$enableval"],<br>+    [enable_gallium_xlib_glx="$gallium_xlib_glx_default"])<br> AC_ARG_ENABLE([osmesa],<br>     [AS_HELP_STRING([--enable-osmesa],<br>         [enable OSMesa library @<:@default=disabled@:>@])],<br>@@ -925,11 +949,6 @@ AC_ARG_ENABLE([opencl_icd],<br>            @<:@default=disabled@:>@])],<br>     [enable_opencl_icd="$enableval"],<br>     [enable_opencl_icd=no])<br>-AC_ARG_ENABLE([xlib-glx],<br>-    [AS_HELP_STRING([--enable-xlib-glx],<br>-        [make GLX library Xlib-based instead of DRI-based @<:@default=disabled@:>@])],<br>-    [enable_xlib_glx="$enableval"],<br>-    [enable_xlib_glx=no])<br> <br> AC_ARG_ENABLE([gallium-tests],<br>     [AS_HELP_STRING([--enable-gallium-tests],<br>@@ -988,35 +1007,39 @@ AM_CONDITIONAL(NEED_OPENGL_COMMON, test "x$enable_opengl" = xyes -o \<br>                                         "x$enable_gles1" = xyes -o \<br>                                         "x$enable_gles2" = xyes)<br> <br>-if test "x$enable_glx" = xno; then<br>-    AC_MSG_WARN([GLX disabled, disabling Xlib-GLX])<br>-    enable_xlib_glx=no<br>-fi<br> <br>-if test "x$enable_dri$enable_xlib_glx" = xyesyes; then<br>-    AC_MSG_ERROR([DRI and Xlib-GLX cannot be built together])<br>-fi<br>-<br>-if test "x$enable_opengl$enable_xlib_glx" = xnoyes; then<br>-    AC_MSG_ERROR([Xlib-GLX cannot be built without OpenGL])<br>-fi<br>+# Error if more than one GLX implementation is specified<br>+case "x$enable_glx$enable_xlib_glx$enable_gallium_xlib_glx" in<br>+xyesyesno)<br>+  AC_MSG_ERROR([Only one GLX implementation at a time can be enabled.  DRI-based GLX cannot be built with classic Xlib-based GLX.]) ;;<br>+xnoyesyes)<br>+  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.]) ;;<br>+xyesnoyes)<br>+  AC_MSG_ERROR([Only one GLX implementation at a time can be enabled.  DRI-based GLX cannot be built with gallium Xlib-based GLX.]) ;;<br>+xyesyesyes)<br>+  AC_MSG_ERROR([Only one GLX implementation at a time can be enabled.]) ;;<br>+xyesnono|xnoyesno|xnonoyes)<br>+  enable_any_glx=yes<br>+  # Error if GLX is enabled but not OpenGL<br>+  if test "x$enable_opengl" = xno; then<br>+    AC_MSG_ERROR([GLX cannot be built without OpenGL])<br>+  fi<br>+  ;;<br>+esac<br> <br>-# Disable GLX if OpenGL is not enabled<br>-if test "x$enable_glx$enable_opengl" = xyesno; then<br>-    AC_MSG_WARN([OpenGL not enabled, disabling GLX])<br>-    enable_glx=no<br>+# DRI is incompatible with both Xlib-GLX configurations<br>+if test "x$enable_dri$enable_xlib_glx" = xyesyes -o \<br>+        "x$enable_dri$enable_gallium_xlib_glx" = xyesyes; then<br>+  AC_MSG_ERROR([DRI and Xlib-GLX (classic or gallium) cannot be built together])<br> fi<br> <br>-# Disable GLX if DRI and Xlib-GLX are not enabled<br>-if test "x$enable_glx" = xyes -a \<br>-        "x$enable_dri" = xno -a \<br>-        "x$enable_xlib_glx" = xno; then<br>-    AC_MSG_WARN([Neither DRI nor Xlib-GLX enabled, disabling GLX])<br>-    enable_glx=no<br>+# DRI-GLX requires DRI<br>+if test "x$enable_dri$enable_glx" = xnoyes; then<br>+  AC_MSG_ERROR([DRI-GLX cannot be built without DRI])<br> fi<br>-<br>-AM_CONDITIONAL(HAVE_DRI_GLX, test "x$enable_glx" = xyes -a \<br>-                                  "x$enable_dri" = xyes)<br>+AM_CONDITIONAL(HAVE_DRI_GLX, test "x$enable_glx" = xyes)<br>+AM_CONDITIONAL(HAVE_XLIB_GLX, test "x$enable_xlib_glx" = xyes)<br>+AM_CONDITIONAL(HAVE_GALLIUM_XLIB_GLX, test "x$enable_gallium_xlib_glx" = xyes)<br> <br> # Check for libdrm<br> PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED],<br>@@ -1072,7 +1095,7 @@ dnl<br> dnl Driver specific build directories<br> dnl<br> <br>-if test -n "$with_gallium_drivers" -a "x$enable_glx$enable_xlib_glx" = xyesyes; then<br>+if test -n "$with_gallium_drivers" -a "x$enable_gallium_xlib_glx" = xyesyes; then<br>     NEED_WINSYS_XLIB="yes"<br> fi<br> <br>@@ -1268,8 +1291,8 @@ AC_ARG_ENABLE([driglx-direct],<br> dnl<br> dnl libGL configuration per driver<br> dnl<br>-case "x$enable_glx$enable_xlib_glx" in<br>-xyesyes)<br>+case "x$enable_glx$enable_xlib_glx$enable_gallium_glx" in<br>+xnoyesno|xnonoyes)<br>     # Xlib-based GLX<br>     dri_modules="x11 xext xcb"<br>     PKG_CHECK_MODULES([XLIBGL], [$dri_modules])<br>@@ -1279,7 +1302,7 @@ xyesyes)<br>     GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"<br>     GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm $PTHREAD_LIBS"<br>     ;;<br>-xyesno)<br>+xyesnono)<br>     # DRI-based GLX<br>     PKG_CHECK_MODULES([GLPROTO], [glproto >= $GLPROTO_REQUIRED])<br> <br>@@ -1368,11 +1391,11 @@ AC_SUBST([HAVE_XF86VIDMODE])<br> dnl<br> dnl More GLX setup<br> dnl<br>-case "x$enable_glx$enable_xlib_glx" in<br>-xyesyes)<br>+case "x$enable_glx$enable_xlib_glx$enable_gallium_xlib_glx" in<br>+xnoyesno|xnonoyes)<br>     DEFINES="$DEFINES -DUSE_XSHM"<br>     ;;<br>-xyesno)<br>+xyesnono)<br>     DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"<br>     if test "x$driglx_direct" = xyes; then<br>         DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"<br>@@ -1547,6 +1570,7 @@ fi<br> <br> AM_CONDITIONAL(NEED_MEGADRIVER, test -n "$DRI_DIRS")<br> AM_CONDITIONAL(NEED_LIBMESA, test "x$enable_xlib_glx" = xyes -o \<br>+                                  "x$enable_gallium_xlib_glx" = xyes \<br>                                   "x$enable_osmesa" = xyes -o \<br>                                   -n "$DRI_DIRS")<br> <br>@@ -1561,7 +1585,7 @@ AC_ARG_WITH([osmesa-bits],<br>     [osmesa_bits="$withval"],<br>     [osmesa_bits=8])<br> if test "x$osmesa_bits" != x8; then<br>-    if test "x$enable_dri" = xyes -o "x$enable_glx" = xyes; then<br>+    if test "x$enable_dri" = xyes -o "x$enable_any_glx" = xyes; then<br>         AC_MSG_WARN([Ignoring OSMesa channel bits because of non-OSMesa driver])<br>         osmesa_bits=8<br>     fi<br>@@ -2412,7 +2436,6 @@ if test "x$USE_VC4_SIMULATOR" = xyes -a "x$HAVE_GALLIUM_ILO" = xyes; then<br> fi<br> <br> AM_CONDITIONAL(HAVE_LIBDRM, test "x$have_libdrm" = xyes)<br>-AM_CONDITIONAL(HAVE_X11_DRIVER, test "x$enable_xlib_glx" = xyes)<br> AM_CONDITIONAL(HAVE_OSMESA, test "x$enable_osmesa" = xyes)<br> AM_CONDITIONAL(HAVE_GALLIUM_OSMESA, test "x$enable_gallium_osmesa" = xyes)<br> <br>@@ -2602,16 +2625,13 @@ if test "x$enable_dri" != xno; then<br>         echo "        DRI driver dir:  $DRI_DRIVER_INSTALL_DIR"<br> fi<br> <br>-case "x$enable_glx$enable_xlib_glx" in<br>-xyesyes)<br>-    echo "        GLX:             Xlib-based"<br>-    ;;<br>-xyesno)<br>-    echo "        GLX:             DRI-based"<br>-    ;;<br>-*)<br>-    echo "        GLX:             $enable_glx"<br>-    ;;<br>+case "x$enable_glx$enable_xlib_glx$enable_gallium_glx" in<br>+xyesnono)<br>+    echo "        GLX:             DRI-based" ;;<br>+xnoyesno)<br>+    echo "        GLX:             Xlib-based" ;;<br>+xnonoyes)<br>+    echo "        GLX:             Xlib-based (Gallium)" ;;<br> esac<br> <br> dnl EGL<br>diff --git a/src/gallium/Makefile.am b/src/gallium/Makefile.am<br>index ef2bc10..34671ca 100644<br>--- a/src/gallium/Makefile.am<br>+++ b/src/gallium/Makefile.am<br>@@ -138,7 +138,7 @@ if HAVE_DRICOMMON<br> SUBDIRS += state_trackers/dri targets/dri<br> endif<br> <br>-if HAVE_X11_DRIVER<br>+if HAVE_GALLIUM_XLIB_GLX<br> SUBDIRS += state_trackers/glx/xlib targets/libgl-xlib<br> endif<br> <br>diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am<br>index 3903818..2c77fa8 100644<br>--- a/src/mesa/Makefile.am<br>+++ b/src/mesa/Makefile.am<br>@@ -21,7 +21,7 @@<br> <br> SUBDIRS = . main/tests<br> <br>-if HAVE_X11_DRIVER<br>+if HAVE_XLIB_GLX<br> SUBDIRS += drivers/x11<br> endif<br> <br>--<br>2.5.5</div>
</blockquote></div><br></div>