separate out checks for VIDMODE and DGA in preparation for the Great Vidmode Hack :)

This commit is contained in:
Bill Currie 2000-05-01 10:36:00 +00:00
parent ecba3b9f42
commit 7da23db202
6 changed files with 59 additions and 22 deletions

View file

@ -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

View file

@ -35,6 +35,8 @@
#if defined(HAS_DGA)
#include <X11/extensions/xf86dga.h>
#endif
#if defined(HAS_VIDMODE)
#include <X11/extensions/xf86vmode.h>
#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;

View file

@ -63,8 +63,11 @@
#include <X11/keysym.h>
#include <X11/cursorfont.h>
#undef HAS_DGA
#ifdef HAS_DGA
# include <X11/extensions/xf86dga.h>
#endif
#ifdef HAS_VIDMODE
# include <X11/extensions/xf86vmode.h>
#endif
#include <dga_check.h>
@ -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;

View file

@ -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)

View file

@ -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 $<

View file

@ -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 $<