summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xserver/config/hal.c27
-rw-r--r--xserver/config/x11-input.fdi4
-rw-r--r--xserver/configure.ac5
-rw-r--r--xserver/exa/exa.h4
-rw-r--r--xserver/exa/exa_accel.c4
-rw-r--r--xserver/exa/exa_migration.c6
-rw-r--r--xserver/exa/exa_priv.h3
-rw-r--r--xserver/glx/glxdri.c2
-rw-r--r--xserver/glx/glxscreens.c2
-rw-r--r--xserver/hw/kdrive/src/kinput.c2
-rw-r--r--xserver/hw/kdrive/vesa/vm86.h9
-rw-r--r--xserver/hw/xfree86/common/Makefile.am3
-rw-r--r--xserver/hw/xfree86/common/xf86.h1
-rw-r--r--xserver/hw/xfree86/common/xf86Config.c39
-rw-r--r--xserver/hw/xfree86/common/xf86Events.c173
-rw-r--r--xserver/hw/xfree86/common/xf86Globals.c1
-rw-r--r--xserver/hw/xfree86/common/xf86Helper.c7
-rw-r--r--xserver/hw/xfree86/common/xf86Init.c363
-rw-r--r--xserver/hw/xfree86/ddc/interpret_edid.c10
-rw-r--r--xserver/hw/xfree86/doc/man/xorg.conf.man.pre8
-rw-r--r--xserver/hw/xfree86/dri/dri.c2
-rw-r--r--xserver/hw/xfree86/dri/xf86dri.c2
-rw-r--r--xserver/hw/xfree86/os-support/linux/int10/linux.c12
-rw-r--r--xserver/hw/xfree86/os-support/linux/lnx_init.c67
-rw-r--r--xserver/hw/xfree86/shadowfb/shadow.c4
-rw-r--r--xserver/include/dix-config.h.in6
-rw-r--r--xserver/include/os.h2
-rw-r--r--xserver/mi/mieq.c6
-rw-r--r--xserver/mi/miinitext.c3
-rw-r--r--xserver/os/Makefile.am1
-rw-r--r--xserver/os/backtrace.c201
-rw-r--r--xserver/os/utils.c8
-rw-r--r--xserver/randr/rrproperty.c45
-rw-r--r--xserver/xkb/xkbEvents.c19
34 files changed, 684 insertions, 367 deletions
diff --git a/xserver/config/hal.c b/xserver/config/hal.c
index 0e0505b66..639e0ec2b 100644
--- a/xserver/config/hal.c
+++ b/xserver/config/hal.c
@@ -166,6 +166,26 @@ get_prop_string_array(LibHalContext *hal_ctx, const char *udi, const char *prop)
return ret;
}
+static BOOL
+device_is_duplicate(char *config_info)
+{
+ DeviceIntPtr dev;
+
+ for (dev = inputInfo.devices; dev; dev = dev->next)
+ {
+ if (dev->config_info && (strcmp(dev->config_info, config_info) == 0))
+ return TRUE;
+ }
+
+ for (dev = inputInfo.off_devices; dev; dev = dev->next)
+ {
+ if (dev->config_info && (strcmp(dev->config_info, config_info) == 0))
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static void
device_added(LibHalContext *hal_ctx, const char *udi)
{
@@ -227,6 +247,13 @@ device_added(LibHalContext *hal_ctx, const char *udi)
}
sprintf(config_info, "hal:%s", udi);
+ /* Check for duplicate devices */
+ if (device_is_duplicate(config_info))
+ {
+ LogMessage(X_WARNING, "config/hal: device %s already added. Ignoring.\n", name);
+ goto unwind;
+ }
+
/* ok, grab options from hal.. iterate through all properties
* and lets see if any of them are options that we can add */
set = libhal_device_get_all_properties(hal_ctx, udi, &error);
diff --git a/xserver/config/x11-input.fdi b/xserver/config/x11-input.fdi
index f2e2d50ab..6c4a1e325 100644
--- a/xserver/config/x11-input.fdi
+++ b/xserver/config/x11-input.fdi
@@ -64,8 +64,8 @@
<merge key="input.x11_options.XkbRules" type="string">base</merge>
<!-- If we're using Linux, we use evdev by default (falling back to
- keyboard otherwise). -->
- <merge key="input.x11_driver" type="string">keyboard</merge>
+ kbd otherwise). -->
+ <merge key="input.x11_driver" type="string">kbd</merge>
<merge key="input.x11_options.XkbModel" type="string">pc105</merge>
<match key="/org/freedesktop/Hal/devices/computer:system.kernel.name"
string="Linux">
diff --git a/xserver/configure.ac b/xserver/configure.ac
index 486ce7fdd..870641711 100644
--- a/xserver/configure.ac
+++ b/xserver/configure.ac
@@ -26,8 +26,9 @@ dnl
dnl Process this file with autoconf to create configure.
AC_PREREQ(2.57)
-AC_INIT([xorg-server], 1.5.2, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="10 October 2008"
+AC_INIT([xorg-server], 1.5.3, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="5 November 2008"
+REMEMBER_REMEMBER="The Fifth of November"
AC_CONFIG_SRCDIR([Makefile.am])
AM_INIT_AUTOMAKE([dist-bzip2 foreign])
AM_MAINTAINER_MODE
diff --git a/xserver/exa/exa.h b/xserver/exa/exa.h
index 256209418..a3dad6965 100644
--- a/xserver/exa/exa.h
+++ b/xserver/exa/exa.h
@@ -783,6 +783,10 @@ exaGetPixmapSize(PixmapPtr pPix);
void
exaEnableDisableFBAccess (int index, Bool enable);
+Bool
+exaDrawableIsOffscreen (DrawablePtr pDrawable);
+
+/* in exa_migration.c */
void
exaMoveInPixmap (PixmapPtr pPixmap);
diff --git a/xserver/exa/exa_accel.c b/xserver/exa/exa_accel.c
index 3ec96253d..5b33ef78a 100644
--- a/xserver/exa/exa_accel.c
+++ b/xserver/exa/exa_accel.c
@@ -398,6 +398,10 @@ exaCopyNtoN (DrawablePtr pSrcDrawable,
RegionPtr srcregion = NULL, dstregion = NULL;
xRectangle *rects;
+ /* avoid doing copy operations if no boxes */
+ if (nbox == 0)
+ return;
+
pSrcPixmap = exaGetDrawablePixmap (pSrcDrawable);
pDstPixmap = exaGetDrawablePixmap (pDstDrawable);
diff --git a/xserver/exa/exa_migration.c b/xserver/exa/exa_migration.c
index 5f22474e9..b7cc06240 100644
--- a/xserver/exa/exa_migration.c
+++ b/xserver/exa/exa_migration.c
@@ -132,6 +132,7 @@ exaCopyDirty(ExaMigrationPtr migrate, RegionPtr pValidDst, RegionPtr pValidSrc,
BoxPtr pBox;
int nbox;
Bool access_prepared = FALSE;
+ Bool need_sync = FALSE;
/* Damaged bits are valid in current copy but invalid in other one */
if (exaPixmapIsOffscreen(pPixmap)) {
@@ -223,14 +224,15 @@ exaCopyDirty(ExaMigrationPtr migrate, RegionPtr pValidDst, RegionPtr pValidSrc,
exaMemcpyBox (pPixmap, pBox,
fallback_src, fallback_srcpitch,
fallback_dst, fallback_dstpitch);
- }
+ } else
+ need_sync = TRUE;
pBox++;
}
if (access_prepared)
exaFinishAccess(&pPixmap->drawable, fallback_index);
- else
+ else if (need_sync)
sync (pPixmap->drawable.pScreen);
pExaPixmap->offscreen = save_offscreen;
diff --git a/xserver/exa/exa_priv.h b/xserver/exa/exa_priv.h
index e4b6b54a5..387e751d2 100644
--- a/xserver/exa/exa_priv.h
+++ b/xserver/exa/exa_priv.h
@@ -375,9 +375,6 @@ exaGetDrawableDeltas (DrawablePtr pDrawable, PixmapPtr pPixmap,
int *xp, int *yp);
Bool
-exaDrawableIsOffscreen (DrawablePtr pDrawable);
-
-Bool
exaPixmapIsOffscreen(PixmapPtr p);
PixmapPtr
diff --git a/xserver/glx/glxdri.c b/xserver/glx/glxdri.c
index a87ff13ce..52a97d4c4 100644
--- a/xserver/glx/glxdri.c
+++ b/xserver/glx/glxdri.c
@@ -189,6 +189,8 @@ __glXDRIdoReleaseTexImage(__GLXDRIscreen *screen, __GLXDRIdrawable *drawable)
for (i = 0; i < lastOverride; i++) {
if (texOffsetOverride[i] == drawable) {
+ if (screen->texOffsetFinish)
+ screen->texOffsetFinish((PixmapPtr)drawable->base.pDraw);
texOffsetOverride[i] = NULL;
diff --git a/xserver/glx/glxscreens.c b/xserver/glx/glxscreens.c
index cc7054a64..f4839b32c 100644
--- a/xserver/glx/glxscreens.c
+++ b/xserver/glx/glxscreens.c
@@ -110,7 +110,7 @@ static const char GLServerExtensions[] =
"GL_EXT_texture_env_add "
"GL_EXT_texture_env_combine "
"GL_EXT_texture_env_dot3 "
- "GL_EXT_texture_filter_ansiotropic "
+ "GL_EXT_texture_filter_anisotropic "
"GL_EXT_texture_lod "
"GL_EXT_texture_lod_bias "
"GL_EXT_texture_mirror_clamp "
diff --git a/xserver/hw/kdrive/src/kinput.c b/xserver/hw/kdrive/src/kinput.c
index 80fcdde5a..9ba11661c 100644
--- a/xserver/hw/kdrive/src/kinput.c
+++ b/xserver/hw/kdrive/src/kinput.c
@@ -1295,7 +1295,7 @@ KdParsePointer (char *arg)
return NULL;
pi->emulateMiddleButton = kdEmulateMiddleButton;
pi->transformCoordinates = !kdRawPointerCoordinates;
- pi->nButtons = 3;
+ pi->nButtons = 5; /* XXX should not be hardcoded */
pi->inputClass = KD_MOUSE;
if (!arg)
diff --git a/xserver/hw/kdrive/vesa/vm86.h b/xserver/hw/kdrive/vesa/vm86.h
index bd1ad43c0..81693081a 100644
--- a/xserver/hw/kdrive/vesa/vm86.h
+++ b/xserver/hw/kdrive/vesa/vm86.h
@@ -1,6 +1,4 @@
/*
- * $RCSId: $
- *
* Copyright © 2000 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
@@ -69,6 +67,13 @@ static void ErrorF(char*, ...);
#include "os.h"
#endif
+#ifndef IF_MASK
+#define IF_MASK X86_EFLAGS_IF
+#endif
+#ifndef IOPL_MASK
+#define IOPL_MASK X86_EFLAGS_IOPL
+#endif
+
typedef unsigned char U8;
typedef unsigned short U16;
typedef unsigned int U32;
diff --git a/xserver/hw/xfree86/common/Makefile.am b/xserver/hw/xfree86/common/Makefile.am
index 0f44075ba..1379f457c 100644
--- a/xserver/hw/xfree86/common/Makefile.am
+++ b/xserver/hw/xfree86/common/Makefile.am
@@ -24,7 +24,8 @@ BUSSOURCES = xf86isaBus.c xf86pciBus.c xf86fbBus.c xf86noBus.c $(SBUS_SOURCES)
MODEDEFSOURCES = $(srcdir)/vesamodes $(srcdir)/extramodes
xf86DefModeSet.c: $(srcdir)/modeline2c.awk $(MODEDEFSOURCES)
- cat $(MODEDEFSOURCES) | $(AWK) -f $(srcdir)/modeline2c.awk > $@
+ cat $(MODEDEFSOURCES) | LC_ALL=C $(AWK) -f $(srcdir)/modeline2c.awk > $@
+ echo >> $@
BUILT_SOURCES = xf86DefModeSet.c
diff --git a/xserver/hw/xfree86/common/xf86.h b/xserver/hw/xfree86/common/xf86.h
index 065102fb5..e91521770 100644
--- a/xserver/hw/xfree86/common/xf86.h
+++ b/xserver/hw/xfree86/common/xf86.h
@@ -56,6 +56,7 @@
/* General parameters */
extern int xf86DoConfigure;
+extern Bool xf86DoModalias;
extern Bool xf86DoConfigurePass1;
extern DevPrivateKey xf86ScreenKey;
extern DevPrivateKey xf86CreateRootWindowKey;
diff --git a/xserver/hw/xfree86/common/xf86Config.c b/xserver/hw/xfree86/common/xf86Config.c
index dfa90e361..892e5c51a 100644
--- a/xserver/hw/xfree86/common/xf86Config.c
+++ b/xserver/hw/xfree86/common/xf86Config.c
@@ -1350,7 +1350,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
}
/* 4. First pointer with 'mouse' as the driver. */
- if (!foundPointer && (!xf86Info.allowEmptyInput || implicitLayout)) {
+ if (!foundPointer && !xf86Info.allowEmptyInput) {
confInput = xf86findInput(CONF_IMPLICIT_POINTER,
xf86configptr->conf_input_lst);
if (!confInput) {
@@ -1490,7 +1490,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
}
/* 4. First keyboard with 'keyboard' or 'kbd' as the driver. */
- if (!foundKeyboard && (!xf86Info.allowEmptyInput || implicitLayout)) {
+ if (!foundKeyboard && !xf86Info.allowEmptyInput) {
confInput = xf86findInput(CONF_IMPLICIT_KEYBOARD,
xf86configptr->conf_input_lst);
if (!confInput) {
@@ -2491,6 +2491,41 @@ addDefaultModes(MonPtr monitorp)
static void
checkInput(serverLayoutPtr layout, Bool implicit_layout) {
checkCoreInputDevices(layout, implicit_layout);
+
+ /* AllowEmptyInput and the "kbd" and "mouse" drivers are mutually
+ * exclusive. Trawl the list for mouse/kbd devices and disable them.
+ */
+ if (xf86Info.allowEmptyInput && layout->inputs)
+ {
+ IDevPtr *dev = layout->inputs;
+ BOOL warned = FALSE;
+
+ while(*dev)
+ {
+ if (strcmp((*dev)->driver, "kbd") == 0 ||
+ strcmp((*dev)->driver, "mouse") == 0)
+ {
+ IDevPtr *current;
+ if (!warned)
+ {
+ xf86Msg(X_WARNING, "AllowEmptyInput is on, devices using "
+ "drivers 'kbd' or 'mouse' will be disabled.\n");
+ warned = TRUE;
+ }
+
+ xf86Msg(X_WARNING, "Disabling %s\n", (*dev)->identifier);
+
+ current = dev;
+ xfree(*dev);
+
+ do {
+ *current = *(current + 1);
+ current++;
+ } while(*current);
+ } else
+ dev++;
+ }
+ }
}
/*
diff --git a/xserver/hw/xfree86/common/xf86Events.c b/xserver/hw/xfree86/common/xf86Events.c
index 2b7cb121d..76c207a13 100644
--- a/xserver/hw/xfree86/common/xf86Events.c
+++ b/xserver/hw/xfree86/common/xf86Events.c
@@ -561,179 +561,6 @@ xf86InterceptSigIll(void (*sigillhandler)(void))
xf86SigIllHandler = sigillhandler;
}
-#ifdef HAVE_BACKTRACE
-#include <execinfo.h>
-
-static __inline__ void xorg_backtrace(void)
-{
- void *array[32]; /* deeper nesting than this means something's wrong */
- size_t size, i;
- char **strings;
- ErrorF("\nBacktrace:\n");
- size = backtrace(array, 32);
- strings = backtrace_symbols(array, size);
- for (i = 0; i < size; i++)
- ErrorF("%d: %s\n", i, strings[i]);
- free(strings);
-}
-
-#else /* not glibc or glibc < 2.1 */
-
-# if defined(sun) && defined(__SVR4)
-# define HAVE_PSTACK
-# endif
-
-# if defined(HAVE_WALKCONTEXT) /* Solaris 9 & later */
-
-# include <ucontext.h>
-# include <signal.h>
-# include <dlfcn.h>
-# include <sys/elf.h>
-
-#ifdef _LP64
-# define ElfSym Elf64_Sym
-#else
-# define ElfSym Elf32_Sym
-#endif
-
-/* Called for each frame on the stack to print it's contents */
-static int xorg_backtrace_frame(uintptr_t pc, int signo, void *arg)
-{
- Dl_info dlinfo;
- ElfSym *dlsym;
- char header[32];
- int depth = *((int *) arg);
-
- if (signo) {
- char signame[SIG2STR_MAX];
-
- if (sig2str(signo, signame) != 0) {
- strcpy(signame, "unknown");
- }
-
- ErrorF("** Signal %d (%s)\n", signo, signame);
- }
-
- snprintf(header, sizeof(header), "%d: 0x%lx", depth, pc);
- *((int *) arg) = depth + 1;
-
- /* Ask system dynamic loader for info on the address */
- if (dladdr1((void *) pc, &dlinfo, (void **) &dlsym, RTLD_DL_SYMENT)) {
- unsigned long offset = pc - (uintptr_t) dlinfo.dli_saddr;
- const char *symname;
-
- if (offset < dlsym->st_size) { /* inside a function */
- symname = dlinfo.dli_sname;
- } else { /* found which file it was in, but not which function */
- symname = "<section start>";
- offset = pc - (uintptr_t)dlinfo.dli_fbase;
- }
- ErrorF("%s: %s:%s+0x%lx\n", header, dlinfo.dli_fname,
- symname, offset);
-
- } else {
- /* Couldn't find symbol info from system dynamic loader, should
- * probably poke elfloader here, but haven't written that code yet,
- * so we just print the pc.
- */
- ErrorF("%s\n", header);
- }
-
- return 0;
-}
-# endif /* HAVE_WALKCONTEXT */
-
-# ifdef HAVE_PSTACK
-static int xorg_backtrace_pstack(void) {
- pid_t kidpid;
- int pipefd[2];
-
- if (pipe(pipefd) != 0) {
- return -1;
- }
-
- kidpid = fork1();
-
- if (kidpid == -1) {
- /* ERROR */
- return -1;
- } else if (kidpid == 0) {
- /* CHILD */
- char parent[16];
-
- seteuid(0);
- close(STDIN_FILENO);
- close(STDOUT_FILENO);
- dup2(pipefd[1],STDOUT_FILENO);
- closefrom(STDERR_FILENO);
-
- snprintf(parent, sizeof(parent), "%d", getppid());
- execle("/usr/bin/pstack", "pstack", parent, NULL);
- exit(1);
- } else {
- /* PARENT */
- char btline[256];
- int kidstat;
- int bytesread;
- int done = 0;
-
- close(pipefd[1]);
-
- while (!done) {
- bytesread = read(pipefd[0], btline, sizeof(btline) - 1);
-
- if (bytesread > 0) {
- btline[bytesread] = 0;
- ErrorF("%s", btline);
- }
- else if ((bytesread < 0) ||
- ((errno != EINTR) && (errno != EAGAIN)))
- done = 1;
- }
- close(pipefd[0]);
- waitpid(kidpid, &kidstat, 0);
- if (kidstat != 0)
- return -1;
- }
- return 0;
-}
-# endif /* HAVE_PSTACK */
-
-
-# if defined(HAVE_PSTACK) || defined(HAVE_WALKCONTEXT)
-
-static __inline__ void xorg_backtrace(void) {
-
- ErrorF("\nBacktrace:\n");
-
-# ifdef HAVE_PSTACK
-/* First try fork/exec of pstack - otherwise fall back to walkcontext
- pstack is preferred since it can print names of non-exported functions */
-
- if (xorg_backtrace_pstack() < 0)
-# endif
- {
-# ifdef HAVE_WALKCONTEXT
- ucontext_t u;
- int depth = 1;
-
- if (getcontext(&u) == 0)
- walkcontext(&u, xorg_backtrace_frame, &depth);
- else
-# endif
- Error("Failed to get backtrace info");
- }
- ErrorF("\n");
-}
-
-# else
-
-/* Default fallback if we can't find any way to get a backtrace */
-static __inline__ void xorg_backtrace(void) { return; }
-
-# endif
-#endif
-
/*
* xf86SigHandler --
* Catch unexpected signals and exit or continue cleanly.
diff --git a/xserver/hw/xfree86/common/xf86Globals.c b/xserver/hw/xfree86/common/xf86Globals.c
index 0dc42c66b..f5babbc49 100644
--- a/xserver/hw/xfree86/common/xf86Globals.c
+++ b/xserver/hw/xfree86/common/xf86Globals.c
@@ -149,6 +149,7 @@ Bool xf86Resetting = FALSE;
Bool xf86Initialising = FALSE;
Bool xf86DoProbe = FALSE;
Bool xf86DoConfigure = FALSE;
+Bool xf86DoModalias = FALSE;
DriverPtr *xf86DriverList = NULL;
int xf86NumDrivers = 0;
InputDriverPtr *xf86InputDriverList = NULL;
diff --git a/xserver/hw/xfree86/common/xf86Helper.c b/xserver/hw/xfree86/common/xf86Helper.c
index 475628b0c..d72a359e1 100644
--- a/xserver/hw/xfree86/common/xf86Helper.c
+++ b/xserver/hw/xfree86/common/xf86Helper.c
@@ -448,10 +448,6 @@ xf86AddPixFormat(ScrnInfoPtr pScrn, int depth, int bpp, int pad)
#define GLOBAL_DEFAULT_DEPTH 24
#endif
-#ifndef GLOBAL_DEFAULT_FBBPP
-#define GLOBAL_DEFAULT_FBBPP 32
-#endif
-
_X_EXPORT Bool
xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int dummy, int fbbpp,
int depth24flags)
@@ -529,7 +525,6 @@ xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int dummy, int fbbpp,
if (depth > 0)
scrp->depth = depth;
} else {
- scrp->bitsPerPixel = GLOBAL_DEFAULT_FBBPP;
scrp->depth = GLOBAL_DEFAULT_DEPTH;
}
}
@@ -1486,6 +1481,8 @@ xf86MatchDevice(const char *drivername, GDevPtr **sectlist)
if (sectlist)
*sectlist = NULL;
+ if (xf86DoModalias) return 0;
+
if (xf86DoProbe) return 1;
if (xf86DoConfigure && xf86DoConfigurePass1) return 1;
diff --git a/xserver/hw/xfree86/common/xf86Init.c b/xserver/hw/xfree86/common/xf86Init.c
index 3da8f893b..4742b83b3 100644
--- a/xserver/hw/xfree86/common/xf86Init.c
+++ b/xserver/hw/xfree86/common/xf86Init.c
@@ -135,6 +135,208 @@ static Bool formatsDone = FALSE;
static Bool xf86KeepPriv = FALSE;
#endif
+#ifndef OSNAME
+#define OSNAME " unknown"
+#endif
+#ifndef OSVENDOR
+#define OSVENDOR ""
+#endif
+#ifndef PRE_RELEASE
+#define PRE_RELEASE XORG_VERSION_SNAP
+#endif
+
+static void
+xf86PrintBanner()
+{
+#if PRE_RELEASE
+ ErrorF("\n"
+ "This is a pre-release version of the X server from " XVENDORNAME ".\n"
+ "It is not supported in any way.\n"
+ "Bugs may be filed in the bugzilla at http://bugs.freedesktop.org/.\n"
+ "Select the \"xorg\" product for bugs you find in this release.\n"
+ "Before reporting bugs in pre-release versions please check the\n"
+ "latest version in the X.Org Foundation git repository.\n"
+ "See http://wiki.x.org/wiki/GitPage for git access instructions.\n");
+#endif
+ ErrorF("\nX.Org X Server %d.%d.%d",
+ XORG_VERSION_MAJOR,
+ XORG_VERSION_MINOR,
+ XORG_VERSION_PATCH);
+#if XORG_VERSION_SNAP > 0
+ ErrorF(".%d", XORG_VERSION_SNAP);
+#endif
+
+#if XORG_VERSION_SNAP >= 900
+ /* When the minor number is 99, that signifies that the we are making
+ * a release candidate for a major version. (X.0.0)
+ * When the patch number is 99, that signifies that the we are making
+ * a release candidate for a minor version. (X.Y.0)
+ * When the patch number is < 99, then we are making a release
+ * candidate for the next point release. (X.Y.Z)
+ */
+#if XORG_VERSION_MINOR >= 99
+ ErrorF(" (%d.0.0 RC %d)", XORG_VERSION_MAJOR+1, XORG_VERSION_SNAP - 900);
+#elif XORG_VERSION_PATCH == 99
+ ErrorF(" (%d.%d.0 RC %d)", XORG_VERSION_MAJOR, XORG_VERSION_MINOR + 1,
+ XORG_VERSION_SNAP - 900);
+#else
+ ErrorF(" (%d.%d.%d RC %d)", XORG_VERSION_MAJOR, XORG_VERSION_MINOR,
+ XORG_VERSION_PATCH + 1, XORG_VERSION_SNAP - 900);
+#endif
+#endif
+
+#ifdef XORG_CUSTOM_VERSION
+ ErrorF(" (%s)", XORG_CUSTOM_VERSION);
+#endif
+#ifndef XORG_DATE
+#define XORG_DATE XF86_DATE
+#endif
+ ErrorF("\nRelease Date: %s\n", XORG_DATE);
+ ErrorF("X Protocol Version %d, Revision %d\n",
+ X_PROTOCOL, X_PROTOCOL_REVISION);
+ ErrorF("Build Operating System: %s %s\n", OSNAME, OSVENDOR);
+#ifdef HAS_UTSNAME
+ {
+ struct utsname name;
+
+ /* Linux & BSD state that 0 is success, SysV (including Solaris, HP-UX,
+ and Irix) and Single Unix Spec 3 just say that non-negative is success.
+ All agree that failure is represented by a negative number.
+ */
+ if (uname(&name) >= 0) {
+ ErrorF("Current Operating System: %s %s %s %s %s\n",
+ name.sysname, name.nodename, name.release, name.version, name.machine);
+ }
+ }
+#endif
+#if defined(BUILD_DATE) && (BUILD_DATE > 19000000)
+ {
+ struct tm t;
+ char buf[100];
+
+ bzero(&t, sizeof(t));
+ bzero(buf, sizeof(buf));
+ t.tm_mday = BUILD_DATE % 100;
+ t.tm_mon = (BUILD_DATE / 100) % 100 - 1;
+ t.tm_year = BUILD_DATE / 10000 - 1900;
+#if defined(BUILD_TIME)
+ t.tm_sec = BUILD_TIME % 100;
+ t.tm_min = (BUILD_TIME / 100) % 100;
+ t.tm_hour = (BUILD_TIME / 10000) % 100;
+ if (strftime(buf, sizeof(buf), "%d %B %Y %I:%M:%S%p", &t))
+ ErrorF("Build Date: %s\n", buf);
+#else
+ if (strftime(buf, sizeof(buf), "%d %B %Y", &t))
+ ErrorF("Build Date: %s\n", buf);
+#endif
+ }
+#endif
+#if defined(CLOG_DATE) && (CLOG_DATE > 19000000)
+ {
+ struct tm t;
+ char buf[100];
+
+ bzero(&t, sizeof(t));
+ bzero(buf, sizeof(buf));
+ t.tm_mday = CLOG_DATE % 100;
+ t.tm_mon = (CLOG_DATE / 100) % 100 - 1;
+ t.tm_year = CLOG_DATE / 10000 - 1900;
+ if (strftime(buf, sizeof(buf), "%d %B %Y", &t))
+ ErrorF("Changelog Date: %s\n", buf);
+ }
+#endif
+#if defined(BUILDERSTRING)
+ ErrorF("%s \n",BUILDERSTRING);
+#endif
+ ErrorF("\tBefore reporting problems, check "__VENDORDWEBSUPPORT__"\n"
+ "\tto make sure that you have the latest version.\n");
+}
+
+static void
+xf86PrintMarkers()
+{
+ LogPrintMarkers();
+}
+
+static void
+DoModalias()
+{
+ int i = -1;
+ char **vlist;
+
+ /* Get all the drivers */
+ vlist = xf86DriverlistFromCompile();
+ if (!vlist) {
+ ErrorF("Missing output drivers. PCI Access dump failed.\n");
+ goto bail;
+ }
+
+ /* Load all the drivers that were found. */
+ xf86LoadModules(vlist, NULL);
+
+ xfree(vlist);
+
+ /* Iterate through each driver */
+ for (i = 0; i < xf86NumDrivers; i++) {
+ struct pci_id_match *match;
+
+ /* Iterate through each pci id match data, dumping it to the screen */
+ for (match = (struct pci_id_match *) xf86DriverList[i]->supported_devices ;
+ match && !(!match->vendor_id && !match->device_id) ; match++) {
+ /* Prefix */
+ ErrorF("alias pci:");
+
+ /* Vendor */
+ if (match->vendor_id == ~0)
+ ErrorF("v*");
+ else
+ ErrorF("v%08X", match->vendor_id);
+
+ /* Device */
+ if (match->device_id == ~0)
+ ErrorF("d*");
+ else
+ ErrorF("d%08X", match->device_id);
+
+ /* Subvendor */
+ if (match->subvendor_id == ~0)
+ ErrorF("sv*");
+ else
+ ErrorF("sv%08X", match->subvendor_id);
+
+ /* Subdevice */
+ if (match->subdevice_id == ~0)
+ ErrorF("sd*");
+ else
+ ErrorF("sd%08X", match->subdevice_id);
+
+ /* Class */
+ if ((match->device_class_mask >> 16 & 0xFF) == 0xFF)
+ ErrorF("bc%02X", match->device_class >> 16 & 0xFF);
+ else
+ ErrorF("bc*");
+ if ((match->device_class_mask >> 8 & 0xFF) == 0xFF)
+ ErrorF("sc%02X", match->device_class >> 8 & 0xFF);
+ else
+ ErrorF("sc*");
+ if ((match->device_class_mask & 0xFF) == 0xFF)
+ ErrorF("i%02X*", match->device_class & 0xFF);
+ else
+ ErrorF("i*");
+
+ /* Suffix (driver) */
+ ErrorF(" %s\n", xf86DriverList[i]->driverName);
+ }
+ }
+
+bail:
+ OsCleanup(TRUE);
+ AbortDDX();
+ fflush(stderr);
+ exit(0);
+}
+
+
static Bool
xf86CreateRootWindow(WindowPtr pWin)
{
@@ -484,7 +686,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
xf86Initialising = TRUE;
if (serverGeneration == 1) {
- GDevPtr configured_device;
pScreenInfo->numScreens = 0;
@@ -493,19 +694,21 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
else
xf86ServerName = argv[0];
- xf86PrintBanner();
- xf86PrintMarkers();
- if (xf86LogFile) {
- time_t t;
- const char *ct;
- t = time(NULL);
- ct = ctime(&t);
- xf86MsgVerb(xf86LogFileFrom, 0, "Log file: \"%s\", Time: %s",
- xf86LogFile, ct);
+ if (!xf86DoModalias) {
+ xf86PrintBanner();
+ xf86PrintMarkers();
+ if (xf86LogFile) {
+ time_t t;
+ const char *ct;
+ t = time(NULL);
+ ct = ctime(&t);
+ xf86MsgVerb(xf86LogFileFrom, 0, "Log file: \"%s\", Time: %s",
+ xf86LogFile, ct);
+ }
}
/* Read and parse the config file */
- if (!xf86DoProbe && !xf86DoConfigure) {
+ if (!xf86DoProbe && !xf86DoConfigure && !xf86DoModalias) {
switch (xf86HandleConfigFile(FALSE)) {
case CONFIG_OK:
break;
@@ -542,6 +745,10 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
if (xf86DoConfigure)
DoConfigure();
+ /* Do the PCI Access dump */
+ if (xf86DoModalias)
+ DoModalias();
+
if (autoconfig) {
if (!xf86AutoConfig()) {
xf86Msg(X_ERROR, "Auto configuration failed\n");
@@ -564,7 +771,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
/* If there aren't any specified in the config file, autoconfig them */
/* FIXME: Does not handle multiple active screen sections, but I'm not
* sure if we really want to handle that case*/
- configured_device = xf86ConfigLayout.screens->screen->device;
+ GDevPtr configured_device = xf86ConfigLayout.screens->screen->device;
if ((!configured_device) || (!configured_device->driver)) {
if (!autoConfigDevice(configured_device)) {
xf86Msg(X_ERROR, "Automatic driver configuration failed\n");
@@ -1717,6 +1924,12 @@ ddxProcessArgument(int argc, char **argv, int i)
return 1;
}
#endif
+ if (!strcmp(argv[i], "-modalias"))
+ {
+ xf86DoModalias = TRUE;
+ xf86AllowMouseOpenFail = TRUE;
+ return 1;
+ }
if (!strcmp(argv[i], "-isolateDevice"))
{
int bus, device, func;
@@ -1761,6 +1974,7 @@ ddxUseMsg()
ErrorF("-logfile file specify a log file name\n");
ErrorF("-configure probe for devices and write an "__XCONFIGFILE__"\n");
}
+ ErrorF("-modalias output a modalias-style filter for each driver installed\n");
ErrorF("-config file specify a configuration file, relative to the\n");
ErrorF(" "__XCONFIGFILE__" search path, only root can use absolute\n");
ErrorF("-probeonly probe for devices, then exit\n");
@@ -1806,131 +2020,6 @@ ddxUseMsg()
ErrorF("\n");
}
-
-#ifndef OSNAME
-#define OSNAME " unknown"
-#endif
-#ifndef OSVENDOR
-#define OSVENDOR ""
-#endif
-#ifndef PRE_RELEASE
-#define PRE_RELEASE XORG_VERSION_SNAP
-#endif
-
-static void
-xf86PrintBanner()
-{
-#if PRE_RELEASE
- ErrorF("\n"
- "This is a pre-release version of the X server from " XVENDORNAME ".\n"
- "It is not supported in any way.\n"
- "Bugs may be filed in the bugzilla at http://bugs.freedesktop.org/.\n"
- "Select the \"xorg\" product for bugs you find in this release.\n"
- "Before reporting bugs in pre-release versions please check the\n"
- "latest version in the X.Org Foundation git repository.\n"
- "See http://wiki.x.org/wiki/GitPage for git access instructions.\n");
-#endif
- ErrorF("\nX.Org X Server %d.%d.%d",
- XORG_VERSION_MAJOR,
- XORG_VERSION_MINOR,
- XORG_VERSION_PATCH);
-#if XORG_VERSION_SNAP > 0
- ErrorF(".%d", XORG_VERSION_SNAP);
-#endif
-
-#if XORG_VERSION_SNAP >= 900
- /* When the minor number is 99, that signifies that the we are making
- * a release candidate for a major version. (X.0.0)
- * When the patch number is 99, that signifies that the we are making
- * a release candidate for a minor version. (X.Y.0)
- * When the patch number is < 99, then we are making a release
- * candidate for the next point release. (X.Y.Z)
- */
-#if XORG_VERSION_MINOR >= 99
- ErrorF(" (%d.0.0 RC %d)", XORG_VERSION_MAJOR+1, XORG_VERSION_SNAP - 900);
-#elif XORG_VERSION_PATCH == 99
- ErrorF(" (%d.%d.0 RC %d)", XORG_VERSION_MAJOR, XORG_VERSION_MINOR + 1,
- XORG_VERSION_SNAP - 900);
-#else
- ErrorF(" (%d.%d.%d RC %d)", XORG_VERSION_MAJOR, XORG_VERSION_MINOR,
- XORG_VERSION_PATCH + 1, XORG_VERSION_SNAP - 900);
-#endif
-#endif
-
-#ifdef XORG_CUSTOM_VERSION
- ErrorF(" (%s)", XORG_CUSTOM_VERSION);
-#endif
-#ifndef XORG_DATE
-#define XORG_DATE XF86_DATE
-#endif
- ErrorF("\nRelease Date: %s\n", XORG_DATE);
- ErrorF("X Protocol Version %d, Revision %d\n",
- X_PROTOCOL, X_PROTOCOL_REVISION);
- ErrorF("Build Operating System: %s %s\n", OSNAME, OSVENDOR);
-#ifdef HAS_UTSNAME
- {
- struct utsname name;
-
- /* Linux & BSD state that 0 is success, SysV (including Solaris, HP-UX,
- and Irix) and Single Unix Spec 3 just say that non-negative is success.
- All agree that failure is represented by a negative number.
- */
- if (uname(&name) >= 0) {
- ErrorF("Current Operating System: %s %s %s %s %s\n",
- name.sysname, name.nodename, name.release, name.version, name.machine);
- }
- }
-#endif
-#if defined(BUILD_DATE) && (BUILD_DATE > 19000000)
- {
- struct tm t;
- char buf[100];
-
- bzero(&t, sizeof(t));
- bzero(buf, sizeof(buf));
- t.tm_mday = BUILD_DATE % 100;
- t.tm_mon = (BUILD_DATE / 100) % 100 - 1;
- t.tm_year = BUILD_DATE / 10000 - 1900;
-#if defined(BUILD_TIME)
- t.tm_sec = BUILD_TIME % 100;
- t.tm_min = (BUILD_TIME / 100) % 100;
- t.tm_hour = (BUILD_TIME / 10000) % 100;
- if (strftime(buf, sizeof(buf), "%d %B %Y %I:%M:%S%p", &t))
- ErrorF("Build Date: %s\n", buf);
-#else
- if (strftime(buf, sizeof(buf), "%d %B %Y", &t))
- ErrorF("Build Date: %s\n", buf);
-#endif
- }
-#endif
-#if defined(CLOG_DATE) && (CLOG_DATE > 19000000)
- {
- struct tm t;
- char buf[100];
-
- bzero(&t, sizeof(t));
- bzero(buf, sizeof(buf));
- t.tm_mday = CLOG_DATE % 100;
- t.tm_mon = (CLOG_DATE / 100) % 100 - 1;
- t.tm_year = CLOG_DATE / 10000 - 1900;
- if (strftime(buf, sizeof(buf), "%d %B %Y", &t))
- ErrorF("Changelog Date: %s\n", buf);
- }
-#endif
-#if defined(BUILDERSTRING)
- ErrorF("%s \n",BUILDERSTRING);
-#endif
- ErrorF("\tBefore reporting problems, check "__VENDORDWEBSUPPORT__"\n"
- "\tto make sure that you have the latest version.\n");
- ErrorF("Module Loader present\n");
-}
-
-static void
-xf86PrintMarkers()
-{
- LogPrintMarkers();
-}
-
static void
xf86PrintDefaultModulePath(void)
{
diff --git a/xserver/hw/xfree86/ddc/interpret_edid.c b/xserver/hw/xfree86/ddc/interpret_edid.c
index 958247c95..879308520 100644
--- a/xserver/hw/xfree86/ddc/interpret_edid.c
+++ b/xserver/hw/xfree86/ddc/interpret_edid.c
@@ -115,12 +115,16 @@ handle_edid_quirks(xf86MonPtr m)
}
}
- if (real_hsize && real_vsize) {
+ if (!real_hsize || !real_vsize) {
+ m->features.hsize = m->features.vsize = 0;
+ } else if ((m->features.hsize * 10 == real_hsize) &&
+ (m->features.vsize * 10 == real_vsize)) {
+ /* exact match is just unlikely, should do a better check though */
+ m->features.hsize = m->features.vsize = 0;
+ } else {
/* convert mm to cm */
m->features.hsize = (real_hsize + 5) / 10;
m->features.vsize = (real_vsize + 5) / 10;
- } else {
- m->features.hsize = m->features.vsize = 0;
}
xf86Msg(X_INFO, "Quirked EDID physical size to %dx%d cm\n",
diff --git a/xserver/hw/xfree86/doc/man/xorg.conf.man.pre b/xserver/hw/xfree86/doc/man/xorg.conf.man.pre
index aaefa4f39..de93aaf36 100644
--- a/xserver/hw/xfree86/doc/man/xorg.conf.man.pre
+++ b/xserver/hw/xfree86/doc/man/xorg.conf.man.pre
@@ -2164,7 +2164,7 @@ Display drivers:
.BR glint (__drivermansuffix__),
.BR i128 (__drivermansuffix__),
.BR i740 (__drivermansuffix__),
-.BR intel (__drivermansuffix__),
+.BR i810 (__drivermansuffix__),
.BR imstt (__drivermansuffix__),
.BR mga (__drivermansuffix__),
.BR neomagic (__drivermansuffix__),
@@ -2187,9 +2187,9 @@ Display drivers:
.BR trident (__drivermansuffix__),
.BR tseng (__drivermansuffix__),
.BR vesa (__drivermansuffix__),
-.BR openchrome (__drivermansuffix__),
-.BR vmware (__drivermansuffix__),
-.BR wsfb (__drivermansuffix__).
+.BR vga (__drivermansuffix__),
+.BR via (__drivermansuffix__),
+.BR vmware (__drivermansuffix__).
.PP
Input drivers:
.\" .BR acecad (__drivermansuffix__),
diff --git a/xserver/hw/xfree86/dri/dri.c b/xserver/hw/xfree86/dri/dri.c
index b736c6ae0..79934a1c5 100644
--- a/xserver/hw/xfree86/dri/dri.c
+++ b/xserver/hw/xfree86/dri/dri.c
@@ -349,7 +349,6 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
pDRIPriv = (DRIScreenPrivPtr) xcalloc(1, sizeof(DRIScreenPrivRec));
if (!pDRIPriv) {
dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
- DRIScreenPrivKey = NULL;
return FALSE;
}
@@ -742,7 +741,6 @@ DRICloseScreen(ScreenPtr pScreen)
xfree(pDRIPriv);
dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
- DRIScreenPrivKey = NULL;
}
}
diff --git a/xserver/hw/xfree86/dri/xf86dri.c b/xserver/hw/xfree86/dri/xf86dri.c
index 5fc560fc0..ea11b38ee 100644
--- a/xserver/hw/xfree86/dri/xf86dri.c
+++ b/xserver/hw/xfree86/dri/xf86dri.c
@@ -406,10 +406,10 @@ ProcXF86DRIDestroyDrawable(
register ClientPtr client
)
{
- int rc;
REQUEST(xXF86DRIDestroyDrawableReq);
DrawablePtr pDrawable;
REQUEST_SIZE_MATCH(xXF86DRIDestroyDrawableReq);
+ int rc;
if (stuff->screen >= screenInfo.numScreens) {
client->errorValue = stuff->screen;
diff --git a/xserver/hw/xfree86/os-support/linux/int10/linux.c b/xserver/hw/xfree86/os-support/linux/int10/linux.c
index 9e2c6199c..23061ba15 100644
--- a/xserver/hw/xfree86/os-support/linux/int10/linux.c
+++ b/xserver/hw/xfree86/os-support/linux/int10/linux.c
@@ -1,6 +1,6 @@
/*
* linux specific part of the int10 module
- * Copyright 1999, 2000, 2001, 2002, 2003, 2004 Egbert Eich
+ * Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2008 Egbert Eich
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
@@ -357,7 +357,10 @@ MapCurrentInt10(xf86Int10InfoPtr pInt)
"shmat(low_mem) error: %s\n",strerror(errno));
return FALSE;
}
-
+ if (mprotect((void*)0, V_RAM, PROT_READ|PROT_WRITE|PROT_EXEC) != 0)
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR,
+ "Cannot set EXEC bit on low memory: %s\n", strerror(errno));
+
if (((linuxInt10Priv*)pInt->private)->highMem >= 0) {
addr = shmat(((linuxInt10Priv*)pInt->private)->highMem,
(char*)HIGH_MEM, 0);
@@ -368,6 +371,11 @@ MapCurrentInt10(xf86Int10InfoPtr pInt)
"shmget error: %s\n",strerror(errno));
return FALSE;
}
+ if (mprotect((void*)HIGH_MEM, HIGH_MEM_SIZE,
+ PROT_READ|PROT_WRITE|PROT_EXEC) != 0)
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR,
+ "Cannot set EXEC bit on high memory: %s\n",
+ strerror(errno));
} else {
if ((fd = open(DEV_MEM, O_RDWR, 0)) >= 0) {
if (mmap((void *)(V_BIOS), SYS_BIOS - V_BIOS,
diff --git a/xserver/hw/xfree86/os-support/linux/lnx_init.c b/xserver/hw/xfree86/os-support/linux/lnx_init.c
index 85b6def56..da5ca57cc 100644
--- a/xserver/hw/xfree86/os-support/linux/lnx_init.c
+++ b/xserver/hw/xfree86/os-support/linux/lnx_init.c
@@ -22,7 +22,6 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
-/* $XConsortium: lnx_init.c /main/7 1996/10/23 18:46:30 kaleb $ */
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
@@ -54,6 +53,8 @@ static int activeVT = -1;
static int vtPermSave[4];
static char vtname[11];
+static struct termios tty_attr; /* tty state to restore */
+static int tty_mode; /* kbd mode to restore */
static int
saveVtPerms(void)
@@ -84,6 +85,14 @@ restoreVtPerms(void)
chown(vtname, vtPermSave[2], vtPermSave[3]);
}
+static void *console_handler;
+
+static void
+drain_console(int fd, void *closure)
+{
+ tcflush(fd, TCIOFLUSH);
+}
+
void
xf86OpenConsole(void)
{
@@ -245,15 +254,15 @@ xf86OpenConsole(void)
lnx_savefont();
#endif
/*
- * now get the VT
+ * now get the VT. This _must_ succeed, or else fail completely.
*/
if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) < 0)
- xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed: %s\n",
- strerror(errno));
+ FatalError("xf86OpenConsole: VT_ACTIVATE failed: %s\n",
+ strerror(errno));
if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) < 0)
- xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed: %s\n",
- strerror(errno));
+ FatalError("xf86OpenConsole: VT_WAITACTIVE failed: %s\n",
+ strerror(errno));
if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0)
FatalError("xf86OpenConsole: VT_GETMODE failed %s\n",
@@ -273,6 +282,38 @@ xf86OpenConsole(void)
FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed %s\n",
strerror(errno));
+ /* Set the keyboard to RAW mode. If we're using the keyboard
+ * driver, the driver does it for us. If we have AEI on, then
+ * we're expecting the devices to be added (i.e. evdev) and we
+ * have to set it manually.
+ */
+ if (xf86Info.allowEmptyInput)
+ {
+ struct termios nTty;
+
+ tcgetattr(xf86Info.consoleFd, &tty_attr);
+ ioctl(xf86Info.consoleFd, KDGKBMODE, &tty_mode);
+
+ if (ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW) < 0)
+ FatalError("xf86OpenConsole: KDSKBMODE K_RAW failed %s\n",
+ strerror(errno));
+
+ nTty = tty_attr;
+ nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
+ nTty.c_oflag = 0;
+ nTty.c_cflag = CREAD | CS8;
+ nTty.c_lflag = 0;
+ nTty.c_cc[VTIME]=0;
+ nTty.c_cc[VMIN]=1;
+ cfsetispeed(&nTty, 9600);
+ cfsetospeed(&nTty, 9600);
+ tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty);
+
+ /* need to keep the buffer clean, else the kernel gets angry */
+ console_handler = xf86AddGeneralHandler(xf86Info.consoleFd,
+ drain_console, NULL);
+ }
+
/* we really should have a InitOSInputDevices() function instead
* of Init?$#*&Device(). So I just place it here */
@@ -317,6 +358,11 @@ xf86CloseConsole()
if (ShareVTs) return;
+ if (console_handler) {
+ xf86RemoveGeneralHandler(console_handler);
+ console_handler = NULL;
+ };
+
#if defined(DO_OS_FONTRESTORE)
if (ioctl(xf86Info.consoleFd, VT_GETSTATE, &vts) < 0)
xf86Msg(X_WARNING, "xf86CloseConsole: VT_GETSTATE failed: %s\n",
@@ -329,7 +375,10 @@ xf86CloseConsole()
if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT) < 0)
xf86Msg(X_WARNING, "xf86CloseConsole: KDSETMODE failed: %s\n",
strerror(errno));
-
+
+ ioctl(xf86Info.consoleFd, KDSKBMODE, tty_mode);
+ tcsetattr(xf86Info.consoleFd, TCSANOW, &tty_attr);
+
if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0)
xf86Msg(X_WARNING, "xf86CloseConsole: VT_GETMODE failed: %s\n",
strerror(errno));
@@ -350,6 +399,10 @@ xf86CloseConsole()
if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, activeVT) < 0)
xf86Msg(X_WARNING, "xf86CloseConsole: VT_ACTIVATE failed: %s\n",
strerror(errno));
+ if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, activeVT) < 0)
+ xf86Msg(X_WARNING,
+ "xf86CloseConsole: VT_WAITACTIVE failed: %s\n",
+ strerror(errno));
activeVT = -1;
}
diff --git a/xserver/hw/xfree86/shadowfb/shadow.c b/xserver/hw/xfree86/shadowfb/shadow.c
index 6c904a713..74beefb67 100644
--- a/xserver/hw/xfree86/shadowfb/shadow.c
+++ b/xserver/hw/xfree86/shadowfb/shadow.c
@@ -117,9 +117,9 @@ static DevPrivateKey ShadowGCKey = &ShadowGCKey;
}
#define SHADOW_GC_OP_PROLOGUE(pGC)\
- GCFuncs *oldFuncs = pGC->funcs;\
ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pGC->pScreen); \
ShadowGCPtr pGCPriv = GET_GC_PRIVATE(pGC);\
+ GCFuncs *oldFuncs = pGC->funcs;\
pGC->funcs = pGCPriv->funcs;\
pGC->ops = pGCPriv->ops
@@ -432,10 +432,10 @@ extern GCOps ShadowGCOps;
static Bool
ShadowCreateGC(GCPtr pGC)
{
- Bool ret;
ScreenPtr pScreen = pGC->pScreen;
ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen);
ShadowGCPtr pGCPriv = GET_GC_PRIVATE(pGC);
+ Bool ret;
pScreen->CreateGC = pPriv->CreateGC;
if((ret = (*pScreen->CreateGC) (pGC))) {
diff --git a/xserver/include/dix-config.h.in b/xserver/include/dix-config.h.in
index dde547910..5ce680dc1 100644
--- a/xserver/include/dix-config.h.in
+++ b/xserver/include/dix-config.h.in
@@ -102,6 +102,9 @@
/* Define to 1 if you have the <asm/mtrr.h> header file. */
#undef HAVE_ASM_MTRR_H
+/* Has backtrace support */
+#undef HAVE_BACKTRACE
+
/* Define to 1 if you have the <byteswap.h> header file. */
#undef HAVE_BYTESWAP_H
@@ -121,6 +124,9 @@
/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
#undef HAVE_DOPRNT
+/* Have execinfo.h */
+#undef HAVE_EXECINFO_H
+
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
diff --git a/xserver/include/os.h b/xserver/include/os.h
index 9cb266d3c..ef3db2978 100644
--- a/xserver/include/os.h
+++ b/xserver/include/os.h
@@ -527,4 +527,6 @@ extern void ErrorF(const char *f, ...) _printf_attribute(1,2);
extern void Error(char *str);
extern void LogPrintMarkers(void);
+extern void xorg_backtrace(void);
+
#endif /* OS_H */
diff --git a/xserver/mi/mieq.c b/xserver/mi/mieq.c
index aaa247d6c..803724708 100644
--- a/xserver/mi/mieq.c
+++ b/xserver/mi/mieq.c
@@ -145,6 +145,7 @@ mieqEnqueue(DeviceIntPtr pDev, xEvent *e)
oldtail = (oldtail - 1) % QUEUE_SIZE;
}
else {
+ static int stuck = 0;
newtail = (oldtail + 1) % QUEUE_SIZE;
/* Toss events which come in late. Usually this means your server's
* stuck in an infinite loop somewhere, but SIGIO is still getting
@@ -152,8 +153,13 @@ mieqEnqueue(DeviceIntPtr pDev, xEvent *e)
if (newtail == miEventQueue.head) {
ErrorF("[mi] EQ overflowing. The server is probably stuck "
"in an infinite loop.\n");
+ if (!stuck) {
+ xorg_backtrace();
+ stuck = 1;
+ }
return;
}
+ stuck = 0;
miEventQueue.tail = newtail;
}
diff --git a/xserver/mi/miinitext.c b/xserver/mi/miinitext.c
index 55faec333..4f252d41f 100644
--- a/xserver/mi/miinitext.c
+++ b/xserver/mi/miinitext.c
@@ -661,7 +661,8 @@ InitExtensions(argc, argv)
#endif
#ifdef GLXEXT
- GlxPushProvider(&__glXDRISWRastProvider);
+ if (serverGeneration == 1)
+ GlxPushProvider(&__glXDRISWRastProvider);
if (!noGlxExtension) GlxExtensionInit();
#endif
}
diff --git a/xserver/os/Makefile.am b/xserver/os/Makefile.am
index 1609db2c7..76855583d 100644
--- a/xserver/os/Makefile.am
+++ b/xserver/os/Makefile.am
@@ -12,6 +12,7 @@ libos_la_SOURCES = \
WaitFor.c \
access.c \
auth.c \
+ backtrace.c \
connection.c \
io.c \
mitauth.c \
diff --git a/xserver/os/backtrace.c b/xserver/os/backtrace.c
new file mode 100644
index 000000000..b52dcded8
--- /dev/null
+++ b/xserver/os/backtrace.c
@@ -0,0 +1,201 @@
+/*
+ * Copyright 2008 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software")
+ * to deal in the software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * them Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTIBILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "os.h"
+#include "misc.h"
+
+#ifdef HAVE_BACKTRACE
+#include <execinfo.h>
+
+void xorg_backtrace(void)
+{
+ void *array[32]; /* deeper nesting than this means something's wrong */
+ size_t size, i;
+ char **strings;
+ ErrorF("\nBacktrace:\n");
+ size = backtrace(array, 32);
+ strings = backtrace_symbols(array, size);
+ for (i = 0; i < size; i++)
+ ErrorF("%d: %s\n", i, strings[i]);
+ free(strings);
+}
+
+#else /* not glibc or glibc < 2.1 */
+
+# if defined(sun) && defined(__SVR4)
+# define HAVE_PSTACK
+# endif
+
+# if defined(HAVE_WALKCONTEXT) /* Solaris 9 & later */
+
+# include <ucontext.h>
+# include <signal.h>
+# include <dlfcn.h>
+# include <sys/elf.h>
+
+#ifdef _LP64
+# define ElfSym Elf64_Sym
+#else
+# define ElfSym Elf32_Sym
+#endif
+
+/* Called for each frame on the stack to print it's contents */
+static int xorg_backtrace_frame(uintptr_t pc, int signo, void *arg)
+{
+ Dl_info dlinfo;
+ ElfSym *dlsym;
+ char header[32];
+ int depth = *((int *) arg);
+
+ if (signo) {
+ char signame[SIG2STR_MAX];
+
+ if (sig2str(signo, signame) != 0) {
+ strcpy(signame, "unknown");
+ }
+
+ ErrorF("** Signal %d (%s)\n", signo, signame);
+ }
+
+ snprintf(header, sizeof(header), "%d: 0x%lx", depth, pc);
+ *((int *) arg) = depth + 1;
+
+ /* Ask system dynamic loader for info on the address */
+ if (dladdr1((void *) pc, &dlinfo, (void **) &dlsym, RTLD_DL_SYMENT)) {
+ unsigned long offset = pc - (uintptr_t) dlinfo.dli_saddr;
+ const char *symname;
+
+ if (offset < dlsym->st_size) { /* inside a function */
+ symname = dlinfo.dli_sname;
+ } else { /* found which file it was in, but not which function */
+ symname = "<section start>";
+ offset = pc - (uintptr_t)dlinfo.dli_fbase;
+ }
+ ErrorF("%s: %s:%s+0x%lx\n", header, dlinfo.dli_fname,
+ symname, offset);
+
+ } else {
+ /* Couldn't find symbol info from system dynamic loader, should
+ * probably poke elfloader here, but haven't written that code yet,
+ * so we just print the pc.
+ */
+ ErrorF("%s\n", header);
+ }
+
+ return 0;
+}
+# endif /* HAVE_WALKCONTEXT */
+
+# ifdef HAVE_PSTACK
+static int xorg_backtrace_pstack(void) {
+ pid_t kidpid;
+ int pipefd[2];
+
+ if (pipe(pipefd) != 0) {
+ return -1;
+ }
+
+ kidpid = fork1();
+
+ if (kidpid == -1) {
+ /* ERROR */
+ return -1;
+ } else if (kidpid == 0) {
+ /* CHILD */
+ char parent[16];
+
+ seteuid(0);
+ close(STDIN_FILENO);
+ close(STDOUT_FILENO);
+ dup2(pipefd[1],STDOUT_FILENO);
+ closefrom(STDERR_FILENO);
+
+ snprintf(parent, sizeof(parent), "%d", getppid());
+ execle("/usr/bin/pstack", "pstack", parent, NULL);
+ exit(1);
+ } else {
+ /* PARENT */
+ char btline[256];
+ int kidstat;
+ int bytesread;
+ int done = 0;
+
+ close(pipefd[1]);
+
+ while (!done) {
+ bytesread = read(pipefd[0], btline, sizeof(btline) - 1);
+
+ if (bytesread > 0) {
+ btline[bytesread] = 0;
+ ErrorF("%s", btline);
+ }
+ else if ((bytesread < 0) ||
+ ((errno != EINTR) && (errno != EAGAIN)))
+ done = 1;
+ }
+ close(pipefd[0]);
+ waitpid(kidpid, &kidstat, 0);
+ if (kidstat != 0)
+ return -1;
+ }
+ return 0;
+}
+# endif /* HAVE_PSTACK */
+
+
+# if defined(HAVE_PSTACK) || defined(HAVE_WALKCONTEXT)
+
+void xorg_backtrace(void) {
+
+ ErrorF("\nBacktrace:\n");
+
+# ifdef HAVE_PSTACK
+/* First try fork/exec of pstack - otherwise fall back to walkcontext
+ pstack is preferred since it can print names of non-exported functions */
+
+ if (xorg_backtrace_pstack() < 0)
+# endif
+ {
+# ifdef HAVE_WALKCONTEXT
+ ucontext_t u;
+ int depth = 1;
+
+ if (getcontext(&u) == 0)
+ walkcontext(&u, xorg_backtrace_frame, &depth);
+ else
+# endif
+ Error("Failed to get backtrace info");
+ }
+ ErrorF("\n");
+}
+
+# else
+
+/* Default fallback if we can't find any way to get a backtrace */
+void xorg_backtrace(void) { return; }
+
+# endif
+#endif
diff --git a/xserver/os/utils.c b/xserver/os/utils.c
index c640b1ba1..cd07ddc4e 100644
--- a/xserver/os/utils.c
+++ b/xserver/os/utils.c
@@ -1720,7 +1720,7 @@ static struct pid {
int pid;
} *pidlist;
-void (*old_alarm)(int) = NULL; /* XXX horrible awful hack */
+OsSigHandlerPtr old_alarm = NULL; /* XXX horrible awful hack */
pointer
Popen(char *command, char *type)
@@ -1744,7 +1744,7 @@ Popen(char *command, char *type)
}
/* Ignore the smart scheduler while this is going on */
- old_alarm = signal(SIGALRM, SIG_IGN);
+ old_alarm = OsSignal(SIGALRM, SIG_IGN);
if (old_alarm == SIG_ERR) {
perror("signal");
return NULL;
@@ -1755,7 +1755,7 @@ Popen(char *command, char *type)
close(pdes[0]);
close(pdes[1]);
xfree(cur);
- if (signal(SIGALRM, old_alarm) == SIG_ERR)
+ if (OsSignal(SIGALRM, old_alarm) == SIG_ERR)
perror("signal");
return NULL;
case 0: /* child */
@@ -1932,7 +1932,7 @@ Pclose(pointer iop)
/* allow EINTR again */
OsReleaseSignals ();
- if (old_alarm && signal(SIGALRM, old_alarm) == SIG_ERR) {
+ if (old_alarm && OsSignal(SIGALRM, old_alarm) == SIG_ERR) {
perror("signal");
return -1;
}
diff --git a/xserver/randr/rrproperty.c b/xserver/randr/rrproperty.c
index 429246c68..8e7f5d878 100644
--- a/xserver/randr/rrproperty.c
+++ b/xserver/randr/rrproperty.c
@@ -24,10 +24,43 @@
#include "propertyst.h"
#include "swaprep.h"
-static void
-RRDeliverEvent (ScreenPtr pScreen, xEvent *event, CARD32 mask)
+static int
+DeliverPropertyEvent(WindowPtr pWin, void *value)
{
+ xRROutputPropertyNotifyEvent *event = value;
+ RREventPtr *pHead, pRREvent;
+ ClientPtr client;
+
+ pHead = LookupIDByType(pWin->drawable.id, RREventType);
+ if (!pHead)
+ return WT_WALKCHILDREN;
+
+ for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next)
+ {
+ client = pRREvent->client;
+ if (client == serverClient || client->clientGone)
+ continue;
+
+ if (!(pRREvent->mask & RROutputPropertyNotifyMask))
+ continue;
+ event->sequenceNumber = client->sequence;
+ event->window = pRREvent->window->drawable.id;
+ if (client->swapped) {
+ int n;
+ swaps(&event->sequenceNumber, n);
+ swapl(&event->window, n);
+ }
+ WriteEventsToClient(pRREvent->client, 1, (xEvent *)event);
+ }
+
+ return WT_WALKCHILDREN;
+}
+
+static void RRDeliverPropertyEvent(ScreenPtr pScreen, xEvent *event)
+{
+ if (!(dispatchException & (DE_RESET | DE_TERMINATE)))
+ WalkTree(pScreen, DeliverPropertyEvent, event);
}
void
@@ -45,7 +78,7 @@ RRDeleteAllOutputProperties (RROutputPtr output)
event.state = PropertyDelete;
event.atom = prop->propertyName;
event.timestamp = currentTime.milliseconds;
- RRDeliverEvent (output->pScreen, (xEvent *) &event, RROutputPropertyNotifyMask);
+ RRDeliverPropertyEvent (output->pScreen, (xEvent *)&event);
if (prop->current.data)
xfree(prop->current.data);
if (prop->pending.data)
@@ -113,7 +146,7 @@ RRDeleteOutputProperty (RROutputPtr output, Atom property)
event.state = PropertyDelete;
event.atom = prop->propertyName;
event.timestamp = currentTime.milliseconds;
- RRDeliverEvent (output->pScreen, (xEvent *) &event, RROutputPropertyNotifyMask);
+ RRDeliverPropertyEvent (output->pScreen, (xEvent *)&event);
RRDestroyOutputProperty (prop);
}
}
@@ -238,7 +271,7 @@ RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type,
event.state = PropertyNewValue;
event.atom = prop->propertyName;
event.timestamp = currentTime.milliseconds;
- RRDeliverEvent (output->pScreen, (xEvent *) &event, RROutputPropertyNotifyMask);
+ RRDeliverPropertyEvent (output->pScreen, (xEvent *)&event);
}
return(Success);
}
@@ -700,7 +733,7 @@ ProcRRGetOutputProperty (ClientPtr client)
event.state = PropertyDelete;
event.atom = prop->propertyName;
event.timestamp = currentTime.milliseconds;
- RRDeliverEvent (output->pScreen, (xEvent *) &event, RROutputPropertyNotifyMask);
+ RRDeliverPropertyEvent (output->pScreen, (xEvent *)&event);
}
if (client->swapped) {
diff --git a/xserver/xkb/xkbEvents.c b/xserver/xkb/xkbEvents.c
index 49725d065..36084cc02 100644
--- a/xserver/xkb/xkbEvents.c
+++ b/xserver/xkb/xkbEvents.c
@@ -109,7 +109,7 @@ Time time;
register CARD16 changed,bState;
interest = kbd->xkb_interest;
- if (!interest)
+ if (!interest || !kbd->key || !kbd->key->xkbInfo)
return;
xkbi = kbd->key->xkbInfo;
state= &xkbi->state;
@@ -168,6 +168,9 @@ XkbSrvInfoPtr xkbi;
unsigned time = 0,initialized;
CARD16 changed;
+ if (!kbd->key || !kbd->key->xkbInfo)
+ return;
+
xkbi = kbd->key->xkbInfo;
initialized= 0;
@@ -291,7 +294,7 @@ XkbInterestPtr interest;
Time time = 0;
interest = kbd->xkb_interest;
- if (!interest)
+ if (!interest || !kbd->key || !kbd->key->xkbInfo)
return;
xkbi = kbd->key->xkbInfo;
@@ -401,6 +404,9 @@ CARD16 pitch,duration;
Time time = 0;
XID winID = 0;
+ if (!kbd->key || !kbd->key->xkbInfo)
+ return;
+
xkbi = kbd->key->xkbInfo;
if ((force||(xkbi->desc->ctrls->enabled_ctrls&XkbAudibleBellMask))&&
@@ -616,11 +622,12 @@ XkbSrvInfoPtr xkbi;
XkbInterestPtr interest;
Time time = 0;
- xkbi = kbd->key->xkbInfo;
interest = kbd->xkb_interest;
- if (!interest)
+ if (!interest || !kbd->key || !kbd->key->xkbInfo)
return;
+ xkbi = kbd->key->xkbInfo;
+
initialized = 0;
pEv->mods= xkbi->state.mods;
pEv->group= xkbi->state.group;
@@ -996,6 +1003,10 @@ unsigned long autoCtrls,autoValues;
ClientPtr client = NULL;
found= False;
+
+ if (!dev->key || !dev->key->xkbInfo)
+ return found;
+
autoCtrls= autoValues= 0;
if ( dev->xkb_interest ) {
interest = dev->xkb_interest;