winex11: Load the XVidMode extension (libXxf86vm) when available.

oldstable
Francois Gouget 2008-06-26 14:02:17 +02:00 committed by Alexandre Julliard
parent ce823a8e47
commit a49beb4c5c
6 changed files with 118 additions and 54 deletions

51
configure vendored
View File

@ -1414,7 +1414,7 @@ Optional Packages:
--without-xshape do not use the Xshape extension
--without-xshm do not use XShm (shared memory extension)
--without-xslt do not use XSLT
--without-xvidmode do not use XFree video mode extension
--without-xxf86vm do not use XFree video mode extension
--with-wine-tools=DIR use Wine tools from directory DIR
--with-x use the X Window System
@ -2110,9 +2110,9 @@ if test "${with_xslt+set}" = set; then
fi
# Check whether --with-xvidmode was given.
if test "${with_xvidmode+set}" = set; then
withval=$with_xvidmode; if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_xf86vmode_h=no; fi
# Check whether --with-xxf86vm was given.
if test "${with_xxf86vm+set}" = set; then
withval=$with_xxf86vm; if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_xf86vmode_h=no; fi
fi
@ -10252,14 +10252,14 @@ fi
if test "$ac_cv_header_X11_extensions_xf86vmode_h" = "yes"
then
{ echo "$as_me:$LINENO: checking for XF86VidModeQueryExtension in -lXxf86vm" >&5
echo $ECHO_N "checking for XF86VidModeQueryExtension in -lXxf86vm... $ECHO_C" >&6; }
if test "${ac_cv_lib_Xxf86vm_XF86VidModeQueryExtension+set}" = set; then
{ echo "$as_me:$LINENO: checking for -lXxf86vm" >&5
echo $ECHO_N "checking for -lXxf86vm... $ECHO_C" >&6; }
if test "${ac_cv_lib_soname_Xxf86vm+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
ac_check_soname_save_LIBS=$LIBS
LIBS="-lXxf86vm $X_LIBS -lXext -lX11 $X_EXTRA_LIBS $LIBS"
cat >conftest.$ac_ext <<_ACEOF
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
@ -10299,39 +10299,46 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
ac_cv_lib_Xxf86vm_XF86VidModeQueryExtension=yes
case "$LIBEXT" in
dll) ;;
dylib) ac_cv_lib_soname_Xxf86vm=`otool -L conftest$ac_exeext | grep "libXxf86vm\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libXxf86vm\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;;
*) ac_cv_lib_soname_Xxf86vm=`$ac_cv_path_LDD conftest$ac_exeext | grep "libXxf86vm\\.$LIBEXT" | sed -e "s/^.*\(libXxf86vm\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` ;;
esac
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_Xxf86vm_XF86VidModeQueryExtension=no
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
LIBS=$ac_check_soname_save_LIBS
fi
{ echo "$as_me:$LINENO: result: $ac_cv_lib_Xxf86vm_XF86VidModeQueryExtension" >&5
echo "${ECHO_T}$ac_cv_lib_Xxf86vm_XF86VidModeQueryExtension" >&6; }
if test $ac_cv_lib_Xxf86vm_XF86VidModeQueryExtension = yes; then
if test "x$ac_cv_lib_soname_Xxf86vm" = "x"; then
{ echo "$as_me:$LINENO: result: not found" >&5
echo "${ECHO_T}not found" >&6; }
cat >>confdefs.h <<\_ACEOF
#define HAVE_LIBXXF86VM 1
else
{ echo "$as_me:$LINENO: result: $ac_cv_lib_soname_Xxf86vm" >&5
echo "${ECHO_T}$ac_cv_lib_soname_Xxf86vm" >&6; }
cat >>confdefs.h <<_ACEOF
#define SONAME_LIBXXF86VM "$ac_cv_lib_soname_Xxf86vm"
_ACEOF
X_PRE_LIBS="$X_PRE_LIBS -lXxf86vm"
fi
fi
if test "$ac_cv_lib_Xxf86vm_XF86VidModeQueryExtension" != "yes"; then
case "x$with_xvidmode" in
if test "x$ac_cv_lib_soname_Xxf86vm" = "x"; then
case "x$with_xxf86vm" in
x) wine_notices="$wine_notices|libXxf86vm development files not found, XFree86 Vidmode won't be supported." ;;
xno) ;;
*) { { echo "$as_me:$LINENO: error: libXxf86vm development files not found, XFree86 Vidmode won't be supported.
This is an error since --with-xvidmode was requested." >&5
This is an error since --with-xxf86vm was requested." >&5
echo "$as_me: error: libXxf86vm development files not found, XFree86 Vidmode won't be supported.
This is an error since --with-xvidmode was requested." >&2;}
This is an error since --with-xxf86vm was requested." >&2;}
{ (exit 1); exit 1; }; } ;;
esac
fi

View File

@ -73,7 +73,7 @@ AC_ARG_WITH(xshape, AS_HELP_STRING([--without-xshape],[do not use the Xshape
AC_ARG_WITH(xshm, AS_HELP_STRING([--without-xshm],[do not use XShm (shared memory extension)]),
[if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_XShm_h=no; fi])
AC_ARG_WITH(xslt, AS_HELP_STRING([--without-xslt],[do not use XSLT]))
AC_ARG_WITH(xvidmode, AS_HELP_STRING([--without-xvidmode],[do not use XFree video mode extension]),
AC_ARG_WITH(xxf86vm, AS_HELP_STRING([--without-xxf86vm],[do not use XFree video mode extension]),
[if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_xf86vmode_h=no; fi])
AC_ARG_WITH(wine-tools,AS_HELP_STRING([--with-wine-tools=DIR],[use Wine tools from directory DIR]))
@ -683,13 +683,9 @@ then
dnl *** Check for XFree86 VMODE extension
if test "$ac_cv_header_X11_extensions_xf86vmode_h" = "yes"
then
AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension,
[ AC_DEFINE(HAVE_LIBXXF86VM, 1, [Define if you have the Xxf86vm library])
X_PRE_LIBS="$X_PRE_LIBS -lXxf86vm"
],,
$X_LIBS -lXext -lX11 $X_EXTRA_LIBS)
WINE_CHECK_SONAME(Xxf86vm,XF86VidModeQueryExtension,,,[$X_LIBS -lXext -lX11 $X_EXTRA_LIBS])
fi
WINE_NOTICE_WITH(xvidmode,[test "$ac_cv_lib_Xxf86vm_XF86VidModeQueryExtension" != "yes"],
WINE_NOTICE_WITH(xxf86vm,[test "x$ac_cv_lib_soname_Xxf86vm" = "x"],
[libXxf86vm development files not found, XFree86 Vidmode won't be supported.])
dnl *** Check for Transform functions in Xrender

View File

@ -525,7 +525,7 @@ static BOOL process_attach(void)
xinerama_init( WidthOfScreen(screen), HeightOfScreen(screen) );
X11DRV_Settings_Init();
#ifdef HAVE_LIBXXF86VM
#ifdef SONAME_LIBXXF86VM
/* initialize XVidMode */
X11DRV_XF86VM_Init();
#endif
@ -569,7 +569,7 @@ static void thread_detach(void)
*/
static void process_detach(void)
{
#ifdef HAVE_LIBXXF86VM
#ifdef SONAME_LIBXXF86VM
/* cleanup XVidMode */
X11DRV_XF86VM_Cleanup();
#endif

View File

@ -19,15 +19,17 @@
*/
#include "config.h"
#include "wine/port.h"
#include <string.h>
#include <stdio.h>
#include <math.h>
#include "x11drv.h"
#ifdef HAVE_LIBXXF86VM
#ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H
#include <X11/extensions/xf86vmode.h>
#endif /* HAVE_LIBXXF86VM */
#endif
#include "xvidmode.h"
@ -35,10 +37,11 @@
#include "wingdi.h"
#include "ddrawi.h"
#include "wine/debug.h"
#include "wine/library.h"
WINE_DEFAULT_DEBUG_CHANNEL(xvidmode);
#ifdef HAVE_LIBXXF86VM
#ifdef SONAME_LIBXXF86VM
extern int usexvidmode;
@ -54,6 +57,26 @@ static unsigned int dd_mode_count;
static XF86VidModeModeInfo** real_xf86vm_modes;
static unsigned int real_xf86vm_mode_count;
#define MAKE_FUNCPTR(f) typeof(f) * p##f;
MAKE_FUNCPTR(XF86VidModeGetAllModeLines)
MAKE_FUNCPTR(XF86VidModeGetModeLine)
MAKE_FUNCPTR(XF86VidModeLockModeSwitch)
MAKE_FUNCPTR(XF86VidModeQueryExtension)
MAKE_FUNCPTR(XF86VidModeQueryVersion)
MAKE_FUNCPTR(XF86VidModeSetViewPort)
MAKE_FUNCPTR(XF86VidModeSwitchToMode)
#ifdef X_XF86VidModeSetGamma
MAKE_FUNCPTR(XF86VidModeGetGamma)
MAKE_FUNCPTR(XF86VidModeSetGamma)
#endif
#ifdef X_XF86VidModeSetGammaRamp
MAKE_FUNCPTR(XF86VidModeGetGammaRamp)
MAKE_FUNCPTR(XF86VidModeGetGammaRampSize)
MAKE_FUNCPTR(XF86VidModeSetGammaRamp)
#endif
#undef MAKE_FUNCPTR
static void convert_modeinfo( const XF86VidModeModeInfo *mode)
{
int rate;
@ -98,7 +121,7 @@ static int X11DRV_XF86VM_GetCurrentMode(void)
TRACE("Querying XVidMode current mode\n");
wine_tsx11_lock();
XF86VidModeGetModeLine(gdi_display, DefaultScreen(gdi_display), &dotclock, &line);
pXF86VidModeGetModeLine(gdi_display, DefaultScreen(gdi_display), &dotclock, &line);
wine_tsx11_unlock();
convert_modeline(dotclock, &line, &cmode, dwBpp);
for (i=0; i<dd_mode_count; i++)
@ -123,9 +146,9 @@ static LONG X11DRV_XF86VM_SetCurrentMode(int mode)
wine_tsx11_lock();
TRACE("Resizing X display to %dx%d\n",
real_xf86vm_modes[mode]->hdisplay, real_xf86vm_modes[mode]->vdisplay);
XF86VidModeSwitchToMode(gdi_display, DefaultScreen(gdi_display), real_xf86vm_modes[mode]);
pXF86VidModeSwitchToMode(gdi_display, DefaultScreen(gdi_display), real_xf86vm_modes[mode]);
#if 0 /* it is said that SetViewPort causes problems with some X servers */
XF86VidModeSetViewPort(gdi_display, DefaultScreen(gdi_display), 0, 0);
pXF86VidModeSetViewPort(gdi_display, DefaultScreen(gdi_display), 0, 0);
#else
XWarpPointer(gdi_display, None, DefaultRootWindow(gdi_display), 0, 0, 0, 0, 0, 0);
#endif
@ -135,21 +158,52 @@ static LONG X11DRV_XF86VM_SetCurrentMode(int mode)
return DISP_CHANGE_SUCCESSFUL;
}
void X11DRV_XF86VM_Init(void)
{
void *xvidmode_handle;
Bool ok;
int nmodes;
unsigned int i;
if (xf86vm_major) return; /* already initialized? */
xvidmode_handle = wine_dlopen(SONAME_LIBXXF86VM, RTLD_NOW, NULL, 0);
if (!xvidmode_handle)
{
TRACE("Unable to open %s, XVidMode disabled\n", SONAME_LIBXXF86VM);
usexvidmode = 0;
return;
}
#define LOAD_FUNCPTR(f) \
if((p##f = wine_dlsym(xvidmode_handle, #f, NULL, 0)) == NULL) \
goto sym_not_found;
LOAD_FUNCPTR(XF86VidModeGetAllModeLines)
LOAD_FUNCPTR(XF86VidModeGetModeLine)
LOAD_FUNCPTR(XF86VidModeLockModeSwitch)
LOAD_FUNCPTR(XF86VidModeQueryExtension)
LOAD_FUNCPTR(XF86VidModeQueryVersion)
LOAD_FUNCPTR(XF86VidModeSetViewPort)
LOAD_FUNCPTR(XF86VidModeSwitchToMode)
#ifdef X_XF86VidModeSetGamma
LOAD_FUNCPTR(XF86VidModeGetGamma)
LOAD_FUNCPTR(XF86VidModeSetGamma)
#endif
#ifdef X_XF86VidModeSetGammaRamp
LOAD_FUNCPTR(XF86VidModeGetGammaRamp)
LOAD_FUNCPTR(XF86VidModeGetGammaRampSize)
LOAD_FUNCPTR(XF86VidModeSetGammaRamp)
#endif
#undef LOAD_FUNCPTR
/* see if XVidMode is available */
wine_tsx11_lock();
ok = XF86VidModeQueryExtension(gdi_display, &xf86vm_event, &xf86vm_error);
ok = pXF86VidModeQueryExtension(gdi_display, &xf86vm_event, &xf86vm_error);
if (ok)
{
X11DRV_expect_error(gdi_display, XVidModeErrorHandler, NULL);
ok = XF86VidModeQueryVersion(gdi_display, &xf86vm_major, &xf86vm_minor);
ok = pXF86VidModeQueryVersion(gdi_display, &xf86vm_major, &xf86vm_minor);
if (X11DRV_check_error()) ok = FALSE;
}
if (ok)
@ -157,7 +211,7 @@ void X11DRV_XF86VM_Init(void)
#ifdef X_XF86VidModeSetGammaRamp
if (xf86vm_major > 2 || (xf86vm_major == 2 && xf86vm_minor >= 1))
{
XF86VidModeGetGammaRampSize(gdi_display, DefaultScreen(gdi_display),
pXF86VidModeGetGammaRampSize(gdi_display, DefaultScreen(gdi_display),
&xf86vm_gammaramp_size);
if (xf86vm_gammaramp_size == 256)
xf86vm_use_gammaramp = TRUE;
@ -166,7 +220,7 @@ void X11DRV_XF86VM_Init(void)
/* retrieve modes */
if (usexvidmode && root_window == DefaultRootWindow( gdi_display ))
ok = XF86VidModeGetAllModeLines(gdi_display, DefaultScreen(gdi_display), &nmodes, &real_xf86vm_modes);
ok = pXF86VidModeGetAllModeLines(gdi_display, DefaultScreen(gdi_display), &nmodes, &real_xf86vm_modes);
else
ok = FALSE; /* In desktop mode, do not switch resolution... But still use the Gamma ramp stuff */
}
@ -193,6 +247,13 @@ void X11DRV_XF86VM_Init(void)
TRACE("Available DD modes: count=%d\n", dd_mode_count);
TRACE("Enabling XVidMode\n");
return;
sym_not_found:
TRACE("Unable to load function pointers from %s, XVidMode disabled\n", SONAME_LIBXXF86VM);
wine_dlclose(xvidmode_handle, NULL, 0);
xvidmode_handle = NULL;
usexvidmode = 0;
}
void X11DRV_XF86VM_Cleanup(void)
@ -207,7 +268,7 @@ void X11DRV_XF86VM_SetExclusiveMode(int lock)
if (!dd_modes) return; /* no XVidMode */
wine_tsx11_lock();
XF86VidModeLockModeSwitch(gdi_display, DefaultScreen(gdi_display), lock);
pXF86VidModeLockModeSwitch(gdi_display, DefaultScreen(gdi_display), lock);
wine_tsx11_unlock();
}
@ -307,7 +368,7 @@ BOOL X11DRV_XF86VM_GetGammaRamp(LPDDGAMMARAMP ramp)
{
Bool ret;
wine_tsx11_lock();
ret = XF86VidModeGetGammaRamp(gdi_display, DefaultScreen(gdi_display), 256,
ret = pXF86VidModeGetGammaRamp(gdi_display, DefaultScreen(gdi_display), 256,
ramp->red, ramp->green, ramp->blue);
wine_tsx11_unlock();
return ret;
@ -316,7 +377,7 @@ BOOL X11DRV_XF86VM_GetGammaRamp(LPDDGAMMARAMP ramp)
else
{
wine_tsx11_lock();
ret = XF86VidModeGetGamma(gdi_display, DefaultScreen(gdi_display), &gamma);
ret = pXF86VidModeGetGamma(gdi_display, DefaultScreen(gdi_display), &gamma);
wine_tsx11_unlock();
if (ret) {
GenerateRampFromGamma(ramp->red, gamma.red);
@ -340,7 +401,7 @@ BOOL X11DRV_XF86VM_SetGammaRamp(LPDDGAMMARAMP ramp)
{
Bool ret;
wine_tsx11_lock();
ret = XF86VidModeSetGammaRamp(gdi_display, DefaultScreen(gdi_display), 256,
ret = pXF86VidModeSetGammaRamp(gdi_display, DefaultScreen(gdi_display), 256,
ramp->red, ramp->green, ramp->blue);
wine_tsx11_unlock();
return ret;
@ -353,7 +414,7 @@ BOOL X11DRV_XF86VM_SetGammaRamp(LPDDGAMMARAMP ramp)
ComputeGammaFromRamp(ramp->blue, &gamma.blue)) {
Bool ret;
wine_tsx11_lock();
ret = XF86VidModeSetGamma(gdi_display, DefaultScreen(gdi_display), &gamma);
ret = pXF86VidModeSetGamma(gdi_display, DefaultScreen(gdi_display), &gamma);
wine_tsx11_unlock();
return ret;
}
@ -362,7 +423,7 @@ BOOL X11DRV_XF86VM_SetGammaRamp(LPDDGAMMARAMP ramp)
return FALSE;
}
#endif /* HAVE_LIBXXF86VM */
#endif /* SONAME_LIBXXF86VM */
/***********************************************************************
* GetDeviceGammaRamp (X11DRV.@)
@ -373,7 +434,7 @@ BOOL X11DRV_XF86VM_SetGammaRamp(LPDDGAMMARAMP ramp)
*/
BOOL X11DRV_GetDeviceGammaRamp(X11DRV_PDEVICE *physDev, LPVOID ramp)
{
#ifdef HAVE_LIBXXF86VM
#ifdef SONAME_LIBXXF86VM
return X11DRV_XF86VM_GetGammaRamp(ramp);
#else
return FALSE;
@ -389,7 +450,7 @@ BOOL X11DRV_GetDeviceGammaRamp(X11DRV_PDEVICE *physDev, LPVOID ramp)
*/
BOOL X11DRV_SetDeviceGammaRamp(X11DRV_PDEVICE *physDev, LPVOID ramp)
{
#ifdef HAVE_LIBXXF86VM
#ifdef SONAME_LIBXXF86VM
return X11DRV_XF86VM_SetGammaRamp(ramp);
#else
return FALSE;

View File

@ -24,7 +24,7 @@
# error You must include config.h to use this header
#endif
#ifdef HAVE_LIBXXF86VM
#ifdef SONAME_LIBXXF86VM
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
@ -38,5 +38,5 @@ void X11DRV_XF86VM_SetExclusiveMode(int lock);
BOOL X11DRV_XF86VM_GetGammaRamp(LPDDGAMMARAMP ramp);
BOOL X11DRV_XF86VM_SetGammaRamp(LPDDGAMMARAMP ramp);
#endif /* HAVE_LIBXXF86VM */
#endif /* SONAME_LIBXXF86VM */
#endif /* __WINE_XVIDMODE_H */

View File

@ -336,9 +336,6 @@
/* Define to 1 if you have the <libxslt/transform.h> header file. */
#undef HAVE_LIBXSLT_TRANSFORM_H
/* Define if you have the Xxf86vm library */
#undef HAVE_LIBXXF86VM
/* Define if you have the X Shm extension */
#undef HAVE_LIBXXSHM
@ -1107,6 +1104,9 @@
/* Define to the soname of the libXrender library. */
#undef SONAME_LIBXRENDER
/* Define to the soname of the libXxf86vm library. */
#undef SONAME_LIBXXF86VM
/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
#undef STAT_MACROS_BROKEN