From 7da23db202851860a7b4b69895770360b8a5da0f Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 1 May 2000 10:36:00 +0000 Subject: [PATCH] separate out checks for VIDMODE and DGA in preparation for the Great Vidmode Hack :) --- acconfig.h | 3 +++ common/dga_check.c | 4 +++- common/vid_glx.c | 19 ++++++++++-------- configure.in | 45 ++++++++++++++++++++++++++++++++++--------- qw_client/Makefile.in | 5 +++-- uquake/Makefile.in | 5 +++-- 6 files changed, 59 insertions(+), 22 deletions(-) diff --git a/acconfig.h b/acconfig.h index a2ef474..e736330 100644 --- a/acconfig.h +++ b/acconfig.h @@ -18,6 +18,9 @@ /* Define this if you have OGL */ #undef HAS_OGL +/* Define if you have the XFree86 VIDMODE extension */ +#undef HAS_VIDMODE + /* Define if you have the XFree86 DGA extension */ #undef HAS_DGA diff --git a/common/dga_check.c b/common/dga_check.c index 1428db1..5468eb0 100644 --- a/common/dga_check.c +++ b/common/dga_check.c @@ -35,6 +35,8 @@ #if defined(HAS_DGA) #include +#endif +#if defined(HAS_VIDMODE) #include #endif @@ -83,7 +85,7 @@ VID_CheckDGA(Display *dpy, int *maj_ver, int *min_ver, int *hasvideo) int VID_CheckVMode(Display *dpy, int *maj_ver, int *min_ver) { -#if defined(HAS_DGA) +#if defined(HAS_VIDMODE) int event_base, error_base; int dummy; diff --git a/common/vid_glx.c b/common/vid_glx.c index da214e1..1528abd 100644 --- a/common/vid_glx.c +++ b/common/vid_glx.c @@ -63,8 +63,11 @@ #include #include +#undef HAS_DGA #ifdef HAS_DGA # include +#endif +#ifdef HAS_VIDMODE # include #endif #include @@ -93,19 +96,19 @@ cvar_t *vid_glx_fullscreen; extern cvar_t *gl_triplebuffer; extern cvar_t *vid_dga_mouseaccel; -#ifdef HAS_DGA -static int nummodes; +#ifdef HAS_VIDMODE static XF86VidModeModeInfo **vidmodes; -static int hasdgavideo = 0, hasvidmode = 0; - +static int nummodes, hasvidmode = 0; #endif +#ifdef HAS_DGA +static int hasdgavideo = 0; +static int hasdga = 0; +#endif + #ifdef HAVE_DLOPEN static void *dlhand = NULL; #endif -#ifdef HAS_DGA -static int hasdga = 0; -#endif static GLboolean (*QF_XMesaSetFXmode)(GLint mode) = NULL; @@ -159,7 +162,7 @@ VID_Shutdown(void) glXDestroyContext(x_disp, ctx); -#ifdef HAS_DGA +#ifdef HAS_VIDMODE if (hasvidmode) { int i; diff --git a/configure.in b/configure.in index f155a68..0d0bd48 100644 --- a/configure.in +++ b/configure.in @@ -248,16 +248,31 @@ if test "x$no_x" = x; then [HAS_X11="no"], [ $X_LIBS -lX11 $X_EXTRA_LIBS ]) fi +dnl Check for VIDMODE support +AC_ARG_ENABLE(VIDMODE, +[ --enable-DGA use XFree86 DGA extension, if available], +HAS_DGA=$enable_VIDMODE, HAS_VIDMODE=auto) +if test "x$HAS_VIDMODE" != xno; then + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$X_CFLAGS $CPPFLAGS" + AC_CHECK_HEADER(X11/extensions/xf86vmode.h, HAS_VIDMODE=yes, HAS_VIDMODE=no) + CPPFLAGS="$save_CPPFLAGS" +fi + dnl Check for DGA support AC_ARG_ENABLE(DGA, [ --enable-DGA use XFree86 DGA extension, if available], HAS_DGA=$enable_DGA, HAS_DGA=auto) -if test "x$HAS_DGA" != xno; then - save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$X_CFLAGS $CPPFLAGS" - AC_CHECK_HEADER(X11/extensions/xf86dga.h, HAS_DGA=yes, HAS_DGA=no) - AC_CHECK_HEADER(X11/extensions/xf86vmode.h, qwfoo=qwfoo, HAS_DGA=no) - CPPFLAGS="$save_CPPFLAGS" +if test "x$HAS_VIDMODE" = xyes; then + if test "x$HAS_DGA" != xno; then + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$X_CFLAGS $CPPFLAGS" + AC_CHECK_HEADER(X11/extensions/xf86dga.h, HAS_DGA=yes, HAS_DGA=no) + AC_CHECK_HEADER(X11/extensions/xf86vmode.h, qwfoo=qwfoo, HAS_DGA=no) + CPPFLAGS="$save_CPPFLAGS" + else + HAS_DGA=no + fi fi dnl Checks for VGA support @@ -415,18 +430,28 @@ if test "x$HAS_OGL" = xyes; then AC_DEFINE(HAS_OGL) fi +dnl Make sure VIDMODE works +if test "x$HAS_VIDMODE" = xyes; then + AC_CHECK_LIB(Xxf86vm, XF86VidModeSwitchToMode,qwfoo=qwfoo, + HAS_VIDMODE=no HAS_DGA=no, [$X_LIBS -lXext -lX11 $X_EXTRA_LIBS]) +fi +if test "x$HAS_VIDMODE" != xyes; then + VIDMODE_LIBS="" +else + AC_DEFINE(HAS_VIDMODE) + VIDMODE_LIBS="-lXxf86vm" +fi + dnl Make sure DGA works if test "x$HAS_DGA" = xyes; then AC_CHECK_LIB(Xxf86dga, XF86DGAQueryVersion,qwfoo=qwfoo, HAS_DGA=no, [$X_LIBS -lXext -lX11 $X_EXTRA_LIBS]) - AC_CHECK_LIB(Xxf86vm, XF86VidModeSwitchToMode,qwfoo=qwfoo, - HAS_DGA=no, [$X_LIBS -lXext -lX11 $X_EXTRA_LIBS]) fi if test "x$HAS_DGA" != xyes; then DGA_LIBS="" else AC_DEFINE(HAS_DGA) - DGA_LIBS="-lXxf86dga -lXxf86vm" + DGA_LIBS="-lXxf86dga" fi dnl Make sure -lmgllt works @@ -850,7 +875,9 @@ AC_SUBST(X_LIBS) AC_SUBST(X_CFLAGS) AC_SUBST(X11_SHM_LIB) AC_SUBST(HAS_X11) +AC_SUBST(HAD_VIDMODE) AC_SUBST(HAS_DGA) +AC_SUBST(VIDMODE_LIBS) AC_SUBST(DGA_LIBS) AC_SUBST(HAS_VGA) AC_SUBST(VGA_CFLAGS) diff --git a/qw_client/Makefile.in b/qw_client/Makefile.in index 1a02aef..ed52e1a 100644 --- a/qw_client/Makefile.in +++ b/qw_client/Makefile.in @@ -182,7 +182,8 @@ ALL_X11_OBJS = $(patsubst %,$(BUILD_DIR)/%,$(addsuffix .@OBJEXT@,\ $(BUILD_DIR)/common_lib.a $(TARGET_DIR)/sound_lib.a X11_CFLAGS = -DX11 @X_CFLAGS@ -X11_LDFLAGS = @X_LIBS@ -lX11 @X11_SHM_LIB@ @X_EXTRA_LIBS@ @DGA_LIBS@ +X11_LDFLAGS = @X_LIBS@ -lX11 @X11_SHM_LIB@ @X_EXTRA_LIBS@ @VIDMODE_LIBS@ \ + @DGA_LIBS@ # FIXME: This rule is pathological because of the seperate sunx driver, # either merge it into vid_x11.c or make a seperate sun target. In either @@ -327,7 +328,7 @@ ALL_GL_OBJS = $(GLX_GL_OBJS) $(GL_REND_OBJS) \ $(BUILD_DIR)/common_lib.a $(TARGET_DIR)/sound_lib.a GL_CFLAGS = @OGL_CFLAGS@ -GL_LDFLAGS = $(X11_LDFLAGS) @OGL_LIBS@ @DGA_LIBS@ +GL_LDFLAGS = $(X11_LDFLAGS) @OGL_LIBS@ @VIDMODE_LIBS@ @DGA_LIBS@ $(BUILD_DIR)/vid_glx.@OBJEXT@: $(COMMON_DIR)/vid_glx.c $(CC) $(CFLAGS) $(GL_CFLAGS) -o $@ -c $< diff --git a/uquake/Makefile.in b/uquake/Makefile.in index 0a77e36..2458ff3 100644 --- a/uquake/Makefile.in +++ b/uquake/Makefile.in @@ -188,7 +188,8 @@ ALL_X11_OBJS = $(patsubst %,$(BUILD_DIR)/%,$(addsuffix .@OBJEXT@,\ $(TARGET_DIR)/sound_lib.a X11_CFLAGS = -DX11 @X_CFLAGS@ -X11_LDFLAGS = @X_LIBS@ -lX11 @X11_SHM_LIB@ @X_EXTRA_LIBS@ @DGA_LIBS@ +X11_LDFLAGS = @X_LIBS@ -lX11 @X11_SHM_LIB@ @X_EXTRA_LIBS@ @VIDMODE_LIBS@ \ + @DGA_LIBS@ # FIXME: This rule is pathological because of the seperate sunx driver, # either merge it into vid_x11.c or make a seperate sun target. In either @@ -358,7 +359,7 @@ ALL_GL_OBJS = $(patsubst %,$(BUILD_DIR)/%,$(addsuffix .@OBJEXT@,\ $(TARGET_DIR)/sound_lib.a GL_CFLAGS = @OGL_CFLAGS@ -GL_LDFLAGS = $(X11_LDFLAGS) @OGL_LIBS@ @DGA_LIBS@ +GL_LDFLAGS = $(X11_LDFLAGS) @OGL_LIBS@ @VIDMODE_LIBS@ @DGA_LIBS@ $(BUILD_DIR)/vid_glx.o: $(COMMON_DIR)/vid_glx.c $(CC) $(CFLAGS) $(GL_CFLAGS) -o $@ -c $<