[Midnightbsd-cvs] mports: x11-servers/xorg-server: update xorg-server to 1.5.3
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sun Mar 15 16:06:55 EDT 2009
Log Message:
-----------
update xorg-server to 1.5.3
Modified Files:
--------------
mports/x11-servers/xorg-server:
Makefile (r1.11 -> r1.12)
distinfo (r1.5 -> r1.6)
pkg-plist (r1.3 -> r1.4)
mports/x11-servers/xorg-server/files:
patch-Xserver-hw-xfree86-os-support-bsd-bsd_mouse.c (r1.1 -> r1.2)
patch-bsdResource.c (r1.2 -> r1.3)
patch-config-hal.c (r1.1 -> r1.2)
Added Files:
-----------
mports/x11-servers/xorg-server/files:
patch-Xserver-Xext-sync.c (r1.1)
patch-Xserver-hw-xfree86-common-compiler.h (r1.1)
Removed Files:
-------------
mports/x11-servers/xorg-server/files:
patch-Pci.h
patch-configure
patch-freebsdPci.c
xorg-xserver-1.4-multiple-overflows-v2.diff
-------------- next part --------------
Index: pkg-plist
===================================================================
RCS file: /home/cvs/mports/x11-servers/xorg-server/pkg-plist,v
retrieving revision 1.3
retrieving revision 1.4
diff -L x11-servers/xorg-server/pkg-plist -L x11-servers/xorg-server/pkg-plist -u -r1.3 -r1.4
--- x11-servers/xorg-server/pkg-plist
+++ x11-servers/xorg-server/pkg-plist
@@ -2,8 +2,6 @@
bin/Xorg
bin/cvt
bin/gtf
-bin/pcitweak
-%%AMD64_I386_SPARC64%%bin/scanpci
bin/xorgconfig
include/xorg/BT.h
include/xorg/IBM.h
@@ -35,6 +33,7 @@
include/xorg/dbestruct.h
include/xorg/dgaproc.h
include/xorg/dix.h
+include/xorg/dixaccess.h
include/xorg/dixevents.h
include/xorg/dixfont.h
include/xorg/dixfontstr.h
@@ -91,11 +90,13 @@
include/xorg/picturestr.h
include/xorg/pixmap.h
include/xorg/pixmapstr.h
+include/xorg/privates.h
include/xorg/property.h
include/xorg/propertyst.h
include/xorg/randrstr.h
include/xorg/region.h
include/xorg/regionstr.h
+include/xorg/registry.h
include/xorg/renderedge.h
include/xorg/resource.h
include/xorg/rgb.h
@@ -150,8 +151,6 @@
include/xorg/xf86Xinput.h
include/xorg/xf86_OSlib.h
include/xorg/xf86_OSproc.h
-include/xorg/xf86_ansic.h
-include/xorg/xf86_libc.h
include/xorg/xf86cmap.h
include/xorg/xf86fbman.h
include/xorg/xf86i2c.h
@@ -162,15 +161,15 @@
include/xorg/xf86xvmc.h
include/xorg/xf86xvpriv.h
include/xorg/xisb.h
+include/xorg/xkbfile.h
include/xorg/xkbsrv.h
+include/xorg/xkbstr.h
include/xorg/xorg-server.h
include/xorg/xorgVersion.h
include/xorg/xvdix.h
include/xorg/xvmcext.h
lib/X11/Cards
lib/X11/Options
-lib/xorg/modules/extensions/libGLcore.la
-lib/xorg/modules/extensions/libGLcore.so
lib/xorg/modules/extensions/libdbe.la
lib/xorg/modules/extensions/libdbe.so
lib/xorg/modules/extensions/libdri.la
@@ -185,8 +184,6 @@
lib/xorg/modules/extensions/libxtrap.so
lib/xorg/modules/fonts/libfreetype.la
lib/xorg/modules/fonts/libfreetype.so
-lib/xorg/modules/fonts/libtype1.la
-lib/xorg/modules/fonts/libtype1.so
lib/xorg/modules/libcfb.la
lib/xorg/modules/libcfb.so
lib/xorg/modules/libcfb32.la
@@ -199,10 +196,6 @@
lib/xorg/modules/libint10.so
lib/xorg/modules/libmfb.la
lib/xorg/modules/libmfb.so
-lib/xorg/modules/libpcidata.la
-lib/xorg/modules/libpcidata.so
-lib/xorg/modules/libscanpci.la
-lib/xorg/modules/libscanpci.so
lib/xorg/modules/libshadow.la
lib/xorg/modules/libshadow.so
lib/xorg/modules/libshadowfb.la
@@ -239,9 +232,8 @@
lib/xorg/modules/multimedia/tda9885_drv.so
lib/xorg/modules/multimedia/uda1380_drv.la
lib/xorg/modules/multimedia/uda1380_drv.so
-lib/xserver/SecurityPolicy
+lib/xorg/protocol.txt
libdata/pkgconfig/xorg-server.pc
-share/X11/xkb/compiled/README.compiled
share/aclocal/xorg-server.m4
@dirrm include/xorg
@dirrm lib/xorg/modules/fonts
@@ -250,7 +242,6 @@
@dirrm lib/xorg/modules/multimedia
@dirrm lib/xorg/modules
@dirrm lib/xorg
- at dirrm lib/xserver
@dirrmtry include/X11/bitmaps
@dirrmtry include/X11/pixmaps
@dirrmtry lib/X11/doc
Index: Makefile
===================================================================
RCS file: /home/cvs/mports/x11-servers/xorg-server/Makefile,v
retrieving revision 1.11
retrieving revision 1.12
diff -L x11-servers/xorg-server/Makefile -L x11-servers/xorg-server/Makefile -u -r1.11 -r1.12
--- x11-servers/xorg-server/Makefile
+++ x11-servers/xorg-server/Makefile
@@ -7,15 +7,12 @@
#
PORTNAME= xorg-server
-PORTVERSION= 1.4.2
+PORTVERSION= 1.5.3
PORTREVISION= 0
PORTEPOCH= 1
CATEGORIES= x11-servers
-MASTER_SITES= http://xorg.freedesktop.org/releases/individual/xserver/:fdo \
- ${MASTER_SITE_SOURCEFORGE:S/$/:mesa/}
-MASTER_SITE_SUBDIR=mesa3d/:mesa
-DISTFILES= xorg-server-${PORTVERSION}.tar.bz2:fdo \
- MesaLib-7.0.2.tar.bz2:mesa
+MASTER_SITES= http://xorg.freedesktop.org/releases/individual/xserver/
+DISTFILES= xorg-server-${PORTVERSION}.tar.bz2
MAINTAINER= ports at MidnightBSD.org
COMMENT= X.Org X server and related programs
@@ -26,18 +23,20 @@
XORG_CAT= xserver
+USE_GL= gl
USE_XORG= xf86driproto glproto xdmcp x11 xkbfile xxf86misc xxf86vm xaw7 \
xmu xt xpm xext randrproto renderproto fixesproto damageproto \
- xcmiscproto xextproto xproto xtrans xf86miscproto \
+ dri2proto xcmiscproto xextproto xproto xtrans xf86miscproto \
xf86vidmodeproto xf86bigfontproto scrnsaverproto bigreqsproto \
resourceproto fontsproto inputproto xf86dgaproto \
videoproto compositeproto trapproto recordproto xineramaproto \
- evieproto xfont fontenc xkbui pixman
+ evieproto xfont fontenc xkbui pixman pciaccess
+USE_OPENSSL= yes
USE_PERL5_BUILD=yes
-CONFIGURE_ARGS= --with-mesa-source=${WRKDIR}/Mesa-7.0.2 \
- --disable-dmx --disable-xvfb --disable-xnest --disable-xprint \
- --localstatedir=/var --without-dtrace
+CONFIGURE_ARGS= --disable-dmx --disable-xvfb --disable-xnest --disable-xprint \
+ --localstatedir=/var --without-dtrace --disable-xephyr \
+ --enable-record=yes --enable-xtrap=yes
OPTIONS= HAL "Compile with HAL config support" on \
AIGLX "Compile with Accelerated Indirect GLX support" on \
@@ -45,6 +44,13 @@
.include <bsd.port.pre.mk>
+.if defined(WITH_OPENSSL_BASE)
+# The reason why I use this is cause openssl from base doesn't install a .pc file
+# and configure will fail trying to find it. Setting both of those variables to
+# a *non-empty* value by-passes the pkg-config check.
+CONFIGURE_ENV= SHA1_LIB="-L/usr/lib -lcrypto" SHA1_CFLAGS="-I/usr/include"
+.endif
+
.if !defined(WITHOUT_HAL)
LIB_DEPENDS+= hal.1:${PORTSDIR}/sysutils/hal
CONFIGURE_ARGS+= --enable-config-hal=yes
@@ -68,12 +74,10 @@
Xserver.1 \
cvt.1 \
gtf.1 \
- pcitweak.1 \
xorgconfig.1
MAN4= exa.4 \
fbdevhw.4
-MAN5= xorg.conf.5 \
- SecurityPolicy.5
+MAN5= xorg.conf.5
.if ${ARCH} == sparc64
PLIST_SUB+= SPARC64=""
@@ -85,7 +89,6 @@
.if ${ARCH} == amd64 || ${ARCH} == i386 || ${ARCH} == sparc64
PLIST_SUB+= AMD64_I386_SPARC64=""
-MAN1+= scanpci.1
.else
PLIST_SUB+= AMD64_I386_SPARC64="@comment "
.endif
Index: distinfo
===================================================================
RCS file: /home/cvs/mports/x11-servers/xorg-server/distinfo,v
retrieving revision 1.5
retrieving revision 1.6
diff -L x11-servers/xorg-server/distinfo -L x11-servers/xorg-server/distinfo -u -r1.5 -r1.6
--- x11-servers/xorg-server/distinfo
+++ x11-servers/xorg-server/distinfo
@@ -1,6 +1,6 @@
-MD5 (xorg/xserver/xorg-server-1.4.2.tar.bz2) = fa2915ae377f61c340a18ebef484b64b
-SHA256 (xorg/xserver/xorg-server-1.4.2.tar.bz2) = 829c66ec4c295822700067c87afae796b8e67530cc65a7b83060ea29a4ff316d
-SIZE (xorg/xserver/xorg-server-1.4.2.tar.bz2) = 6216638
+MD5 (xorg/xserver/xorg-server-1.5.3.tar.bz2) = 308971036e25250e7fe3cccfd5a120f8
+SHA256 (xorg/xserver/xorg-server-1.5.3.tar.bz2) = a680174f54be7763819e5275c5d5d44fc9e9b6f8e9351dd45c150eb4c182d5bb
+SIZE (xorg/xserver/xorg-server-1.5.3.tar.bz2) = 5622625
MD5 (xorg/xserver/MesaLib-7.0.2.tar.bz2) = 93e6ed7924ff069a4f883b4fce5349dc
SHA256 (xorg/xserver/MesaLib-7.0.2.tar.bz2) = 9d4707b556960f6aef14480f91fcd4f868720f64321947ab1b2fd20e85ce7f9e
SIZE (xorg/xserver/MesaLib-7.0.2.tar.bz2) = 3353217
Index: patch-Xserver-hw-xfree86-os-support-bsd-bsd_mouse.c
===================================================================
RCS file: /home/cvs/mports/x11-servers/xorg-server/files/patch-Xserver-hw-xfree86-os-support-bsd-bsd_mouse.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -L x11-servers/xorg-server/files/patch-Xserver-hw-xfree86-os-support-bsd-bsd_mouse.c -L x11-servers/xorg-server/files/patch-Xserver-hw-xfree86-os-support-bsd-bsd_mouse.c -u -r1.1 -r1.2
--- x11-servers/xorg-server/files/patch-Xserver-hw-xfree86-os-support-bsd-bsd_mouse.c
+++ x11-servers/xorg-server/files/patch-Xserver-hw-xfree86-os-support-bsd-bsd_mouse.c
@@ -1,11 +1,11 @@
---- hw/xfree86/os-support/bsd/bsd_mouse.c.orig 2007-08-23 15:05:48.000000000 -0400
-+++ hw/xfree86/os-support/bsd/bsd_mouse.c 2008-04-08 15:41:42.000000000 -0400
+--- hw/xfree86/os-support/bsd/bsd_mouse.c.orig 2008-11-05 11:52:17.000000000 -0500
++++ hw/xfree86/os-support/bsd/bsd_mouse.c 2009-02-04 12:54:48.000000000 -0500
@@ -1,4 +1,3 @@
-
/*
* Copyright (c) 1999-2003 by The XFree86 Project, Inc.
*
-@@ -76,11 +75,15 @@
+@@ -76,11 +75,13 @@
#define DEFAULT_MOUSE_DEV "/dev/mouse"
#define DEFAULT_SYSMOUSE_DEV "/dev/sysmouse"
#define DEFAULT_PS2_DEV "/dev/psm0"
@@ -14,14 +14,12 @@
static const char *mouseDevs[] = {
DEFAULT_MOUSE_DEV,
DEFAULT_SYSMOUSE_DEV,
-+#ifndef CONFIG_HAL
DEFAULT_PS2_DEV,
+ DEFAULT_USB_DEV,
-+#endif
NULL
};
- #elif defined(__OpenBSD__) && defined(WSCONS_SUPPORT)
-@@ -101,7 +104,11 @@
+ #elif (defined(__OpenBSD__) || defined(__NetBSD__)) && defined(WSCONS_SUPPORT)
+@@ -101,7 +102,11 @@
#if defined(__NetBSD__)
return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO;
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
@@ -34,7 +32,7 @@
#else
return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_XPS2 | MSE_AUTO;
#endif
-@@ -180,10 +187,31 @@
+@@ -180,10 +185,31 @@
{ MOUSE_PROTO_THINK, "ThinkingMouse" },
{ MOUSE_PROTO_SYSMOUSE, "SysMouse" }
};
@@ -67,29 +65,25 @@
int i;
mousehw_t hw;
mousemode_t mode;
-@@ -191,10 +219,20 @@
+@@ -191,10 +217,16 @@
if (pInfo->fd == -1)
return NULL;
+#ifdef XPS2_SUPPORT
/* set the driver operation level, if applicable */
-+ if ((dev = xf86FindOptionValue(pInfo->options, "Device"))) {
-+ if (!strncmp(dev, DEFAULT_PS2_DEV, 8))
-+ i = 2;
-+ else
-+ i = 1;
-+ ioctl(pInfo->fd, MOUSE_SETLEVEL, &i);
-+ }
-+#else
++ dev = xf86FindOptionValue(pInfo->options, "Device");
++ if (dev != NULL && !strncmp(dev, DEFAULT_PS2_DEV, 8))
++ i = 2;
++ else
++#endif
i = 1;
ioctl(pInfo->fd, MOUSE_SETLEVEL, &i);
-
-+#endif
+
/* interrogate the driver and get some intelligence on the device. */
hw.iftype = MOUSE_IF_UNKNOWN;
hw.model = MOUSE_MODEL_GENERIC;
-@@ -210,9 +248,18 @@
+@@ -210,9 +242,18 @@
protoPara[0] = mode.syncmask[0];
protoPara[1] = mode.syncmask[1];
}
@@ -110,7 +104,7 @@
}
}
}
-@@ -235,41 +282,41 @@
+@@ -235,41 +276,41 @@
(protocol && xf86NameCmp(protocol, "SysMouse") == 0)) {
/*
* As the FreeBSD sysmouse driver defaults to protocol level 0
@@ -169,10 +163,48 @@
}
return FALSE;
}
-@@ -309,15 +356,12 @@
+@@ -277,17 +318,17 @@
+ static const char *
+ FindDevice(InputInfoPtr pInfo, const char *protocol, int flags)
+ {
+- int fd = -1;
++ int ret = -1;
+ const char **pdev, *dev = NULL;
+ Bool devMouse = FALSE;
+ struct stat devMouseStat;
+ struct stat sb;
+
+ for (pdev = mouseDevs; *pdev; pdev++) {
+- SYSCALL (fd = open(*pdev, O_RDWR | O_NONBLOCK));
+- if (fd == -1) {
++ SYSCALL (ret = stat(*pdev, &sb));
++ if (ret == -1) {
+ #ifdef DEBUG
+- ErrorF("Cannot open %s (%s)\n", *pdev, strerror(errno));
++ ErrorF("Cannot stat %s (%s)\n", *pdev, strerror(errno));
+ #endif
+ } else {
+ /*
+@@ -296,28 +337,32 @@
+ * the test for whether /dev/sysmouse is usable can be made.
+ */
+ if (!strcmp(*pdev, DEFAULT_MOUSE_DEV)) {
+- if (fstat(fd, &devMouseStat) == 0)
+- devMouse = TRUE;
+- close(fd);
++ memcpy(&devMouseStat, &sb, sizeof(devMouseStat));
++ devMouse = TRUE;
+ continue;
+ } else if (!strcmp(*pdev, DEFAULT_SYSMOUSE_DEV)) {
+ /* Check if /dev/mouse is the same as /dev/sysmouse. */
+- if (devMouse && fstat(fd, &sb) == 0 &&
+- devMouseStat.st_dev == sb.st_dev &&
++ if (devMouse && devMouseStat.st_dev == sb.st_dev &&
+ devMouseStat.st_ino == sb.st_ino) {
+ /* If the same, use /dev/sysmouse. */
devMouse = FALSE;
}
- close(fd);
+- close(fd);
- if (MousedRunning())
+ if (MousedRunning(NULL))
break;
@@ -182,13 +214,24 @@
-#endif
- }
} else {
- close(fd);
+- close(fd);
++ /* Check if /dev/mouse is the same as this device. */
++ if (devMouse && devMouseStat.st_dev == sb.st_dev &&
++ devMouseStat.st_ino == sb.st_ino) {
++ /* If the same, use this device. */
++ devMouse = FALSE;
++ }
+ if (MousedRunning(*pdev))
+ continue;
++ /* ums(4) does not support anything but SysMouse protocol. */
++ if (!strncmp(*pdev, DEFAULT_USB_DEV, 8) && protocol &&
++ xf86NameCmp(protocol, "auto") != 0 &&
++ xf86NameCmp(protocol, "sysmouse") != 0)
++ continue;
break;
}
}
-@@ -775,7 +819,9 @@
+@@ -775,7 +820,9 @@
p->CheckProtocol = CheckProtocol;
#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)) && defined(MOUSE_PROTO_SYSMOUSE)
p->SetupAuto = SetupAuto;
Index: patch-config-hal.c
===================================================================
RCS file: /home/cvs/mports/x11-servers/xorg-server/files/patch-config-hal.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -L x11-servers/xorg-server/files/patch-config-hal.c -L x11-servers/xorg-server/files/patch-config-hal.c -u -r1.1 -r1.2
--- x11-servers/xorg-server/files/patch-config-hal.c
+++ x11-servers/xorg-server/files/patch-config-hal.c
@@ -1,10 +1,143 @@
---- config/hal.c.orig 2007-08-23 15:04:52.000000000 -0400
-+++ config/hal.c 2008-03-27 18:36:36.000000000 -0400
-@@ -212,6 +212,7 @@
- }
-
- add_option(&options, "path", path);
-+ add_option(&options, "device", path);
- add_option(&options, "driver", driver);
- add_option(&options, "name", name);
- config_info = xalloc(strlen(udi) + 5); /* "hal:" and NULL */
+--- config/hal.c.orig 2008-11-14 16:27:05.000000000 -0500
++++ config/hal.c 2009-02-08 01:17:28.000000000 -0500
+@@ -467,11 +467,10 @@
+ info->system_bus = NULL;
+ }
+
+-static void
+-connect_hook(DBusConnection *connection, void *data)
++static BOOL
++connect_and_register(DBusConnection *connection, struct config_hal_info *info)
+ {
+ DBusError error;
+- struct config_hal_info *info = data;
+ char **devices;
+ int num_devices, i;
+
+@@ -479,8 +478,10 @@
+
+ dbus_error_init(&error);
+
+- if (!info->hal_ctx)
+- info->hal_ctx = libhal_ctx_new();
++ if (info->hal_ctx)
++ return TRUE; /* already registered, pretend we did something */
++
++ info->hal_ctx = libhal_ctx_new();
+ if (!info->hal_ctx) {
+ LogMessage(X_ERROR, "config/hal: couldn't create HAL context\n");
+ goto out_err;
+@@ -512,7 +513,7 @@
+
+ dbus_error_free(&error);
+
+- return;
++ return TRUE;
+
+ out_ctx2:
+ if (!libhal_ctx_shutdown(info->hal_ctx, &error))
+@@ -526,6 +527,104 @@
+ info->hal_ctx = NULL;
+ info->system_bus = NULL;
+
++ return FALSE;
++}
++
++
++/**
++ * Handle NewOwnerChanged signals to deal with HAL startup at X server runtime.
++ *
++ * NewOwnerChanged is send once when HAL shuts down, and once again when it
++ * comes back up. Message has three arguments, first is the name
++ * (org.freedesktop.Hal), the second one is the old owner, third one is new
++ * owner.
++ */
++static DBusHandlerResult
++ownerchanged_handler(DBusConnection *connection, DBusMessage *message, void *data)
++{
++ int ret = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
++
++ if (dbus_message_is_signal(message,
++ "org.freedesktop.DBus",
++ "NameOwnerChanged")) {
++ DBusError error;
++ char *name, *old_owner, *new_owner;
++
++ dbus_error_init(&error);
++ dbus_message_get_args(message, &error,
++ DBUS_TYPE_STRING, &name,
++ DBUS_TYPE_STRING, &old_owner,
++ DBUS_TYPE_STRING, &new_owner,
++ DBUS_TYPE_INVALID);
++
++ if (dbus_error_is_set(&error)) {
++ ErrorF("[config/hal] failed to get NameOwnerChanged args: %s (%s)\n",
++ error.name, error.message);
++ } else if (name && strcmp(name, "org.freedesktop.Hal") == 0) {
++
++ if (!old_owner || !strlen(old_owner)) {
++ DebugF("[config/hal] HAL startup detected.\n");
++ if (connect_and_register(connection, (struct config_hal_info*)data))
++ dbus_connection_unregister_object_path(connection,
++ "/org/freedesktop/DBus");
++ else
++ ErrorF("[config/hal] Failed to connect to HAL bus.\n");
++ }
++
++ ret = DBUS_HANDLER_RESULT_HANDLED;
++ }
++ dbus_error_free(&error);
++ }
++
++ return ret;
++}
++
++/**
++ * Register a handler for the NameOwnerChanged signal.
++ */
++static BOOL
++listen_for_startup(DBusConnection *connection, void *data)
++{
++ DBusObjectPathVTable vtable = { .message_function = ownerchanged_handler, };
++ DBusError error;
++ const char MATCH_RULE[] = "sender='org.freedesktop.DBus',"
++ "interface='org.freedesktop.DBus',"
++ "type='signal',"
++ "path='/org/freedesktop/DBus',"
++ "member='NameOwnerChanged'";
++ int rc = FALSE;
++
++ dbus_error_init(&error);
++ dbus_bus_add_match(connection, MATCH_RULE, &error);
++ if (!dbus_error_is_set(&error)) {
++ if (dbus_connection_register_object_path(connection,
++ "/org/freedesktop/DBus",
++ &vtable,
++ data))
++ rc = TRUE;
++ else
++ ErrorF("[config/hal] cannot register object path.\n");
++ } else {
++ ErrorF("[config/hal] couldn't add match rule: %s (%s)\n", error.name,
++ error.message);
++ ErrorF("[config/hal] cannot detect a HAL startup.\n");
++ }
++
++ dbus_error_free(&error);
++
++ return rc;
++}
++
++static void
++connect_hook(DBusConnection *connection, void *data)
++{
++ struct config_hal_info *info = data;
++
++ if (listen_for_startup(connection, data) &&
++ connect_and_register(connection, info))
++ dbus_connection_unregister_object_path(connection,
++ "/org/freedesktop/DBus");
++
+ return;
+ }
+
--- x11-servers/xorg-server/files/patch-Pci.h
+++ /dev/null
@@ -1,88 +0,0 @@
---- hw/xfree86/os-support/bus/Pci.h.orig 2007-09-06 02:48:26.000000000 +0200
-+++ hw/xfree86/os-support/bus/Pci.h 2007-09-28 21:43:06.000000000 +0200
-@@ -112,6 +112,10 @@
- #include "xf86Pci.h"
- #include "xf86PciInfo.h"
-
-+#if defined(__FreeBSD__)
-+#include <osreldate.h>
-+#endif
-+
- /*
- * Global Definitions
- */
-@@ -123,6 +127,10 @@
- # define MAX_PCI_DOMAINS 512
- # define PCI_DOM_MASK 0x01fful
- # define MAX_PCI_BUSES (MAX_PCI_DOMAINS*256) /* 256 per domain */
-+#elif defined(FreeBSD) && __FreeBSD_version >= 700053 && !defined(__i386__)
-+# define MAX_PCI_DOMAINS 256 /* limited by 32-bit xf86 PCITAG */
-+# define PCI_DOM_MASK (MAX_PCI_DOMAINS - 1)
-+# define MAX_PCI_BUSES (MAX_PCI_DOMAINS*256) /* 256 per domain */
- #else
- # define MAX_PCI_BUSES 256 /* Max number of PCI buses */
- #endif
-@@ -238,7 +246,9 @@
- # elif defined(__FreeBSD__) || defined(__OpenBSD__)
- # define ARCH_PCI_INIT freebsdPciInit
- # define INCLUDE_XF86_MAP_PCI_MEM
--# define INCLUDE_XF86_NO_DOMAIN
-+# if __FreeBSD_version < 700053 || defined(__OpenBSD__)
-+# define INCLUDE_XF86_NO_DOMAIN
-+# endif
- # elif defined(__NetBSD__)
- # define ARCH_PCI_INIT netbsdPciInit
- # define INCLUDE_XF86_MAP_PCI_MEM
-@@ -260,10 +270,12 @@
- # if defined(linux)
- # define ARCH_PCI_INIT ia64linuxPciInit
- # define INCLUDE_XF86_MAP_PCI_MEM
--# elif defined(FreeBSD)
-+# elif defined(FreeBSD) || defined(__OpenBSD__)
- # define ARCH_PCI_INIT freebsdPciInit
- # define INCLUDE_XF86_MAP_PCI_MEM
--# define INCLUDE_XF86_NO_DOMAIN
-+# if __FreeBSD_version < 700053 || defined(__OpenBSD__)
-+# define INCLUDE_XF86_NO_DOMAIN
-+# endif
- # endif
- # define XF86SCANPCI_WRAPPER ia64ScanPCIWrapper
- #elif defined(__i386__) || defined(i386)
-@@ -293,7 +305,9 @@
- # elif defined(__FreeBSD__) || defined(__OpenBSD__)
- # define ARCH_PCI_INIT freebsdPciInit
- # define INCLUDE_XF86_MAP_PCI_MEM
--# define INCLUDE_XF86_NO_DOMAIN
-+# if __FreeBSD_version < 700053 || defined(__OpenBSD__)
-+# define INCLUDE_XF86_NO_DOMAIN
-+# endif
- # elif defined(__NetBSD__)
- # define ARCH_PCI_INIT netbsdPciInit
- # define INCLUDE_XF86_MAP_PCI_MEM
-@@ -325,7 +339,9 @@
- # elif (defined(__OpenBSD__) || defined(__FreeBSD__)) && defined(__sparc64__)
- # define ARCH_PCI_INIT freebsdPciInit
- # define INCLUDE_XF86_MAP_PCI_MEM
--# define INCLUDE_XF86_NO_DOMAIN
-+# if __FreeBSD_version < 700053 || defined(__OpenBSD__)
-+# define INCLUDE_XF86_NO_DOMAIN
-+# endif
- # endif
- # if !defined(__FreeBSD__) && !defined(linux)
- # define ARCH_PCI_PCI_BRIDGE sparcPciPciBridge
-@@ -333,11 +349,14 @@
- #elif defined(__amd64__) || defined(__amd64)
- # if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- # define ARCH_PCI_INIT freebsdPciInit
-+# if __FreeBSD_version < 700053 || defined(__FreeBSD_kernel__)
-+# define INCLUDE_XF86_NO_DOMAIN
-+# endif
- # else
- # define ARCH_PCI_INIT ix86PciInit
-+# define INCLUDE_XF86_NO_DOMAIN
- # endif
- # define INCLUDE_XF86_MAP_PCI_MEM
--# define INCLUDE_XF86_NO_DOMAIN
- # if defined(linux)
- # define ARCH_PCI_OS_INIT linuxPciInit
- # endif
--- x11-servers/xorg-server/files/patch-freebsdPci.c
+++ /dev/null
@@ -1,306 +0,0 @@
---- hw/xfree86/os-support/bus/freebsdPci.c.orig Thu Sep 6 02:48:26 2007
-+++ hw/xfree86/os-support/bus/freebsdPci.c Sat Sep 29 12:22:56 2007
-@@ -109,10 +109,6 @@
- #define PCI_CPU(val) (val)
- #endif
-
--
--#define BUS(tag) (((tag)>>16)&0xff)
--#define DFN(tag) (((tag)>>8)&0xff)
--
- static int pciFd = -1;
-
- void
-@@ -133,9 +129,12 @@
- {
- struct pci_io io;
- int error;
-- io.pi_sel.pc_bus = BUS(tag);
-- io.pi_sel.pc_dev = DFN(tag) >> 3;
-- io.pi_sel.pc_func = DFN(tag) & 7;
-+#ifndef INCLUDE_XF86_NO_DOMAIN
-+ io.pi_sel.pc_domain = PCI_DOM_FROM_TAG(tag);
-+#endif
-+ io.pi_sel.pc_bus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(tag));
-+ io.pi_sel.pc_dev = PCI_DEV_FROM_TAG(tag);
-+ io.pi_sel.pc_func = PCI_FUNC_FROM_TAG(tag);
- io.pi_reg = off;
- io.pi_width = 4;
- error = ioctl(pciFd, PCIOCREAD, &io);
-@@ -148,9 +147,12 @@
- freebsdPciCfgWrite(PCITAG tag, int off, CARD32 val)
- {
- struct pci_io io;
-- io.pi_sel.pc_bus = BUS(tag);
-- io.pi_sel.pc_dev = DFN(tag) >> 3;
-- io.pi_sel.pc_func = DFN(tag) & 7;
-+#ifndef INCLUDE_XF86_NO_DOMAIN
-+ io.pi_sel.pc_domain = PCI_DOM_FROM_TAG(tag);
-+#endif
-+ io.pi_sel.pc_bus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(tag));
-+ io.pi_sel.pc_dev = PCI_DEV_FROM_TAG(tag);
-+ io.pi_sel.pc_func = PCI_FUNC_FROM_TAG(tag);
- io.pi_reg = off;
- io.pi_width = 4;
- io.pi_data = PCI_CPU(val);
-@@ -164,3 +166,260 @@
- val = (val & ~mask) | (bits & mask);
- freebsdPciCfgWrite(tag, off, val);
- }
-+
-+#ifndef INCLUDE_XF86_NO_DOMAIN
-+
-+/* This probably shouldn't be FreeBSD-specific. */
-+static pciConfigPtr
-+xf86GetPciHostConfigFromTag(PCITAG Tag)
-+{
-+ int bus = PCI_BUS_FROM_TAG(Tag);
-+ pciBusInfo_t *pBusInfo;
-+
-+ while ((bus < pciNumBuses) && (pBusInfo = pciBusInfo[bus])) {
-+ if (bus == pBusInfo->primary_bus)
-+ return pBusInfo->bridge;
-+ bus = pBusInfo->primary_bus;
-+ }
-+
-+ return NULL; /* Bad data */
-+}
-+
-+/*
-+ * This is ugly, but until I can extract this information from the kernel,
-+ * it'll have to do. The default I/O space size is 64K, and 4G for memory.
-+ * Anything else needs to go in this table. (PowerPC folk take note.)
-+ *
-+ * Please keep this table in ascending vendor/device order.
-+ */
-+static const struct pciSizes {
-+ unsigned short vendor, device;
-+ unsigned long io_size, mem_size;
-+} pciControllerSizes[] = {
-+ {
-+ PCI_VENDOR_SUN, PCI_CHIP_PSYCHO,
-+ 1U << 16, 1U << 31
-+ },
-+ {
-+ PCI_VENDOR_SUN, PCI_CHIP_SCHIZO,
-+ 1U << 24, 1U << 31 /* ??? */
-+ },
-+ {
-+ PCI_VENDOR_SUN, PCI_CHIP_SABRE,
-+ 1U << 24, (unsigned long)(1ULL << 32)
-+ },
-+ {
-+ PCI_VENDOR_SUN, PCI_CHIP_HUMMINGBIRD,
-+ 1U << 24, (unsigned long)(1ULL << 32)
-+ }
-+};
-+#define NUM_SIZES (sizeof(pciControllerSizes) / sizeof(pciControllerSizes[0]))
-+
-+static const struct pciSizes *
-+freebsdGetSizesStruct(PCITAG Tag)
-+{
-+ static const struct pciSizes default_size = {
-+ 0, 0, 1U << 16, (unsigned long)(1ULL << 32)
-+ };
-+ pciConfigPtr pPCI;
-+ int i;
-+
-+ /* Find host bridge */
-+ if ((pPCI = xf86GetPciHostConfigFromTag(Tag))) {
-+ /* Look up vendor/device */
-+ for (i = 0; i < NUM_SIZES; i++) {
-+ if ((pPCI->pci_vendor ==
-+ pciControllerSizes[i].vendor) &&
-+ (pPCI->pci_device ==
-+ pciControllerSizes[i].device)) {
-+ return & pciControllerSizes[i];
-+ }
-+ }
-+ }
-+
-+ /* Default to 64KB I/O and 4GB memory. */
-+ return & default_size;
-+}
-+
-+static __inline__ unsigned long
-+freebsdGetIOSize(PCITAG Tag)
-+{
-+ const struct pciSizes * const sizes = freebsdGetSizesStruct(Tag);
-+ return sizes->io_size;
-+}
-+
-+static __inline__ void
-+freebsdGetSizes(PCITAG Tag, unsigned long *io_size, unsigned long *mem_size)
-+{
-+ const struct pciSizes * const sizes = freebsdGetSizesStruct(Tag);
-+
-+ *io_size = sizes->io_size;
-+ *mem_size = sizes->mem_size;
-+}
-+
-+_X_EXPORT int
-+xf86GetPciDomain(PCITAG Tag)
-+{
-+ return PCI_DOM_FROM_TAG(Tag);
-+}
-+
-+_X_EXPORT pointer
-+xf86MapDomainMemory(int ScreenNum, int Flags, PCITAG Tag, ADDRESS Base,
-+ unsigned long Size)
-+{
-+ return xf86MapVidMem(ScreenNum, Flags, Base, Size);
-+}
-+
-+_X_EXPORT IOADDRESS
-+xf86MapDomainIO(int ScreenNum, int Flags, PCITAG Tag, IOADDRESS Base,
-+ unsigned long Size)
-+{
-+ return Base;
-+}
-+
-+_X_EXPORT int
-+xf86ReadDomainMemory(PCITAG Tag, ADDRESS Base, int Len, unsigned char *Buf)
-+{
-+ int ret, length, rlength;
-+
-+ /* Read in 64kB chunks. */
-+ ret = 0;
-+ while ((length = Len) > 0) {
-+ if (length > 0x010000) length = 0x010000;
-+ rlength = xf86ReadBIOS(Base, 0, Buf, length);
-+ if (rlength < 0) {
-+ ret = rlength;
-+ break;
-+ }
-+ ret += rlength;
-+ if (rlength < length) break;
-+ Base += rlength;
-+ Buf += rlength;
-+ Len -= rlength;
-+ }
-+
-+ return ret;
-+}
-+
-+resPtr
-+xf86BusAccWindowsFromOS(void)
-+{
-+ pciConfigPtr *ppPCI, pPCI;
-+ resPtr pRes = NULL;
-+ resRange range;
-+ unsigned long io_size, mem_size;
-+ int domain;
-+
-+ if ((ppPCI = xf86scanpci(0))) {
-+ for (; (pPCI = *ppPCI); ppPCI++) {
-+ if ((pPCI->pci_base_class != PCI_CLASS_BRIDGE) ||
-+ (pPCI->pci_sub_class != PCI_SUBCLASS_BRIDGE_HOST))
-+ continue;
-+
-+ domain = xf86GetPciDomain(pPCI->tag);
-+ freebsdGetSizes(pPCI->tag, &io_size, &mem_size);
-+
-+ RANGE(range, 0, (ADDRESS)(mem_size - 1),
-+ RANGE_TYPE(ResExcMemBlock, domain));
-+ pRes = xf86AddResToList(pRes, &range, -1);
-+
-+ RANGE(range, 0, (IOADDRESS)(io_size - 1),
-+ RANGE_TYPE(ResExcIoBlock, domain));
-+ pRes = xf86AddResToList(pRes, &range, -1);
-+
-+ if (domain <= 0)
-+ break;
-+ }
-+ }
-+
-+ return pRes;
-+}
-+
-+resPtr
-+xf86PciBusAccWindowsFromOS(void)
-+{
-+ pciConfigPtr *ppPCI, pPCI;
-+ resPtr pRes = NULL;
-+ resRange range;
-+ unsigned long io_size, mem_size;
-+ int domain;
-+
-+ if ((ppPCI = xf86scanpci(0))) {
-+ for (; (pPCI = *ppPCI); ppPCI++) {
-+ if ((pPCI->pci_base_class != PCI_CLASS_BRIDGE) ||
-+ (pPCI->pci_sub_class != PCI_SUBCLASS_BRIDGE_HOST))
-+ continue;
-+
-+ domain = xf86GetPciDomain(pPCI->tag);
-+ freebsdGetSizes(pPCI->tag, &io_size, &mem_size);
-+
-+ RANGE(range, 0, (ADDRESS)(mem_size - 1),
-+ RANGE_TYPE(ResExcMemBlock, domain));
-+ pRes = xf86AddResToList(pRes, &range, -1);
-+
-+ RANGE(range, 0, (IOADDRESS)(io_size - 1),
-+ RANGE_TYPE(ResExcIoBlock, domain));
-+ pRes = xf86AddResToList(pRes, &range, -1);
-+
-+ if (domain <= 0)
-+ break;
-+ }
-+ }
-+
-+ return pRes;
-+}
-+
-+resPtr
-+xf86AccResFromOS(resPtr pRes)
-+{
-+ pciConfigPtr *ppPCI, pPCI;
-+ resRange range;
-+ unsigned long io_size, mem_size;
-+ int domain;
-+
-+ if ((ppPCI = xf86scanpci(0))) {
-+ for (; (pPCI = *ppPCI); ppPCI++) {
-+ if ((pPCI->pci_base_class != PCI_CLASS_BRIDGE) ||
-+ (pPCI->pci_sub_class != PCI_SUBCLASS_BRIDGE_HOST))
-+ continue;
-+
-+ domain = xf86GetPciDomain(pPCI->tag);
-+ freebsdGetSizes(pPCI->tag, &io_size, &mem_size);
-+
-+ /*
-+ * At minimum, the top and bottom resources must be
-+ * claimed, so that resources that are (or appear to
-+ * be) unallocated can be relocated.
-+ */
-+ RANGE(range, 0x00000000u, 0x0009ffffu,
-+ RANGE_TYPE(ResExcMemBlock, domain));
-+ pRes = xf86AddResToList(pRes, &range, -1);
-+ RANGE(range, 0x000c0000u, 0x000effffu,
-+ RANGE_TYPE(ResExcMemBlock, domain));
-+ pRes = xf86AddResToList(pRes, &range, -1);
-+ RANGE(range, 0x000f0000u, 0x000fffffu,
-+ RANGE_TYPE(ResExcMemBlock, domain));
-+ pRes = xf86AddResToList(pRes, &range, -1);
-+
-+ RANGE(range, (ADDRESS)(mem_size - 1),
-+ (ADDRESS)(mem_size - 1),
-+ RANGE_TYPE(ResExcMemBlock, domain));
-+ pRes = xf86AddResToList(pRes, &range, -1);
-+
-+ RANGE(range, 0x00000000u, 0x00000000u,
-+ RANGE_TYPE(ResExcIoBlock, domain));
-+ pRes = xf86AddResToList(pRes, &range, -1);
-+ RANGE(range, (IOADDRESS)(io_size - 1),
-+ (IOADDRESS)(io_size - 1),
-+ RANGE_TYPE(ResExcIoBlock, domain));
-+ pRes = xf86AddResToList(pRes, &range, -1);
-+
-+ if (domain <= 0)
-+ break;
-+ }
-+ }
-+
-+ return pRes;
-+}
-+
-+#endif /* !INCLUDE_XF86_NO_DOMAIN */
--- /dev/null
+++ x11-servers/xorg-server/files/patch-Xserver-hw-xfree86-common-compiler.h
@@ -0,0 +1,11 @@
+--- hw/xfree86/common/compiler.h.orig 2009-03-02 12:21:23.000000000 -0600
++++ hw/xfree86/common/compiler.h 2009-03-02 12:21:29.000000000 -0600
+@@ -498,7 +498,7 @@
+ extern unsigned int inw(unsigned long port);
+ extern unsigned int inl(unsigned long port);
+
+-# elif defined(linux) && (defined(__amd64__) || defined(__x86_64__))
++# elif defined(linux) || defined(__FreeBSD__) && (defined(__amd64__) || defined(__x86_64__))
+
+ # include <inttypes.h>
+
Index: patch-bsdResource.c
===================================================================
RCS file: /home/cvs/mports/x11-servers/xorg-server/files/patch-bsdResource.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L x11-servers/xorg-server/files/patch-bsdResource.c -L x11-servers/xorg-server/files/patch-bsdResource.c -u -r1.2 -r1.3
--- x11-servers/xorg-server/files/patch-bsdResource.c
+++ x11-servers/xorg-server/files/patch-bsdResource.c
@@ -1,15 +1,15 @@
---- hw/xfree86/os-support/bsd/bsdResource.c.orig Fri Apr 23 21:54:07 2004
-+++ hw/xfree86/os-support/bsd/bsdResource.c Tue May 17 00:48:36 2005
-@@ -18,7 +18,7 @@
+--- hw/xfree86/os-support/bsd/bsdResource.c.orig 2008-07-19 12:47:13.000000000 +0100
++++ hw/xfree86/os-support/bsd/bsdResource.c 2008-07-19 12:52:03.000000000 +0100
+@@ -19,7 +19,7 @@
#ifdef INCLUDE_XF86_NO_DOMAIN
--#if defined(__alpha__) || defined(__sparc64__) || defined(__amd64__)
-+#if defined(__alpha__) || defined(__amd64__)
+-#if defined(__alpha__) || defined(__sparc64__) || defined(__amd64__) || defined(__x86_64__)
++#if defined(__alpha__) || defined(__amd64__) || defined(__x86_64__)
resPtr
- xf86BusAccWindowsFromOS(void)
-@@ -112,7 +112,7 @@
+ xf86AccResFromOS(resPtr ret)
+@@ -60,7 +60,7 @@
return ret;
}
@@ -17,44 +17,8 @@
+#elif defined(__powerpc__) || defined(__sparc__) || defined(__sparc64__)
resPtr
- xf86BusAccWindowsFromOS(void)
-@@ -123,7 +123,11 @@
- RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock);
- ret = xf86AddResToList(ret, &range, -1);
-
-+#if defined(__sparc__) || defined(__sparc64__)
-+ RANGE(range, 0x00000000, 0x00ffffff, ResExcIoBlock);
-+#else
- RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock);
-+#endif
- ret = xf86AddResToList(ret, &range, -1);
- return ret;
- }
-@@ -137,7 +141,11 @@
- RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock);
- ret = xf86AddResToList(ret, &range, -1);
-
-+#if defined(__sparc__) || defined(__sparc64__)
-+ RANGE(range, 0x00000000, 0x00ffffff, ResExcIoBlock);
-+#else
- RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock);
-+#endif
- ret = xf86AddResToList(ret, &range, -1);
- return ret;
- }
-@@ -153,7 +161,11 @@
- RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock);
- ret = xf86AddResToList(ret, &range, -1);
-
-+#if defined(__sparc__) || defined(__sparc64__)
-+ RANGE(range, 0x00000000, 0x00ffffff, ResExcIoBlock);
-+#else
- RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock);
-+#endif
- ret = xf86AddResToList(ret, &range, -1);
- return ret;
- }
-@@ -175,7 +187,11 @@
+ xf86AccResFromOS(resPtr ret)
+@@ -77,7 +77,11 @@
ret = xf86AddResToList(ret, &range, -1);
RANGE(range, 0x00000000, 0x00000000, ResExcIoBlock);
ret = xf86AddResToList(ret, &range, -1);
--- x11-servers/xorg-server/files/patch-configure
+++ /dev/null
@@ -1,11 +0,0 @@
---- configure.orig 2008-02-28 16:08:55.000000000 -0500
-+++ configure 2008-02-28 16:11:19.000000000 -0500
-@@ -30376,7 +30376,7 @@
- else
- cat >conftest.$ac_ext <<_ACEOF
-
--#define _POSIX_C_SOURCE 199309L
-+#define _POSIX_C_SOURCE 200112L
- #include <time.h>
-
- int main(int argc, char *argv[]) {
--- x11-servers/xorg-server/files/xorg-xserver-1.4-multiple-overflows-v2.diff
+++ /dev/null
@@ -1,515 +0,0 @@
-diff --git a/Xext/EVI.c b/Xext/EVI.c
-index 8fe3481..13bd32a 100644
---- a/Xext/EVI.c
-+++ b/Xext/EVI.c
-@@ -34,6 +34,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
- #include <X11/extensions/XEVIstr.h>
- #include "EVIstruct.h"
- #include "modinit.h"
-+#include "scrnintstr.h"
-
- #if 0
- static unsigned char XEVIReqCode = 0;
-@@ -87,10 +88,22 @@ ProcEVIGetVisualInfo(ClientPtr client)
- {
- REQUEST(xEVIGetVisualInfoReq);
- xEVIGetVisualInfoReply rep;
-- int n, n_conflict, n_info, sz_info, sz_conflict;
-+ int i, n, n_conflict, n_info, sz_info, sz_conflict;
- VisualID32 *conflict;
-+ unsigned int total_visuals = 0;
- xExtendedVisualInfo *eviInfo;
- int status;
-+
-+ /*
-+ * do this first, otherwise REQUEST_FIXED_SIZE can overflow. we assume
-+ * here that you don't have more than 2^32 visuals over all your screens;
-+ * this seems like a safe assumption.
-+ */
-+ for (i = 0; i < screenInfo.numScreens; i++)
-+ total_visuals += screenInfo.screens[i]->numVisuals;
-+ if (stuff->n_visual > total_visuals)
-+ return BadValue;
-+
- REQUEST_FIXED_SIZE(xEVIGetVisualInfoReq, stuff->n_visual * sz_VisualID32);
- status = eviPriv->getVisualInfo((VisualID32 *)&stuff[1], (int)stuff->n_visual,
- &eviInfo, &n_info, &conflict, &n_conflict);
-diff --git a/Xext/cup.c b/Xext/cup.c
-index 6bfa278..781b9ce 100644
---- a/Xext/cup.c
-+++ b/Xext/cup.c
-@@ -196,6 +196,9 @@ int ProcGetReservedColormapEntries(
-
- REQUEST_SIZE_MATCH (xXcupGetReservedColormapEntriesReq);
-
-+ if (stuff->screen >= screenInfo.numScreens)
-+ return BadValue;
-+
- #ifndef HAVE_SPECIAL_DESKTOP_COLORS
- citems[CUP_BLACK_PIXEL].pixel =
- screenInfo.screens[stuff->screen]->blackPixel;
-diff --git a/Xext/sampleEVI.c b/Xext/sampleEVI.c
-index 7508aa7..b871bfd 100644
---- a/Xext/sampleEVI.c
-+++ b/Xext/sampleEVI.c
-@@ -34,6 +34,13 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
- #include <X11/extensions/XEVIstr.h>
- #include "EVIstruct.h"
- #include "scrnintstr.h"
-+
-+#if HAVE_STDINT_H
-+#include <stdint.h>
-+#elif !defined(UINT32_MAX)
-+#define UINT32_MAX 0xffffffffU
-+#endif
-+
- static int sampleGetVisualInfo(
- VisualID32 *visual,
- int n_visual,
-@@ -42,24 +49,36 @@ static int sampleGetVisualInfo(
- VisualID32 **conflict_rn,
- int *n_conflict_rn)
- {
-- int max_sz_evi = n_visual * sz_xExtendedVisualInfo * screenInfo.numScreens;
-+ unsigned int max_sz_evi;
- VisualID32 *temp_conflict;
- xExtendedVisualInfo *evi;
-- int max_visuals = 0, max_sz_conflict, sz_conflict = 0;
-+ unsigned int max_visuals = 0, max_sz_conflict, sz_conflict = 0;
- register int visualI, scrI, sz_evi = 0, conflictI, n_conflict;
-- *evi_rn = evi = (xExtendedVisualInfo *)xalloc(max_sz_evi);
-- if (!*evi_rn)
-- return BadAlloc;
-+
-+ if (n_visual > UINT32_MAX/(sz_xExtendedVisualInfo * screenInfo.numScreens))
-+ return BadAlloc;
-+ max_sz_evi = n_visual * sz_xExtendedVisualInfo * screenInfo.numScreens;
-+
- for (scrI = 0; scrI < screenInfo.numScreens; scrI++) {
- if (screenInfo.screens[scrI]->numVisuals > max_visuals)
- max_visuals = screenInfo.screens[scrI]->numVisuals;
- }
-+
-+ if (n_visual > UINT32_MAX/(sz_VisualID32 * screenInfo.numScreens
-+ * max_visuals))
-+ return BadAlloc;
- max_sz_conflict = n_visual * sz_VisualID32 * screenInfo.numScreens * max_visuals;
-+
-+ *evi_rn = evi = (xExtendedVisualInfo *)xalloc(max_sz_evi);
-+ if (!*evi_rn)
-+ return BadAlloc;
-+
- temp_conflict = (VisualID32 *)xalloc(max_sz_conflict);
- if (!temp_conflict) {
- xfree(*evi_rn);
- return BadAlloc;
- }
-+
- for (scrI = 0; scrI < screenInfo.numScreens; scrI++) {
- for (visualI = 0; visualI < n_visual; visualI++) {
- evi[sz_evi].core_visual_id = visual[visualI];
-diff --git a/Xext/security.c b/Xext/security.c
-index ba057de..e9d48c9 100644
---- a/Xext/security.c
-+++ b/Xext/security.c
-@@ -1563,7 +1563,7 @@ SecurityLoadPropertyAccessList(void)
- if (!SecurityPolicyFile)
- return;
-
-- f = fopen(SecurityPolicyFile, "r");
-+ f = Fopen(SecurityPolicyFile, "r");
- if (!f)
- {
- ErrorF("error opening security policy file %s\n",
-@@ -1646,7 +1646,7 @@ SecurityLoadPropertyAccessList(void)
- }
- #endif /* PROPDEBUG */
-
-- fclose(f);
-+ Fclose(f);
- } /* SecurityLoadPropertyAccessList */
-
-
-diff --git a/Xext/shm.c b/Xext/shm.c
-index ac587be..6f99e90 100644
---- a/Xext/shm.c
-+++ b/Xext/shm.c
-@@ -711,6 +711,8 @@ ProcPanoramiXShmCreatePixmap(
- int i, j, result, rc;
- ShmDescPtr shmdesc;
- REQUEST(xShmCreatePixmapReq);
-+ unsigned int width, height, depth;
-+ unsigned long size;
- PanoramiXRes *newPix;
-
- REQUEST_SIZE_MATCH(xShmCreatePixmapReq);
-@@ -724,11 +726,18 @@ ProcPanoramiXShmCreatePixmap(
- return rc;
-
- VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
-- if (!stuff->width || !stuff->height)
-+
-+ width = stuff->width;
-+ height = stuff->height;
-+ depth = stuff->depth;
-+ if (!width || !height || !depth)
- {
- client->errorValue = 0;
- return BadValue;
- }
-+ if (width > 32767 || height > 32767)
-+ return BadAlloc;
-+
- if (stuff->depth != 1)
- {
- pDepth = pDraw->pScreen->allowedDepths;
-@@ -738,10 +747,18 @@ ProcPanoramiXShmCreatePixmap(
- client->errorValue = stuff->depth;
- return BadValue;
- }
-+
- CreatePmap:
-- VERIFY_SHMSIZE(shmdesc, stuff->offset,
-- PixmapBytePad(stuff->width, stuff->depth) * stuff->height,
-- client);
-+ size = PixmapBytePad(width, depth) * height;
-+ if (sizeof(size) == 4 && BitsPerPixel(depth) > 8) {
-+ if (size < width * height)
-+ return BadAlloc;
-+ /* thankfully, offset is unsigned */
-+ if (stuff->offset + size < size)
-+ return BadAlloc;
-+ }
-+
-+ VERIFY_SHMSIZE(shmdesc, stuff->offset, size, client);
-
- if(!(newPix = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
- return BadAlloc;
-@@ -1040,6 +1057,8 @@ ProcShmCreatePixmap(client)
- register int i, rc;
- ShmDescPtr shmdesc;
- REQUEST(xShmCreatePixmapReq);
-+ unsigned int width, height, depth;
-+ unsigned long size;
-
- REQUEST_SIZE_MATCH(xShmCreatePixmapReq);
- client->errorValue = stuff->pid;
-@@ -1052,11 +1071,18 @@ ProcShmCreatePixmap(client)
- return rc;
-
- VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
-- if (!stuff->width || !stuff->height)
-+
-+ width = stuff->width;
-+ height = stuff->height;
-+ depth = stuff->depth;
-+ if (!width || !height || !depth)
- {
- client->errorValue = 0;
- return BadValue;
- }
-+ if (width > 32767 || height > 32767)
-+ return BadAlloc;
-+
- if (stuff->depth != 1)
- {
- pDepth = pDraw->pScreen->allowedDepths;
-@@ -1066,10 +1092,18 @@ ProcShmCreatePixmap(client)
- client->errorValue = stuff->depth;
- return BadValue;
- }
-+
- CreatePmap:
-- VERIFY_SHMSIZE(shmdesc, stuff->offset,
-- PixmapBytePad(stuff->width, stuff->depth) * stuff->height,
-- client);
-+ size = PixmapBytePad(width, depth) * height;
-+ if (sizeof(size) == 4 && BitsPerPixel(depth) > 8) {
-+ if (size < width * height)
-+ return BadAlloc;
-+ /* thankfully, offset is unsigned */
-+ if (stuff->offset + size < size)
-+ return BadAlloc;
-+ }
-+
-+ VERIFY_SHMSIZE(shmdesc, stuff->offset, size, client);
- pMap = (*shmFuncs[pDraw->pScreen->myNum]->CreatePixmap)(
- pDraw->pScreen, stuff->width,
- stuff->height, stuff->depth,
-diff --git a/Xi/chgfctl.c b/Xi/chgfctl.c
-index 2e0e13c..235d659 100644
---- a/Xi/chgfctl.c
-+++ b/Xi/chgfctl.c
-@@ -327,18 +327,13 @@ ChangeStringFeedback(ClientPtr client, DeviceIntPtr dev,
- xStringFeedbackCtl * f)
- {
- char n;
-- long *p;
- int i, j;
- KeySym *syms, *sup_syms;
-
- syms = (KeySym *) (f + 1);
- if (client->swapped) {
- swaps(&f->length, n); /* swapped num_keysyms in calling proc */
-- p = (long *)(syms);
-- for (i = 0; i < f->num_keysyms; i++) {
-- swapl(p, n);
-- p++;
-- }
-+ SwapLongs((CARD32 *) syms, f->num_keysyms);
- }
-
- if (f->num_keysyms > s->ctrl.max_symbols) {
-diff --git a/Xi/chgkmap.c b/Xi/chgkmap.c
-index eac520f..75ee9f5 100644
---- a/Xi/chgkmap.c
-+++ b/Xi/chgkmap.c
-@@ -79,18 +79,14 @@ int
- SProcXChangeDeviceKeyMapping(ClientPtr client)
- {
- char n;
-- long *p;
-- int i, count;
-+ unsigned int count;
-
- REQUEST(xChangeDeviceKeyMappingReq);
- swaps(&stuff->length, n);
- REQUEST_AT_LEAST_SIZE(xChangeDeviceKeyMappingReq);
-- p = (long *)&stuff[1];
- count = stuff->keyCodes * stuff->keySymsPerKeyCode;
-- for (i = 0; i < count; i++) {
-- swapl(p, n);
-- p++;
-- }
-+ REQUEST_FIXED_SIZE(xChangeDeviceKeyMappingReq, count * sizeof(CARD32));
-+ SwapLongs((CARD32 *) (&stuff[1]), count);
- return (ProcXChangeDeviceKeyMapping(client));
- }
-
-@@ -106,10 +102,14 @@ ProcXChangeDeviceKeyMapping(ClientPtr client)
- int ret;
- unsigned len;
- DeviceIntPtr dev;
-+ unsigned int count;
-
- REQUEST(xChangeDeviceKeyMappingReq);
- REQUEST_AT_LEAST_SIZE(xChangeDeviceKeyMappingReq);
-
-+ count = stuff->keyCodes * stuff->keySymsPerKeyCode;
-+ REQUEST_FIXED_SIZE(xChangeDeviceKeyMappingReq, count * sizeof(CARD32));
-+
- dev = LookupDeviceIntRec(stuff->deviceid);
- if (dev == NULL) {
- SendErrorToClient(client, IReqCode, X_ChangeDeviceKeyMapping, 0,
-diff --git a/Xi/chgprop.c b/Xi/chgprop.c
-index 59a93c6..21bda5b 100644
---- a/Xi/chgprop.c
-+++ b/Xi/chgprop.c
-@@ -81,19 +81,15 @@ int
- SProcXChangeDeviceDontPropagateList(ClientPtr client)
- {
- char n;
-- long *p;
-- int i;
-
- REQUEST(xChangeDeviceDontPropagateListReq);
- swaps(&stuff->length, n);
- REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq);
- swapl(&stuff->window, n);
- swaps(&stuff->count, n);
-- p = (long *)&stuff[1];
-- for (i = 0; i < stuff->count; i++) {
-- swapl(p, n);
-- p++;
-- }
-+ REQUEST_FIXED_SIZE(xChangeDeviceDontPropagateListReq,
-+ stuff->count * sizeof(CARD32));
-+ SwapLongs((CARD32 *) (&stuff[1]), stuff->count);
- return (ProcXChangeDeviceDontPropagateList(client));
- }
-
-diff --git a/Xi/grabdev.c b/Xi/grabdev.c
-index e2809ef..d0b4ae7 100644
---- a/Xi/grabdev.c
-+++ b/Xi/grabdev.c
-@@ -82,8 +82,6 @@ int
- SProcXGrabDevice(ClientPtr client)
- {
- char n;
-- long *p;
-- int i;
-
- REQUEST(xGrabDeviceReq);
- swaps(&stuff->length, n);
-@@ -91,11 +89,11 @@ SProcXGrabDevice(ClientPtr client)
- swapl(&stuff->grabWindow, n);
- swapl(&stuff->time, n);
- swaps(&stuff->event_count, n);
-- p = (long *)&stuff[1];
-- for (i = 0; i < stuff->event_count; i++) {
-- swapl(p, n);
-- p++;
-- }
-+
-+ if (stuff->length != (sizeof(xGrabDeviceReq) >> 2) + stuff->event_count)
-+ return BadLength;
-+
-+ SwapLongs((CARD32 *) (&stuff[1]), stuff->event_count);
-
- return (ProcXGrabDevice(client));
- }
-diff --git a/Xi/grabdevb.c b/Xi/grabdevb.c
-index df62d0c..18db1f7 100644
---- a/Xi/grabdevb.c
-+++ b/Xi/grabdevb.c
-@@ -80,8 +80,6 @@ int
- SProcXGrabDeviceButton(ClientPtr client)
- {
- char n;
-- long *p;
-- int i;
-
- REQUEST(xGrabDeviceButtonReq);
- swaps(&stuff->length, n);
-@@ -89,11 +87,9 @@ SProcXGrabDeviceButton(ClientPtr client)
- swapl(&stuff->grabWindow, n);
- swaps(&stuff->modifiers, n);
- swaps(&stuff->event_count, n);
-- p = (long *)&stuff[1];
-- for (i = 0; i < stuff->event_count; i++) {
-- swapl(p, n);
-- p++;
-- }
-+ REQUEST_FIXED_SIZE(xGrabDeviceButtonReq,
-+ stuff->event_count * sizeof(CARD32));
-+ SwapLongs((CARD32 *) (&stuff[1]), stuff->event_count);
-
- return (ProcXGrabDeviceButton(client));
- }
-diff --git a/Xi/grabdevk.c b/Xi/grabdevk.c
-index b74592f..429b2f7 100644
---- a/Xi/grabdevk.c
-+++ b/Xi/grabdevk.c
-@@ -80,8 +80,6 @@ int
- SProcXGrabDeviceKey(ClientPtr client)
- {
- char n;
-- long *p;
-- int i;
-
- REQUEST(xGrabDeviceKeyReq);
- swaps(&stuff->length, n);
-@@ -89,11 +87,8 @@ SProcXGrabDeviceKey(ClientPtr client)
- swapl(&stuff->grabWindow, n);
- swaps(&stuff->modifiers, n);
- swaps(&stuff->event_count, n);
-- p = (long *)&stuff[1];
-- for (i = 0; i < stuff->event_count; i++) {
-- swapl(p, n);
-- p++;
-- }
-+ REQUEST_FIXED_SIZE(xGrabDeviceKeyReq, stuff->event_count * sizeof(CARD32));
-+ SwapLongs((CARD32 *) (&stuff[1]), stuff->event_count);
- return (ProcXGrabDeviceKey(client));
- }
-
-diff --git a/Xi/selectev.c b/Xi/selectev.c
-index d52db1b..19415c5 100644
---- a/Xi/selectev.c
-+++ b/Xi/selectev.c
-@@ -131,19 +131,16 @@ int
- SProcXSelectExtensionEvent(ClientPtr client)
- {
- char n;
-- long *p;
-- int i;
-
- REQUEST(xSelectExtensionEventReq);
- swaps(&stuff->length, n);
- REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq);
- swapl(&stuff->window, n);
- swaps(&stuff->count, n);
-- p = (long *)&stuff[1];
-- for (i = 0; i < stuff->count; i++) {
-- swapl(p, n);
-- p++;
-- }
-+ REQUEST_FIXED_SIZE(xSelectExtensionEventReq,
-+ stuff->count * sizeof(CARD32));
-+ SwapLongs((CARD32 *) (&stuff[1]), stuff->count);
-+
- return (ProcXSelectExtensionEvent(client));
- }
-
-diff --git a/Xi/sendexev.c b/Xi/sendexev.c
-index eac9abe..9803cf3 100644
---- a/Xi/sendexev.c
-+++ b/Xi/sendexev.c
-@@ -83,7 +83,7 @@ int
- SProcXSendExtensionEvent(ClientPtr client)
- {
- char n;
-- long *p;
-+ CARD32 *p;
- int i;
- xEvent eventT;
- xEvent *eventP;
-@@ -94,6 +94,11 @@ SProcXSendExtensionEvent(ClientPtr client)
- REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq);
- swapl(&stuff->destination, n);
- swaps(&stuff->count, n);
-+
-+ if (stuff->length != (sizeof(xSendExtensionEventReq) >> 2) + stuff->count +
-+ (stuff->num_events * (sizeof(xEvent) >> 2)))
-+ return BadLength;
-+
- eventP = (xEvent *) & stuff[1];
- for (i = 0; i < stuff->num_events; i++, eventP++) {
- proc = EventSwapVector[eventP->u.u.type & 0177];
-@@ -103,11 +108,8 @@ SProcXSendExtensionEvent(ClientPtr client)
- *eventP = eventT;
- }
-
-- p = (long *)(((xEvent *) & stuff[1]) + stuff->num_events);
-- for (i = 0; i < stuff->count; i++) {
-- swapl(p, n);
-- p++;
-- }
-+ p = (CARD32 *)(((xEvent *) & stuff[1]) + stuff->num_events);
-+ SwapLongs(p, stuff->count);
- return (ProcXSendExtensionEvent(client));
- }
-
-diff --git a/dix/dixfonts.c b/dix/dixfonts.c
-index c21b3ec..7bb2404 100644
---- a/dix/dixfonts.c
-+++ b/dix/dixfonts.c
-@@ -325,6 +325,13 @@ doOpenFont(ClientPtr client, OFclosurePtr c)
- err = BadFontName;
- goto bail;
- }
-+ /* check values for firstCol, lastCol, firstRow, and lastRow */
-+ if (pfont->info.firstCol > pfont->info.lastCol ||
-+ pfont->info.firstRow > pfont->info.lastRow ||
-+ pfont->info.lastCol - pfont->info.firstCol > 255) {
-+ err = AllocError;
-+ goto bail;
-+ }
- if (!pfont->fpe)
- pfont->fpe = fpe;
- pfont->refcnt++;
-diff --git a/hw/xfree86/common/xf86MiscExt.c b/hw/xfree86/common/xf86MiscExt.c
-index 655304e..ccb4f75 100644
---- a/hw/xfree86/common/xf86MiscExt.c
-+++ b/hw/xfree86/common/xf86MiscExt.c
-@@ -568,6 +568,10 @@ MiscExtPassMessage(int scrnIndex, const char *msgtype, const char *msgval,
-
- DEBUG_P("MiscExtPassMessage");
-
-+ /* should check this in the protocol, but xf86NumScreens isn't exported */
-+ if (scrnIndex >= xf86NumScreens)
-+ return BadValue;
-+
- if (*pScr->HandleMessage == NULL)
- return BadImplementation;
- return (*pScr->HandleMessage)(scrnIndex, msgtype, msgval, retstr);
--- /dev/null
+++ x11-servers/xorg-server/files/patch-Xserver-Xext-sync.c
@@ -0,0 +1,90 @@
+--- Xext/sync.c.orig 2008-11-05 10:52:17.000000000 -0600
++++ Xext/sync.c 2009-03-08 17:04:38.000000000 -0500
+@@ -2533,7 +2533,7 @@
+ * IDLETIME implementation
+ */
+
+-static pointer IdleTimeCounter;
++static SyncCounter *IdleTimeCounter;
+ static XSyncValue *pIdleTimeValueLess;
+ static XSyncValue *pIdleTimeValueGreater;
+
+@@ -2545,38 +2545,69 @@
+ }
+
+ static void
+-IdleTimeBlockHandler (pointer env,
+- struct timeval **wt,
+- pointer LastSelectMask)
++IdleTimeBlockHandler(pointer env, struct timeval **wt, pointer LastSelectMask)
+ {
+- XSyncValue idle;
++ XSyncValue idle, old_idle;
++ SyncTriggerList *list = IdleTimeCounter->pTriglist;
++ SyncTrigger *trig;
+
+ if (!pIdleTimeValueLess && !pIdleTimeValueGreater)
+ return;
+
++ old_idle = IdleTimeCounter->value;
+ IdleTimeQueryValue (NULL, &idle);
++ IdleTimeCounter->value = idle; /* push, so CheckTrigger works */
+
+ if (pIdleTimeValueLess &&
+ XSyncValueLessOrEqual (idle, *pIdleTimeValueLess))
+ {
+- AdjustWaitForDelay (wt, 0);
++ /*
++ * We've been idle for less than the threshold value, and someone
++ * wants to know about that, but now we need to know whether they
++ * want level or edge trigger. Check the trigger list against the
++ * current idle time, and if any succeed, bomb out of select()
++ * immediately so we can reschedule.
++ */
++
++ for (list = IdleTimeCounter->pTriglist; list; list = list->next) {
++ trig = list->pTrigger;
++ if (trig->CheckTrigger(trig, old_idle)) {
++ AdjustWaitForDelay(wt, 0);
++ break;
++ }
++ }
+ }
+ else if (pIdleTimeValueGreater)
+ {
+- unsigned long timeout = 0;
++ /*
++ * There's a threshold in the positive direction. If we've been
++ * idle less than it, schedule a wakeup for sometime in the future.
++ * If we've been idle more than it, and someone wants to know about
++ * that level-triggered, schedule an immediate wakeup.
++ */
++ unsigned long timeout = -1;
+
+- if (XSyncValueLessThan (idle, *pIdleTimeValueGreater))
+- {
++ if (XSyncValueLessThan (idle, *pIdleTimeValueGreater)) {
+ XSyncValue value;
+ Bool overflow;
+
+ XSyncValueSubtract (&value, *pIdleTimeValueGreater,
+ idle, &overflow);
+- timeout = XSyncValueLow32 (value);
++ timeout = min(timeout, XSyncValueLow32 (value));
++ } else {
++ for (list = IdleTimeCounter->pTriglist; list; list = list->next) {
++ trig = list->pTrigger;
++ if (trig->CheckTrigger(trig, old_idle)) {
++ timeout = min(timeout, 0);
++ break;
++ }
++ }
+ }
+
+ AdjustWaitForDelay (wt, timeout);
+ }
++
++ IdleTimeCounter->value = old_idle; /* pop */
+ }
+
+ static void
More information about the Midnightbsd-cvs
mailing list