aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-10-19 19:56:00 +0000
committermarha <marha@users.sourceforge.net>2010-10-19 19:56:00 +0000
commit6ab3babba7b1b74528c2194a495fa1e2e67faa55 (patch)
treeed84a65e3d6f8bebb29359424d69d37b416754a5 /xorg-server/hw/xfree86
parentd621ea397a3d181e7a0bf07d72bd21e116fccdb8 (diff)
downloadvcxsrv-6ab3babba7b1b74528c2194a495fa1e2e67faa55.tar.gz
vcxsrv-6ab3babba7b1b74528c2194a495fa1e2e67faa55.tar.bz2
vcxsrv-6ab3babba7b1b74528c2194a495fa1e2e67faa55.zip
xserver update 19/10/2010
Diffstat (limited to 'xorg-server/hw/xfree86')
-rw-r--r--xorg-server/hw/xfree86/common/xf86Config.c54
-rw-r--r--xorg-server/hw/xfree86/common/xf86Mode.c64
-rw-r--r--xorg-server/hw/xfree86/common/xf86Xinput.c35
-rw-r--r--xorg-server/hw/xfree86/common/xf86Xinput.h2
-rw-r--r--xorg-server/hw/xfree86/ddc/ddc.c4
-rw-r--r--xorg-server/hw/xfree86/doc/man/xorg.conf.man.pre6
-rw-r--r--xorg-server/hw/xfree86/os-support/shared/sigio.c627
-rw-r--r--xorg-server/hw/xfree86/parser/DRI.c310
-rw-r--r--xorg-server/hw/xfree86/parser/scan.c63
-rw-r--r--xorg-server/hw/xfree86/parser/xf86Parser.h11
-rw-r--r--xorg-server/hw/xfree86/parser/xf86tokens.h1
11 files changed, 519 insertions, 658 deletions
diff --git a/xorg-server/hw/xfree86/common/xf86Config.c b/xorg-server/hw/xfree86/common/xf86Config.c
index 3a8380121..faeda92ee 100644
--- a/xorg-server/hw/xfree86/common/xf86Config.c
+++ b/xorg-server/hw/xfree86/common/xf86Config.c
@@ -78,19 +78,19 @@ extern DeviceAssocRec mouse_assoc;
"/etc/X11/%R," "%P/etc/X11/%R," \
"%E," "%F," \
"/etc/X11/%F," "%P/etc/X11/%F," \
- "/etc/X11/%X-%M," "/etc/X11/%X," "/etc/%X," \
- "%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \
+ "/etc/X11/%X," "/etc/%X," \
+ "%P/etc/X11/%X.%H," \
"%P/etc/X11/%X," \
- "%P/lib/X11/%X.%H," "%P/lib/X11/%X-%M," \
+ "%P/lib/X11/%X.%H," \
"%P/lib/X11/%X"
#endif
#ifndef USER_CONFIGPATH
#define USER_CONFIGPATH "/etc/X11/%S," "%P/etc/X11/%S," \
"/etc/X11/%G," "%P/etc/X11/%G," \
- "/etc/X11/%X-%M," "/etc/X11/%X," "/etc/%X," \
- "%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \
+ "/etc/X11/%X," "/etc/%X," \
+ "%P/etc/X11/%X.%H," \
"%P/etc/X11/%X," \
- "%P/lib/X11/%X.%H," "%P/lib/X11/%X-%M," \
+ "%P/lib/X11/%X.%H," \
"%P/lib/X11/%X"
#endif
#ifndef ROOT_CONFIGDIRPATH
@@ -524,24 +524,6 @@ fixup_video_driver_list(char **drivers)
}
}
}
- /*
- * since the ati wrapper driver is gross and awful, sort ati before
- * atimisc, which makes sure all the ati symbols are visible in xorgcfg.
- */
- for (drv = drivers; drv != end; drv++) {
- if (!strcmp(*drv, "atimisc")) {
- atimisc = drv;
- for (drv = atimisc; drv != end; drv++) {
- if (!strcmp(*drv, "ati")) {
- ati = drv;
- x = *ati; *ati = *atimisc; *atimisc = x;
- return;
- }
- }
- /* if we get here, ati was already ahead of atimisc */
- return;
- }
- }
}
static char **
@@ -549,7 +531,7 @@ GenerateDriverlist(char * dirname)
{
char **ret;
const char *subdirs[] = { dirname, NULL };
- static const char *patlist[] = {"(.*)_drv\\.so", "(.*)_drv\\.o", NULL};
+ static const char *patlist[] = {"(.*)_drv\\.so", NULL};
ret = LoaderListDirs(subdirs, patlist);
/* fix up the probe order for video drivers */
@@ -2229,15 +2211,11 @@ configDevice(GDevPtr devicep, XF86ConfDevicePtr conf_device, Bool active)
static void
configDRI(XF86ConfDRIPtr drip)
{
- int count = 0;
- XF86ConfBuffersPtr bufs;
int i;
struct group *grp;
xf86ConfigDRI.group = -1;
xf86ConfigDRI.mode = 0;
- xf86ConfigDRI.bufs_count = 0;
- xf86ConfigDRI.bufs = NULL;
if (drip) {
if (drip->dri_group_name) {
@@ -2248,24 +2226,6 @@ configDRI(XF86ConfDRIPtr drip)
xf86ConfigDRI.group = drip->dri_group;
}
xf86ConfigDRI.mode = drip->dri_mode;
- for (bufs = drip->dri_buffers_lst; bufs; bufs = bufs->list.next)
- ++count;
-
- xf86ConfigDRI.bufs_count = count;
- xf86ConfigDRI.bufs = xnfalloc(count * sizeof(*xf86ConfigDRI.bufs));
-
- for (i = 0, bufs = drip->dri_buffers_lst;
- i < count;
- i++, bufs = bufs->list.next) {
-
- xf86ConfigDRI.bufs[i].count = bufs->buf_count;
- xf86ConfigDRI.bufs[i].size = bufs->buf_size;
- /* FIXME: Flags not implemented. These
- could be used, for example, to specify a
- contiguous block and/or write-combining
- cache policy. */
- xf86ConfigDRI.bufs[i].flags = 0;
- }
}
}
#endif
diff --git a/xorg-server/hw/xfree86/common/xf86Mode.c b/xorg-server/hw/xfree86/common/xf86Mode.c
index af738e703..c3a190777 100644
--- a/xorg-server/hw/xfree86/common/xf86Mode.c
+++ b/xorg-server/hw/xfree86/common/xf86Mode.c
@@ -1831,8 +1831,6 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
numModes++;
}
-#undef _VIRTUALX
-
/*
* If we estimated the virtual size above, we may have filtered away all
* the modes that maximally match that size; scan again to find out and
@@ -1847,13 +1845,69 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
}
}
if (vx < virtX || vy < virtY) {
+ const int types[] = {
+ M_T_BUILTIN | M_T_PREFERRED,
+ M_T_BUILTIN,
+ M_T_DRIVER | M_T_PREFERRED,
+ M_T_DRIVER,
+ 0
+ };
+ const int ntypes = sizeof(types) / sizeof(int);
+ int n;
+
+ /*
+ * We did not find the estimated virtual size. So now we want to
+ * find the largest mode available, but we want to search in the
+ * modes in the order of "types" listed above.
+ */
+ for (n = 0; n < ntypes; n++) {
+ int type = types[n];
+
+ vx = 0; vy = 0;
+ for (p = scrp->modes; p; p = p->next) {
+ /* scan through the modes in the sort order above */
+ if ((p->type & type) != type)
+ continue;
+ if (p->HDisplay > vx && p->VDisplay > vy) {
+ vx = p->HDisplay;
+ vy = p->VDisplay;
+ }
+ }
+ if (vx && vy)
+ /* Found one */
+ break;
+ }
xf86DrvMsg(scrp->scrnIndex, X_WARNING,
"Shrinking virtual size estimate from %dx%d to %dx%d\n",
virtX, virtY, vx, vy);
- virtX = vx;
+ virtX = _VIRTUALX(vx);
virtY = vy;
- linePitch = scanLineWidth(vx, vy, minPitch, apertureSize,
- BankFormat, pitchInc);
+ for (p = scrp->modes; p; p = p->next) {
+ if (numModes > 0) {
+ if (p->HDisplay > virtX)
+ p->status = MODE_VIRTUAL_X;
+ if (p->VDisplay > virtY)
+ p->status = MODE_VIRTUAL_Y;
+ if (p->status != MODE_OK) {
+ numModes--;
+ printModeRejectMessage(scrp->scrnIndex, p, p->status);
+ }
+ }
+ }
+ if (linePitches != NULL) {
+ for (i = 0; linePitches[i] != 0; i++) {
+ if ((linePitches[i] >= virtX) &&
+ (linePitches[i] ==
+ scanLineWidth(virtX, virtY, linePitches[i],
+ apertureSize, BankFormat, pitchInc))) {
+ linePitch = linePitches[i];
+ break;
+ }
+ }
+ } else {
+ linePitch = scanLineWidth(virtX, virtY, minPitch,
+ apertureSize, BankFormat, pitchInc);
+ }
}
}
diff --git a/xorg-server/hw/xfree86/common/xf86Xinput.c b/xorg-server/hw/xfree86/common/xf86Xinput.c
index 585be69a5..3542abd4a 100644
--- a/xorg-server/hw/xfree86/common/xf86Xinput.c
+++ b/xorg-server/hw/xfree86/common/xf86Xinput.c
@@ -1238,40 +1238,43 @@ xf86FirstLocalDevice(void)
/*
* Cx - raw data from touch screen
- * Sxhigh - scaled highest dimension
+ * to_max - scaled highest dimension
* (remember, this is of rows - 1 because of 0 origin)
- * Sxlow - scaled lowest dimension
- * Rxhigh - highest raw value from touch screen calibration
- * Rxlow - lowest raw value from touch screen calibration
+ * to_min - scaled lowest dimension
+ * from_max - highest raw value from touch screen calibration
+ * from_min - lowest raw value from touch screen calibration
*
* This function is the same for X or Y coordinates.
* You may have to reverse the high and low values to compensate for
* different orgins on the touch screen vs X.
+ *
+ * e.g. to scale from device coordinates into screen coordinates, call
+ * xf86ScaleAxis(x, 0, screen_width, dev_min, dev_max);
*/
int
xf86ScaleAxis(int Cx,
- int Sxhigh,
- int Sxlow,
- int Rxhigh,
- int Rxlow )
+ int to_max,
+ int to_min,
+ int from_max,
+ int from_min )
{
int X;
- int64_t dSx = Sxhigh - Sxlow;
- int64_t dRx = Rxhigh - Rxlow;
+ int64_t to_width = to_max - to_min;
+ int64_t from_width = from_max - from_min;
- if (dRx) {
- X = (int)(((dSx * (Cx - Rxlow)) / dRx) + Sxlow);
+ if (from_width) {
+ X = (int)(((to_width * (Cx - from_min)) / from_width) + to_min);
}
else {
X = 0;
ErrorF ("Divide by Zero in xf86ScaleAxis");
}
- if (X > Sxhigh)
- X = Sxhigh;
- if (X < Sxlow)
- X = Sxlow;
+ if (X > to_max)
+ X = to_max;
+ if (X < to_min)
+ X = to_min;
return X;
}
diff --git a/xorg-server/hw/xfree86/common/xf86Xinput.h b/xorg-server/hw/xfree86/common/xf86Xinput.h
index 1e5671574..727f26107 100644
--- a/xorg-server/hw/xfree86/common/xf86Xinput.h
+++ b/xorg-server/hw/xfree86/common/xf86Xinput.h
@@ -184,7 +184,7 @@ extern _X_EXPORT void xf86PostKeyboardEvent(DeviceIntPtr device, unsigned int ke
int is_down);
extern _X_EXPORT int xf86ActivateDevice(LocalDevicePtr local);
extern _X_EXPORT LocalDevicePtr xf86FirstLocalDevice(void);
-extern _X_EXPORT int xf86ScaleAxis(int Cx, int Sxhigh, int Sxlow, int Rxhigh, int Rxlow);
+extern _X_EXPORT int xf86ScaleAxis(int Cx, int to_max, int to_min, int from_max, int from_min);
extern _X_EXPORT void xf86XInputSetScreen(LocalDevicePtr local, int screen_number, int x, int y);
extern _X_EXPORT void xf86ProcessCommonOptions(InputInfoPtr pInfo, pointer options);
extern _X_EXPORT void xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval,
diff --git a/xorg-server/hw/xfree86/ddc/ddc.c b/xorg-server/hw/xfree86/ddc/ddc.c
index 975e07620..e9b8a52eb 100644
--- a/xorg-server/hw/xfree86/ddc/ddc.c
+++ b/xorg-server/hw/xfree86/ddc/ddc.c
@@ -314,10 +314,6 @@ DDC2Init(int scrnIndex, I2CBusPtr pBus)
dev = DDC2MakeDevice(pBus, 0x00A0, "ddc2");
if (xf86I2CProbeAddress(pBus, 0x0060))
DDC2MakeDevice(pBus, 0x0060, "E-EDID segment register");
- if (xf86I2CProbeAddress(pBus, 0x0062))
- DDC2MakeDevice(pBus, 0x0062, "EDID EEPROM interface");
- if (xf86I2CProbeAddress(pBus, 0x006E))
- DDC2MakeDevice(pBus, 0x006E, "DDC control interface");
return dev;
}
diff --git a/xorg-server/hw/xfree86/doc/man/xorg.conf.man.pre b/xorg-server/hw/xfree86/doc/man/xorg.conf.man.pre
index 1bec1bf27..8d09862b3 100644
--- a/xorg-server/hw/xfree86/doc/man/xorg.conf.man.pre
+++ b/xorg-server/hw/xfree86/doc/man/xorg.conf.man.pre
@@ -39,14 +39,11 @@ server is started as a normal user:
.IR __projectroot__/etc/X11/ <cmdline>
.IB /etc/X11/ $XORGCONFIG
.IB __projectroot__/etc/X11/ $XORGCONFIG
-.I /etc/X11/__xconfigfile__\-4
.I /etc/X11/__xconfigfile__
.I /etc/__xconfigfile__
.IR __projectroot__/etc/X11/__xconfigfile__. <hostname>
-.I __projectroot__/etc/X11/__xconfigfile__\-4
.I __projectroot__/etc/X11/__xconfigfile__
.IR __projectroot__/lib/X11/__xconfigfile__. <hostname>
-.I __projectroot__/lib/X11/__xconfigfile__\-4
.I __projectroot__/lib/X11/__xconfigfile__
.fi
.RE
@@ -74,14 +71,11 @@ search locations are as follows:
.B $XORGCONFIG
.IB /etc/X11/ $XORGCONFIG
.IB __projectroot__/etc/X11/ $XORGCONFIG
-.I /etc/X11/__xconfigfile__\-4
.I /etc/X11/__xconfigfile__
.I /etc/__xconfigfile__
.IR __projectroot__/etc/X11/__xconfigfile__. <hostname>
-.I __projectroot__/etc/X11/__xconfigfile__\-4
.I __projectroot__/etc/X11/__xconfigfile__
.IR __projectroot__/lib/X11/__xconfigfile__. <hostname>
-.I __projectroot__/lib/X11/__xconfigfile__\-4
.I __projectroot__/lib/X11/__xconfigfile__
.fi
.RE
diff --git a/xorg-server/hw/xfree86/os-support/shared/sigio.c b/xorg-server/hw/xfree86/os-support/shared/sigio.c
index aed5654e8..ef04c1140 100644
--- a/xorg-server/hw/xfree86/os-support/shared/sigio.c
+++ b/xorg-server/hw/xfree86/os-support/shared/sigio.c
@@ -1,318 +1,309 @@
-
-/* sigio.c -- Support for SIGIO handler installation and removal
- * Created: Thu Jun 3 15:39:18 1999 by faith@precisioninsight.com
- *
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * 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
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * 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 MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * PRECISION INSIGHT AND/OR ITS SUPPLIERS 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.
- *
- * Authors: Rickard E. (Rik) Faith <faith@valinux.com>
- */
-/*
- * Copyright (c) 2002 by The XFree86 Project, 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
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice 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 MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) 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.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * authorization from the copyright holder(s) and author(s).
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-# include <X11/X.h>
-# include "xf86.h"
-# include "xf86Priv.h"
-# include "xf86_OSlib.h"
-# include "inputstr.h"
-
-#ifdef HAVE_STROPTS_H
-# include <stropts.h>
-#endif
-
-/*
- * Linux libc5 defines FASYNC, but not O_ASYNC. Don't know if it is
- * functional or not.
- */
-#if defined(FASYNC) && !defined(O_ASYNC)
-# define O_ASYNC FASYNC
-#endif
-
-#ifdef MAXDEVICES
-/* MAXDEVICES represents the maximimum number of input devices usable
- * at the same time plus one entry for DRM support.
- */
-# define MAX_FUNCS (MAXDEVICES + 1)
-#else
-# define MAX_FUNCS 16
-#endif
-
-typedef struct _xf86SigIOFunc {
- void (*f) (int, void *);
- int fd;
- void *closure;
-} Xf86SigIOFunc;
-
-static Xf86SigIOFunc xf86SigIOFuncs[MAX_FUNCS];
-static int xf86SigIOMax;
-static int xf86SigIOMaxFd;
-static fd_set xf86SigIOMask;
-
-/*
- * SIGIO gives no way of discovering which fd signalled, select
- * to discover
- */
-static void
-xf86SIGIO (int sig)
-{
- int i;
- fd_set ready;
- struct timeval to;
- int save_errno = errno; /* do not clobber the global errno */
- int r;
-
- ready = xf86SigIOMask;
- to.tv_sec = 0;
- to.tv_usec = 0;
- SYSCALL (r = select (xf86SigIOMaxFd, &ready, 0, 0, &to));
- for (i = 0; r > 0 && i < xf86SigIOMax; i++)
- if (xf86SigIOFuncs[i].f && FD_ISSET (xf86SigIOFuncs[i].fd, &ready))
- {
- (*xf86SigIOFuncs[i].f)(xf86SigIOFuncs[i].fd,
- xf86SigIOFuncs[i].closure);
- r--;
- }
- if (r > 0) {
- xf86Msg(X_ERROR, "SIGIO %d descriptors not handled\n", r);
- }
- /* restore global errno */
- errno = save_errno;
-}
-
-static int
-xf86IsPipe (int fd)
-{
- struct stat buf;
-
- if (fstat (fd, &buf) < 0)
- return 0;
- return S_ISFIFO(buf.st_mode);
-}
-
-int
-xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), void *closure)
-{
- struct sigaction sa;
- struct sigaction osa;
- int i;
- int blocked;
- int installed = FALSE;
-
- if (!xf86Info.useSIGIO)
- return 0;
-
- for (i = 0; i < MAX_FUNCS; i++)
- {
- if (!xf86SigIOFuncs[i].f)
- {
- if (xf86IsPipe (fd))
- return 0;
- blocked = xf86BlockSIGIO();
-#ifdef O_ASYNC
- if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_ASYNC) == -1) {
- xf86Msg(X_WARNING, "fcntl(%d, O_ASYNC): %s\n",
- fd, strerror(errno));
- } else {
- if (fcntl(fd, F_SETOWN, getpid()) == -1) {
- xf86Msg(X_WARNING, "fcntl(%d, F_SETOWN): %s\n",
- fd, strerror(errno));
- } else {
- installed = TRUE;
- }
- }
-#endif
-#ifdef I_SETSIG /* System V Streams - used on Solaris for input devices */
- if (!installed && isastream(fd)) {
- if (ioctl(fd, I_SETSIG, S_INPUT | S_ERROR | S_HANGUP) == -1) {
- xf86Msg(X_WARNING, "fcntl(%d, I_SETSIG): %s\n",
- fd, strerror(errno));
- } else {
- installed = TRUE;
- }
- }
-#endif
- if (!installed) {
- xf86UnblockSIGIO(blocked);
- return 0;
- }
- sigemptyset(&sa.sa_mask);
- sigaddset(&sa.sa_mask, SIGIO);
- sa.sa_flags = 0;
- sa.sa_handler = xf86SIGIO;
- sigaction(SIGIO, &sa, &osa);
- xf86SigIOFuncs[i].fd = fd;
- xf86SigIOFuncs[i].closure = closure;
- xf86SigIOFuncs[i].f = f;
- if (i >= xf86SigIOMax)
- xf86SigIOMax = i+1;
- if (fd >= xf86SigIOMaxFd)
- xf86SigIOMaxFd = fd + 1;
- FD_SET (fd, &xf86SigIOMask);
- xf86UnblockSIGIO(blocked);
- return 1;
- }
- /* Allow overwriting of the closure and callback */
- else if (xf86SigIOFuncs[i].fd == fd)
- {
- xf86SigIOFuncs[i].closure = closure;
- xf86SigIOFuncs[i].f = f;
- return 1;
- }
- }
- return 0;
-}
-
-int
-xf86RemoveSIGIOHandler(int fd)
-{
- struct sigaction sa;
- struct sigaction osa;
- int i;
- int max;
- int maxfd;
- int ret;
-
- if (!xf86Info.useSIGIO)
- return 0;
-
- max = 0;
- maxfd = -1;
- ret = 0;
- for (i = 0; i < MAX_FUNCS; i++)
- {
- if (xf86SigIOFuncs[i].f)
- {
- if (xf86SigIOFuncs[i].fd == fd)
- {
- xf86SigIOFuncs[i].f = 0;
- xf86SigIOFuncs[i].fd = 0;
- xf86SigIOFuncs[i].closure = 0;
- FD_CLR (fd, &xf86SigIOMask);
- ret = 1;
- }
- else
- {
- max = i + 1;
- if (xf86SigIOFuncs[i].fd >= maxfd)
- maxfd = xf86SigIOFuncs[i].fd + 1;
- }
- }
- }
- if (ret)
- {
-#ifdef O_ASYNC
- fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) & ~O_ASYNC);
-#endif
-#ifdef I_SETSIG
- if (isastream(fd)) {
- if (ioctl(fd, I_SETSIG, 0) == -1) {
- xf86Msg(X_WARNING, "fcntl(%d, I_SETSIG, 0): %s\n",
- fd, strerror(errno));
- }
- }
-#endif
- xf86SigIOMax = max;
- xf86SigIOMaxFd = maxfd;
- if (!max)
- {
- sigemptyset(&sa.sa_mask);
- sigaddset(&sa.sa_mask, SIGIO);
- sa.sa_flags = 0;
- sa.sa_handler = SIG_IGN;
- sigaction(SIGIO, &sa, &osa);
- }
- }
- return ret;
-}
-
-int
-xf86BlockSIGIO (void)
-{
- sigset_t set, old;
- int ret;
-
- sigemptyset (&set);
- sigaddset (&set, SIGIO);
- sigprocmask (SIG_BLOCK, &set, &old);
- ret = sigismember (&old, SIGIO);
- return ret;
-}
-
-void
-xf86UnblockSIGIO (int wasset)
-{
- sigset_t set;
-
- if (!wasset)
- {
- sigemptyset (&set);
- sigaddset (&set, SIGIO);
- sigprocmask (SIG_UNBLOCK, &set, NULL);
- }
-}
-
-void
-xf86AssertBlockedSIGIO (char *where)
-{
- sigset_t set, old;
-
- sigemptyset (&set);
- sigprocmask (SIG_BLOCK, &set, &old);
- if (!sigismember (&old, SIGIO))
- xf86Msg (X_ERROR, "SIGIO not blocked at %s\n", where);
-}
-
-/* XXX This is a quick hack for the benefit of xf86SetSilkenMouse() */
-
-int
-xf86SIGIOSupported (void)
-{
- return 1;
-}
+/* sigio.c -- Support for SIGIO handler installation and removal
+ * Created: Thu Jun 3 15:39:18 1999 by faith@precisioninsight.com
+ *
+ * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * 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
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * 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 MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * PRECISION INSIGHT AND/OR ITS SUPPLIERS 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.
+ *
+ * Authors: Rickard E. (Rik) Faith <faith@valinux.com>
+ */
+/*
+ * Copyright (c) 2002 by The XFree86 Project, 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
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice 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 MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) 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.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+# include <X11/X.h>
+# include "xf86.h"
+# include "xf86Priv.h"
+# include "xf86_OSlib.h"
+# include "inputstr.h"
+
+#ifdef HAVE_STROPTS_H
+# include <stropts.h>
+#endif
+
+#ifdef MAXDEVICES
+/* MAXDEVICES represents the maximimum number of input devices usable
+ * at the same time plus one entry for DRM support.
+ */
+# define MAX_FUNCS (MAXDEVICES + 1)
+#else
+# define MAX_FUNCS 16
+#endif
+
+typedef struct _xf86SigIOFunc {
+ void (*f) (int, void *);
+ int fd;
+ void *closure;
+} Xf86SigIOFunc;
+
+static Xf86SigIOFunc xf86SigIOFuncs[MAX_FUNCS];
+static int xf86SigIOMax;
+static int xf86SigIOMaxFd;
+static fd_set xf86SigIOMask;
+
+/*
+ * SIGIO gives no way of discovering which fd signalled, select
+ * to discover
+ */
+static void
+xf86SIGIO (int sig)
+{
+ int i;
+ fd_set ready;
+ struct timeval to;
+ int save_errno = errno; /* do not clobber the global errno */
+ int r;
+
+ ready = xf86SigIOMask;
+ to.tv_sec = 0;
+ to.tv_usec = 0;
+ SYSCALL (r = select (xf86SigIOMaxFd, &ready, 0, 0, &to));
+ for (i = 0; r > 0 && i < xf86SigIOMax; i++)
+ if (xf86SigIOFuncs[i].f && FD_ISSET (xf86SigIOFuncs[i].fd, &ready))
+ {
+ (*xf86SigIOFuncs[i].f)(xf86SigIOFuncs[i].fd,
+ xf86SigIOFuncs[i].closure);
+ r--;
+ }
+ if (r > 0) {
+ xf86Msg(X_ERROR, "SIGIO %d descriptors not handled\n", r);
+ }
+ /* restore global errno */
+ errno = save_errno;
+}
+
+static int
+xf86IsPipe (int fd)
+{
+ struct stat buf;
+
+ if (fstat (fd, &buf) < 0)
+ return 0;
+ return S_ISFIFO(buf.st_mode);
+}
+
+int
+xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), void *closure)
+{
+ struct sigaction sa;
+ struct sigaction osa;
+ int i;
+ int blocked;
+ int installed = FALSE;
+
+ if (!xf86Info.useSIGIO)
+ return 0;
+
+ for (i = 0; i < MAX_FUNCS; i++)
+ {
+ if (!xf86SigIOFuncs[i].f)
+ {
+ if (xf86IsPipe (fd))
+ return 0;
+ blocked = xf86BlockSIGIO();
+#ifdef O_ASYNC
+ if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_ASYNC) == -1) {
+ xf86Msg(X_WARNING, "fcntl(%d, O_ASYNC): %s\n",
+ fd, strerror(errno));
+ } else {
+ if (fcntl(fd, F_SETOWN, getpid()) == -1) {
+ xf86Msg(X_WARNING, "fcntl(%d, F_SETOWN): %s\n",
+ fd, strerror(errno));
+ } else {
+ installed = TRUE;
+ }
+ }
+#endif
+#ifdef I_SETSIG /* System V Streams - used on Solaris for input devices */
+ if (!installed && isastream(fd)) {
+ if (ioctl(fd, I_SETSIG, S_INPUT | S_ERROR | S_HANGUP) == -1) {
+ xf86Msg(X_WARNING, "fcntl(%d, I_SETSIG): %s\n",
+ fd, strerror(errno));
+ } else {
+ installed = TRUE;
+ }
+ }
+#endif
+ if (!installed) {
+ xf86UnblockSIGIO(blocked);
+ return 0;
+ }
+ sigemptyset(&sa.sa_mask);
+ sigaddset(&sa.sa_mask, SIGIO);
+ sa.sa_flags = 0;
+ sa.sa_handler = xf86SIGIO;
+ sigaction(SIGIO, &sa, &osa);
+ xf86SigIOFuncs[i].fd = fd;
+ xf86SigIOFuncs[i].closure = closure;
+ xf86SigIOFuncs[i].f = f;
+ if (i >= xf86SigIOMax)
+ xf86SigIOMax = i+1;
+ if (fd >= xf86SigIOMaxFd)
+ xf86SigIOMaxFd = fd + 1;
+ FD_SET (fd, &xf86SigIOMask);
+ xf86UnblockSIGIO(blocked);
+ return 1;
+ }
+ /* Allow overwriting of the closure and callback */
+ else if (xf86SigIOFuncs[i].fd == fd)
+ {
+ xf86SigIOFuncs[i].closure = closure;
+ xf86SigIOFuncs[i].f = f;
+ return 1;
+ }
+ }
+ return 0;
+}
+
+int
+xf86RemoveSIGIOHandler(int fd)
+{
+ struct sigaction sa;
+ struct sigaction osa;
+ int i;
+ int max;
+ int maxfd;
+ int ret;
+
+ if (!xf86Info.useSIGIO)
+ return 0;
+
+ max = 0;
+ maxfd = -1;
+ ret = 0;
+ for (i = 0; i < MAX_FUNCS; i++)
+ {
+ if (xf86SigIOFuncs[i].f)
+ {
+ if (xf86SigIOFuncs[i].fd == fd)
+ {
+ xf86SigIOFuncs[i].f = 0;
+ xf86SigIOFuncs[i].fd = 0;
+ xf86SigIOFuncs[i].closure = 0;
+ FD_CLR (fd, &xf86SigIOMask);
+ ret = 1;
+ }
+ else
+ {
+ max = i + 1;
+ if (xf86SigIOFuncs[i].fd >= maxfd)
+ maxfd = xf86SigIOFuncs[i].fd + 1;
+ }
+ }
+ }
+ if (ret)
+ {
+#ifdef O_ASYNC
+ fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) & ~O_ASYNC);
+#endif
+#ifdef I_SETSIG
+ if (isastream(fd)) {
+ if (ioctl(fd, I_SETSIG, 0) == -1) {
+ xf86Msg(X_WARNING, "fcntl(%d, I_SETSIG, 0): %s\n",
+ fd, strerror(errno));
+ }
+ }
+#endif
+ xf86SigIOMax = max;
+ xf86SigIOMaxFd = maxfd;
+ if (!max)
+ {
+ sigemptyset(&sa.sa_mask);
+ sigaddset(&sa.sa_mask, SIGIO);
+ sa.sa_flags = 0;
+ sa.sa_handler = SIG_IGN;
+ sigaction(SIGIO, &sa, &osa);
+ }
+ }
+ return ret;
+}
+
+int
+xf86BlockSIGIO (void)
+{
+ sigset_t set, old;
+ int ret;
+
+ sigemptyset (&set);
+ sigaddset (&set, SIGIO);
+ sigprocmask (SIG_BLOCK, &set, &old);
+ ret = sigismember (&old, SIGIO);
+ return ret;
+}
+
+void
+xf86UnblockSIGIO (int wasset)
+{
+ sigset_t set;
+
+ if (!wasset)
+ {
+ sigemptyset (&set);
+ sigaddset (&set, SIGIO);
+ sigprocmask (SIG_UNBLOCK, &set, NULL);
+ }
+}
+
+void
+xf86AssertBlockedSIGIO (char *where)
+{
+ sigset_t set, old;
+
+ sigemptyset (&set);
+ sigprocmask (SIG_BLOCK, &set, &old);
+ if (!sigismember (&old, SIGIO))
+ xf86Msg (X_ERROR, "SIGIO not blocked at %s\n", where);
+}
+
+/* XXX This is a quick hack for the benefit of xf86SetSilkenMouse() */
+
+int
+xf86SIGIOSupported (void)
+{
+ return 1;
+}
diff --git a/xorg-server/hw/xfree86/parser/DRI.c b/xorg-server/hw/xfree86/parser/DRI.c
index 12b8d1d1a..4847bef2c 100644
--- a/xorg-server/hw/xfree86/parser/DRI.c
+++ b/xorg-server/hw/xfree86/parser/DRI.c
@@ -1,187 +1,123 @@
-/* DRI.c -- DRI Section in XF86Config file
- * Created: Fri Mar 19 08:40:22 1999 by faith@precisioninsight.com
- * Revised: Thu Jun 17 16:08:05 1999 by faith@precisioninsight.com
- *
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * 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
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * 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 MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * PRECISION INSIGHT AND/OR ITS SUPPLIERS 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_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Parser.h"
-#include "xf86tokens.h"
-#include "Configint.h"
-
-extern LexRec val;
-
-static xf86ConfigSymTabRec DRITab[] =
-{
- {ENDSECTION, "endsection"},
- {GROUP, "group"},
- {BUFFERS, "buffers"},
- {MODE, "mode"},
- {-1, ""},
-};
-
-#define CLEANUP xf86freeBuffersList
-
-static void
-xf86freeBuffersList (XF86ConfBuffersPtr ptr)
-{
- XF86ConfBuffersPtr prev;
-
- while (ptr) {
- TestFree (ptr->buf_flags);
- TestFree (ptr->buf_comment);
- prev = ptr;
- ptr = ptr->list.next;
- free (prev);
- }
-}
-
-static XF86ConfBuffersPtr
-xf86parseBuffers (void)
-{
- int token;
- parsePrologue (XF86ConfBuffersPtr, XF86ConfBuffersRec)
-
- if (xf86getSubToken (&(ptr->buf_comment)) != NUMBER)
- Error ("Buffers count expected", NULL);
- ptr->buf_count = val.num;
-
- if (xf86getSubToken (&(ptr->buf_comment)) != NUMBER)
- Error ("Buffers size expected", NULL);
- ptr->buf_size = val.num;
-
- if ((token = xf86getSubToken (&(ptr->buf_comment))) == STRING) {
- ptr->buf_flags = val.str;
- if ((token = xf86getToken (NULL)) == COMMENT)
- ptr->buf_comment = xf86addComment(ptr->buf_comment, val.str);
- else
- xf86unGetToken(token);
- }
-
-#ifdef DEBUG
- printf ("Buffers parsed\n");
-#endif
-
- return ptr;
-}
-
-#undef CLEANUP
-
-#define CLEANUP xf86freeDRI
-
-XF86ConfDRIPtr
-xf86parseDRISection (void)
-{
- int token;
- parsePrologue (XF86ConfDRIPtr, XF86ConfDRIRec);
-
- /* Zero is a valid value for this. */
- ptr->dri_group = -1;
- while ((token = xf86getToken (DRITab)) != ENDSECTION) {
- switch (token)
- {
- case GROUP:
- if ((token = xf86getSubToken (&(ptr->dri_comment))) == STRING)
- ptr->dri_group_name = val.str;
- else if (token == NUMBER)
- ptr->dri_group = val.num;
- else
- Error (GROUP_MSG, NULL);
- break;
- case MODE:
- if (xf86getSubToken (&(ptr->dri_comment)) != NUMBER)
- Error (NUMBER_MSG, "Mode");
- if (val.numType != PARSE_OCTAL)
- Error (MUST_BE_OCTAL_MSG, val.num);
- ptr->dri_mode = val.num;
- break;
- case BUFFERS:
- HANDLE_LIST (dri_buffers_lst, xf86parseBuffers,
- XF86ConfBuffersPtr);
- break;
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG, NULL);
- break;
- case COMMENT:
- ptr->dri_comment = xf86addComment(ptr->dri_comment, val.str);
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
- }
-
-#ifdef DEBUG
- ErrorF("DRI section parsed\n");
-#endif
-
- return ptr;
-}
-
-#undef CLEANUP
-
-void
-xf86printDRISection (FILE * cf, XF86ConfDRIPtr ptr)
-{
- XF86ConfBuffersPtr bufs;
-
- if (ptr == NULL)
- return;
-
- fprintf (cf, "Section \"DRI\"\n");
- if (ptr->dri_comment)
- fprintf (cf, "%s", ptr->dri_comment);
- if (ptr->dri_group_name)
- fprintf (cf, "\tGroup \"%s\"\n", ptr->dri_group_name);
- else if (ptr->dri_group >= 0)
- fprintf (cf, "\tGroup %d\n", ptr->dri_group);
- if (ptr->dri_mode)
- fprintf (cf, "\tMode 0%o\n", ptr->dri_mode);
- for (bufs = ptr->dri_buffers_lst; bufs; bufs = bufs->list.next) {
- fprintf (cf, "\tBuffers %d %d",
- bufs->buf_count, bufs->buf_size);
- if (bufs->buf_flags) fprintf (cf, " \"%s\"", bufs->buf_flags);
- if (bufs->buf_comment)
- fprintf(cf, "%s", bufs->buf_comment);
- else
- fprintf (cf, "\n");
- }
- fprintf (cf, "EndSection\n\n");
-}
-
-void
-xf86freeDRI (XF86ConfDRIPtr ptr)
-{
- if (ptr == NULL)
- return;
-
- xf86freeBuffersList (ptr->dri_buffers_lst);
- TestFree (ptr->dri_comment);
- free (ptr);
-}
+/* DRI.c -- DRI Section in XF86Config file
+ * Created: Fri Mar 19 08:40:22 1999 by faith@precisioninsight.com
+ * Revised: Thu Jun 17 16:08:05 1999 by faith@precisioninsight.com
+ *
+ * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * 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
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * 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 MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * PRECISION INSIGHT AND/OR ITS SUPPLIERS 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_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Parser.h"
+#include "xf86tokens.h"
+#include "Configint.h"
+
+extern LexRec val;
+
+static xf86ConfigSymTabRec DRITab[] =
+{
+ {ENDSECTION, "endsection"},
+ {GROUP, "group"},
+ {MODE, "mode"},
+ {-1, ""},
+};
+
+#define CLEANUP xf86freeDRI
+
+XF86ConfDRIPtr
+xf86parseDRISection (void)
+{
+ int token;
+ parsePrologue (XF86ConfDRIPtr, XF86ConfDRIRec);
+
+ /* Zero is a valid value for this. */
+ ptr->dri_group = -1;
+ while ((token = xf86getToken (DRITab)) != ENDSECTION) {
+ switch (token)
+ {
+ case GROUP:
+ if ((token = xf86getSubToken (&(ptr->dri_comment))) == STRING)
+ ptr->dri_group_name = val.str;
+ else if (token == NUMBER)
+ ptr->dri_group = val.num;
+ else
+ Error (GROUP_MSG, NULL);
+ break;
+ case MODE:
+ if (xf86getSubToken (&(ptr->dri_comment)) != NUMBER)
+ Error (NUMBER_MSG, "Mode");
+ if (val.numType != PARSE_OCTAL)
+ Error (MUST_BE_OCTAL_MSG, val.num);
+ ptr->dri_mode = val.num;
+ break;
+ case EOF_TOKEN:
+ Error (UNEXPECTED_EOF_MSG, NULL);
+ break;
+ case COMMENT:
+ ptr->dri_comment = xf86addComment(ptr->dri_comment, val.str);
+ break;
+ default:
+ Error (INVALID_KEYWORD_MSG, xf86tokenString ());
+ break;
+ }
+ }
+
+#ifdef DEBUG
+ ErrorF("DRI section parsed\n");
+#endif
+
+ return ptr;
+}
+
+#undef CLEANUP
+
+void
+xf86printDRISection (FILE * cf, XF86ConfDRIPtr ptr)
+{
+ if (ptr == NULL)
+ return;
+
+ fprintf (cf, "Section \"DRI\"\n");
+ if (ptr->dri_comment)
+ fprintf (cf, "%s", ptr->dri_comment);
+ if (ptr->dri_group_name)
+ fprintf (cf, "\tGroup \"%s\"\n", ptr->dri_group_name);
+ else if (ptr->dri_group >= 0)
+ fprintf (cf, "\tGroup %d\n", ptr->dri_group);
+ if (ptr->dri_mode)
+ fprintf (cf, "\tMode 0%o\n", ptr->dri_mode);
+ fprintf (cf, "EndSection\n\n");
+}
+
+void
+xf86freeDRI (XF86ConfDRIPtr ptr)
+{
+ if (ptr == NULL)
+ return;
+
+ TestFree (ptr->dri_comment);
+ free (ptr);
+}
diff --git a/xorg-server/hw/xfree86/parser/scan.c b/xorg-server/hw/xfree86/parser/scan.c
index 783a42545..b829868f7 100644
--- a/xorg-server/hw/xfree86/parser/scan.c
+++ b/xorg-server/hw/xfree86/parser/scan.c
@@ -115,53 +115,6 @@ static int pushToken = LOCK_TOKEN;
static int eol_seen = 0; /* private state to handle comments */
LexRec val;
-/*
- * xf86strToUL --
- *
- * A portable, but restricted, version of strtoul(). It only understands
- * hex, octal, and decimal. But it's good enough for our needs.
- */
-static unsigned int
-xf86strToUL (char *str)
-{
- int base = 10;
- char *p = str;
- unsigned int tot = 0;
-
- if (*p == '0')
- {
- p++;
- if ((*p == 'x') || (*p == 'X'))
- {
- p++;
- base = 16;
- }
- else
- base = 8;
- }
- while (*p)
- {
- if ((*p >= '0') && (*p <= ((base == 8) ? '7' : '9')))
- {
- tot = tot * base + (*p - '0');
- }
- else if ((base == 16) && (*p >= 'a') && (*p <= 'f'))
- {
- tot = tot * base + 10 + (*p - 'a');
- }
- else if ((base == 16) && (*p >= 'A') && (*p <= 'F'))
- {
- tot = tot * base + 10 + (*p - 'A');
- }
- else
- {
- return tot;
- }
- p++;
- }
- return tot;
-}
-
/*
* xf86getNextLine --
*
@@ -434,7 +387,7 @@ again:
configRBuf[i++] = c;
configPos--; /* GJA -- one too far */
configRBuf[i] = '\0';
- val.num = xf86strToUL (configRBuf);
+ val.num = strtoul (configRBuf, NULL, 0);
val.realnum = atof (configRBuf);
return NUMBER;
}
@@ -601,7 +554,6 @@ xf86pathIsSafe(const char *path)
* %P projroot
* %C sysconfdir
* %D datadir
- * %M config file format version number
* %% %
*/
@@ -626,11 +578,6 @@ xf86pathIsSafe(const char *path)
#ifndef XCONFENV
#define XCONFENV "XORGCONFIG"
#endif
-/* xorg.conf is based on XF86Config version 4. If we ever break
- compatibility of the xorg.conf syntax, we'll bump this version number. */
-#ifndef CONFIG_FILE_VERSION
-#define CONFIG_FILE_VERSION 4
-#endif
#define BAIL_OUT do { \
free(result); \
@@ -661,7 +608,6 @@ DoSubstitution(const char *template, const char *cmdline, const char *projroot,
int i, l;
static const char *env = NULL;
static char *hostname = NULL;
- static char majorvers[3] = "";
if (!template)
return NULL;
@@ -762,13 +708,6 @@ DoSubstitution(const char *template, const char *cmdline, const char *projroot,
case 'D':
APPEND_STR(DATADIR);
break;
- case 'M':
- if (!majorvers[0]) {
- snprintf(majorvers, sizeof(majorvers),
- "%d", CONFIG_FILE_VERSION);
- }
- APPEND_STR(majorvers);
- break;
case '%':
result[l++] = '%';
CHECK_LENGTH;
diff --git a/xorg-server/hw/xfree86/parser/xf86Parser.h b/xorg-server/hw/xfree86/parser/xf86Parser.h
index d35bbab27..f8c9c3cde 100644
--- a/xorg-server/hw/xfree86/parser/xf86Parser.h
+++ b/xorg-server/hw/xfree86/parser/xf86Parser.h
@@ -442,20 +442,9 @@ XF86ConfVendorRec, *XF86ConfVendorPtr;
typedef struct
{
- GenericListRec list;
- int buf_count;
- int buf_size;
- char *buf_flags;
- char *buf_comment;
-}
-XF86ConfBuffersRec, *XF86ConfBuffersPtr;
-
-typedef struct
-{
char *dri_group_name;
int dri_group;
int dri_mode;
- XF86ConfBuffersPtr dri_buffers_lst;
char *dri_comment;
}
XF86ConfDRIRec, *XF86ConfDRIPtr;
diff --git a/xorg-server/hw/xfree86/parser/xf86tokens.h b/xorg-server/hw/xfree86/parser/xf86tokens.h
index 3bea43d15..8c7ea1b28 100644
--- a/xorg-server/hw/xfree86/parser/xf86tokens.h
+++ b/xorg-server/hw/xfree86/parser/xf86tokens.h
@@ -273,7 +273,6 @@ typedef enum {
/* DRI Tokens */
GROUP,
- BUFFERS,
/* InputClass Tokens */
MATCH_PRODUCT,