On 04/15/2016 09:36 AM, Chuck Atkins wrote:
Instead of cascading support for various different implementations of
GLX, all three options are now specified through the --enable-glx
option:

   --enable-glx=dri          : Enable the DRI-based GLX
   --enable-glx=xlib         : Enable the classic Xlib-based GLX
   --enable-glx=gallium-xlib : Enable the gallium Xlib-based GLX
   --enable-glx[=yes]        : Defaults to dri if DRI is enabled, else
                               gallium-xlib if gallium is enabled, else
                               xlib

This removes the --enable-xlib-glx option and fixes a bug in which both
the classic xlib-glx and gallium xlib-glx implementations were getting
built causing differnt versioned and conflicting libGL libraries to be
installed.

So we'll no longer be able to build both the "xlib" and "gallium-xlib" at the same time, right? I sometimes switch between the old swrast and gallium libs with LD_LIBRARY_PATH to compare things. But I guess I can live without that since I don't do that as much as I used to.

-Brian


---
  configure.ac            | 108 +++++++++++++++++++++++++-----------------------
  src/gallium/Makefile.am |   2 +-
  src/mesa/Makefile.am    |   2 +-
  3 files changed, 59 insertions(+), 53 deletions(-)

diff --git a/configure.ac b/configure.ac
index 8c82c43..090b7af 100644
--- a/configure.ac
+++ b/configure.ac
@@ -858,8 +858,8 @@ AC_ARG_ENABLE([dri3],
      [enable_dri3="$enableval"],
      [enable_dri3="$dri3_default"])
  AC_ARG_ENABLE([glx],
-    [AS_HELP_STRING([--enable-glx],
-        [enable GLX library @<:@default=enabled@:>@])],
+    [AS_HELP_STRING([--enable-glx[=dri|xlib|gallium-xlib]],
+        [enable the GLX library and choose an implementation
@<:@default=dri@:>@])],
      [enable_glx="$enableval"],
      [enable_glx=yes])
  AC_ARG_ENABLE([osmesa],
@@ -925,11 +925,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 +983,47 @@ 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
-
-# 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
+# Validate GLX options
+if test "x$enable_glx" = xyes; then
+    if test "x$enable_dri" = xyes; then
+        enable_glx=dri
+    elif test -n "$with_gallium_drivers"; then
+        enable_glx=gallium-xlib
+    else
+        enable_glx=xlib
+    fi
  fi
+case "x$enable_glx" in
+xdri | xxlib | xgallium-xlib)
+    # GLX requires OpenGL
+    if test "x$enable_opengl" = xno; then
+        AC_MSG_ERROR([GLX cannot be built without OpenGL])
+    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
-fi
+    # Check individual dependencies
+    case "x$enable_glx" in
+    xdri)
+        if test "x$enable_dri" = xno; then
+            AC_MSG_ERROR([DRI-based GLX requires DRI to be enabled])
+        fi
+        ;;
+    xxlib | xgallium-xlib )
+        if test "x$enable_dri" = xyes; then
+            AC_MSG_ERROR([Xlib-based GLX cannot be built with DRI enabled])
+        fi
+        ;;
+    esac
+    ;;
+xno)
+    ;;
+*)
+    AC_MSG_ERROR([Illegal value for --enable-dri: $enable_dri])
+    ;;
+esac

-AM_CONDITIONAL(HAVE_DRI_GLX, test "x$enable_glx" = xyes -a \
-                                  "x$enable_dri" = xyes)
+AM_CONDITIONAL(HAVE_DRI_GLX, test "x$enable_glx" = xdri)
+AM_CONDITIONAL(HAVE_XLIB_GLX, test "x$enable_glx" = xxlib)
+AM_CONDITIONAL(HAVE_GALLIUM_XLIB_GLX, test "x$enable_glx" = xgallium-xlib)

  # Check for libdrm
  PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED],
@@ -1072,10 +1079,6 @@ dnl
  dnl Driver specific build directories
  dnl

-if test -n "$with_gallium_drivers" -a "x$enable_glx$enable_xlib_glx"
= xyesyes; then
-    NEED_WINSYS_XLIB="yes"
-fi
-
  if test "x$enable_gallium_osmesa" = xyes; then
      if ! echo "$with_gallium_drivers" | grep -q 'swrast'; then
          AC_MSG_ERROR([gallium_osmesa requires the gallium swrast driver])
@@ -1268,8 +1271,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" in
+xxlib | xgallium-xlib)
      # Xlib-based GLX
      dri_modules="x11 xext xcb"
      PKG_CHECK_MODULES([XLIBGL], [$dri_modules])
@@ -1279,7 +1282,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)
+xdri)
      # DRI-based GLX
      PKG_CHECK_MODULES([GLPROTO], [glproto >= $GLPROTO_REQUIRED])

@@ -1368,11 +1371,11 @@ AC_SUBST([HAVE_XF86VIDMODE])
  dnl
  dnl More GLX setup
  dnl
-case "x$enable_glx$enable_xlib_glx" in
-xyesyes)
+case "x$enable_glx" in
+xxlib | xgallium-xlib)
      DEFINES="$DEFINES -DUSE_XSHM"
      ;;
-xyesno)
+xdri)
      DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
      if test "x$driglx_direct" = xyes; then
          DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
@@ -1546,7 +1549,8 @@ if test -n "$with_dri_drivers"; then
  fi

  AM_CONDITIONAL(NEED_MEGADRIVER, test -n "$DRI_DIRS")
-AM_CONDITIONAL(NEED_LIBMESA, test "x$enable_xlib_glx" = xyes -o \
+AM_CONDITIONAL(NEED_LIBMESA, test "x$enable_glx" = xxlib -o \
+                                  "x$enable_glx" = xgallium-xlib -o \
                                    "x$enable_osmesa" = xyes -o \
                                    -n "$DRI_DIRS")

@@ -1561,7 +1565,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_glx" != xno; then
          AC_MSG_WARN([Ignoring OSMesa channel bits because of
non-OSMesa driver])
          osmesa_bits=8
      fi
@@ -2402,7 +2406,7 @@ AM_CONDITIONAL(HAVE_SWRAST_DRI, test
x$HAVE_SWRAST_DRI = xyes)
  AM_CONDITIONAL(NEED_RADEON_DRM_WINSYS, test "x$HAVE_GALLIUM_R300" = xyes -o \
                                              "x$HAVE_GALLIUM_R600" = xyes -o \
                                              "x$HAVE_GALLIUM_RADEONSI" = xyes)
-AM_CONDITIONAL(NEED_WINSYS_XLIB, test "x$NEED_WINSYS_XLIB" = xyes)
+AM_CONDITIONAL(NEED_WINSYS_XLIB, test "x$enable_glx" = xgallium-xlib)
  AM_CONDITIONAL(NEED_RADEON_LLVM, test x$NEED_RADEON_LLVM = xyes)
  AM_CONDITIONAL(HAVE_GALLIUM_COMPUTE, test x$enable_opencl = xyes)
  AM_CONDITIONAL(HAVE_MESA_LLVM, test x$MESA_LLVM = x1)
@@ -2412,7 +2416,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,12 +2605,15 @@ 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)
+case "x$enable_glx" in
+xdri)
+    echo "        GLX:             DRI-based"
+    ;;
+xxlib)
      echo "        GLX:             Xlib-based"
      ;;
-xyesno)
-    echo "        GLX:             DRI-based"
+xgallium-xlib)
+    echo "        GLX:             Xlib-based (Gallium)"
      ;;
  *)
      echo "        GLX:             $enable_glx"
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


_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to