[Mesa-dev] [PATCH 1/2] Revert "glx: make xf86vidmode mandatory for direct rendering"

Jon Turney jon.turney at dronecode.org.uk
Tue Dec 11 15:15:09 UTC 2018


This reverts commit 5bc509363b6dbc42af72668fe500b6aec988dbf0.

Signed-off-by: Jon Turney <jon.turney at dronecode.org.uk>
---
 configure.ac        | 12 +++++++++++-
 meson.build         |  6 ++++--
 src/glx/Makefile.am |  5 +++++
 src/glx/SConscript  |  5 ++++-
 src/glx/glxcmds.c   |  7 ++++++-
 src/glx/meson.build |  6 +++++-
 6 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5d3da4b7c48..f42e36c0658 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1725,7 +1725,11 @@ xdri)
         fi
     fi
 
-    dri_modules="$dri_modules xxf86vm"
+    # add xf86vidmode if available
+    PKG_CHECK_MODULES([XF86VIDMODE], [xxf86vm], HAVE_XF86VIDMODE=yes, HAVE_XF86VIDMODE=no)
+    if test "$HAVE_XF86VIDMODE" = yes ; then
+        dri_modules="$dri_modules xxf86vm"
+    fi
 
     PKG_CHECK_MODULES([DRIGL], [$dri_modules])
     GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
@@ -1738,6 +1742,10 @@ xdri)
     ;;
 esac
 
+# This is outside the case (above) so that it is invoked even for non-GLX
+# builds.
+AM_CONDITIONAL(HAVE_XF86VIDMODE, test "x$HAVE_XF86VIDMODE" = xyes)
+
 GLESv1_CM_LIB_DEPS="$LIBDRM_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
 GLESv1_CM_PC_LIB_PRIV="-lm $PTHREAD_LIBS $DLOPEN_LIBS"
 GLESv2_LIB_DEPS="$LIBDRM_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
@@ -1754,6 +1762,8 @@ AC_SUBST([GLESv1_CM_PC_LIB_PRIV])
 AC_SUBST([GLESv2_LIB_DEPS])
 AC_SUBST([GLESv2_PC_LIB_PRIV])
 
+AC_SUBST([HAVE_XF86VIDMODE])
+
 dnl
 dnl More GLX setup
 dnl
diff --git a/meson.build b/meson.build
index 4f6176b8d96..c21b7b826e0 100644
--- a/meson.build
+++ b/meson.build
@@ -1349,7 +1349,7 @@ if with_platform_x11
     dep_xdamage = dependency('xdamage', version : '>= 1.1')
     dep_xfixes = dependency('xfixes')
     dep_xcb_glx = dependency('xcb-glx', version : '>= 1.8.1')
-    dep_xxf86vm = dependency('xxf86vm')
+    dep_xxf86vm = dependency('xxf86vm', required : false)
   endif
   if (with_any_vk or with_glx == 'dri' or
        (with_gallium_vdpau or with_gallium_xvmc or with_gallium_va or
@@ -1427,11 +1427,13 @@ elif with_glx == 'dri'
   if with_dri_platform == 'drm'
     gl_priv_reqs += 'xcb-dri2 >= 1.8'
   endif
-  gl_priv_reqs += 'xxf86vm'
 endif
 if dep_libdrm.found()
   gl_priv_reqs += 'libdrm >= 2.4.75'
 endif
+if dep_xxf86vm.found()
+  gl_priv_reqs += 'xxf86vm'
+endif
 
 gl_priv_libs = []
 if dep_thread.found()
diff --git a/src/glx/Makefile.am b/src/glx/Makefile.am
index a66957d609b..d208ce14bb7 100644
--- a/src/glx/Makefile.am
+++ b/src/glx/Makefile.am
@@ -24,6 +24,10 @@ SUBDIRS =
 
 EXTRA_DIST = SConscript meson.build
 
+if HAVE_XF86VIDMODE
+EXTRA_DEFINES_XF86VIDMODE = -DXF86VIDMODE
+endif
+
 AM_CFLAGS = \
 	-I$(top_srcdir)/include \
 	-I$(top_srcdir)/include/GL/internal \
@@ -34,6 +38,7 @@ AM_CFLAGS = \
 	-I$(top_builddir)/src/mapi/glapi \
 	-I$(top_srcdir)/src/mapi/glapi \
 	$(VISIBILITY_CFLAGS) \
+	$(EXTRA_DEFINES_XF86VIDMODE) \
 	-D_REENTRANT \
 	$(DEFINES) \
 	$(LIBDRM_CFLAGS) \
diff --git a/src/glx/SConscript b/src/glx/SConscript
index ce25a1faa84..7555fb0568c 100644
--- a/src/glx/SConscript
+++ b/src/glx/SConscript
@@ -35,7 +35,10 @@ env.Prepend(LIBS = [
 env.PkgUseModules('X11')
 env.PkgUseModules('XCB')
 env.PkgUseModules('DRM')
-env.PkgUseModules('XF86VIDMODE')
+
+if env['HAVE_XF86VIDMODE']:
+    env.Append(CPPDEFINES = ['XF86VIDMODE'])
+    env.PkgUseModules('XF86VIDMODE')
 
 sources = [
     'clientattrib.c',
diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index b940c8ebdbe..3ed960fbf3c 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -46,9 +46,11 @@
 #include "util/debug.h"
 #else
 #include <sys/time.h>
+#ifdef XF86VIDMODE
 #include <X11/extensions/xf86vmode.h>
 #endif
 #endif
+#endif
 
 #include <X11/Xlib-xcb.h>
 #include <xcb/xcb.h>
@@ -2086,6 +2088,7 @@ _X_HIDDEN GLboolean
 __glxGetMscRate(struct glx_screen *psc,
 		int32_t * numerator, int32_t * denominator)
 {
+#ifdef XF86VIDMODE
    XF86VidModeModeLine mode_line;
    int dot_clock;
    int i;
@@ -2132,6 +2135,8 @@ __glxGetMscRate(struct glx_screen *psc,
 
       return True;
    }
+   else
+#endif
 
    return False;
 }
@@ -2157,7 +2162,7 @@ _X_HIDDEN GLboolean
 __glXGetMscRateOML(Display * dpy, GLXDrawable drawable,
                    int32_t * numerator, int32_t * denominator)
 {
-#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
+#if defined( GLX_DIRECT_RENDERING ) && defined( XF86VIDMODE )
    __GLXDRIdrawable *draw = GetGLXDRIDrawable(dpy, drawable);
 
    if (draw == NULL)
diff --git a/src/glx/meson.build b/src/glx/meson.build
index 3fd74439b11..1de35fca6bc 100644
--- a/src/glx/meson.build
+++ b/src/glx/meson.build
@@ -136,6 +136,10 @@ gl_lib_cargs = [
   '-D_REENTRANT',
 ]
 
+if dep_xxf86vm.found()
+  gl_lib_cargs += '-DHAVE_XF86VIDMODE'
+endif
+
 libglx = static_library(
   'glx',
   [files_libglx, glx_generated],
@@ -162,7 +166,7 @@ if with_glx == 'dri'
     link_args : [ld_args_bsymbolic, ld_args_gc_sections, extra_ld_args_libgl],
     dependencies : [
       dep_libdrm, dep_dl, dep_m, dep_thread, dep_x11, dep_xcb_glx, dep_xcb,
-      dep_x11_xcb, dep_xcb_dri2, dep_xext, dep_xfixes, dep_xdamage, dep_xxf86vm,
+      dep_x11_xcb, dep_xcb_dri2, dep_xext, dep_xfixes, dep_xdamage,
       extra_deps_libgl,
     ],
     version : gl_lib_version,
-- 
2.17.0



More information about the mesa-dev mailing list