Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver into input-hotplug

This commit is contained in:
Daniel Stone 2006-10-26 00:28:30 +03:00 committed by Daniel Stone
commit cdc8a4b7b2
6 changed files with 111 additions and 9 deletions

View File

@ -890,7 +890,6 @@ PKG_CHECK_MODULES([XSERVERLIBS], [$REQUIRED_LIBS])
XSERVER_CFLAGS="${XSERVERCFLAGS_CFLAGS}" XSERVER_CFLAGS="${XSERVERCFLAGS_CFLAGS}"
XSERVER_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} -lm" XSERVER_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} -lm"
AC_SUBST([XSERVER_LIBS])
AC_SUBST([SYS_LIBS]) AC_SUBST([SYS_LIBS])
# The Xorg binary needs to export symbols so that they can be used from modules # The Xorg binary needs to export symbols so that they can be used from modules
@ -916,6 +915,44 @@ case $host_os in
esac esac
AC_SUBST([LD_EXPORT_SYMBOLS_FLAG]) AC_SUBST([LD_EXPORT_SYMBOLS_FLAG])
AC_CHECK_FUNCS([clock_gettime], [have_clock_gettime=yes],
[AC_CHECK_LIB([rt], [clock_gettime], [have_clock_gettime=-lrt],
[have_clock_gettime=no])])
AC_MSG_CHECKING([for a useful monotonic clock ...])
if ! test "x$have_clock_gettime" = xno; then
if ! test "x$have_clock_gettime" = xyes; then
LIBS="$have_clock_gettime"
else
LIBS=""
fi
AC_RUN_IFELSE([
#define _POSIX_C_SOURCE 199309L
#include <time.h>
int main(int argc, char *argv[]) {
struct timespec tp;
if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
return 0;
else
return 1;
}
], [MONOTONIC_CLOCK=yes], [MONOTONIC_CLOCK=no],
[MONOTONIC_CLOCK="cross compiling"])
else
MONOTONIC_CLOCK=no
fi
AC_MSG_RESULT([$MONOTONIC_CLOCK])
if test "x$MONOTONIC_CLOCK" = xyes; then
AC_DEFINE(MONOTONIC_CLOCK, 1, [Have monotonic clock from clock_gettime()])
XSERVER_LIBS="$XSERVER_LIBS $LIBS"
fi
dnl Imake defines SVR4 on SVR4 systems, and many files check for it, so dnl Imake defines SVR4 on SVR4 systems, and many files check for it, so
dnl we need to replicate that here until those can all be fixed dnl we need to replicate that here until those can all be fixed
AC_MSG_CHECKING([if SVR4 needs to be defined]) AC_MSG_CHECKING([if SVR4 needs to be defined])
@ -930,6 +967,8 @@ AC_MSG_RESULT([yes])], AC_MSG_RESULT([no]))
XSERVER_CFLAGS="$XSERVER_CFLAGS $CORE_INCS $XEXT_INC $COMPOSITE_INC $DAMAGE_INC $FIXES_INC $XI_INC $MI_INC $MIEXT_SHADOW_INC $MIEXT_LAYER_INC $MIEXT_DAMAGE_INC $RENDER_INC $RANDR_INC $FB_INC" XSERVER_CFLAGS="$XSERVER_CFLAGS $CORE_INCS $XEXT_INC $COMPOSITE_INC $DAMAGE_INC $FIXES_INC $XI_INC $MI_INC $MIEXT_SHADOW_INC $MIEXT_LAYER_INC $MIEXT_DAMAGE_INC $RENDER_INC $RANDR_INC $FB_INC"
AC_DEFINE_UNQUOTED(X_BYTE_ORDER,[$ENDIAN],[Endian order]) AC_DEFINE_UNQUOTED(X_BYTE_ORDER,[$ENDIAN],[Endian order])
AC_SUBST([XSERVER_LIBS])
dnl --------------------------------------------------------------------------- dnl ---------------------------------------------------------------------------
dnl DDX section. dnl DDX section.
dnl --------------------------------------------------------------------------- dnl ---------------------------------------------------------------------------

View File

@ -880,7 +880,7 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
xf86GetOptValBool(FlagOptions, FLAG_ALLOW_CLOSEDOWN_GRABS, xf86GetOptValBool(FlagOptions, FLAG_ALLOW_CLOSEDOWN_GRABS,
&(xf86Info.grabInfo.allowClosedown)); &(xf86Info.grabInfo.allowClosedown));
xf86GetOptValBool(FlagOptions, FLAG_IGNORE_ABI, &xf86Info.ignoreABI); xf86GetOptValBool(FlagOptions, FLAG_IGNORE_ABI, &xf86Info.ignoreABI);
if (&xf86Info.ignoreABI) { if (xf86Info.ignoreABI) {
xf86Msg(X_CONFIG, "Ignoring ABI Version\n"); xf86Msg(X_CONFIG, "Ignoring ABI Version\n");
} }

View File

@ -457,4 +457,7 @@
/* Use an empty root cursor */ /* Use an empty root cursor */
#undef NULL_ROOT_CURSOR #undef NULL_ROOT_CURSOR
/* Have a monotonic clock from clock_gettime() */
#undef MONOTONIC_CLOCK
#endif /* _DIX_CONFIG_H_ */ #endif /* _DIX_CONFIG_H_ */

View File

@ -119,11 +119,13 @@ mffs(fd_mask mask)
struct _OsTimerRec { struct _OsTimerRec {
OsTimerPtr next; OsTimerPtr next;
CARD32 expires; CARD32 expires;
CARD32 delta;
OsTimerCallback callback; OsTimerCallback callback;
pointer arg; pointer arg;
}; };
static void DoTimer(OsTimerPtr timer, CARD32 now, OsTimerPtr *prev); static void DoTimer(OsTimerPtr timer, CARD32 now, OsTimerPtr *prev);
static void CheckAllTimers(CARD32 now);
static OsTimerPtr timers = NULL; static OsTimerPtr timers = NULL;
/***************** /*****************
@ -200,6 +202,11 @@ WaitForSomething(int *pClientsReady)
{ {
now = GetTimeInMillis(); now = GetTimeInMillis();
timeout = timers->expires - now; timeout = timers->expires - now;
/* time has rewound. reset the timers. */
if (timeout > timers->delta) {
CheckAllTimers(now);
timeout = timers->expires - now;
}
if (timeout < 0) if (timeout < 0)
timeout = 0; timeout = 0;
waittime.tv_sec = timeout / MILLI_PER_SECOND; waittime.tv_sec = timeout / MILLI_PER_SECOND;
@ -426,6 +433,20 @@ ANYSET(FdMask *src)
} }
#endif #endif
/* If time has rewound, re-run every affected timer.
* TimerForce will change timer->next, but it will _generally_ only
* promote timers in the list, meaning that we should still be
* walking every timer. */
static void
CheckAllTimers(CARD32 now)
{
OsTimerPtr timer;
for (timer = timers; timer; timer = timer->next) {
if (timer->expires - now > timer->delta)
TimerForce(timer);
}
}
static void static void
DoTimer(OsTimerPtr timer, CARD32 now, OsTimerPtr *prev) DoTimer(OsTimerPtr timer, CARD32 now, OsTimerPtr *prev)
@ -467,8 +488,13 @@ TimerSet(OsTimerPtr timer, int flags, CARD32 millis,
} }
if (!millis) if (!millis)
return timer; return timer;
if (!(flags & TimerAbsolute)) if (flags & TimerAbsolute) {
timer->delta = millis - now;
}
else {
timer->delta = millis;
millis += now; millis += now;
}
timer->expires = millis; timer->expires = millis;
timer->callback = func; timer->callback = func;
timer->arg = arg; timer->arg = arg;
@ -481,8 +507,10 @@ TimerSet(OsTimerPtr timer, int flags, CARD32 millis,
} }
for (prev = &timers; for (prev = &timers;
*prev && (int) ((*prev)->expires - millis) <= 0; *prev && (int) ((*prev)->expires - millis) <= 0;
prev = &(*prev)->next) prev = &(*prev)->next) {
; if ((*prev)->expires - now > (*prev)->delta)
CheckAllTimers(now);
}
timer->next = *prev; timer->next = *prev;
*prev = timer; *prev = timer;
return timer; return timer;

View File

@ -53,6 +53,19 @@ OR PERFORMANCE OF THIS SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
/* The world's most shocking hack, to ensure we get clock_gettime() and
* CLOCK_MONOTONIC. */
#ifdef _POSIX_C_SOURCE
#define _SAVED_POSIX_C_SOURCE _POSIX_C_SOURCE
#undef _POSIX_C_SOURCE
#endif
#define _POSIX_C_SOURCE 199309L
#include <time.h>
#undef _POSIX_C_SOURCE
#ifdef _SAVED_POSIX_C_SOURCE
#define _POSIX_C_SOURCE _SAVED_POSIX_C_SOURCE
#endif
#ifdef __CYGWIN__ #ifdef __CYGWIN__
#include <stdlib.h> #include <stdlib.h>
#include <signal.h> #include <signal.h>
@ -92,7 +105,6 @@ OR PERFORMANCE OF THIS SOFTWARE.
#if !defined(SYSV) && !defined(WIN32) && !defined(Lynx) && !defined(QNX4) #if !defined(SYSV) && !defined(WIN32) && !defined(Lynx) && !defined(QNX4)
#include <sys/resource.h> #include <sys/resource.h>
#endif #endif
#include <time.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <ctype.h> /* for isspace */ #include <ctype.h> /* for isspace */
#include <stdarg.h> #include <stdarg.h>
@ -256,6 +268,8 @@ int auditTrailLevel = 1;
_X_EXPORT Bool Must_have_memory = FALSE; _X_EXPORT Bool Must_have_memory = FALSE;
static int monotonic_usable = -1;
#ifdef AIXV3 #ifdef AIXV3
int SyncOn = 0; int SyncOn = 0;
extern int SelectWaitTime; extern int SelectWaitTime;
@ -535,10 +549,27 @@ GiveUp(int sig)
_X_EXPORT CARD32 _X_EXPORT CARD32
GetTimeInMillis(void) GetTimeInMillis(void)
{ {
struct timeval tp; struct timeval tv;
#ifdef MONOTONIC_CLOCK
struct timespec tp;
int spare = 0;
X_GETTIMEOFDAY(&tp); if (_X_UNLIKELY(monotonic_usable == -1)) {
return(tp.tv_sec * 1000) + (tp.tv_usec / 1000); if (clock_gettime(0, &tp) == 0 &&
clock_getcpuclockid(0, &spare) == 0)
monotonic_usable = 1;
else
monotonic_usable = 0;
}
if (_X_LIKELY(monotonic_usable == 1)) {
if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
return (tp.tv_sec * 1000) + (tp.tv_nsec / 1000000);
}
#endif
X_GETTIMEOFDAY(&tv);
return(tv.tv_sec * 1000) + (tv.tv_usec / 1000);
} }
_X_EXPORT void _X_EXPORT void

View File

@ -1187,6 +1187,7 @@ SProcRRSelectInput (ClientPtr client)
swaps(&stuff->length, n); swaps(&stuff->length, n);
swapl(&stuff->window, n); swapl(&stuff->window, n);
swaps(&stuff->enable, n);
return ProcRRSelectInput(client); return ProcRRSelectInput(client);
} }