summaryrefslogtreecommitdiff
path: root/hw/xfree86
diff options
context:
space:
mode:
Diffstat (limited to 'hw/xfree86')
-rw-r--r--hw/xfree86/common/Makefile.am7
-rw-r--r--hw/xfree86/common/modeline2c.awk97
-rw-r--r--hw/xfree86/common/modeline2c.pl107
-rw-r--r--hw/xfree86/common/xf86.h11
-rw-r--r--hw/xfree86/common/xf86AutoConfig.c22
-rw-r--r--hw/xfree86/common/xf86Bus.c29
-rw-r--r--hw/xfree86/common/xf86Bus.h1
-rw-r--r--hw/xfree86/common/xf86Config.c32
-rw-r--r--hw/xfree86/common/xf86Configure.c29
-rw-r--r--hw/xfree86/common/xf86DGA.c44
-rw-r--r--hw/xfree86/common/xf86DPMS.c48
-rw-r--r--hw/xfree86/common/xf86DefModes.c155
-rw-r--r--hw/xfree86/common/xf86Events.c6
-rw-r--r--hw/xfree86/common/xf86Globals.c8
-rw-r--r--hw/xfree86/common/xf86Helper.c17
-rw-r--r--hw/xfree86/common/xf86Init.c32
-rw-r--r--hw/xfree86/common/xf86Mode.c48
-rw-r--r--hw/xfree86/common/xf86Module.h4
-rw-r--r--hw/xfree86/common/xf86PM.c2
-rw-r--r--hw/xfree86/common/xf86Priv.h2
-rw-r--r--hw/xfree86/common/xf86RandR.c20
-rw-r--r--hw/xfree86/common/xf86VidMode.c27
-rw-r--r--hw/xfree86/common/xf86Xinput.c1
-rw-r--r--hw/xfree86/common/xf86cmap.c122
-rw-r--r--hw/xfree86/common/xf86fbman.c148
-rw-r--r--hw/xfree86/common/xf86sbusBus.c13
-rw-r--r--hw/xfree86/common/xf86str.h1
-rw-r--r--hw/xfree86/common/xf86xv.c45
-rw-r--r--hw/xfree86/common/xf86xvmc.c20
-rw-r--r--hw/xfree86/common/xf86xvpriv.h3
-rw-r--r--hw/xfree86/ddc/ddcProperty.c1
-rw-r--r--hw/xfree86/dixmods/extmod/modinit.h5
-rw-r--r--hw/xfree86/dixmods/extmod/xf86dga2.c30
-rw-r--r--hw/xfree86/dixmods/extmod/xf86misc.c40
-rw-r--r--hw/xfree86/dixmods/extmod/xf86vmode.c43
-rw-r--r--hw/xfree86/dixmods/extmod/xvmod.c2
-rw-r--r--hw/xfree86/dixmods/extmod/xvmodproc.h2
-rw-r--r--hw/xfree86/dixmods/xkbKillSrv.c4
-rw-r--r--hw/xfree86/doc/man/xorg.conf.man.pre4
-rw-r--r--hw/xfree86/dri/dri.c52
-rw-r--r--hw/xfree86/dri/dristruct.h22
-rw-r--r--hw/xfree86/exa/exa.man.pre6
-rw-r--r--hw/xfree86/exa/examodule.c26
-rw-r--r--hw/xfree86/loader/dixsym.c64
-rw-r--r--hw/xfree86/loader/loadmod.c2
-rw-r--r--hw/xfree86/loader/misym.c4
-rw-r--r--hw/xfree86/loader/xf86sym.c195
-rw-r--r--hw/xfree86/modes/xf86Crtc.c82
-rw-r--r--hw/xfree86/modes/xf86Cursors.c5
-rw-r--r--hw/xfree86/modes/xf86EdidModes.c9
-rw-r--r--hw/xfree86/modes/xf86Modes.c69
-rw-r--r--hw/xfree86/modes/xf86Modes.h5
-rw-r--r--hw/xfree86/modes/xf86RandR12.c60
-rw-r--r--hw/xfree86/os-support/Makefile.am2
-rw-r--r--hw/xfree86/os-support/bsd/Makefile.am1
-rw-r--r--hw/xfree86/os-support/bsd/alpha_video.c2
-rw-r--r--hw/xfree86/os-support/bsd/arm_video.c2
-rw-r--r--hw/xfree86/os-support/bsd/i386_video.c2
-rw-r--r--hw/xfree86/os-support/bus/Pci.h2
-rw-r--r--hw/xfree86/os-support/bus/Sbus.c4
-rw-r--r--hw/xfree86/os-support/bus/sparcPci.c2
-rw-r--r--hw/xfree86/os-support/bus/zx1PCI.c2
-rw-r--r--hw/xfree86/os-support/hurd/Makefile.am1
-rw-r--r--hw/xfree86/os-support/hurd/hurd_video.c4
-rw-r--r--hw/xfree86/os-support/linux/Makefile.am1
-rw-r--r--hw/xfree86/os-support/misc/Delay.c2
-rw-r--r--hw/xfree86/os-support/shared/bios_mmap.c4
-rw-r--r--hw/xfree86/os-support/shared/libc_wrapper.c2123
-rw-r--r--hw/xfree86/os-support/solaris/Makefile.am1
-rw-r--r--hw/xfree86/os-support/solaris/sun_bios.c6
-rw-r--r--hw/xfree86/os-support/solaris/sun_init.c11
-rw-r--r--hw/xfree86/os-support/solaris/sun_mouse.c14
-rw-r--r--hw/xfree86/os-support/solaris/sun_vid.c12
-rw-r--r--hw/xfree86/os-support/xf86_OSlib.h21
-rw-r--r--hw/xfree86/os-support/xf86_ansic.h314
-rw-r--r--hw/xfree86/os-support/xf86_libc.h721
-rw-r--r--hw/xfree86/parser/Flags.c3
-rw-r--r--hw/xfree86/parser/Screen.c13
-rw-r--r--hw/xfree86/parser/cpconfig.c2
-rw-r--r--hw/xfree86/parser/scan.c12
-rw-r--r--hw/xfree86/parser/xf86Parser.h1
-rw-r--r--hw/xfree86/rac/xf86RAC.c68
-rw-r--r--hw/xfree86/ramdac/xf86Cursor.c78
-rw-r--r--hw/xfree86/ramdac/xf86CursorPriv.h2
-rw-r--r--hw/xfree86/ramdac/xf86HWCurs.c20
-rw-r--r--hw/xfree86/shadowfb/shadow.c20
-rw-r--r--hw/xfree86/utils/xorgcfg/Makefile.am1
-rw-r--r--hw/xfree86/utils/xorgcfg/config.h1
-rw-r--r--hw/xfree86/utils/xorgconfig/xorgconfig.c2
-rw-r--r--hw/xfree86/xaa/xaaDashLine.c3
-rw-r--r--hw/xfree86/xaa/xaaGC.c3
-rw-r--r--hw/xfree86/xaa/xaaGCmisc.c3
-rw-r--r--hw/xfree86/xaa/xaaInit.c45
-rw-r--r--hw/xfree86/xaa/xaaLineMisc.c3
-rw-r--r--hw/xfree86/xaa/xaaOverlayDF.c15
-rw-r--r--hw/xfree86/xaa/xaaStateChange.c15
-rw-r--r--hw/xfree86/xaa/xaaWrapper.c31
-rw-r--r--hw/xfree86/xaa/xaalocal.h22
-rw-r--r--hw/xfree86/xaa/xaawrap.h14
-rw-r--r--hw/xfree86/xf4bpp/mfbfillarc.c3
-rw-r--r--hw/xfree86/xf4bpp/mfbimggblt.c3
-rw-r--r--hw/xfree86/xf4bpp/mfbzerarc.c3
-rw-r--r--hw/xfree86/xf4bpp/ppcArea.c2
-rw-r--r--hw/xfree86/xf4bpp/ppcGC.c10
-rw-r--r--hw/xfree86/xf4bpp/ppcPixFS.c24
-rw-r--r--hw/xfree86/xf4bpp/ppcPixmap.c2
-rw-r--r--hw/xfree86/xf4bpp/ppcPolyPnt.c2
-rw-r--r--hw/xfree86/xf4bpp/ppcWinFS.c24
-rw-r--r--hw/xfree86/xf4bpp/vgaGC.c2
-rw-r--r--hw/xfree86/xf8_32bpp/cfb8_32.h14
-rw-r--r--hw/xfree86/xf8_32bpp/cfbscrinit.c33
-rw-r--r--hw/xfree86/xf8_32bpp/xf86overlay.c35
112 files changed, 957 insertions, 4664 deletions
diff --git a/hw/xfree86/common/Makefile.am b/hw/xfree86/common/Makefile.am
index db726fea1..c060b73f0 100644
--- a/hw/xfree86/common/Makefile.am
+++ b/hw/xfree86/common/Makefile.am
@@ -23,8 +23,8 @@ BUSSOURCES = xf86isaBus.c xf86pciBus.c xf86fbBus.c xf86noBus.c $(SBUS_SOURCES)
MODEDEFSOURCES = $(srcdir)/vesamodes $(srcdir)/extramodes
-xf86DefModeSet.c: $(srcdir)/modeline2c.pl $(MODEDEFSOURCES)
- cat $(MODEDEFSOURCES) | $(PERL) $(srcdir)/modeline2c.pl > $@
+xf86DefModeSet.c: $(srcdir)/modeline2c.awk $(MODEDEFSOURCES)
+ cat $(MODEDEFSOURCES) | $(AWK) -f $(srcdir)/modeline2c.awk > $@
BUILT_SOURCES = xf86DefModeSet.c
@@ -85,9 +85,8 @@ EXTRA_DIST = \
xf86Version.h \
xorgVersion.h \
xf86Date.h \
- xf86DefModes.c \
$(MODEDEFSOURCES) \
- modeline2c.pl \
+ modeline2c.awk \
$(DISTKBDSOURCES)
if LNXACPI
diff --git a/hw/xfree86/common/modeline2c.awk b/hw/xfree86/common/modeline2c.awk
new file mode 100644
index 000000000..d4b9649c8
--- /dev/null
+++ b/hw/xfree86/common/modeline2c.awk
@@ -0,0 +1,97 @@
+#!/usr/bin/awk -f
+#
+# Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>.
+# All rights reserved.
+#
+# Based on Perl script by Dirk Hohndel.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# Usage: modeline2c.awk < modefile > xf86DefModeSet.c
+#
+
+BEGIN {
+ flagsdict[""] = "0"
+
+ flagsdict["+hsync +vsync"] = "V_PHSYNC | V_PVSYNC"
+ flagsdict["+hsync -vsync"] = "V_PHSYNC | V_NVSYNC"
+ flagsdict["-hsync +vsync"] = "V_NHSYNC | V_PVSYNC"
+ flagsdict["-hsync -vsync"] = "V_NHSYNC | V_NVSYNC"
+ flagsdict["+hsync +vsync interlace"] = "V_PHSYNC | V_PVSYNC | V_INTERLACE"
+ flagsdict["+hsync -vsync interlace"] = "V_PHSYNC | V_NVSYNC | V_INTERLACE"
+ flagsdict["-hsync +vsync interlace"] = "V_NHSYNC | V_PVSYNC | V_INTERLACE"
+ flagsdict["-hsync -vsync interlace"] = "V_NHSYNC | V_NVSYNC | V_INTERLACE"
+
+ print "/* $" "XFree86$ */"
+ print
+ print "/* THIS FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT -- LOOK at"
+ print " * modeline2c.awk */"
+ print ""
+ print "/*"
+ print " * Author: Joerg Sonnenberger <joerg@NetBSD.org>"
+ print " * Based on Perl script from Dirk Hohndel <hohndel@XFree86.Org>"
+ print " */"
+ print ""
+ print "#ifdef HAVE_XORG_CONFIG_H"
+ print "#include <xorg-config.h>"
+ print "#endif"
+ print ""
+ print "#ifdef __UNIXOS2__"
+ print "#define I_NEED_OS2_H"
+ print "#endif"
+ print "#include \"xf86.h\""
+ print "#include \"xf86Config.h\""
+ print "#include \"xf86Priv.h\""
+ print "#include \"xf86_OSlib.h\""
+ print ""
+ print "#include \"globals.h\""
+ print ""
+ print "#define MODEPREFIX(name) NULL, NULL, name, MODE_OK, M_T_DEFAULT"
+ print "#define MODESUFFIX 0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0"
+ print ""
+ print "DisplayModeRec xf86DefaultModes [] = {"
+
+ modeline = "\t{MODEPREFIX(\"%dx%d\"),%d, %d,%d,%d,%d,0, %d,%d,%d,%d,0, %s, MODESUFFIX},\n"
+ modeline_data = "^[a-zA-Z]+[ \t]+[^ \t]+[ \t0-9.]+"
+}
+
+/^[mM][oO][dD][eE][lL][iI][nN][eE]/ {
+ flags = $0
+ gsub(modeline_data, "", flags)
+ flags = tolower(flags)
+ printf(modeline, $4, $8, $3 * 1000, $4, $5, $6, $7,
+ $8, $9, $10, $11, flagsdict[flags])
+ # Half-width double scanned modes
+ printf(modeline, $4/2, $8/2, $3 * 500, $4/2, $5/2, $6/2, $7/2,
+ $8/2, $9/2, $10/2, $11/2, flagsdict[flags] " | V_DBLSCAN")
+}
+
+/^#/ {
+ print "/*" substr($0, 2) " */"
+}
+
+END {
+ printf("\t{MODEPREFIX(NULL),0,0,0,0,0,0,0,0,0,0,0,0,MODESUFFIX}\n};\n")
+}
diff --git a/hw/xfree86/common/modeline2c.pl b/hw/xfree86/common/modeline2c.pl
deleted file mode 100644
index 88e380de4..000000000
--- a/hw/xfree86/common/modeline2c.pl
+++ /dev/null
@@ -1,107 +0,0 @@
-#!/usr/bin/perl
-
-# automatically generate the xf86DefModeSet.c file from a normal
-# XF86Config style file of Modelines
-#
-# run as
-#
-# perl /modeline2c.pl < [modesfile] > xf86DefModes.c
-#
-# hackish perl - author Dirk Hohndel
-#
-# Copyright 1999-2003 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).
-#
-# $XFree86: xc/programs/Xserver/hw/xfree86/common/modeline2c.pl,v 1.10tsi Exp $
-
-#my %flagshash;
-$flagshash{""} = "0";
-# $flagshash{"Interlace"} = "V_INTERLACE";
-# $flagshash{"+hsync"} = "V_PHSYNC";
-# $flagshash{"-hsync"} = "V_NHSYNC";
-# $flagshash{"+vsync"} = "V_PVSYNC";
-# $flagshash{"-vsync"} = "V_NVSYNC";
-# XXX I'm definitely not a perl guru... -- tsi
-$flagshash{"+hsync +vsync"} = "V_PHSYNC | V_PVSYNC";
-$flagshash{"+hsync -vsync"} = "V_PHSYNC | V_NVSYNC";
-$flagshash{"-hsync +vsync"} = "V_NHSYNC | V_PVSYNC";
-$flagshash{"-hsync -vsync"} = "V_NHSYNC | V_NVSYNC";
-$flagshash{"+hsync +vsync interlace"} = "V_PHSYNC | V_PVSYNC | V_INTERLACE";
-$flagshash{"+hsync -vsync interlace"} = "V_PHSYNC | V_NVSYNC | V_INTERLACE";
-$flagshash{"-hsync +vsync interlace"} = "V_NHSYNC | V_PVSYNC | V_INTERLACE";
-$flagshash{"-hsync -vsync interlace"} = "V_NHSYNC | V_NVSYNC | V_INTERLACE";
-
-# stop CVS from expanding the XFree86 Id here...
-
-$proj = "XFree86";
-printf("/* \$$proj\$ */
-
-/* THIS FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT -- LOOK at
- * modeline2c.pl */
-
-/*
- * Copyright 1999-2003 by The XFree86 Project, Inc.
- *
- * Author: Dirk Hohndel <hohndel\@XFree86.Org>
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include \"xf86.h\"
-#include \"xf86Config.h\"
-#include \"xf86Priv.h\"
-#include \"xf86_OSlib.h\"
-
-#include \"globals.h\"
-
-#define MODEPREFIX(name) NULL, NULL, name, MODE_OK, M_T_DEFAULT
-#define MODESUFFIX 0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0
-
-DisplayModeRec xf86DefaultModes [] = {
-");
-while (<>) {
- if (/^\#/) {
- s/^\#//;
- chop;
- print "/*" . $_ . " */\n";
- }
- if (/^ModeLine\s+(\S+)\s+([\d.\s]+)(.*)/i) {
- $name = $1;
- $values = $2;
- $flags = $3;
- $flags =~ y/A-Z/a-z/;
- $values =~ /([\d.]+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/;
- printf("\t{MODEPREFIX(%s),%d, %d,%d,%d,%d,0, %d,%d,%d,%d,0, %s, MODESUFFIX},\n",
- $name,$1*1000,$2,$3,$4,$5,$6,$7,$8,$9,$flagshash{$flags});
-# Also generate half-width doublescanned modes
- printf("\t{MODEPREFIX(\"%dx%d\"),%d, %d,%d,%d,%d,0, %d,%d,%d,%d,0, %s | V_DBLSCAN, MODESUFFIX},\n",
- $2/2,$6/2,$1*500,$2/2,$3/2,$4/2,$5/2,$6/2,$7/2,$8/2,$9/2,$flagshash{$flags});
- }
-
-
-}
-printf("\t{MODEPREFIX(NULL),0,0,0,0,0,0,0,0,0,0,0,0,MODESUFFIX}\n};\n");
diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
index 064107428..4e7d914bf 100644
--- a/hw/xfree86/common/xf86.h
+++ b/hw/xfree86/common/xf86.h
@@ -57,9 +57,9 @@
/* General parameters */
extern int xf86DoConfigure;
extern Bool xf86DoConfigurePass1;
-extern int xf86ScreenIndex; /* Index into pScreen.devPrivates */
-extern int xf86CreateRootWindowIndex; /* Index into pScreen.devPrivates */
-extern int xf86PixmapIndex;
+extern DevPrivateKey xf86ScreenKey;
+extern DevPrivateKey xf86CreateRootWindowKey;
+extern DevPrivateKey xf86PixmapKey;
extern ScrnInfoPtr *xf86Screens; /* List of pointers to ScrnInfoRecs */
extern const unsigned char byte_reversed[256];
extern ScrnInfoPtr xf86CurrentScreen;
@@ -72,8 +72,8 @@ extern Bool sbusSlotClaimed;
extern confDRIRec xf86ConfigDRI;
extern Bool xf86inSuspend;
-#define XF86SCRNINFO(p) ((ScrnInfoPtr)((p)->devPrivates[xf86ScreenIndex].ptr))
-
+#define XF86SCRNINFO(p) ((ScrnInfoPtr)dixLookupPrivate(&(p)->devPrivates, \
+ xf86ScreenKey))
#define XF86FLIP_PIXELS() \
do { \
if (xf86GetFlipPixels()) { \
@@ -339,6 +339,7 @@ Bool xf86IsUnblank(int mode);
void xf86AddModuleInfo(ModuleInfoPtr info, pointer module);
void xf86DeleteModuleInfo(int idx);
+void xf86getsecs(long *, long *);
/* xf86Debug.c */
#ifdef BUILDDEBUG
diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c
index c5998bfb8..c6e197216 100644
--- a/hw/xfree86/common/xf86AutoConfig.c
+++ b/hw/xfree86/common/xf86AutoConfig.c
@@ -43,16 +43,6 @@
/* Sections for the default built-in configuration. */
-#define BUILTIN_MODULE_SECTION \
- "Section \"Module\"\n" \
- "\tLoad\t\"extmod\"\n" \
- "\tLoad\t\"dbe\"\n" \
- "\tLoad\t\"glx\"\n" \
- "\tLoad\t\"freetype\"\n" \
- "\tLoad\t\"record\"\n" \
- "\tLoad\t\"dri\"\n" \
- "EndSection\n\n"
-
#define BUILTIN_DEVICE_NAME \
"\"Builtin Default %s Device %d\""
@@ -68,14 +58,6 @@
BUILTIN_DEVICE_SECTION_PRE \
BUILTIN_DEVICE_SECTION_POST
-#define BUILTIN_MONITOR_NAME \
- "\"Builtin Default Monitor\""
-
-#define BUILTIN_MONITOR_SECTION \
- "Section \"Monitor\"\n" \
- "\tIdentifier\t" BUILTIN_MONITOR_NAME "\n" \
- "EndSection\n\n"
-
#define BUILTIN_SCREEN_NAME \
"\"Builtin Default %s Screen %d\""
@@ -83,7 +65,6 @@
"Section \"Screen\"\n" \
"\tIdentifier\t" BUILTIN_SCREEN_NAME "\n" \
"\tDevice\t" BUILTIN_DEVICE_NAME "\n" \
- "\tMonitor\t" BUILTIN_MONITOR_NAME "\n" \
"EndSection\n\n"
#define BUILTIN_LAYOUT_SECTION_PRE \
@@ -220,9 +201,6 @@ xf86AutoConfig(void)
driver = chooseVideoDriver();
- AppendToConfig(BUILTIN_MODULE_SECTION);
- AppendToConfig(BUILTIN_MONITOR_SECTION);
-
if (driver) {
snprintf(buf, sizeof(buf), BUILTIN_DEVICE_SECTION_PRE,
driver, 0, driver);
diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c
index 3dc08f8a2..f7ffac85e 100644
--- a/hw/xfree86/common/xf86Bus.c
+++ b/hw/xfree86/common/xf86Bus.c
@@ -75,7 +75,6 @@ static resPtr AccReducers = NULL;
/* resource lists */
resPtr Acc = NULL;
-resPtr osRes = NULL;
/* predefined special resources */
_X_EXPORT resRange resVgaExclusive[] = {_VGA_EXCLUSIVE, _END};
@@ -291,8 +290,10 @@ xf86AddEntityToScreen(ScrnInfoPtr pScrn, int entityIndex)
if (entityIndex == -1)
return;
if (xf86Entities[entityIndex]->inUse &&
- !(xf86Entities[entityIndex]->entityProp & IS_SHARED_ACCEL))
- FatalError("Requested Entity already in use!\n");
+ !(xf86Entities[entityIndex]->entityProp & IS_SHARED_ACCEL)) {
+ ErrorF("Requested Entity already in use!\n");
+ return;
+ }
pScrn->numEntities++;
pScrn->entityList = xnfrealloc(pScrn->entityList,
@@ -1357,28 +1358,12 @@ xf86AddRangesToList(resPtr list, resRange *pRange, int entityIndex)
void
xf86ResourceBrokerInit(void)
{
-#if 0
- resPtr resPci;
-#endif
-
- osRes = NULL;
+ Acc = NULL;
/* Get the ranges used exclusively by the system */
- osRes = xf86AccResFromOS(osRes);
- xf86MsgVerb(X_INFO, 3, "OS-reported resource ranges:\n");
- xf86PrintResList(3, osRes);
-
- /* Bus dep initialization */
-#if 0
- resPci = ResourceBrokerInitPci(&osRes);
- Acc = xf86JoinResLists(xf86DupResList(osRes), resPci);
-#else
- Acc = xf86DupResList( osRes );
-#endif
-
- xf86MsgVerb(X_INFO, 3, "All system resource ranges:\n");
+ Acc = xf86AccResFromOS(Acc);
+ xf86MsgVerb(X_INFO, 3, "System resource ranges:\n");
xf86PrintResList(3, Acc);
-
}
#define MEM_ALIGN (1024 * 1024)
diff --git a/hw/xfree86/common/xf86Bus.h b/hw/xfree86/common/xf86Bus.h
index 5ea5cc8e1..489ee3459 100644
--- a/hw/xfree86/common/xf86Bus.h
+++ b/hw/xfree86/common/xf86Bus.h
@@ -132,7 +132,6 @@ extern int xf86NumEntities;
extern xf86AccessRec AccessNULL;
extern BusRec primaryBus;
extern resPtr Acc;
-extern resPtr osRes;
extern resPtr ResRange;
extern BusAccPtr xf86BusAccInfo;
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 985ed1260..a6bc5dbe3 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -93,7 +93,6 @@ extern DeviceAssocRec mouse_assoc;
"/etc/X11/%R," "%P/etc/X11/%R," \
"%E," "%F," \
"/etc/X11/%F," "%P/etc/X11/%F," \
- "%D/%X," \
"/etc/X11/%X-%M," "/etc/X11/%X," "/etc/%X," \
"%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \
"%P/etc/X11/%X," \
@@ -538,14 +537,8 @@ fixup_video_driver_list(char **drivers)
}
}
-
-/*
- * Generate a compiled-in list of driver names. This is used to produce a
- * consistent probe order. For the loader server, we also look for vendor-
- * provided modules, pre-pending them to our own list.
- */
static char **
-GenerateDriverlist(char * dirname, char * drivernames)
+GenerateDriverlist(char * dirname)
{
char **ret;
const char *subdirs[] = { dirname, NULL };
@@ -559,20 +552,13 @@ GenerateDriverlist(char * dirname, char * drivernames)
return ret;
}
-
char **
xf86DriverlistFromCompile(void)
{
static char **driverlist = NULL;
- static Bool generated = FALSE;
-
- /* This string is modified in-place */
- static char drivernames[] = DRIVERS;
- if (!generated) {
- generated = TRUE;
- driverlist = GenerateDriverlist("drivers", drivernames);
- }
+ if (!driverlist)
+ driverlist = GenerateDriverlist("drivers");
return driverlist;
}
@@ -1972,6 +1958,18 @@ configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum,
}
screenp->displays = xnfalloc((count) * sizeof(DispRec));
screenp->numdisplays = count;
+
+ /* Fill in the default Virtual size, if any */
+ if (conf_screen->scrn_virtualX && conf_screen->scrn_virtualY) {
+ for (count = 0, dispptr = conf_screen->scrn_display_lst;
+ dispptr;
+ dispptr = (XF86ConfDisplayPtr)dispptr->list.next, count++) {
+ screenp->displays[count].virtualX = conf_screen->scrn_virtualX;
+ screenp->displays[count].virtualY = conf_screen->scrn_virtualY;
+ }
+ }
+
+ /* Now do the per-Display Virtual sizes */
count = 0;
dispptr = conf_screen->scrn_display_lst;
while(dispptr) {
diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c
index 0cf445cdb..536f89700 100644
--- a/hw/xfree86/common/xf86Configure.c
+++ b/hw/xfree86/common/xf86Configure.c
@@ -372,9 +372,6 @@ configureDeviceSection (int screennum)
char identifier[16];
OptionInfoPtr p;
int i = 0;
-#ifdef DO_FBDEV_PROBE
- Bool foundFBDEV = FALSE;
-#endif
parsePrologue (XF86ConfDevicePtr, XF86ConfDeviceRec)
/* Move device info to parser structure */
@@ -443,32 +440,6 @@ configureDeviceSection (int screennum)
}
}
-#ifdef DO_FBDEV_PROBE
- /* Crude mechanism to auto-detect fbdev (os dependent) */
- /* Skip it for now. Options list it anyway, and we can't
- * determine which screen/driver this belongs too anyway. */
- {
- int fd;
-
- fd = open("/dev/fb0", 0);
- if (fd != -1) {
- foundFBDEV = TRUE;
- close(fd);
- }
- }
-
- if (foundFBDEV) {
- XF86OptionPtr fbdev;
-
- fbdev = xf86confmalloc(sizeof(XF86OptionRec));
- memset((XF86OptionPtr)fbdev,0,sizeof(XF86OptionRec));
- fbdev->opt_name = "UseFBDev";
- fbdev->opt_val = "ON";
- ptr->dev_option_lst = (XF86OptionPtr)xf86addListItem(
- (glp)ptr->dev_option_lst, (glp)fbdev);
- }
-#endif
-
return ptr;
}
diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c
index 5b3664ac0..dfec4b1ae 100644
--- a/hw/xfree86/common/xf86DGA.c
+++ b/hw/xfree86/common/xf86DGA.c
@@ -49,8 +49,7 @@
#include "mi.h"
-static unsigned long DGAGeneration = 0;
-static int DGAScreenIndex = -1;
+static DevPrivateKey DGAScreenKey = NULL;
static int mieq_installed = 0;
static Bool DGACloseScreen(int i, ScreenPtr pScreen);
@@ -68,8 +67,8 @@ DGACopyModeInfo(
_X_EXPORT int *XDGAEventBase = NULL;
-#define DGA_GET_SCREEN_PRIV(pScreen) \
- ((DGAScreenPtr)((pScreen)->devPrivates[DGAScreenIndex].ptr))
+#define DGA_GET_SCREEN_PRIV(pScreen) ((DGAScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, DGAScreenKey))
typedef struct _FakedVisualList{
@@ -116,11 +115,7 @@ DGAInit(
if(!modes || num <= 0)
return FALSE;
- if(DGAGeneration != serverGeneration) {
- if((DGAScreenIndex = AllocateScreenPrivateIndex()) < 0)
- return FALSE;
- DGAGeneration = serverGeneration;
- }
+ DGAScreenKey = &DGAScreenKey;
if(!(pScreenPriv = (DGAScreenPtr)xalloc(sizeof(DGAScreenRec))))
return FALSE;
@@ -148,7 +143,7 @@ DGAInit(
modes[i].flags &= ~DGA_PIXMAP_AVAILABLE;
#endif
- pScreen->devPrivates[DGAScreenIndex].ptr = (pointer)pScreenPriv;
+ dixSetPrivate(&pScreen->devPrivates, DGAScreenKey, pScreenPriv);
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = DGACloseScreen;
pScreenPriv->DestroyColormap = pScreen->DestroyColormap;
@@ -176,7 +171,7 @@ DGAReInitModes(
int i;
/* No DGA? Ignore call (but don't make it look like it failed) */
- if(DGAScreenIndex < 0)
+ if(DGAScreenKey == NULL)
return TRUE;
pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
@@ -350,7 +345,7 @@ xf86SetDGAMode(
DGAModePtr pMode = NULL;
/* First check if DGAInit was successful on this screen */
- if (DGAScreenIndex < 0)
+ if (DGAScreenKey == NULL)
return BadValue;
pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
if (!pScreenPriv)
@@ -485,7 +480,7 @@ DGAChangePixmapMode(int index, int *x, int *y, int mode)
DGAModePtr pMode;
PixmapPtr pPix;
- if(DGAScreenIndex < 0)
+ if(DGAScreenKey == NULL)
return FALSE;
pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
@@ -535,11 +530,12 @@ DGAChangePixmapMode(int index, int *x, int *y, int mode)
_X_EXPORT Bool
DGAAvailable(int index)
{
- if(DGAScreenIndex < 0)
+ if(DGAScreenKey == NULL)
return FALSE;
- if (!xf86NoSharedResources(((ScrnInfoPtr)screenInfo.screens[index]->
- devPrivates[xf86ScreenIndex].ptr)->scrnIndex,MEM))
+ if (!xf86NoSharedResources(((ScrnInfoPtr)dixLookupPrivate(
+ &screenInfo.screens[index]->devPrivates,
+ xf86ScreenKey))->scrnIndex, MEM))
return FALSE;
if(DGA_GET_SCREEN_PRIV(screenInfo.screens[index]))
@@ -553,7 +549,7 @@ DGAActive(int index)
{
DGAScreenPtr pScreenPriv;
- if(DGAScreenIndex < 0)
+ if(DGAScreenKey == NULL)
return FALSE;
pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
@@ -574,7 +570,7 @@ DGAShutdown()
ScrnInfoPtr pScrn;
int i;
- if(DGAScreenIndex < 0)
+ if(DGAScreenKey == NULL)
return;
for(i = 0; i < screenInfo.numScreens; i++) {
@@ -904,7 +900,7 @@ DGAVTSwitch(void)
/* Alternatively, this could send events to DGA clients */
- if(DGAScreenIndex >= 0) {
+ if(DGAScreenKey) {
DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
if(pScreenPriv && pScreenPriv->current)
@@ -921,7 +917,7 @@ DGAStealKeyEvent(DeviceIntPtr dev, int index, int key_code, int is_down)
DGAScreenPtr pScreenPriv;
dgaEvent de;
- if(DGAScreenIndex < 0) /* no DGA */
+ if(DGAScreenKey == NULL) /* no DGA */
return FALSE;
pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
@@ -945,7 +941,7 @@ DGAStealMotionEvent(DeviceIntPtr dev, int index, int dx, int dy)
DGAScreenPtr pScreenPriv;
dgaEvent de;
- if(DGAScreenIndex < 0) /* no DGA */
+ if(DGAScreenKey == NULL) /* no DGA */
return FALSE;
pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
@@ -980,7 +976,7 @@ DGAStealButtonEvent(DeviceIntPtr dev, int index, int button, int is_down)
DGAScreenPtr pScreenPriv;
dgaEvent de;
- if (DGAScreenIndex < 0)
+ if (DGAScreenKey == NULL)
return FALSE;
pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
@@ -1006,7 +1002,7 @@ Bool
DGAIsDgaEvent (xEvent *e)
{
int coreEquiv;
- if (DGAScreenIndex < 0 || XDGAEventBase == 0)
+ if (DGAScreenKey == NULL || XDGAEventBase == 0)
return FALSE;
coreEquiv = e->u.u.type - *XDGAEventBase;
if (KeyPress <= coreEquiv && coreEquiv <= MotionNotify)
@@ -1278,7 +1274,7 @@ DGAHandleEvent(int screen_num, xEvent *event, DeviceIntPtr device, int nevents)
int coreEquiv;
/* no DGA */
- if (DGAScreenIndex < 0 || XDGAEventBase == 0)
+ if (DGAScreenKey == NULL || XDGAEventBase == 0)
return;
pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
diff --git a/hw/xfree86/common/xf86DPMS.c b/hw/xfree86/common/xf86DPMS.c
index 3aa83e882..43efb8ed4 100644
--- a/hw/xfree86/common/xf86DPMS.c
+++ b/hw/xfree86/common/xf86DPMS.c
@@ -47,8 +47,7 @@
#ifdef DPMSExtension
-static int DPMSGeneration = 0;
-static int DPMSIndex = -1;
+static DevPrivateKey DPMSKey = NULL;
static Bool DPMSClose(int i, ScreenPtr pScreen);
static int DPMSCount = 0;
#endif
@@ -62,18 +61,15 @@ xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags)
DPMSPtr pDPMS;
pointer DPMSOpt;
- if (serverGeneration != DPMSGeneration) {
- if ((DPMSIndex = AllocateScreenPrivateIndex()) < 0)
- return FALSE;
- DPMSGeneration = serverGeneration;
- }
+ DPMSKey = &DPMSKey;
if (DPMSDisabledSwitch)
DPMSEnabled = FALSE;
- if (!(pScreen->devPrivates[DPMSIndex].ptr = xcalloc(sizeof(DPMSRec), 1)))
+ if (!dixSetPrivate(&pScreen->devPrivates, DPMSKey,
+ xcalloc(sizeof(DPMSRec), 1)))
return FALSE;
- pDPMS = (DPMSPtr)pScreen->devPrivates[DPMSIndex].ptr;
+ pDPMS = (DPMSPtr)dixLookupPrivate(&pScreen->devPrivates, DPMSKey);
pScrn->DPMSSet = set;
pDPMS->Flags = flags;
DPMSOpt = xf86FindOption(pScrn->options, "dpms");
@@ -110,10 +106,10 @@ DPMSClose(int i, ScreenPtr pScreen)
DPMSPtr pDPMS;
/* This shouldn't happen */
- if (DPMSIndex < 0)
+ if (DPMSKey == NULL)
return FALSE;
- pDPMS = (DPMSPtr)pScreen->devPrivates[DPMSIndex].ptr;
+ pDPMS = (DPMSPtr)dixLookupPrivate(&pScreen->devPrivates, DPMSKey);
/* This shouldn't happen */
if (!pDPMS)
@@ -132,9 +128,9 @@ DPMSClose(int i, ScreenPtr pScreen)
}
xfree((pointer)pDPMS);
- pScreen->devPrivates[DPMSIndex].ptr = NULL;
+ dixSetPrivate(&pScreen->devPrivates, DPMSKey, NULL);
if (--DPMSCount == 0)
- DPMSIndex = -1;
+ DPMSKey = NULL;
return pScreen->CloseScreen(i, pScreen);
}
@@ -144,30 +140,35 @@ DPMSClose(int i, ScreenPtr pScreen)
* Device dependent DPMS mode setting hook. This is called whenever
* the DPMS mode is to be changed.
*/
-_X_EXPORT void
-DPMSSet(int level)
+_X_EXPORT int
+DPMSSet(ClientPtr client, int level)
{
- int i;
+ int rc, i;
DPMSPtr pDPMS;
ScrnInfoPtr pScrn;
DPMSPowerLevel = level;
- if (DPMSIndex < 0)
- return;
+ if (DPMSKey == NULL)
+ return Success;
- if (level != DPMSModeOn)
- SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverActive);
+ if (level != DPMSModeOn) {
+ rc = dixSaveScreens(client, SCREEN_SAVER_FORCER, ScreenSaverActive);
+ if (rc != Success)
+ return rc;
+ }
/* For each screen, set the DPMS level */
for (i = 0; i < xf86NumScreens; i++) {
pScrn = xf86Screens[i];
- pDPMS = (DPMSPtr)screenInfo.screens[i]->devPrivates[DPMSIndex].ptr;
+ pDPMS = (DPMSPtr)dixLookupPrivate(&screenInfo.screens[i]->devPrivates,
+ DPMSKey);
if (pDPMS && pScrn->DPMSSet && pDPMS->Enabled && pScrn->vtSema) {
xf86EnableAccess(pScrn);
pScrn->DPMSSet(pScrn, level, 0);
}
}
+ return Success;
}
@@ -182,14 +183,15 @@ DPMSSupported(void)
DPMSPtr pDPMS;
ScrnInfoPtr pScrn;
- if (DPMSIndex < 0) {
+ if (DPMSKey == NULL) {
return FALSE;
}
/* For each screen, check if DPMS is supported */
for (i = 0; i < xf86NumScreens; i++) {
pScrn = xf86Screens[i];
- pDPMS = (DPMSPtr)screenInfo.screens[i]->devPrivates[DPMSIndex].ptr;
+ pDPMS = (DPMSPtr)dixLookupPrivate(&screenInfo.screens[i]->devPrivates,
+ DPMSKey);
if (pDPMS && pScrn->DPMSSet)
return TRUE;
}
diff --git a/hw/xfree86/common/xf86DefModes.c b/hw/xfree86/common/xf86DefModes.c
deleted file mode 100644
index bdb64fe8e..000000000
--- a/hw/xfree86/common/xf86DefModes.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/* THIS FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT -- LOOK at
- * modeline2c.pl */
-
-/*
- * Copyright 1999-2003 by The XFree86 Project, Inc.
- *
- * Author: Dirk Hohndel <hohndel@XFree86.Org>
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86.h"
-#include "xf86Config.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-
-#include "globals.h"
-
-#define MODEPREFIX(name) NULL, NULL, name, MODE_OK, M_T_DEFAULT
-#define MODESUFFIX 0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0
-
-DisplayModeRec xf86DefaultModes [] = {
-/* 640x350 @ 85Hz (VESA) hsync: 37.9kHz */
- {MODEPREFIX("640x350"),31500, 640,672,736,832,0, 350,382,385,445,0, V_PHSYNC | V_NVSYNC, MODESUFFIX},
- {MODEPREFIX("320x175"),15750, 320,336,368,416,0, 175,191,192,222,0, V_PHSYNC | V_NVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 640x400 @ 85Hz (VESA) hsync: 37.9kHz */
- {MODEPREFIX("640x400"),31500, 640,672,736,832,0, 400,401,404,445,0, V_NHSYNC | V_PVSYNC, MODESUFFIX},
- {MODEPREFIX("320x200"),15750, 320,336,368,416,0, 200,200,202,222,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 720x400 @ 85Hz (VESA) hsync: 37.9kHz */
- {MODEPREFIX("720x400"),35500, 720,756,828,936,0, 400,401,404,446,0, V_NHSYNC | V_PVSYNC, MODESUFFIX},
- {MODEPREFIX("360x200"),17750, 360,378,414,468,0, 200,200,202,223,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 640x480 @ 60Hz (Industry standard) hsync: 31.5kHz */
- {MODEPREFIX("640x480"),25200, 640,656,752,800,0, 480,490,492,525,0, V_NHSYNC | V_NVSYNC, MODESUFFIX},
- {MODEPREFIX("320x240"),12600, 320,328,376,400,0, 240,245,246,262,0, V_NHSYNC | V_NVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 640x480 @ 72Hz (VESA) hsync: 37.9kHz */
- {MODEPREFIX("640x480"),31500, 640,664,704,832,0, 480,489,491,520,0, V_NHSYNC | V_NVSYNC, MODESUFFIX},
- {MODEPREFIX("320x240"),15750, 320,332,352,416,0, 240,244,245,260,0, V_NHSYNC | V_NVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 640x480 @ 75Hz (VESA) hsync: 37.5kHz */
- {MODEPREFIX("640x480"),31500, 640,656,720,840,0, 480,481,484,500,0, V_NHSYNC | V_NVSYNC, MODESUFFIX},
- {MODEPREFIX("320x240"),15750, 320,328,360,420,0, 240,240,242,250,0, V_NHSYNC | V_NVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 640x480 @ 85Hz (VESA) hsync: 43.3kHz */
- {MODEPREFIX("640x480"),36000, 640,696,752,832,0, 480,481,484,509,0, V_NHSYNC | V_NVSYNC, MODESUFFIX},
- {MODEPREFIX("320x240"),18000, 320,348,376,416,0, 240,240,242,254,0, V_NHSYNC | V_NVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 800x600 @ 56Hz (VESA) hsync: 35.2kHz */
- {MODEPREFIX("800x600"),36000, 800,824,896,1024,0, 600,601,603,625,0, V_PHSYNC | V_PVSYNC, MODESUFFIX},
- {MODEPREFIX("400x300"),18000, 400,412,448,512,0, 300,300,301,312,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 800x600 @ 60Hz (VESA) hsync: 37.9kHz */
- {MODEPREFIX("800x600"),40000, 800,840,968,1056,0, 600,601,605,628,0, V_PHSYNC | V_PVSYNC, MODESUFFIX},
- {MODEPREFIX("400x300"),20000, 400,420,484,528,0, 300,300,302,314,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 800x600 @ 72Hz (VESA) hsync: 48.1kHz */
- {MODEPREFIX("800x600"),50000, 800,856,976,1040,0, 600,637,643,666,0, V_PHSYNC | V_PVSYNC, MODESUFFIX},
- {MODEPREFIX("400x300"),25000, 400,428,488,520,0, 300,318,321,333,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 800x600 @ 75Hz (VESA) hsync: 46.9kHz */
- {MODEPREFIX("800x600"),49500, 800,816,896,1056,0, 600,601,604,625,0, V_PHSYNC | V_PVSYNC, MODESUFFIX},
- {MODEPREFIX("400x300"),24750, 400,408,448,528,0, 300,300,302,312,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 800x600 @ 85Hz (VESA) hsync: 53.7kHz */
- {MODEPREFIX("800x600"),56300, 800,832,896,1048,0, 600,601,604,631,0, V_PHSYNC | V_PVSYNC, MODESUFFIX},
- {MODEPREFIX("400x300"),28150, 400,416,448,524,0, 300,300,302,315,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 1024x768i @ 43Hz (industry standard) hsync: 35.5kHz */
- {MODEPREFIX("1024x768"),44900, 1024,1032,1208,1264,0, 768,768,776,817,0, V_PHSYNC | V_PVSYNC | V_INTERLACE, MODESUFFIX},
- {MODEPREFIX("512x384"),22450, 512,516,604,632,0, 384,384,388,408,0, V_PHSYNC | V_PVSYNC | V_INTERLACE | V_DBLSCAN, MODESUFFIX},
-/* 1024x768 @ 60Hz (VESA) hsync: 48.4kHz */
- {MODEPREFIX("1024x768"),65000, 1024,1048,1184,1344,0, 768,771,777,806,0, V_NHSYNC | V_NVSYNC, MODESUFFIX},
- {MODEPREFIX("512x384"),32500, 512,524,592,672,0, 384,385,388,403,0, V_NHSYNC | V_NVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 1024x768 @ 70Hz (VESA) hsync: 56.5kHz */
- {MODEPREFIX("1024x768"),75000, 1024,1048,1184,1328,0, 768,771,777,806,0, V_NHSYNC | V_NVSYNC, MODESUFFIX},
- {MODEPREFIX("512x384"),37500, 512,524,592,664,0, 384,385,388,403,0, V_NHSYNC | V_NVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 1024x768 @ 75Hz (VESA) hsync: 60.0kHz */
- {MODEPREFIX("1024x768"),78800, 1024,1040,1136,1312,0, 768,769,772,800,0, V_PHSYNC | V_PVSYNC, MODESUFFIX},
- {MODEPREFIX("512x384"),39400, 512,520,568,656,0, 384,384,386,400,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 1024x768 @ 85Hz (VESA) hsync: 68.7kHz */
- {MODEPREFIX("1024x768"),94500, 1024,1072,1168,1376,0, 768,769,772,808,0, V_PHSYNC | V_PVSYNC, MODESUFFIX},
- {MODEPREFIX("512x384"),47250, 512,536,584,688,0, 384,384,386,404,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 1152x864 @ 75Hz (VESA) hsync: 67.5kHz */
- {MODEPREFIX("1152x864"),108000, 1152,1216,1344,1600,0, 864,865,868,900,0, V_PHSYNC | V_PVSYNC, MODESUFFIX},
- {MODEPREFIX("576x432"),54000, 576,608,672,800,0, 432,432,434,450,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 1280x960 @ 60Hz (VESA) hsync: 60.0kHz */
- {MODEPREFIX("1280x960"),108000, 1280,1376,1488,1800,0, 960,961,964,1000,0, V_PHSYNC | V_PVSYNC, MODESUFFIX},
- {MODEPREFIX("640x480"),54000, 640,688,744,900,0, 480,480,482,500,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 1280x960 @ 85Hz (VESA) hsync: 85.9kHz */
- {MODEPREFIX("1280x960"),148500, 1280,1344,1504,1728,0, 960,961,964,1011,0, V_PHSYNC | V_PVSYNC, MODESUFFIX},
- {MODEPREFIX("640x480"),74250, 640,672,752,864,0, 480,480,482,505,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 1280x1024 @ 60Hz (VESA) hsync: 64.0kHz */
- {MODEPREFIX("1280x1024"),108000, 1280,1328,1440,1688,0, 1024,1025,1028,1066,0, V_PHSYNC | V_PVSYNC, MODESUFFIX},
- {MODEPREFIX("640x512"),54000, 640,664,720,844,0, 512,512,514,533,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 1280x1024 @ 75Hz (VESA) hsync: 80.0kHz */
- {MODEPREFIX("1280x1024"),135000, 1280,1296,1440,1688,0, 1024,1025,1028,1066,0, V_PHSYNC | V_PVSYNC, MODESUFFIX},
- {MODEPREFIX("640x512"),67500, 640,648,720,844,0, 512,512,514,533,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 1280x1024 @ 85Hz (VESA) hsync: 91.1kHz */
- {MODEPREFIX("1280x1024"),157500, 1280,1344,1504,1728,0, 1024,1025,1028,1072,0, V_PHSYNC | V_PVSYNC, MODESUFFIX},
- {MODEPREFIX("640x512"),78750, 640,672,752,864,0, 512,512,514,536,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 1600x1200 @ 60Hz (VESA) hsync: 75.0kHz */
- {MODEPREFIX("1600x1200"),162000, 1600,1664,1856,2160,0, 1200,1201,1204,1250,0, V_PHSYNC | V_PVSYNC, MODESUFFIX},
- {MODEPREFIX("800x600"),81000, 800,832,928,1080,0, 600,600,602,625,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 1600x1200 @ 65Hz (VESA) hsync: 81.3kHz */
- {MODEPREFIX("1600x1200"),175500, 1600,1664,1856,2160,0, 1200,1201,1204,1250,0, V_PHSYNC | V_PVSYNC, MODESUFFIX},
- {MODEPREFIX("800x600"),87750, 800,832,928,1080,0, 600,600,602,625,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 1600x1200 @ 70Hz (VESA) hsync: 87.5kHz */
- {MODEPREFIX("1600x1200"),189000, 1600,1664,1856,2160,0, 1200,1201,1204,1250,0, V_PHSYNC | V_PVSYNC, MODESUFFIX},
- {MODEPREFIX("800x600"),94500, 800,832,928,1080,0, 600,600,602,625,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 1600x1200 @ 75Hz (VESA) hsync: 93.8kHz */
- {MODEPREFIX("1600x1200"),202500, 1600,1664,1856,2160,0, 1200,1201,1204,1250,0, V_PHSYNC | V_PVSYNC, MODESUFFIX},
- {MODEPREFIX("800x600"),101250, 800,832,928,1080,0, 600,600,602,625,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 1600x1200 @ 85Hz (VESA) hsync: 106.3kHz */
- {MODEPREFIX("1600x1200"),229500, 1600,1664,1856,2160,0, 1200,1201,1204,1250,0, V_PHSYNC | V_PVSYNC, MODESUFFIX},
- {MODEPREFIX("800x600"),114750, 800,832,928,1080,0, 600,600,602,625,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 1792x1344 @ 60Hz (VESA) hsync: 83.6kHz */
- {MODEPREFIX("1792x1344"),204800, 1792,1920,2120,2448,0, 1344,1345,1348,1394,0, V_NHSYNC | V_PVSYNC, MODESUFFIX},
- {MODEPREFIX("896x672"),102400, 896,960,1060,1224,0, 672,672,674,697,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 1792x1344 @ 75Hz (VESA) hsync: 106.3kHz */
- {MODEPREFIX("1792x1344"),261000, 1792,1888,2104,2456,0, 1344,1345,1348,1417,0, V_NHSYNC | V_PVSYNC, MODESUFFIX},
- {MODEPREFIX("896x672"),130500, 896,944,1052,1228,0, 672,672,674,708,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 1856x1392 @ 60Hz (VESA) hsync: 86.3kHz */
- {MODEPREFIX("1856x1392"),218300, 1856,1952,2176,2528,0, 1392,1393,1396,1439,0, V_NHSYNC | V_PVSYNC, MODESUFFIX},
- {MODEPREFIX("928x696"),109150, 928,976,1088,1264,0, 696,696,698,719,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 1856x1392 @ 75Hz (VESA) hsync: 112.5kHz */
- {MODEPREFIX("1856x1392"),288000, 1856,1984,2208,2560,0, 1392,1393,1396,1500,0, V_NHSYNC | V_PVSYNC, MODESUFFIX},
- {MODEPREFIX("928x696"),144000, 928,992,1104,1280,0, 696,696,698,750,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 1920x1440 @ 60Hz (VESA) hsync: 90.0kHz */
- {MODEPREFIX("1920x1440"),234000, 1920,2048,2256,2600,0, 1440,1441,1444,1500,0, V_NHSYNC | V_PVSYNC, MODESUFFIX},
- {MODEPREFIX("960x720"),117000, 960,1024,1128,1300,0, 720,720,722,750,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 1920x1440 @ 75Hz (VESA) hsync: 112.5kHz */
- {MODEPREFIX("1920x1440"),297000, 1920,2064,2288,2640,0, 1440,1441,1444,1500,0, V_NHSYNC | V_PVSYNC, MODESUFFIX},
- {MODEPREFIX("960x720"),148500, 960,1032,1144,1320,0, 720,720,722,750,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 832x624 @ 75Hz (74.55Hz) (fix if the official/Apple spec is different) hsync: 49.725kHz */
- {MODEPREFIX("832x624"),57284, 832,864,928,1152,0, 624,625,628,667,0, V_NHSYNC | V_NVSYNC, MODESUFFIX},
- {MODEPREFIX("416x312"),28642, 416,432,464,576,0, 312,312,314,333,0, V_NHSYNC | V_NVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 1152x768 @ 54.8Hz (Titanium PowerBook) hsync: 44.2kHz */
- {MODEPREFIX("1152x768"),64995, 1152,1178,1314,1472,0, 768,771,777,806,0, V_PHSYNC | V_PVSYNC, MODESUFFIX},
- {MODEPREFIX("576x384"),32497, 576,589,657,736,0, 384,385,388,403,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 1400x1050 @ 60Hz (VESA GTF) hsync: 65.5kHz */
- {MODEPREFIX("1400x1050"),122000, 1400,1488,1640,1880,0, 1050,1052,1064,1082,0, V_PHSYNC | V_PVSYNC, MODESUFFIX},
- {MODEPREFIX("700x525"),61000, 700,744,820,940,0, 525,526,532,541,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 1400x1050 @ 75Hz (VESA GTF) hsync: 82.2kHz */
- {MODEPREFIX("1400x1050"),155800, 1400,1464,1784,1912,0, 1050,1052,1064,1090,0, V_PHSYNC | V_PVSYNC, MODESUFFIX},
- {MODEPREFIX("700x525"),77900, 700,732,892,956,0, 525,526,532,545,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 1600x1024 @ 60Hz (SGI 1600SW) hsync: 64.0kHz */
- {MODEPREFIX("1600x1024"),106910, 1600,1620,1640,1670,0, 1024,1027,1030,1067,0, V_NHSYNC | V_NVSYNC, MODESUFFIX},
- {MODEPREFIX("800x512"),53455, 800,810,820,835,0, 512,513,515,533,0, V_NHSYNC | V_NVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 1920x1440 @ 85Hz (VESA GTF) hsync: 128.5kHz */
- {MODEPREFIX("1920x1440"),341350, 1920,2072,2288,2656,0, 1440,1441,1444,1512,0, V_NHSYNC | V_PVSYNC, MODESUFFIX},
- {MODEPREFIX("960x720"),170675, 960,1036,1144,1328,0, 720,720,722,756,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 2048x1536 @ 60Hz (VESA GTF) hsync: 95.3kHz */
- {MODEPREFIX("2048x1536"),266950, 2048,2200,2424,2800,0, 1536,1537,1540,1589,0, V_NHSYNC | V_PVSYNC, MODESUFFIX},
- {MODEPREFIX("1024x768"),133475, 1024,1100,1212,1400,0, 768,768,770,794,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 2048x1536 @ 75Hz (VESA GTF) hsync: 120.2kHz */
- {MODEPREFIX("2048x1536"),340480, 2048,2216,2440,2832,0, 1536,1537,1540,1603,0, V_NHSYNC | V_PVSYNC, MODESUFFIX},
- {MODEPREFIX("1024x768"),170240, 1024,1108,1220,1416,0, 768,768,770,801,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX},
-/* 2048x1536 @ 85Hz (VESA GTF) hsync: 137.0kHz */
- {MODEPREFIX("2048x1536"),388040, 2048,2216,2440,2832,0, 1536,1537,1540,1612,0, V_NHSYNC | V_PVSYNC, MODESUFFIX},
- {MODEPREFIX("1024x768"),194020, 1024,1108,1220,1416,0, 768,768,770,806,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX},
- {MODEPREFIX(NULL),0,0,0,0,0,0,0,0,0,0,0,0,MODESUFFIX}
-};
diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index 4bbcee231..d1e4393fd 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -859,7 +859,7 @@ xf86VTSwitch()
#endif
#ifdef DPMSExtension
if (DPMSPowerLevel != DPMSModeOn)
- DPMSSet(DPMSModeOn);
+ DPMSSet(serverClient, DPMSModeOn);
#endif
for (i = 0; i < xf86NumScreens; i++) {
if (!(dispatchException & DE_TERMINATE))
@@ -908,7 +908,7 @@ xf86VTSwitch()
(*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE);
}
}
- SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset);
+ dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
pInfo = xf86InputDevs;
while (pInfo) {
@@ -972,7 +972,7 @@ xf86VTSwitch()
}
/* Turn screen saver off when switching back */
- SaveScreens(SCREEN_SAVER_FORCER,ScreenSaverReset);
+ dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
pInfo = xf86InputDevs;
while (pInfo) {
diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c
index b3969b102..d796d627c 100644
--- a/hw/xfree86/common/xf86Globals.c
+++ b/hw/xfree86/common/xf86Globals.c
@@ -46,10 +46,12 @@
/* Globals that video drivers may access */
-_X_EXPORT int xf86ScreenIndex = -1; /* Index of ScrnInfo in pScreen.devPrivates */
-int xf86CreateRootWindowIndex = -1; /* Index into pScreen.devPrivates */
+/* Index into pScreen.devPrivates */
+DevPrivateKey xf86CreateRootWindowKey = &xf86CreateRootWindowKey;
+/* Index of ScrnInfo in pScreen.devPrivates */
+_X_EXPORT DevPrivateKey xf86ScreenKey = &xf86ScreenKey;
+_X_EXPORT DevPrivateKey xf86PixmapKey = &xf86PixmapKey;
_X_EXPORT ScrnInfoPtr *xf86Screens = NULL; /* List of ScrnInfos */
-_X_EXPORT int xf86PixmapIndex = 0;
_X_EXPORT const unsigned char byte_reversed[256] =
{
0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
index 1ef79730c..ec524e63c 100644
--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -1492,9 +1492,6 @@ xf86PrintChipsets(const char *drvname, const char *drvmsg, SymTabPtr chips)
}
-#define MAXDRIVERS 64 /* A >hack<, to be sure ... */
-
-
_X_EXPORT int
xf86MatchDevice(const char *drivername, GDevPtr **sectlist)
{
@@ -2960,3 +2957,17 @@ xf86GetMotionEvents(DeviceIntPtr pDev, xTimecoord *buff, unsigned long start,
{
return GetMotionHistory(pDev, buff, start, stop, pScreen);
}
+
+_X_EXPORT void
+xf86getsecs(long * secs, long * usecs)
+{
+ struct timeval tv;
+
+ X_GETTIMEOFDAY(&tv);
+ if (secs)
+ *secs = tv.tv_sec;
+ if (usecs)
+ *usecs= tv.tv_usec;
+
+ return;
+}
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index bf577e6ad..d12b6bd6a 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -139,8 +139,8 @@ xf86CreateRootWindow(WindowPtr pWin)
int err = Success;
ScreenPtr pScreen = pWin->drawable.pScreen;
RootWinPropPtr pProp;
- CreateWindowProcPtr CreateWindow =
- (CreateWindowProcPtr)(pScreen->devPrivates[xf86CreateRootWindowIndex].ptr);
+ CreateWindowProcPtr CreateWindow = (CreateWindowProcPtr)
+ dixLookupPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey);
#ifdef DEBUG
ErrorF("xf86CreateRootWindow(%p)\n", pWin);
@@ -156,7 +156,7 @@ xf86CreateRootWindow(WindowPtr pWin)
/* Unhook this function ... */
pScreen->CreateWindow = CreateWindow;
- pScreen->devPrivates[xf86CreateRootWindowIndex].ptr = NULL;
+ dixSetPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey, NULL);
/* ... and call the previous CreateWindow fuction, if any */
if (NULL!=pScreen->CreateWindow) {
@@ -476,7 +476,6 @@ void
InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
{
int i, j, k, scr_index;
- static unsigned long generation = 0;
char **modulelist;
pointer *optionlist;
screenLayoutPtr layout;
@@ -487,14 +486,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
xf86Initialising = TRUE;
- /* Do this early? */
- if (generation != serverGeneration) {
- xf86ScreenIndex = AllocateScreenPrivateIndex();
- xf86CreateRootWindowIndex = AllocateScreenPrivateIndex();
- xf86PixmapIndex = AllocatePixmapPrivateIndex();
- generation = serverGeneration;
- }
-
if (serverGeneration == 1) {
pScreenInfo->numScreens = 0;
@@ -1070,8 +1061,8 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
* Hook in our ScrnInfoRec, and initialise some other pScreen
* fields.
*/
- screenInfo.screens[scr_index]->devPrivates[xf86ScreenIndex].ptr
- = (pointer)xf86Screens[i];
+ dixSetPrivate(&screenInfo.screens[scr_index]->devPrivates,
+ xf86ScreenKey, xf86Screens[i]);
xf86Screens[i]->pScreen = screenInfo.screens[scr_index];
/* The driver should set this, but make sure it is set anyway */
xf86Screens[i]->vtSema = TRUE;
@@ -1087,8 +1078,9 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
i, xf86Screens[i]->pScreen->CreateWindow );
#endif
- screenInfo.screens[scr_index]->devPrivates[xf86CreateRootWindowIndex].ptr
- = (void*)(xf86Screens[i]->pScreen->CreateWindow);
+ dixSetPrivate(&screenInfo.screens[scr_index]->devPrivates,
+ xf86CreateRootWindowKey,
+ xf86Screens[i]->pScreen->CreateWindow);
xf86Screens[i]->pScreen->CreateWindow = xf86CreateRootWindow;
#ifdef RENDER
@@ -1203,8 +1195,6 @@ OsVendorInit()
{
static Bool beenHere = FALSE;
- xf86WrapperInit();
-
#ifdef SIGCHLD
signal(SIGCHLD, SIG_DFL); /* Need to wait for child processes */
#endif
@@ -1307,13 +1297,9 @@ AbortDDX()
/*
* try to restore the original video state
*/
-#ifdef HAS_USL_VTS
- /* Need the sleep when starting X from within another X session */
- sleep(1);
-#endif
#ifdef DPMSExtension /* Turn screens back on */
if (DPMSPowerLevel != DPMSModeOn)
- DPMSSet(DPMSModeOn);
+ DPMSSet(serverClient, DPMSModeOn);
#endif
if (xf86Screens) {
if (xf86Screens[0]->vtSema)
diff --git a/hw/xfree86/common/xf86Mode.c b/hw/xfree86/common/xf86Mode.c
index 7fcce10b1..782f08b8d 100644
--- a/hw/xfree86/common/xf86Mode.c
+++ b/hw/xfree86/common/xf86Mode.c
@@ -183,6 +183,8 @@ xf86ModeStatusToString(ModeStatus status)
return "all modes must have the same resolution";
case MODE_NO_REDUCED:
return "monitor doesn't support reduced blanking";
+ case MODE_BANDWIDTH:
+ return "mode requires too much memory bandwidth";
case MODE_BAD:
return "unknown reason";
case MODE_ERROR:
@@ -368,52 +370,6 @@ xf86HandleBuiltinMode(ScrnInfoPtr scrp,
return MODE_OK;
}
-#if 0
-/** Calculates the horizontal sync rate of a mode */
-_X_EXPORT double
-xf86ModeHSync(DisplayModePtr mode)
-{
- double hsync = 0.0;
-
- if (mode->HSync > 0.0)
- hsync = mode->HSync;
- else if (mode->HTotal > 0)
- hsync = (float)mode->Clock / (float)mode->HTotal;
-
- return hsync;
-}
-
-/** Calculates the vertical refresh rate of a mode */
-_X_EXPORT double
-xf86ModeVRefresh(DisplayModePtr mode)
-{
- double refresh = 0.0;
-
- if (mode->VRefresh > 0.0)
- refresh = mode->VRefresh;
- else if (mode->HTotal > 0 && mode->VTotal > 0) {
- refresh = mode->Clock * 1000.0 / mode->HTotal / mode->VTotal;
- if (mode->Flags & V_INTERLACE)
- refresh *= 2.0;
- if (mode->Flags & V_DBLSCAN)
- refresh /= 2.0;
- if (mode->VScan > 1)
- refresh /= (float)(mode->VScan);
- }
- return refresh;
-}
-
-/** Sets a default mode name of <width>x<height> on a mode. */
-_X_EXPORT void
-xf86SetModeDefaultName(DisplayModePtr mode)
-{
- if (mode->name != NULL)
- xfree(mode->name);
-
- mode->name = XNFprintf("%dx%d", mode->HDisplay, mode->VDisplay);
-}
-#endif
-
/*
* xf86LookupMode
*
diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h
index 852e51f43..240155ca7 100644
--- a/hw/xfree86/common/xf86Module.h
+++ b/hw/xfree86/common/xf86Module.h
@@ -83,9 +83,9 @@ typedef enum {
* mask is 0xFFFF0000.
*/
#define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 3)
-#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(3, 0)
+#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(4, 0)
#define ABI_XINPUT_VERSION SET_ABI_VERSION(2, 0)
-#define ABI_EXTENSION_VERSION SET_ABI_VERSION(0, 3)
+#define ABI_EXTENSION_VERSION SET_ABI_VERSION(1, 0)
#define ABI_FONT_VERSION SET_ABI_VERSION(0, 5)
#define MODINFOSTRING1 0xef23fdc5
diff --git a/hw/xfree86/common/xf86PM.c b/hw/xfree86/common/xf86PM.c
index a6bcc3421..7c8320dee 100644
--- a/hw/xfree86/common/xf86PM.c
+++ b/hw/xfree86/common/xf86PM.c
@@ -116,7 +116,7 @@ resume(pmEvent event, Bool undo)
if (xf86Screens[i]->EnableDisableFBAccess)
(*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE);
}
- SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset);
+ dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
pInfo = xf86InputDevs;
while (pInfo) {
EnableDevice(pInfo->dev);
diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h
index 6bba837fa..5d650aa4c 100644
--- a/hw/xfree86/common/xf86Priv.h
+++ b/hw/xfree86/common/xf86Priv.h
@@ -121,7 +121,7 @@ extern RootWinPropPtr *xf86RegisteredPropertiesTable;
#define DEFAULT_LOG_VERBOSE 3
#endif
#ifndef DEFAULT_DPI
-#define DEFAULT_DPI 75
+#define DEFAULT_DPI 96
#endif
#define DEFAULT_UNRESOLVED TRUE
diff --git a/hw/xfree86/common/xf86RandR.c b/hw/xfree86/common/xf86RandR.c
index 87d5a364b..f6157518e 100644
--- a/hw/xfree86/common/xf86RandR.c
+++ b/hw/xfree86/common/xf86RandR.c
@@ -46,10 +46,9 @@ typedef struct _xf86RandRInfo {
Rotation rotation;
} XF86RandRInfoRec, *XF86RandRInfoPtr;
-static int xf86RandRIndex = -1;
-static int xf86RandRGeneration;
+static DevPrivateKey xf86RandRKey = NULL;
-#define XF86RANDRINFO(p) ((XF86RandRInfoPtr) (p)->devPrivates[xf86RandRIndex].ptr)
+#define XF86RANDRINFO(p) ((XF86RandRInfoPtr)dixLookupPrivate(&(p)->devPrivates, xf86RandRKey))
static int
xf86RandRModeRefresh (DisplayModePtr mode)
@@ -339,14 +338,14 @@ xf86RandRCloseScreen (int index, ScreenPtr pScreen)
scrp->currentMode = scrp->modes;
pScreen->CloseScreen = randrp->CloseScreen;
xfree (randrp);
- pScreen->devPrivates[xf86RandRIndex].ptr = 0;
+ dixSetPrivate(&pScreen->devPrivates, xf86RandRKey, NULL);
return (*pScreen->CloseScreen) (index, pScreen);
}
_X_EXPORT Rotation
xf86GetRotation(ScreenPtr pScreen)
{
- if (xf86RandRIndex == -1)
+ if (xf86RandRKey == NULL)
return RR_Rotate_0;
return XF86RANDRINFO(pScreen)->rotation;
@@ -360,7 +359,7 @@ xf86RandRSetNewVirtualAndDimensions(ScreenPtr pScreen,
{
XF86RandRInfoPtr randrp;
- if (xf86RandRIndex == -1)
+ if (xf86RandRKey == NULL)
return FALSE;
randrp = XF86RANDRINFO(pScreen);
@@ -402,11 +401,8 @@ xf86RandRInit (ScreenPtr pScreen)
if (!noPanoramiXExtension)
return TRUE;
#endif
- if (xf86RandRGeneration != serverGeneration)
- {
- xf86RandRIndex = AllocateScreenPrivateIndex();
- xf86RandRGeneration = serverGeneration;
- }
+
+ xf86RandRKey = &xf86RandRKey;
randrp = xalloc (sizeof (XF86RandRInfoRec));
if (!randrp)
@@ -434,7 +430,7 @@ xf86RandRInit (ScreenPtr pScreen)
randrp->rotation = RR_Rotate_0;
- pScreen->devPrivates[xf86RandRIndex].ptr = randrp;
+ dixSetPrivate(&pScreen->devPrivates, xf86RandRKey, randrp);
return TRUE;
}
diff --git a/hw/xfree86/common/xf86VidMode.c b/hw/xfree86/common/xf86VidMode.c
index 16a4d824c..38d605c88 100644
--- a/hw/xfree86/common/xf86VidMode.c
+++ b/hw/xfree86/common/xf86VidMode.c
@@ -47,12 +47,11 @@
#include "vidmodeproc.h"
#include "xf86cmap.h"
-static int VidModeGeneration = 0;
-static int VidModeIndex = -1;
+static DevPrivateKey VidModeKey = NULL;
static int VidModeCount = 0;
static Bool VidModeClose(int i, ScreenPtr pScreen);
-#define VMPTR(p) ((VidModePtr)(p)->devPrivates[VidModeIndex].ptr)
+#define VMPTR(p) ((VidModePtr)dixLookupPrivate(&(p)->devPrivates, VidModeKey))
#endif
@@ -73,15 +72,10 @@ VidModeExtensionInit(ScreenPtr pScreen)
return FALSE;
}
- if (serverGeneration != VidModeGeneration) {
- if ((VidModeIndex = AllocateScreenPrivateIndex()) < 0) {
- DEBUG_P("AllocateScreenPrivateIndex() failed");
- return FALSE;
- }
- VidModeGeneration = serverGeneration;
- }
+ VidModeKey = &VidModeKey;
- if (!(pScreen->devPrivates[VidModeIndex].ptr = xcalloc(sizeof(VidModeRec), 1))) {
+ if (!dixSetPrivate(&pScreen->devPrivates, VidModeKey,
+ xcalloc(sizeof(VidModeRec), 1))) {
DEBUG_P("xcalloc failed");
return FALSE;
}
@@ -114,10 +108,9 @@ VidModeClose(int i, ScreenPtr pScreen)
pScreen->CloseScreen = pVidMode->CloseScreen;
if (--VidModeCount == 0) {
- if (pScreen->devPrivates[VidModeIndex].ptr)
- xfree(pScreen->devPrivates[VidModeIndex].ptr);
- pScreen->devPrivates[VidModeIndex].ptr = NULL;
- VidModeIndex = -1;
+ xfree(dixLookupPrivate(&pScreen->devPrivates, VidModeKey));
+ dixSetPrivate(&pScreen->devPrivates, VidModeKey, NULL);
+ VidModeKey = NULL;
}
return pScreen->CloseScreen(i, pScreen);
}
@@ -128,8 +121,8 @@ VidModeAvailable(int scrnIndex)
ScrnInfoPtr pScrn;
VidModePtr pVidMode;
- if (VidModeIndex < 0) {
- DEBUG_P("VidModeIndex < 0");
+ if (VidModeKey == NULL) {
+ DEBUG_P("VidModeKey == NULL");
return FALSE;
}
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 7223f1dfa..92298e187 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -86,7 +86,6 @@
#define EXTENSION_PROC_ARGS void *
#include "extnsionst.h"
-#include "extinit.h" /* LookupDeviceIntRec */
#include "windowstr.h" /* screenIsSaved */
diff --git a/hw/xfree86/common/xf86cmap.c b/hw/xfree86/common/xf86cmap.c
index ea6a26dcd..764647ee4 100644
--- a/hw/xfree86/common/xf86cmap.c
+++ b/hw/xfree86/common/xf86cmap.c
@@ -60,7 +60,7 @@
#include "xf86cmap.h"
#define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = \
- ((CMapScreenPtr) (pScreen)->devPrivates[CMapScreenIndex].ptr)->field)
+ ((CMapScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, CMapScreenKey))->field)
#define SCREEN_EPILOGUE(pScreen, field, wrapper)\
((pScreen)->field = wrapper)
@@ -102,9 +102,8 @@ typedef struct {
int overscan;
} CMapColormapRec, *CMapColormapPtr;
-static unsigned long CMapGeneration = 0;
-static int CMapScreenIndex = -1;
-static int CMapColormapIndex = -1;
+static DevPrivateKey CMapScreenKey = NULL;
+static DevPrivateKey CMapColormapKey = &CMapColormapKey;
static void CMapInstallColormap(ColormapPtr);
static void CMapStoreColors(ColormapPtr, int, xColorItem *);
@@ -119,7 +118,6 @@ static int CMapChangeGamma(int, Gamma);
static void ComputeGamma(CMapScreenPtr);
static Bool CMapAllocateColormapPrivate(ColormapPtr);
-static Bool CMapInitDefMap(ColormapPtr,int);
static void CMapRefreshColors(ColormapPtr, int, int*);
static void CMapSetOverscan(ColormapPtr, int, int *);
static void CMapReinstallMap(ColormapPtr);
@@ -145,13 +143,7 @@ _X_EXPORT Bool xf86HandleColormaps(
if(!maxColors || !sigRGBbits || !loadPalette)
return FALSE;
- if(CMapGeneration != serverGeneration) {
- if(((CMapScreenIndex = AllocateScreenPrivateIndex()) < 0) ||
- ((CMapColormapIndex = AllocateColormapPrivateIndex(
- CMapInitDefMap)) < 0))
- return FALSE;
- CMapGeneration = serverGeneration;
- }
+ CMapScreenKey = &CMapScreenKey;
elements = 1 << sigRGBbits;
@@ -169,7 +161,7 @@ _X_EXPORT Bool xf86HandleColormaps(
return FALSE;
}
- pScreen->devPrivates[CMapScreenIndex].ptr = (pointer)pScreenPriv;
+ dixSetPrivate(&pScreen->devPrivates, CMapScreenKey, pScreenPriv);
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreenPriv->CreateColormap = pScreen->CreateColormap;
@@ -225,12 +217,6 @@ _X_EXPORT Bool xf86HandleColormaps(
return TRUE;
}
-static Bool
-CMapInitDefMap(ColormapPtr cmap, int index)
-{
- return TRUE;
-}
-
/**** Screen functions ****/
@@ -254,8 +240,8 @@ CMapColormapUseMax(VisualPtr pVisual, CMapScreenPtr pScreenPriv)
static Bool
CMapAllocateColormapPrivate(ColormapPtr pmap)
{
- CMapScreenPtr pScreenPriv =
- (CMapScreenPtr) pmap->pScreen->devPrivates[CMapScreenIndex].ptr;
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pmap->pScreen->devPrivates, CMapScreenKey);
CMapColormapPtr pColPriv;
CMapLinkPtr pLink;
int numColors;
@@ -274,7 +260,7 @@ CMapAllocateColormapPrivate(ColormapPtr pmap)
return FALSE;
}
- pmap->devPrivates[CMapColormapIndex].ptr = (pointer)pColPriv;
+ dixSetPrivate(&pmap->devPrivates, CMapColormapKey, pColPriv);
pColPriv->numColors = numColors;
pColPriv->colors = colors;
@@ -296,8 +282,8 @@ static Bool
CMapCreateColormap (ColormapPtr pmap)
{
ScreenPtr pScreen = pmap->pScreen;
- CMapScreenPtr pScreenPriv =
- (CMapScreenPtr)pScreen->devPrivates[CMapScreenIndex].ptr;
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, CMapScreenKey);
Bool ret = FALSE;
pScreen->CreateColormap = pScreenPriv->CreateColormap;
@@ -314,10 +300,10 @@ static void
CMapDestroyColormap (ColormapPtr cmap)
{
ScreenPtr pScreen = cmap->pScreen;
- CMapScreenPtr pScreenPriv =
- (CMapScreenPtr) pScreen->devPrivates[CMapScreenIndex].ptr;
- CMapColormapPtr pColPriv =
- (CMapColormapPtr) cmap->devPrivates[CMapColormapIndex].ptr;
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, CMapScreenKey);
+ CMapColormapPtr pColPriv = (CMapColormapPtr)dixLookupPrivate(
+ &cmap->devPrivates, CMapColormapKey);
CMapLinkPtr prevLink = NULL, pLink = pScreenPriv->maps;
if(pColPriv) {
@@ -356,8 +342,8 @@ CMapStoreColors(
){
ScreenPtr pScreen = pmap->pScreen;
VisualPtr pVisual = pmap->pVisual;
- CMapScreenPtr pScreenPriv =
- (CMapScreenPtr) pScreen->devPrivates[CMapScreenIndex].ptr;
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, CMapScreenKey);
int *indices = pScreenPriv->PreAllocIndices;
int num = ndef;
@@ -373,8 +359,8 @@ CMapStoreColors(
return;
if(pVisual->class == DirectColor) {
- CMapColormapPtr pColPriv =
- (CMapColormapPtr) pmap->devPrivates[CMapColormapIndex].ptr;
+ CMapColormapPtr pColPriv = (CMapColormapPtr)dixLookupPrivate(
+ &pmap->devPrivates, CMapColormapKey);
int i;
if (CMapColormapUseMax(pVisual, pScreenPriv)) {
@@ -431,8 +417,8 @@ CMapInstallColormap(ColormapPtr pmap)
{
ScreenPtr pScreen = pmap->pScreen;
int index = pScreen->myNum;
- CMapScreenPtr pScreenPriv =
- (CMapScreenPtr) pScreen->devPrivates[CMapScreenIndex].ptr;
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, CMapScreenKey);
if (pmap == miInstalledMaps[index])
return;
@@ -462,8 +448,8 @@ static Bool
CMapEnterVT(int index, int flags)
{
ScreenPtr pScreen = screenInfo.screens[index];
- CMapScreenPtr pScreenPriv =
- (CMapScreenPtr) pScreen->devPrivates[CMapScreenIndex].ptr;
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, CMapScreenKey);
if((*pScreenPriv->EnterVT)(index, flags)) {
if(miInstalledMaps[index])
@@ -478,8 +464,8 @@ static Bool
CMapSwitchMode(int index, DisplayModePtr mode, int flags)
{
ScreenPtr pScreen = screenInfo.screens[index];
- CMapScreenPtr pScreenPriv =
- (CMapScreenPtr) pScreen->devPrivates[CMapScreenIndex].ptr;
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, CMapScreenKey);
if((*pScreenPriv->SwitchMode)(index, mode, flags)) {
if(miInstalledMaps[index])
@@ -494,8 +480,8 @@ static int
CMapSetDGAMode(int index, int num, DGADevicePtr dev)
{
ScreenPtr pScreen = screenInfo.screens[index];
- CMapScreenPtr pScreenPriv =
- (CMapScreenPtr) pScreen->devPrivates[CMapScreenIndex].ptr;
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, CMapScreenKey);
int ret;
ret = (*pScreenPriv->SetDGAMode)(index, num, dev);
@@ -516,10 +502,10 @@ CMapSetDGAMode(int index, int num, DGADevicePtr dev)
static void
CMapReinstallMap(ColormapPtr pmap)
{
- CMapScreenPtr pScreenPriv =
- (CMapScreenPtr) pmap->pScreen->devPrivates[CMapScreenIndex].ptr;
- CMapColormapPtr cmapPriv =
- (CMapColormapPtr) pmap->devPrivates[CMapColormapIndex].ptr;
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pmap->pScreen->devPrivates, CMapScreenKey);
+ CMapColormapPtr cmapPriv = (CMapColormapPtr)dixLookupPrivate(
+ &pmap->devPrivates, CMapColormapKey);
ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum];
int i = cmapPriv->numColors;
int *indices = pScreenPriv->PreAllocIndices;
@@ -547,10 +533,10 @@ CMapReinstallMap(ColormapPtr pmap)
static void
CMapRefreshColors(ColormapPtr pmap, int defs, int* indices)
{
- CMapScreenPtr pScreenPriv =
- (CMapScreenPtr) pmap->pScreen->devPrivates[CMapScreenIndex].ptr;
- CMapColormapPtr pColPriv =
- (CMapColormapPtr) pmap->devPrivates[CMapColormapIndex].ptr;
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pmap->pScreen->devPrivates, CMapScreenKey);
+ CMapColormapPtr pColPriv = (CMapColormapPtr)dixLookupPrivate(
+ &pmap->devPrivates, CMapColormapKey);
VisualPtr pVisual = pmap->pVisual;
ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum];
int numColors, i;
@@ -681,10 +667,10 @@ CMapCompareColors(LOCO *color1, LOCO *color2)
static void
CMapSetOverscan(ColormapPtr pmap, int defs, int *indices)
{
- CMapScreenPtr pScreenPriv =
- (CMapScreenPtr) pmap->pScreen->devPrivates[CMapScreenIndex].ptr;
- CMapColormapPtr pColPriv =
- (CMapColormapPtr) pmap->devPrivates[CMapColormapIndex].ptr;
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pmap->pScreen->devPrivates, CMapScreenKey);
+ CMapColormapPtr pColPriv = (CMapColormapPtr)dixLookupPrivate(
+ &pmap->devPrivates, CMapColormapKey);
ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum];
VisualPtr pVisual = pmap->pVisual;
int i;
@@ -819,8 +805,8 @@ CMapSetOverscan(ColormapPtr pmap, int defs, int *indices)
static void
CMapUnwrapScreen(ScreenPtr pScreen)
{
- CMapScreenPtr pScreenPriv =
- (CMapScreenPtr) pScreen->devPrivates[CMapScreenIndex].ptr;
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, CMapScreenKey);
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
pScreen->CloseScreen = pScreenPriv->CloseScreen;
@@ -904,10 +890,11 @@ CMapChangeGamma(
CMapLinkPtr pLink;
/* Is this sufficient checking ? */
- if(CMapScreenIndex == -1)
+ if(CMapScreenKey == NULL)
return BadImplementation;
- pScreenPriv = (CMapScreenPtr)pScreen->devPrivates[CMapScreenIndex].ptr;
+ pScreenPriv = (CMapScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ CMapScreenKey);
if(!pScreenPriv)
return BadImplementation;
@@ -925,8 +912,8 @@ CMapChangeGamma(
/* mark all colormaps on this screen */
pLink = pScreenPriv->maps;
while(pLink) {
- pColPriv =
- (CMapColormapPtr) pLink->cmap->devPrivates[CMapColormapIndex].ptr;
+ pColPriv = (CMapColormapPtr)dixLookupPrivate(&pLink->cmap->devPrivates,
+ CMapColormapKey);
pColPriv->recalculate = TRUE;
pLink = pLink->next;
}
@@ -997,10 +984,11 @@ xf86ChangeGammaRamp(
CMapScreenPtr pScreenPriv;
CMapLinkPtr pLink;
- if(CMapScreenIndex == -1)
+ if(CMapScreenKey == NULL)
return BadImplementation;
- pScreenPriv = (CMapScreenPtr)pScreen->devPrivates[CMapScreenIndex].ptr;
+ pScreenPriv = (CMapScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ CMapScreenKey);
if(!pScreenPriv)
return BadImplementation;
@@ -1012,8 +1000,8 @@ xf86ChangeGammaRamp(
/* mark all colormaps on this screen */
pLink = pScreenPriv->maps;
while(pLink) {
- pColPriv =
- (CMapColormapPtr) pLink->cmap->devPrivates[CMapColormapIndex].ptr;
+ pColPriv = (CMapColormapPtr)dixLookupPrivate(&pLink->cmap->devPrivates,
+ CMapColormapKey);
pColPriv->recalculate = TRUE;
pLink = pLink->next;
}
@@ -1056,9 +1044,10 @@ xf86GetGammaRampSize(ScreenPtr pScreen)
{
CMapScreenPtr pScreenPriv;
- if(CMapScreenIndex == -1) return 0;
+ if(CMapScreenKey == NULL) return 0;
- pScreenPriv = (CMapScreenPtr)pScreen->devPrivates[CMapScreenIndex].ptr;
+ pScreenPriv = (CMapScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ CMapScreenKey);
if(!pScreenPriv) return 0;
return pScreenPriv->gammaElements;
@@ -1076,10 +1065,11 @@ xf86GetGammaRamp(
LOCO *entry;
int shift, sigbits;
- if(CMapScreenIndex == -1)
+ if(CMapScreenKey == NULL)
return BadImplementation;
- pScreenPriv = (CMapScreenPtr)pScreen->devPrivates[CMapScreenIndex].ptr;
+ pScreenPriv = (CMapScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ CMapScreenKey);
if(!pScreenPriv)
return BadImplementation;
diff --git a/hw/xfree86/common/xf86fbman.c b/hw/xfree86/common/xf86fbman.c
index 537d53d7d..9fd2e6c70 100644
--- a/hw/xfree86/common/xf86fbman.c
+++ b/hw/xfree86/common/xf86fbman.c
@@ -42,21 +42,15 @@
#define DEBUG
*/
-static int xf86FBMangerIndex = -1;
-static unsigned long xf86ManagerGeneration = 0;
+static DevPrivateKey xf86FBManagerKey = NULL;
_X_EXPORT Bool xf86RegisterOffscreenManager(
ScreenPtr pScreen,
FBManagerFuncsPtr funcs
){
- if(xf86ManagerGeneration != serverGeneration) {
- if((xf86FBMangerIndex = AllocateScreenPrivateIndex()) < 0)
- return FALSE;
- xf86ManagerGeneration = serverGeneration;
- }
-
- pScreen->devPrivates[xf86FBMangerIndex].ptr = (pointer)funcs;
+ xf86FBManagerKey = &xf86FBManagerKey;
+ dixSetPrivate(&pScreen->devPrivates, xf86FBManagerKey, funcs);
return TRUE;
}
@@ -65,9 +59,9 @@ _X_EXPORT Bool xf86RegisterOffscreenManager(
_X_EXPORT Bool
xf86FBManagerRunning(ScreenPtr pScreen)
{
- if(xf86FBMangerIndex < 0)
+ if(xf86FBManagerKey == NULL)
return FALSE;
- if(!pScreen->devPrivates[xf86FBMangerIndex].ptr)
+ if(!dixLookupPrivate(&pScreen->devPrivates, xf86FBManagerKey))
return FALSE;
return TRUE;
@@ -81,9 +75,10 @@ xf86RegisterFreeBoxCallback(
){
FBManagerFuncsPtr funcs;
- if(xf86FBMangerIndex < 0)
+ if(xf86FBManagerKey == NULL)
return FALSE;
- if(!(funcs = (FBManagerFuncsPtr)pScreen->devPrivates[xf86FBMangerIndex].ptr))
+ if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBManagerKey)))
return FALSE;
return (*funcs->RegisterFreeBoxCallback)(pScreen, FreeBoxCallback, devPriv);
@@ -101,9 +96,10 @@ xf86AllocateOffscreenArea(
){
FBManagerFuncsPtr funcs;
- if(xf86FBMangerIndex < 0)
+ if(xf86FBManagerKey == NULL)
return NULL;
- if(!(funcs = (FBManagerFuncsPtr)pScreen->devPrivates[xf86FBMangerIndex].ptr))
+ if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBManagerKey)))
return NULL;
return (*funcs->AllocateOffscreenArea)(
@@ -122,9 +118,10 @@ xf86AllocateOffscreenLinear(
){
FBManagerFuncsPtr funcs;
- if(xf86FBMangerIndex < 0)
+ if(xf86FBManagerKey == NULL)
return NULL;
- if(!(funcs = (FBManagerFuncsPtr)pScreen->devPrivates[xf86FBMangerIndex].ptr))
+ if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBManagerKey)))
return NULL;
return (*funcs->AllocateOffscreenLinear)(
@@ -139,10 +136,10 @@ xf86FreeOffscreenArea(FBAreaPtr area)
if(!area) return;
- if(xf86FBMangerIndex < 0)
+ if(xf86FBManagerKey == NULL)
return;
- if(!(funcs =
- (FBManagerFuncsPtr)area->pScreen->devPrivates[xf86FBMangerIndex].ptr))
+ if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(
+ &area->pScreen->devPrivates, xf86FBManagerKey)))
return;
(*funcs->FreeOffscreenArea)(area);
@@ -158,10 +155,10 @@ xf86FreeOffscreenLinear(FBLinearPtr linear)
if(!linear) return;
- if(xf86FBMangerIndex < 0)
+ if(xf86FBManagerKey == NULL)
return;
- if(!(funcs =
- (FBManagerFuncsPtr)linear->pScreen->devPrivates[xf86FBMangerIndex].ptr))
+ if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(
+ &linear->pScreen->devPrivates, xf86FBManagerKey)))
return;
(*funcs->FreeOffscreenLinear)(linear);
@@ -179,10 +176,10 @@ xf86ResizeOffscreenArea(
if(!resize) return FALSE;
- if(xf86FBMangerIndex < 0)
+ if(xf86FBManagerKey == NULL)
return FALSE;
- if(!(funcs =
- (FBManagerFuncsPtr)resize->pScreen->devPrivates[xf86FBMangerIndex].ptr))
+ if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(
+ &resize->pScreen->devPrivates, xf86FBManagerKey)))
return FALSE;
return (*funcs->ResizeOffscreenArea)(resize, w, h);
@@ -197,10 +194,10 @@ xf86ResizeOffscreenLinear(
if(!resize) return FALSE;
- if(xf86FBMangerIndex < 0)
+ if(xf86FBManagerKey == NULL)
return FALSE;
- if(!(funcs =
- (FBManagerFuncsPtr)resize->pScreen->devPrivates[xf86FBMangerIndex].ptr))
+ if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(
+ &resize->pScreen->devPrivates, xf86FBManagerKey)))
return FALSE;
return (*funcs->ResizeOffscreenLinear)(resize, size);
@@ -220,9 +217,10 @@ xf86QueryLargestOffscreenArea(
*w = 0;
*h = 0;
- if(xf86FBMangerIndex < 0)
+ if(xf86FBManagerKey == NULL)
return FALSE;
- if(!(funcs = (FBManagerFuncsPtr)pScreen->devPrivates[xf86FBMangerIndex].ptr))
+ if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBManagerKey)))
return FALSE;
return (*funcs->QueryLargestOffscreenArea)(
@@ -240,9 +238,10 @@ xf86QueryLargestOffscreenLinear(
*size = 0;
- if(xf86FBMangerIndex < 0)
+ if(xf86FBManagerKey == NULL)
return FALSE;
- if(!(funcs = (FBManagerFuncsPtr)pScreen->devPrivates[xf86FBMangerIndex].ptr))
+ if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBManagerKey)))
return FALSE;
return (*funcs->QueryLargestOffscreenLinear)(
@@ -255,9 +254,10 @@ xf86PurgeUnlockedOffscreenAreas(ScreenPtr pScreen)
{
FBManagerFuncsPtr funcs;
- if(xf86FBMangerIndex < 0)
+ if(xf86FBManagerKey == NULL)
return FALSE;
- if(!(funcs = (FBManagerFuncsPtr)pScreen->devPrivates[xf86FBMangerIndex].ptr))
+ if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBManagerKey)))
return FALSE;
return (*funcs->PurgeOffscreenAreas)(pScreen);
@@ -269,8 +269,7 @@ xf86PurgeUnlockedOffscreenAreas(ScreenPtr pScreen)
\************************************************************/
-static unsigned long xf86FBGeneration = 0;
-static int xf86FBScreenIndex = -1;
+static DevPrivateKey xf86FBScreenKey = &xf86FBScreenKey;
typedef struct _FBLink {
FBArea area;
@@ -320,8 +319,8 @@ localRegisterFreeBoxCallback(
FreeBoxCallbackProcPtr *newCallbacks;
DevUnion *newPrivates;
- offman = pScreen->devPrivates[xf86FBScreenIndex].ptr;
-
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
newCallbacks = xrealloc( offman->FreeBoxesUpdateCallback,
sizeof(FreeBoxCallbackProcPtr) * (offman->NumCallbacks + 1));
@@ -446,8 +445,8 @@ localAllocateOffscreenArea(
FBManagerPtr offman;
FBAreaPtr area = NULL;
- offman = pScreen->devPrivates[xf86FBScreenIndex].ptr;
-
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
if((area = AllocateArea(offman, w, h, gran, moveCB, removeCB, privData)))
SendCallFreeBoxCallbacks(offman);
@@ -464,8 +463,8 @@ localFreeOffscreenArea(FBAreaPtr area)
ScreenPtr pScreen;
pScreen = area->pScreen;
- offman = pScreen->devPrivates[xf86FBScreenIndex].ptr;
-
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
pLink = offman->UsedAreas;
if(!pLink) return;
@@ -505,8 +504,8 @@ localResizeOffscreenArea(
FBLinkPtr pLink, newLink, pLinkPrev = NULL;
pScreen = resize->pScreen;
- offman = pScreen->devPrivates[xf86FBScreenIndex].ptr;
-
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
/* find this link */
if(!(pLink = offman->UsedAreas))
return FALSE;
@@ -625,8 +624,8 @@ localQueryLargestOffscreenArea(
if((preferences < 0) || (preferences > 3))
return FALSE;
- offman = pScreen->devPrivates[xf86FBScreenIndex].ptr;
-
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
if(severity < 0) severity = 0;
if(severity > 2) severity = 2;
@@ -731,8 +730,8 @@ localPurgeUnlockedOffscreenAreas(ScreenPtr pScreen)
RegionRec FreedRegion;
Bool anyUsed = FALSE;
- offman = pScreen->devPrivates[xf86FBScreenIndex].ptr;
-
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
pLink = offman->UsedAreas;
if(!pLink) return TRUE;
@@ -780,8 +779,8 @@ LinearRemoveCBWrapper(FBAreaPtr area)
FBLinearLinkPtr pLink, pLinkPrev = NULL;
ScreenPtr pScreen = area->pScreen;
- offman = pScreen->devPrivates[xf86FBScreenIndex].ptr;
-
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
pLink = offman->LinearAreas;
if(!pLink) return;
@@ -911,7 +910,8 @@ localAllocateOffscreenLinear(
BoxPtr extents;
int w, h, pitch;
- offman = pScreen->devPrivates[xf86FBScreenIndex].ptr;
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
/* Try to allocate from linear memory first...... */
#ifdef DEBUG
@@ -991,8 +991,8 @@ localFreeOffscreenLinear(FBLinearPtr linear)
FBLinearLinkPtr pLink, pLinkPrev = NULL;
ScreenPtr pScreen = linear->pScreen;
- offman = pScreen->devPrivates[xf86FBScreenIndex].ptr;
-
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
pLink = offman->LinearAreas;
if(!pLink) return;
@@ -1049,8 +1049,8 @@ localResizeOffscreenLinear(FBLinearPtr resize, int length)
FBLinearLinkPtr pLink;
ScreenPtr pScreen = resize->pScreen;
- offman = pScreen->devPrivates[xf86FBScreenIndex].ptr;
-
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
pLink = offman->LinearAreas;
if(!pLink) return FALSE;
@@ -1099,7 +1099,8 @@ localQueryLargestOffscreenLinear(
int priority
)
{
- FBManagerPtr offman = pScreen->devPrivates[xf86FBScreenIndex].ptr;
+ FBManagerPtr offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
FBLinearLinkPtr pLink;
FBLinearLinkPtr pLinkRet;
@@ -1130,7 +1131,8 @@ localQueryLargestOffscreenLinear(
FBManagerPtr offman;
BoxPtr extents;
- offman = pScreen->devPrivates[xf86FBScreenIndex].ptr;
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
extents = REGION_EXTENTS(pScreen, offman->InitialBoxes);
if((extents->x2 - extents->x1) == w)
*size = w * h;
@@ -1162,9 +1164,8 @@ xf86FBCloseScreen (int i, ScreenPtr pScreen)
{
FBLinkPtr pLink, tmp;
FBLinearLinkPtr pLinearLink, tmp2;
- FBManagerPtr offman =
- (FBManagerPtr) pScreen->devPrivates[xf86FBScreenIndex].ptr;
-
+ FBManagerPtr offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
pScreen->CloseScreen = offman->CloseScreen;
@@ -1188,7 +1189,7 @@ xf86FBCloseScreen (int i, ScreenPtr pScreen)
xfree(offman->FreeBoxesUpdateCallback);
xfree(offman->devPrivates);
xfree(offman);
- pScreen->devPrivates[xf86FBScreenIndex].ptr = NULL;
+ dixSetPrivate(&pScreen->devPrivates, xf86FBScreenKey, NULL);
return (*pScreen->CloseScreen) (i, pScreen);
}
@@ -1332,19 +1333,13 @@ xf86InitFBManagerRegion(
if(REGION_NIL(FullRegion))
return FALSE;
- if(xf86FBGeneration != serverGeneration) {
- if((xf86FBScreenIndex = AllocateScreenPrivateIndex()) < 0)
- return FALSE;
- xf86FBGeneration = serverGeneration;
- }
-
if(!xf86RegisterOffscreenManager(pScreen, &xf86FBManFuncs))
return FALSE;
offman = xalloc(sizeof(FBManager));
if(!offman) return FALSE;
- pScreen->devPrivates[xf86FBScreenIndex].ptr = (pointer)offman;
+ dixSetPrivate(&pScreen->devPrivates, xf86FBScreenKey, offman);
offman->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = xf86FBCloseScreen;
@@ -1380,11 +1375,11 @@ xf86InitFBManagerLinear(
return FALSE;
/* we expect people to have called the Area setup first for pixmap cache */
- if (!pScreen->devPrivates[xf86FBScreenIndex].ptr)
+ if (!dixLookupPrivate(&pScreen->devPrivates, xf86FBScreenKey))
return FALSE;
- offman = pScreen->devPrivates[xf86FBScreenIndex].ptr;
-
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
offman->LinearAreas = xalloc(sizeof(FBLinearLink));
if (!offman->LinearAreas)
return FALSE;
@@ -1424,13 +1419,14 @@ xf86AllocateLinearOffscreenArea (
BoxPtr extents;
int w, h;
- if(xf86FBMangerIndex < 0)
+ if(xf86FBManagerKey == NULL)
return NULL;
- if(!(funcs = (FBManagerFuncsPtr)pScreen->devPrivates[xf86FBMangerIndex].ptr))
+ if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBManagerKey)))
return NULL;
- offman = pScreen->devPrivates[xf86FBScreenIndex].ptr;
-
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
extents = REGION_EXTENTS(pScreen, offman->InitialBoxes);
w = extents->x2 - extents->x1;
diff --git a/hw/xfree86/common/xf86sbusBus.c b/hw/xfree86/common/xf86sbusBus.c
index af2cd4a4c..63d1cb31c 100644
--- a/hw/xfree86/common/xf86sbusBus.c
+++ b/hw/xfree86/common/xf86sbusBus.c
@@ -602,8 +602,7 @@ xf86SbusUseBuiltinMode(ScrnInfoPtr pScrn, sbusDevicePtr psdp)
pScrn->virtualY = psdp->height;
}
-static int sbusPaletteIndex = -1;
-static unsigned long sbusPaletteGeneration = 0;
+static DevPrivateKey sbusPaletteKey = &sbusPaletteKey;
typedef struct _sbusCmap {
sbusDevicePtr psdp;
CloseScreenProcPtr CloseScreen;
@@ -613,7 +612,8 @@ typedef struct _sbusCmap {
unsigned char origBlue[16];
} sbusCmapRec, *sbusCmapPtr;
-#define SBUSCMAPPTR(pScreen) ((sbusCmapPtr)((pScreen)->devPrivates[sbusPaletteIndex].ptr))
+#define SBUSCMAPPTR(pScreen) ((sbusCmapPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, sbusPaletteKey))
static void
xf86SbusCmapLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
@@ -673,13 +673,8 @@ xf86SbusHandleColormaps(ScreenPtr pScreen, sbusDevicePtr psdp)
struct fbcmap fbcmap;
unsigned char data[2];
- if(sbusPaletteGeneration != serverGeneration) {
- if((sbusPaletteIndex = AllocateScreenPrivateIndex()) < 0)
- return FALSE;
- sbusPaletteGeneration = serverGeneration;
- }
cmap = xnfcalloc(1, sizeof(sbusCmapRec));
- pScreen->devPrivates[sbusPaletteIndex].ptr = cmap;
+ dixSetPrivate(&pScreen->devPrivates, sbusPaletteKey, cmap);
cmap->psdp = psdp;
fbcmap.index = 0;
fbcmap.count = 16;
diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h
index af98b4fd5..2e0213597 100644
--- a/hw/xfree86/common/xf86str.h
+++ b/hw/xfree86/common/xf86str.h
@@ -125,6 +125,7 @@ typedef enum {
MODE_ONE_HEIGHT, /* only one height is supported */
MODE_ONE_SIZE, /* only one resolution is supported */
MODE_NO_REDUCED, /* monitor doesn't accept reduced blanking */
+ MODE_BANDWIDTH, /* mode requires too much memory bandwidth */
MODE_BAD = -2, /* unspecified reason */
MODE_ERROR = -1 /* error condition */
} ModeStatus;
diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index eac0d7e2c..7483e20d2 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -110,23 +110,22 @@ static void xf86XVAdjustFrame(int index, int x, int y, int flags);
static Bool xf86XVInitAdaptors(ScreenPtr, XF86VideoAdaptorPtr*, int);
-static int XF86XVWindowIndex = -1;
-int XF86XvScreenIndex = -1;
-static unsigned long XF86XVGeneration = 0;
+static DevPrivateKey XF86XVWindowKey = &XF86XVWindowKey;
+DevPrivateKey XF86XvScreenKey;
static unsigned long PortResource = 0;
-int (*XvGetScreenIndexProc)(void) = NULL;
+DevPrivateKey (*XvGetScreenKeyProc)(void) = NULL;
unsigned long (*XvGetRTPortProc)(void) = NULL;
int (*XvScreenInitProc)(ScreenPtr) = NULL;
#define GET_XV_SCREEN(pScreen) \
- ((XvScreenPtr)((pScreen)->devPrivates[XF86XvScreenIndex].ptr))
+ ((XvScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, XF86XvScreenKey))
#define GET_XF86XV_SCREEN(pScreen) \
- ((XF86XVScreenPtr)(GET_XV_SCREEN(pScreen)->devPriv.ptr))
+ ((XF86XVScreenPtr)(GET_XV_SCREEN(pScreen)->devPriv.ptr))
#define GET_XF86XV_WINDOW(pWin) \
- ((XF86XVWindowPtr)((pWin)->devPrivates[XF86XVWindowIndex].ptr))
+ ((XF86XVWindowPtr)dixLookupPrivate(&(pWin)->devPrivates, XF86XVWindowKey))
static xf86XVInitGenericAdaptorPtr *GenDrivers = NULL;
static int NumGenDrivers = 0;
@@ -233,21 +232,12 @@ xf86XVScreenInit(
XvScreenPtr pxvs;
if(num <= 0 ||
- !XvGetScreenIndexProc || !XvGetRTPortProc || !XvScreenInitProc)
- return FALSE;
-
- if(XF86XVGeneration != serverGeneration) {
- if((XF86XVWindowIndex = AllocateWindowPrivateIndex()) < 0)
- return FALSE;
- XF86XVGeneration = serverGeneration;
- }
-
- if(!AllocateWindowPrivate(pScreen,XF86XVWindowIndex,0))
+ !XvGetScreenKeyProc || !XvGetRTPortProc || !XvScreenInitProc)
return FALSE;
if(Success != (*XvScreenInitProc)(pScreen)) return FALSE;
- XF86XvScreenIndex = (*XvGetScreenIndexProc)();
+ XF86XvScreenKey = (*XvGetScreenKeyProc)();
PortResource = (*XvGetRTPortProc)();
pxvs = GET_XV_SCREEN(pScreen);
@@ -977,7 +967,7 @@ xf86XVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
memset(winPriv, 0, sizeof(XF86XVWindowRec));
winPriv->PortRec = portPriv;
winPriv->next = PrivRoot;
- pWin->devPrivates[XF86XVWindowIndex].ptr = (pointer)winPriv;
+ dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey, winPriv);
}
portPriv->pDraw = (DrawablePtr)pWin;
@@ -998,8 +988,8 @@ xf86XVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
if(prevPriv)
prevPriv->next = winPriv->next;
else
- pWin->devPrivates[XF86XVWindowIndex].ptr =
- (pointer)winPriv->next;
+ dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey,
+ winPriv->next);
xfree(winPriv);
break;
}
@@ -1037,7 +1027,7 @@ xf86XVDestroyWindow(WindowPtr pWin)
xfree(tmp);
}
- pWin->devPrivates[XF86XVWindowIndex].ptr = NULL;
+ dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey, NULL);
pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
ret = (*pScreen->DestroyWindow)(pWin);
@@ -1094,8 +1084,8 @@ xf86XVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
pPriv->pDraw = NULL;
if(!pPrev)
- pWin->devPrivates[XF86XVWindowIndex].ptr =
- (pointer)(WinPriv->next);
+ dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey,
+ WinPriv->next);
else
pPrev->next = WinPriv->next;
tmp = WinPriv;
@@ -1146,8 +1136,8 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy)
pPriv->pDraw = NULL;
if(!pPrev)
- pWin->devPrivates[XF86XVWindowIndex].ptr =
- (pointer)(WinPriv->next);
+ dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey,
+ WinPriv->next);
else
pPrev->next = WinPriv->next;
tmp = WinPriv;
@@ -1844,7 +1834,8 @@ xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes)
int status;
pval[0] = key;
pval[1] = IncludeInferiors;
- pGC = CreateGC(pDraw, GCForeground | GCSubwindowMode, pval, &status);
+ pGC = CreateGC(pDraw, GCForeground | GCSubwindowMode, pval, &status,
+ (XID)0, serverClient);
if(!pGC) return;
ValidateGC(pDraw, pGC);
if (pPriv) pPriv->pGC = pGC;
diff --git a/hw/xfree86/common/xf86xvmc.c b/hw/xfree86/common/xf86xvmc.c
index f8ff0bed4..05267a240 100644
--- a/hw/xfree86/common/xf86xvmc.c
+++ b/hw/xfree86/common/xf86xvmc.c
@@ -56,11 +56,10 @@ typedef struct {
XvMCAdaptorPtr dixinfo;
} xf86XvMCScreenRec, *xf86XvMCScreenPtr;
-static unsigned long XF86XvMCGeneration = 0;
-static int XF86XvMCScreenIndex = -1;
+static DevPrivateKey XF86XvMCScreenKey = &XF86XvMCScreenKey;
-#define XF86XVMC_GET_PRIVATE(pScreen) \
- (xf86XvMCScreenPtr)((pScreen)->devPrivates[XF86XvMCScreenIndex].ptr)
+#define XF86XVMC_GET_PRIVATE(pScreen) (xf86XvMCScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, XF86XvMCScreenKey)
static int
@@ -164,19 +163,12 @@ _X_EXPORT Bool xf86XvMCScreenInit(
{
XvMCAdaptorPtr pAdapt;
xf86XvMCScreenPtr pScreenPriv;
- XvScreenPtr pxvs =
- (XvScreenPtr)(pScreen->devPrivates[XF86XvScreenIndex].ptr);
-
+ XvScreenPtr pxvs = (XvScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ XF86XvScreenKey);
int i, j;
if(!XvMCScreenInitProc) return FALSE;
- if(XF86XvMCGeneration != serverGeneration) {
- if((XF86XvMCScreenIndex = AllocateScreenPrivateIndex()) < 0)
- return FALSE;
- XF86XvMCGeneration = serverGeneration;
- }
-
if(!(pAdapt = xalloc(sizeof(XvMCAdaptorRec) * num_adaptors)))
return FALSE;
@@ -185,7 +177,7 @@ _X_EXPORT Bool xf86XvMCScreenInit(
return FALSE;
}
- pScreen->devPrivates[XF86XvMCScreenIndex].ptr = (pointer)pScreenPriv;
+ dixSetPrivate(&pScreen->devPrivates, XF86XvMCScreenKey, pScreenPriv);
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = xf86XvMCCloseScreen;
diff --git a/hw/xfree86/common/xf86xvpriv.h b/hw/xfree86/common/xf86xvpriv.h
index e716c9c6a..4200dac80 100644
--- a/hw/xfree86/common/xf86xvpriv.h
+++ b/hw/xfree86/common/xf86xvpriv.h
@@ -30,10 +30,11 @@
#define _XF86XVPRIV_H_
#include "xf86xv.h"
+#include "privates.h"
/*** These are DDX layer privates ***/
-extern int XF86XvScreenIndex;
+extern DevPrivateKey XF86XvScreenKey;
typedef struct {
DestroyWindowProcPtr DestroyWindow;
diff --git a/hw/xfree86/ddc/ddcProperty.c b/hw/xfree86/ddc/ddcProperty.c
index 67351d3dc..02125dff7 100644
--- a/hw/xfree86/ddc/ddcProperty.c
+++ b/hw/xfree86/ddc/ddcProperty.c
@@ -31,7 +31,6 @@
#include "property.h"
#include "propertyst.h"
#include "xf86DDC.h"
-#include "xf86_ansic.h"
#define EDID1_ATOM_NAME "XFree86_DDC_EDID1_RAWDATA"
#define EDID2_ATOM_NAME "XFree86_DDC_EDID2_RAWDATA"
diff --git a/hw/xfree86/dixmods/extmod/modinit.h b/hw/xfree86/dixmods/extmod/modinit.h
index 41f060b2a..191b3ef89 100644
--- a/hw/xfree86/dixmods/extmod/modinit.h
+++ b/hw/xfree86/dixmods/extmod/modinit.h
@@ -129,8 +129,11 @@ extern void ShmRegisterFuncs(
extern void XaceExtensionInit(INITARGS);
#endif
+#ifdef XSELINUX
+extern void XSELinuxExtensionInit(INITARGS);
+#endif
+
#if 1
-extern void SecurityExtensionSetup(INITARGS);
extern void SecurityExtensionInit(INITARGS);
#endif
diff --git a/hw/xfree86/dixmods/extmod/xf86dga2.c b/hw/xfree86/dixmods/extmod/xf86dga2.c
index fa9530860..295e05e9e 100644
--- a/hw/xfree86/dixmods/extmod/xf86dga2.c
+++ b/hw/xfree86/dixmods/extmod/xf86dga2.c
@@ -62,8 +62,7 @@ unsigned char DGAReqCode = 0;
int DGAErrorBase;
int DGAEventBase;
-static int DGAGeneration = 0;
-static int DGAClientPrivateIndex;
+static DevPrivateKey DGAClientPrivateKey = &DGAClientPrivateKey;
static int DGACallbackRefCount = 0;
/* This holds the client's version information */
@@ -72,7 +71,11 @@ typedef struct {
int minor;
} DGAPrivRec, *DGAPrivPtr;
-#define DGAPRIV(c) ((c)->devPrivates[DGAClientPrivateIndex].ptr)
+#define DGA_GETPRIV(c) ((DGAPrivPtr) \
+ dixLookupPrivate(&(c)->devPrivates, DGAClientPrivateKey))
+#define DGA_SETPRIV(c,p) \
+ dixSetPrivate(&(c)->devPrivates, DGAClientPrivateKey, p)
+
void
XFree86DGAExtensionInit(INITARGS)
@@ -97,23 +100,6 @@ XFree86DGAExtensionInit(INITARGS)
for (i = KeyPress; i <= MotionNotify; i++)
SetCriticalEvent (DGAEventBase + i);
}
-
- /*
- * Allocate a client private index to hold the client's version
- * information.
- */
- if (DGAGeneration != serverGeneration) {
- DGAClientPrivateIndex = AllocateClientPrivateIndex();
- /*
- * Allocate 0 length, and use the private to hold a pointer to
- * our DGAPrivRec.
- */
- if (!AllocateClientPrivate(DGAClientPrivateIndex, 0)) {
- ErrorF("XFree86DGAExtensionInit: AllocateClientPrivate failed\n");
- return;
- }
- DGAGeneration = serverGeneration;
- }
}
@@ -590,12 +576,12 @@ ProcXDGASetClientVersion(ClientPtr client)
DGAPrivPtr pPriv;
REQUEST_SIZE_MATCH(xXDGASetClientVersionReq);
- if ((pPriv = DGAPRIV(client)) == NULL) {
+ if ((pPriv = DGA_GETPRIV(client)) == NULL) {
pPriv = xalloc(sizeof(DGAPrivRec));
/* XXX Need to look into freeing this */
if (!pPriv)
return BadAlloc;
- DGAPRIV(client) = pPriv;
+ DGA_SETPRIV(client, pPriv);
}
pPriv->major = stuff->major;
pPriv->minor = stuff->minor;
diff --git a/hw/xfree86/dixmods/extmod/xf86misc.c b/hw/xfree86/dixmods/extmod/xf86misc.c
index 3a6f83eca..66278a298 100644
--- a/hw/xfree86/dixmods/extmod/xf86misc.c
+++ b/hw/xfree86/dixmods/extmod/xf86misc.c
@@ -41,8 +41,7 @@
#endif
static int miscErrorBase;
-static int MiscGeneration = 0;
-static int MiscClientPrivateIndex;
+static DevPrivateKey MiscClientPrivateKey = &MiscClientPrivateKey;
/* This holds the client's version information */
typedef struct {
@@ -50,7 +49,10 @@ typedef struct {
int minor;
} MiscPrivRec, *MiscPrivPtr;
-#define MPRIV(c) ((c)->devPrivates[MiscClientPrivateIndex].ptr)
+#define M_GETPRIV(c) ((MiscPrivPtr) \
+ dixLookupPrivate(&(c)->devPrivates, MiscClientPrivateKey))
+#define M_SETPRIV(c,p) \
+ dixSetPrivate(&(c)->devPrivates, MiscClientPrivateKey, p)
static void XF86MiscResetProc(
ExtensionEntry* /* extEntry */
@@ -61,7 +63,7 @@ ClientVersion(ClientPtr client, int *major, int *minor)
{
MiscPrivPtr pPriv;
- pPriv = MPRIV(client);
+ pPriv = M_GETPRIV(client);
if (!pPriv) {
if (major) *major = 0;
if (minor) *minor = 0;
@@ -123,24 +125,6 @@ XFree86MiscExtensionInit(void)
if (!xf86GetModInDevEnabled())
return;
- /*
- * Allocate a client private index to hold the client's version
- * information.
- */
- if (MiscGeneration != serverGeneration) {
- MiscClientPrivateIndex = AllocateClientPrivateIndex();
- /*
- * Allocate 0 length, and use the private to hold a pointer to our
- * MiscPrivRec.
- */
- if (!AllocateClientPrivate(MiscClientPrivateIndex, 0)) {
- ErrorF("XFree86MiscExtensionInit: "
- "AllocateClientPrivate failed\n");
- return;
- }
- MiscGeneration = serverGeneration;
- }
-
if (
(extEntry = AddExtension(XF86MISCNAME,
XF86MiscNumberEvents,
@@ -205,7 +189,9 @@ ProcXF86MiscSetSaver(client)
if (stuff->screen > screenInfo.numScreens)
return BadValue;
- vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr;
+ vptr = (ScrnInfoPtr)
+ dixLookupPrivate(&screenInfo.screens[stuff->screen]->devPrivates,
+ xf86ScreenKey);
REQUEST_SIZE_MATCH(xXF86MiscSetSaverReq);
@@ -233,7 +219,9 @@ ProcXF86MiscGetSaver(client)
if (stuff->screen > screenInfo.numScreens)
return BadValue;
- vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr;
+ vptr = (ScrnInfoPtr)
+ dixLookupPrivate(&screenInfo.screens[stuff->screen]->devPrivates,
+ xf86ScreenKey);
REQUEST_SIZE_MATCH(xXF86MiscGetSaverReq);
rep.type = X_Reply;
@@ -497,11 +485,11 @@ ProcXF86MiscSetClientVersion(ClientPtr client)
REQUEST_SIZE_MATCH(xXF86MiscSetClientVersionReq);
- if ((pPriv = MPRIV(client)) == NULL) {
+ if ((pPriv = M_GETPRIV(client)) == NULL) {
pPriv = xalloc(sizeof(MiscPrivRec));
if (!pPriv)
return BadAlloc;
- MPRIV(client) = pPriv;
+ M_SETPRIV(client, pPriv);
}
if (xf86GetVerbosity() > 1)
ErrorF("SetClientVersion: %i %i\n",stuff->major,stuff->minor);
diff --git a/hw/xfree86/dixmods/extmod/xf86vmode.c b/hw/xfree86/dixmods/extmod/xf86vmode.c
index 3b054a829..718d40fbd 100644
--- a/hw/xfree86/dixmods/extmod/xf86vmode.c
+++ b/hw/xfree86/dixmods/extmod/xf86vmode.c
@@ -52,8 +52,7 @@ from Kaleb S. KEITHLEY
#define DEFAULT_XF86VIDMODE_VERBOSITY 3
static int VidModeErrorBase;
-static int VidModeGeneration = 0;
-static int VidModeClientPrivateIndex;
+static DevPrivateKey VidModeClientPrivateKey = &VidModeClientPrivateKey;
/* This holds the client's version information */
typedef struct {
@@ -61,7 +60,10 @@ typedef struct {
int minor;
} VidModePrivRec, *VidModePrivPtr;
-#define VMPRIV(c) ((c)->devPrivates[VidModeClientPrivateIndex].ptr)
+#define VM_GETPRIV(c) ((VidModePrivPtr) \
+ dixLookupPrivate(&(c)->devPrivates, VidModeClientPrivateKey))
+#define VM_SETPRIV(c,p) \
+ dixSetPrivate(&(c)->devPrivates, VidModeClientPrivateKey, p)
static void XF86VidModeResetProc(
ExtensionEntry* /* extEntry */
@@ -145,10 +147,12 @@ typedef struct _XF86VidModeScreenPrivate {
Bool hasWindow;
} XF86VidModeScreenPrivateRec, *XF86VidModeScreenPrivatePtr;
-static int ScreenPrivateIndex;
+static DevPrivateKey ScreenPrivateKey = &ScreenPrivateKey;
-#define GetScreenPrivate(s) ((ScreenSaverScreenPrivatePtr)(s)->devPrivates[ScreenPrivateIndex].ptr)
-#define SetScreenPrivate(s,v) ((s)->devPrivates[ScreenPrivateIndex].ptr = (pointer) v);
+#define GetScreenPrivate(s) ((ScreenSaverScreenPrivatePtr) \
+ dixLookupPrivate(&(s)->devPrivates, ScreenPrivateKey))
+#define SetScreenPrivate(s,v) \
+ dixSetPrivate(&(s)->devPrivates, ScreenPrivateKey, v)
#define SetupScreen(s) ScreenSaverScreenPrivatePtr pPriv = GetScreenPrivate(s)
#define New(t) (xalloc (sizeof (t)))
@@ -172,7 +176,6 @@ XFree86VidModeExtensionInit(void)
#ifdef XF86VIDMODE_EVENTS
EventType = CreateNewResourceType(XF86VidModeFreeEvents);
- ScreenPrivateIndex = AllocateScreenPrivateIndex ();
#endif
for(i = 0; i < screenInfo.numScreens; i++) {
@@ -187,27 +190,9 @@ XFree86VidModeExtensionInit(void)
if (!enabled)
return;
- /*
- * Allocate a client private index to hold the client's version
- * information.
- */
- if (VidModeGeneration != serverGeneration) {
- VidModeClientPrivateIndex = AllocateClientPrivateIndex();
- /*
- * Allocate 0 length, and use the private to hold a pointer to our
- * VidModePrivRec.
- */
- if (!AllocateClientPrivate(VidModeClientPrivateIndex, 0)) {
- ErrorF("XFree86VidModeExtensionInit: "
- "AllocateClientPrivate failed\n");
- return;
- }
- VidModeGeneration = serverGeneration;
- }
-
if (
#ifdef XF86VIDMODE_EVENTS
- EventType && ScreenPrivateIndex != -1 &&
+ EventType &&
#endif
(extEntry = AddExtension(XF86VIDMODENAME,
XF86VidModeNumberEvents,
@@ -239,7 +224,7 @@ ClientMajorVersion(ClientPtr client)
{
VidModePrivPtr pPriv;
- pPriv = VMPRIV(client);
+ pPriv = VM_GETPRIV(client);
if (!pPriv)
return 0;
else
@@ -1682,11 +1667,11 @@ ProcXF86VidModeSetClientVersion(ClientPtr client)
REQUEST_SIZE_MATCH(xXF86VidModeSetClientVersionReq);
- if ((pPriv = VMPRIV(client)) == NULL) {
+ if ((pPriv = VM_GETPRIV(client)) == NULL) {
pPriv = xalloc(sizeof(VidModePrivRec));
if (!pPriv)
return BadAlloc;
- VMPRIV(client) = pPriv;
+ VM_SETPRIV(client, pPriv);
}
pPriv->major = stuff->major;
pPriv->minor = stuff->minor;
diff --git a/hw/xfree86/dixmods/extmod/xvmod.c b/hw/xfree86/dixmods/extmod/xvmod.c
index 7c1450c7a..6b3f1149a 100644
--- a/hw/xfree86/dixmods/extmod/xvmod.c
+++ b/hw/xfree86/dixmods/extmod/xvmod.c
@@ -16,7 +16,7 @@ void
XvRegister()
{
XvScreenInitProc = XvScreenInit;
- XvGetScreenIndexProc = XvGetScreenIndex;
+ XvGetScreenKeyProc = XvGetScreenKey;
XvGetRTPortProc = XvGetRTPort;
XvMCScreenInitProc = XvMCScreenInit;
}
diff --git a/hw/xfree86/dixmods/extmod/xvmodproc.h b/hw/xfree86/dixmods/extmod/xvmodproc.h
index 81356a149..b39c915b4 100644
--- a/hw/xfree86/dixmods/extmod/xvmodproc.h
+++ b/hw/xfree86/dixmods/extmod/xvmodproc.h
@@ -5,7 +5,7 @@
#include "xvmcext.h"
-extern int (*XvGetScreenIndexProc)(void);
+extern DevPrivateKey (*XvGetScreenKeyProc)(void);
extern unsigned long (*XvGetRTPortProc)(void);
extern int (*XvScreenInitProc)(ScreenPtr);
extern int (*XvMCScreenInitProc)(ScreenPtr, int, XvMCAdaptorPtr);
diff --git a/hw/xfree86/dixmods/xkbKillSrv.c b/hw/xfree86/dixmods/xkbKillSrv.c
index b3399db4a..9074fd390 100644
--- a/hw/xfree86/dixmods/xkbKillSrv.c
+++ b/hw/xfree86/dixmods/xkbKillSrv.c
@@ -48,6 +48,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
int
XkbDDXTerminateServer(DeviceIntPtr dev,KeyCode key,XkbAction *act)
{
- xf86ProcessActionEvent(ACTION_TERMINATE, NULL);
+ if (dev != inputInfo.keyboard)
+ xf86ProcessActionEvent(ACTION_TERMINATE, NULL);
+
return 0;
}
diff --git a/hw/xfree86/doc/man/xorg.conf.man.pre b/hw/xfree86/doc/man/xorg.conf.man.pre
index 3c657d0f0..77439a517 100644
--- a/hw/xfree86/doc/man/xorg.conf.man.pre
+++ b/hw/xfree86/doc/man/xorg.conf.man.pre
@@ -2144,7 +2144,9 @@ The data therein is not used in this release.
General:
.BR X (__miscmansuffix__),
.BR Xserver (__appmansuffix__),
-.BR __xservername__ (__appmansuffix__).
+.BR __xservername__ (__appmansuffix__),
+.BR cvt (__appmansuffix__),
+.BR gtf (__appmansuffix__).
.PP
.B Not all modules or interfaces are available on all platforms.
.PP
diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c
index e2be5983c..263cc52cc 100644
--- a/hw/xfree86/dri/dri.c
+++ b/hw/xfree86/dri/dri.c
@@ -79,8 +79,8 @@ extern Bool noPanoramiXExtension;
#endif
static int DRIEntPrivIndex = -1;
-static int DRIScreenPrivIndex = -1;
-static int DRIWindowPrivIndex = -1;
+static DevPrivateKey DRIScreenPrivKey = &DRIScreenPrivKey;
+static DevPrivateKey DRIWindowPrivKey = &DRIWindowPrivKey;
static unsigned long DRIGeneration = 0;
static unsigned int DRIDrawableValidationStamp = 0;
@@ -343,20 +343,18 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
pDRIEntPriv = DRI_ENT_PRIV(pScrn);
- if (DRIGeneration != serverGeneration) {
- if ((DRIScreenPrivIndex = AllocateScreenPrivateIndex()) < 0)
- return FALSE;
+ DRIScreenPrivKey = &DRIScreenPrivKey;
+ if (DRIGeneration != serverGeneration)
DRIGeneration = serverGeneration;
- }
pDRIPriv = (DRIScreenPrivPtr) xcalloc(1, sizeof(DRIScreenPrivRec));
if (!pDRIPriv) {
- pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
- DRIScreenPrivIndex = -1;
+ dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
+ DRIScreenPrivKey = NULL;
return FALSE;
}
- pScreen->devPrivates[DRIScreenPrivIndex].ptr = (pointer) pDRIPriv;
+ dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, pDRIPriv);
pDRIPriv->drmFD = pDRIEntPriv->drmFD;
pDRIPriv->directRenderingSupport = TRUE;
pDRIPriv->pDriverInfo = pDRIInfo;
@@ -381,7 +379,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
&pDRIPriv->hSAREA) < 0)
{
pDRIPriv->directRenderingSupport = FALSE;
- pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
+ dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
drmClose(pDRIPriv->drmFD);
DRIDrvMsg(pScreen->myNum, X_INFO,
"[drm] drmAddMap failed\n");
@@ -398,7 +396,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
(drmAddressPtr)(&pDRIPriv->pSAREA)) < 0)
{
pDRIPriv->directRenderingSupport = FALSE;
- pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
+ dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
drmClose(pDRIPriv->drmFD);
DRIDrvMsg(pScreen->myNum, X_INFO,
"[drm] drmMap failed\n");
@@ -428,7 +426,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
&pDRIPriv->pDriverInfo->hFrameBuffer) < 0)
{
pDRIPriv->directRenderingSupport = FALSE;
- pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
+ dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
drmUnmap(pDRIPriv->pSAREA, pDRIPriv->pDriverInfo->SAREASize);
drmClose(pDRIPriv->drmFD);
DRIDrvMsg(pScreen->myNum, X_INFO,
@@ -744,8 +742,8 @@ DRICloseScreen(ScreenPtr pScreen)
}
xfree(pDRIPriv);
- pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
- DRIScreenPrivIndex = -1;
+ dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
+ DRIScreenPrivKey = NULL;
}
}
@@ -772,30 +770,13 @@ drmServerInfo DRIDRMServerInfo = {
Bool
DRIExtensionInit(void)
{
- int i;
- ScreenPtr pScreen;
-
- if (DRIScreenPrivIndex < 0 || DRIGeneration != serverGeneration) {
+ if (!DRIScreenPrivKey || DRIGeneration != serverGeneration) {
return FALSE;
}
- /* Allocate a window private index with a zero sized private area for
- * each window, then should a window become a DRI window, we'll hang
- * a DRIWindowPrivateRec off of this private index.
- */
- if ((DRIWindowPrivIndex = AllocateWindowPrivateIndex()) < 0)
- return FALSE;
-
DRIDrawablePrivResType = CreateNewResourceType(DRIDrawablePrivDelete);
DRIContextPrivResType = CreateNewResourceType(DRIContextPrivDelete);
- for (i = 0; i < screenInfo.numScreens; i++)
- {
- pScreen = screenInfo.screens[i];
- if (!AllocateWindowPrivate(pScreen, DRIWindowPrivIndex, 0))
- return FALSE;
- }
-
RegisterBlockAndWakeupHandlers(DRIBlockHandler, DRIWakeupHandler, NULL);
return TRUE;
@@ -1271,9 +1252,8 @@ DRICreateDrawable(ScreenPtr pScreen, ClientPtr client, DrawablePtr pDrawable,
pDRIDrawablePriv->nrects = REGION_NUM_RECTS(&pWin->clipList);
/* save private off of preallocated index */
- pWin->devPrivates[DRIWindowPrivIndex].ptr =
- (pointer)pDRIDrawablePriv;
-
+ dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey,
+ pDRIDrawablePriv);
pDRIPriv->nrWindows++;
if (pDRIDrawablePriv->nrects)
@@ -1331,7 +1311,7 @@ DRIDrawablePrivDestroy(WindowPtr pWin)
drmDestroyDrawable(pDRIPriv->drmFD, pDRIDrawablePriv->hwDrawable);
xfree(pDRIDrawablePriv);
- pWin->devPrivates[DRIWindowPrivIndex].ptr = NULL;
+ dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey, NULL);
}
static Bool
diff --git a/hw/xfree86/dri/dristruct.h b/hw/xfree86/dri/dristruct.h
index c3b0aeede..ae970d834 100644
--- a/hw/xfree86/dri/dristruct.h
+++ b/hw/xfree86/dri/dristruct.h
@@ -37,15 +37,10 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "xf86drm.h"
-#define DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin) \
- ((DRIWindowPrivIndex < 0) ? \
- NULL : \
- ((DRIDrawablePrivPtr)((pWin)->devPrivates[DRIWindowPrivIndex].ptr)))
-
-#define DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix) \
- ((DRIPixmapPrivIndex < 0) ? \
- NULL : \
- ((DRIDrawablePrivPtr)((pPix)->devPrivates[DRIWindowPrivIndex].ptr)))
+#define DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin) ((DRIDrawablePrivPtr) \
+ dixLookupPrivate(&(pWin)->devPrivates, DRIWindowPrivKey))
+#define DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix) ((DRIDrawablePrivPtr) \
+ dixLookupPrivate(&(pPix)->devPrivates, DRIWindowPrivKey))
typedef struct _DRIDrawablePrivRec
{
@@ -65,13 +60,12 @@ struct _DRIContextPrivRec
void** pContextStore;
};
-#define DRI_SCREEN_PRIV(pScreen) \
- ((DRIScreenPrivIndex < 0) ? \
- NULL : \
- ((DRIScreenPrivPtr)((pScreen)->devPrivates[DRIScreenPrivIndex].ptr)))
+#define DRI_SCREEN_PRIV(pScreen) ((DRIScreenPrivPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, DRIScreenPrivKey))
#define DRI_SCREEN_PRIV_FROM_INDEX(screenIndex) ((DRIScreenPrivPtr) \
- (screenInfo.screens[screenIndex]->devPrivates[DRIScreenPrivIndex].ptr))
+ dixLookupPrivate(&screenInfo.screens[screenIndex]->devPrivates, \
+ DRIScreenPrivKey))
#define DRI_ENT_PRIV(pScrn) \
((DRIEntPrivIndex < 0) ? \
diff --git a/hw/xfree86/exa/exa.man.pre b/hw/xfree86/exa/exa.man.pre
index 31e1cfe34..14859bc8f 100644
--- a/hw/xfree86/exa/exa.man.pre
+++ b/hw/xfree86/exa/exa.man.pre
@@ -31,6 +31,12 @@ Disables acceleration of downloading of pixmap data from the framebuffer.
Not usable with drivers which rely on DownloadFromScreen succeeding.
Default: No.
.TP
+.BI "Option \*qEXAOptimizeMigration\*q \*q" boolean \*q
+Enables an additional optimization for migration of destination pixmaps. This
+may improve performance in some cases (e.g. when switching virtual desktops with
+no compositing manager) but causes corruption in others (e.g. when starting
+compiz). Default: No.
+.TP
.BI "Option \*qMigrationHeuristic\*q \*q" anystr \*q
Chooses an alternate pixmap migration heuristic, for debugging purposes. The
default is intended to be the best performing one for general use, though others
diff --git a/hw/xfree86/exa/examodule.c b/hw/xfree86/exa/examodule.c
index 4dce58fd8..b8d306eb4 100644
--- a/hw/xfree86/exa/examodule.c
+++ b/hw/xfree86/exa/examodule.c
@@ -42,14 +42,14 @@ typedef struct _ExaXorgScreenPrivRec {
OptionInfoPtr options;
} ExaXorgScreenPrivRec, *ExaXorgScreenPrivPtr;
-static int exaXorgServerGeneration;
-static int exaXorgScreenPrivateIndex;
+static DevPrivateKey exaXorgScreenPrivateKey = &exaXorgScreenPrivateKey;
typedef enum {
EXAOPT_MIGRATION_HEURISTIC,
EXAOPT_NO_COMPOSITE,
EXAOPT_NO_UTS,
EXAOPT_NO_DFS,
+ EXAOPT_OPTIMIZE_MIGRATION
} EXAOpts;
static const OptionInfoRec EXAOptions[] = {
@@ -61,6 +61,8 @@ static const OptionInfoRec EXAOptions[] = {
OPTV_BOOLEAN, {0}, FALSE },
{ EXAOPT_NO_DFS, "EXANoDownloadFromScreen",
OPTV_BOOLEAN, {0}, FALSE },
+ { EXAOPT_OPTIMIZE_MIGRATION, "EXAOptimizeMigration",
+ OPTV_BOOLEAN, {0}, FALSE },
{ -1, NULL,
OPTV_NONE, {0}, FALSE }
};
@@ -69,8 +71,8 @@ static Bool
exaXorgCloseScreen (int i, ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
- ExaXorgScreenPrivPtr pScreenPriv =
- pScreen->devPrivates[exaXorgScreenPrivateIndex].ptr;
+ ExaXorgScreenPrivPtr pScreenPriv = (ExaXorgScreenPrivPtr)
+ dixLookupPrivate(&pScreen->devPrivates, exaXorgScreenPrivateKey);
pScreen->CloseScreen = pScreenPriv->SavedCloseScreen;
@@ -86,8 +88,8 @@ static void
exaXorgEnableDisableFBAccess (int index, Bool enable)
{
ScreenPtr pScreen = screenInfo.screens[index];
- ExaXorgScreenPrivPtr pScreenPriv =
- pScreen->devPrivates[exaXorgScreenPrivateIndex].ptr;
+ ExaXorgScreenPrivPtr pScreenPriv = (ExaXorgScreenPrivPtr)
+ dixLookupPrivate(&pScreen->devPrivates, exaXorgScreenPrivateKey);
if (!enable)
exaEnableDisableFBAccess (index, enable);
@@ -111,11 +113,6 @@ exaDDXDriverInit(ScreenPtr pScreen)
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ExaXorgScreenPrivPtr pScreenPriv;
- if (exaXorgServerGeneration != serverGeneration) {
- exaXorgScreenPrivateIndex = AllocateScreenPrivateIndex();
- exaXorgServerGeneration = serverGeneration;
- }
-
pScreenPriv = xcalloc (1, sizeof(ExaXorgScreenPrivRec));
if (pScreenPriv == NULL)
return;
@@ -144,6 +141,11 @@ exaDDXDriverInit(ScreenPtr pScreen)
heuristicName);
}
}
+
+ pExaScr->optimize_migration =
+ xf86ReturnOptValBool(pScreenPriv->options,
+ EXAOPT_OPTIMIZE_MIGRATION,
+ FALSE);
}
if (xf86IsOptionSet(pScreenPriv->options, EXAOPT_NO_COMPOSITE)) {
@@ -166,7 +168,7 @@ exaDDXDriverInit(ScreenPtr pScreen)
pExaScr->info->DownloadFromScreen = NULL;
}
- pScreen->devPrivates[exaXorgScreenPrivateIndex].ptr = pScreenPriv;
+ dixSetPrivate(&pScreen->devPrivates, exaXorgScreenPrivateKey, pScreenPriv);
pScreenPriv->SavedEnableDisableFBAccess = pScrn->EnableDisableFBAccess;
pScrn->EnableDisableFBAccess = exaXorgEnableDisableFBAccess;
diff --git a/hw/xfree86/loader/dixsym.c b/hw/xfree86/loader/dixsym.c
index 5d06b05c7..49c7d271b 100644
--- a/hw/xfree86/loader/dixsym.c
+++ b/hw/xfree86/loader/dixsym.c
@@ -63,7 +63,9 @@
#include "globals.h"
#include "os.h"
#include "osdep.h"
+#include "privates.h"
#include "resource.h"
+#include "registry.h"
#include "servermd.h"
#include "scrnintstr.h"
#include "windowstr.h"
@@ -113,6 +115,16 @@ _X_HIDDEN void *dixLookupTab[] = {
SYMFUNC(QueryColors)
/* cursor.c */
SYMFUNC(FreeCursor)
+ /* deprecated.c */
+ SYMFUNC(LookupClient)
+ SYMFUNC(LookupDrawable)
+ SYMFUNC(LookupWindow)
+ SYMFUNC(SecurityLookupDrawable)
+ SYMFUNC(SecurityLookupWindow)
+ SYMFUNC(LookupIDByType)
+ SYMFUNC(LookupIDByClass)
+ SYMFUNC(SecurityLookupIDByClass)
+ SYMFUNC(SecurityLookupIDByType)
/* devices.c */
SYMFUNC(Ones)
SYMFUNC(InitButtonClassDeviceStruct)
@@ -128,8 +140,6 @@ _X_HIDDEN void *dixLookupTab[] = {
SYMFUNC(InitKeyboardDeviceStruct)
SYMFUNC(SendMappingNotify)
SYMFUNC(InitPointerDeviceStruct)
- SYMFUNC(LookupKeyboardDevice)
- SYMFUNC(LookupPointerDevice)
/* dispatch.c */
SYMFUNC(SetInputCheck)
SYMFUNC(SendErrorToClient)
@@ -159,13 +169,6 @@ _X_HIDDEN void *dixLookupTab[] = {
SYMFUNC(dixLookupWindow)
SYMFUNC(dixLookupClient)
SYMFUNC(dixLookupGC)
- /* following are deprecated */
- SYMFUNC(LookupClient)
- SYMFUNC(LookupDrawable)
- SYMFUNC(LookupWindow)
- SYMFUNC(SecurityLookupDrawable)
- SYMFUNC(SecurityLookupWindow)
- /* end deprecated */
SYMFUNC(NoopDDA)
SYMFUNC(QueueWorkProc)
SYMFUNC(RegisterBlockAndWakeupHandlers)
@@ -191,11 +194,11 @@ _X_HIDDEN void *dixLookupTab[] = {
#endif
/* property.c */
SYMFUNC(ChangeWindowProperty)
+ SYMFUNC(dixChangeWindowProperty)
/* extension.c */
SYMFUNC(AddExtension)
SYMFUNC(AddExtensionAlias)
SYMFUNC(CheckExtension)
- SYMFUNC(DeclareExtensionSecurity)
SYMFUNC(MinorOpcodeOfRequest)
SYMFUNC(StandardMinorOpcode)
#ifdef XEVIE
@@ -234,7 +237,7 @@ _X_HIDDEN void *dixLookupTab[] = {
#ifdef XV
/* XXX These are exported from the DDX, not DIX. */
SYMVAR(XvScreenInitProc)
- SYMVAR(XvGetScreenIndexProc)
+ SYMVAR(XvGetScreenKeyProc)
SYMVAR(XvGetRTPortProc)
SYMVAR(XvMCScreenInitProc)
#endif
@@ -259,42 +262,38 @@ _X_HIDDEN void *dixLookupTab[] = {
SYMFUNC(GetScratchPixmapHeader)
SYMFUNC(FreeScratchPixmapHeader)
/* privates.c */
- SYMFUNC(AllocateExtensionPrivate)
- SYMFUNC(AllocateExtensionPrivateIndex)
- SYMFUNC(AllocateClientPrivate)
- SYMFUNC(AllocateClientPrivateIndex)
- SYMFUNC(AllocateGCPrivate)
- SYMFUNC(AllocateGCPrivateIndex)
- SYMFUNC(AllocateWindowPrivate)
- SYMFUNC(AllocateWindowPrivateIndex)
- SYMFUNC(AllocateScreenPrivateIndex)
- SYMFUNC(AllocateColormapPrivateIndex)
- SYMFUNC(AllocateDevicePrivateIndex)
- SYMFUNC(AllocateDevicePrivate)
- SYMFUNC(AllocatePixmapPrivateIndex)
- SYMFUNC(AllocatePixmapPrivate)
+ SYMFUNC(dixRequestPrivate)
+ SYMFUNC(dixRegisterPrivateInitFunc)
+ SYMFUNC(dixRegisterPrivateDeleteFunc)
+ SYMFUNC(dixAllocatePrivate)
+ SYMFUNC(dixFreePrivates)
+ SYMFUNC(dixRegisterPrivateOffset)
+ SYMFUNC(dixLookupPrivateOffset)
/* resource.c */
SYMFUNC(AddResource)
SYMFUNC(ChangeResourceValue)
SYMFUNC(CreateNewResourceClass)
SYMFUNC(CreateNewResourceType)
+ SYMFUNC(dixLookupResource)
SYMFUNC(FakeClientID)
SYMFUNC(FreeResource)
SYMFUNC(FreeResourceByType)
SYMFUNC(GetXIDList)
SYMFUNC(GetXIDRange)
- SYMFUNC(LookupIDByType)
- SYMFUNC(LookupIDByClass)
SYMFUNC(LegalNewID)
- SYMFUNC(SecurityLookupIDByClass)
- SYMFUNC(SecurityLookupIDByType)
SYMFUNC(FindClientResourcesByType)
SYMFUNC(FindAllClientResources)
SYMVAR(lastResourceType)
SYMVAR(TypeMask)
-#ifdef RES
+ SYMVAR(ResourceStateCallback)
+ /* registry.c */
+#ifdef XREGISTRY
SYMFUNC(RegisterResourceName)
- SYMVAR(ResourceNames)
+ SYMFUNC(LookupMajorName)
+ SYMFUNC(LookupRequestName)
+ SYMFUNC(LookupEventName)
+ SYMFUNC(LookupErrorName)
+ SYMFUNC(LookupResourceName)
#endif
/* swaprep.c */
SYMFUNC(CopySwap32Write)
@@ -322,6 +321,7 @@ _X_HIDDEN void *dixLookupTab[] = {
SYMFUNC(NotClippedByChildren)
SYMFUNC(ResizeChildrenWinSize)
SYMFUNC(SaveScreens)
+ SYMFUNC(dixSaveScreens)
SYMFUNC(SendVisibilityNotify)
SYMFUNC(SetWinSize)
SYMFUNC(SetBorderSize)
@@ -512,7 +512,7 @@ _X_HIDDEN void *dixLookupTab[] = {
SYMFUNC(PictureTransformPoint3d)
SYMFUNC(PictureGetSubpixelOrder)
SYMFUNC(PictureSetSubpixelOrder)
- SYMVAR(PictureScreenPrivateIndex)
+ SYMVAR(PictureScreenPrivateKey)
/* mipict.c */
SYMFUNC(miPictureInit)
SYMFUNC(miComputeCompositeRegion)
diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c
index 1b5c717fd..584cabfd1 100644
--- a/hw/xfree86/loader/loadmod.c
+++ b/hw/xfree86/loader/loadmod.c
@@ -859,7 +859,7 @@ doLoadModule(const char *module, const char *path, const char **subdirlist,
char *m = NULL;
const char **cim;
- xf86MsgVerb(X_INFO, 3, "LoadModule: \"%s\"", module);
+ xf86MsgVerb(X_INFO, 3, "LoadModule: \"%s\"\n", module);
for (cim = compiled_in_modules; *cim; cim++)
if (!strcmp (module, *cim))
diff --git a/hw/xfree86/loader/misym.c b/hw/xfree86/loader/misym.c
index 025983b09..aa712c03a 100644
--- a/hw/xfree86/loader/misym.c
+++ b/hw/xfree86/loader/misym.c
@@ -200,9 +200,9 @@ _X_HIDDEN void *miLookupTab[] = {
SYMFUNC(miOverlaySetRootClip)
SYMVAR(miEmptyBox)
SYMVAR(miEmptyData)
- SYMVAR(miZeroLineScreenIndex)
+ SYMVAR(miZeroLineScreenKey)
SYMVAR(miSpritePointerFuncs)
- SYMVAR(miPointerScreenIndex)
+ SYMVAR(miPointerScreenKey)
SYMVAR(miInstalledMaps)
SYMVAR(miInitVisualsProc)
#ifdef DAMAGE
diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c
index b6be172a3..417a3508f 100644
--- a/hw/xfree86/loader/xf86sym.c
+++ b/hw/xfree86/loader/xf86sym.c
@@ -79,8 +79,6 @@
#include "vidmodeproc.h"
#include "xf86miscproc.h"
#include "loader.h"
-#define DONT_DEFINE_WRAPPERS
-#include "xf86_ansic.h"
#include "xisb.h"
#include "vbe.h"
#ifndef __OpenBSD__
@@ -272,7 +270,6 @@ _X_HIDDEN void *xfree86LookupTab[] = {
SYMFUNC(xf86ReadSerial)
SYMFUNC(xf86WriteSerial)
SYMFUNC(xf86CloseSerial)
- SYMFUNC(xf86GetErrno)
SYMFUNC(xf86WaitForInput)
SYMFUNC(xf86SerialSendBreak)
SYMFUNC(xf86FlushInput)
@@ -727,186 +724,6 @@ _X_HIDDEN void *xfree86LookupTab[] = {
SYMFUNC(LoaderGetOS)
SYMFUNC(LoaderGetABIVersion)
- /*
- * These are our own interfaces to libc functions.
- */
- SYMFUNC(xf86abort)
- SYMFUNC(xf86abs)
- SYMFUNC(xf86acos)
- SYMFUNC(xf86asin)
- SYMFUNC(xf86atan)
- SYMFUNC(xf86atan2)
- SYMFUNC(xf86atof)
- SYMFUNC(xf86atoi)
- SYMFUNC(xf86atol)
- SYMFUNC(xf86bsearch)
- SYMFUNC(xf86ceil)
- SYMFUNC(xf86calloc)
- SYMFUNC(xf86clearerr)
- SYMFUNC(xf86close)
- SYMFUNC(xf86cos)
- SYMFUNC(xf86exit)
- SYMFUNC(xf86exp)
- SYMFUNC(xf86fabs)
- SYMFUNC(xf86fclose)
- SYMFUNC(xf86feof)
- SYMFUNC(xf86ferror)
- SYMFUNC(xf86fflush)
- SYMFUNC(xf86fgetc)
- SYMFUNC(xf86fgetpos)
- SYMFUNC(xf86fgets)
- SYMFUNC(xf86finite)
- SYMFUNC(xf86floor)
- SYMFUNC(xf86fmod)
- SYMFUNC(xf86fopen)
- SYMFUNC(xf86fprintf)
- SYMFUNC(xf86fputc)
- SYMFUNC(xf86fputs)
- SYMFUNC(xf86fread)
- SYMFUNC(xf86free)
- SYMFUNC(xf86freopen)
- SYMFUNC(xf86frexp)
- SYMFUNC(xf86fscanf)
- SYMFUNC(xf86fseek)
- SYMFUNC(xf86fsetpos)
- SYMFUNC(xf86ftell)
- SYMFUNC(xf86fwrite)
- SYMFUNC(xf86getc)
- SYMFUNC(xf86getenv)
- SYMFUNC(xf86getpagesize)
- SYMFUNC(xf86hypot)
- SYMFUNC(xf86ioctl)
- SYMFUNC(xf86isalnum)
- SYMFUNC(xf86isalpha)
- SYMFUNC(xf86iscntrl)
- SYMFUNC(xf86isdigit)
- SYMFUNC(xf86isgraph)
- SYMFUNC(xf86islower)
- SYMFUNC(xf86isprint)
- SYMFUNC(xf86ispunct)
- SYMFUNC(xf86isspace)
- SYMFUNC(xf86isupper)
- SYMFUNC(xf86isxdigit)
- SYMFUNC(xf86labs)
- SYMFUNC(xf86ldexp)
- SYMFUNC(xf86log)
- SYMFUNC(xf86log10)
- SYMFUNC(xf86lseek)
- SYMFUNC(xf86malloc)
- SYMFUNC(xf86memchr)
- SYMFUNC(xf86memcmp)
- SYMFUNC(xf86memcpy)
- /*
- * Some compilers generate calls to memcpy to handle structure copies
- * or run-time initializations.
- */
- SYMFUNCALIAS("memcpy", xf86memcpy)
- SYMFUNC(xf86memset)
- /*
- * Some compilers generate calls to memset to handle aggregate
- * initializations.
- */
- SYMFUNCALIAS("memset", xf86memset)
- SYMFUNC(xf86memmove)
- SYMFUNC(xf86mmap)
- SYMFUNC(xf86modf)
- SYMFUNC(xf86munmap)
- SYMFUNC(xf86open)
- SYMFUNC(xf86perror)
- SYMFUNC(xf86pow)
- SYMFUNC(xf86printf)
- SYMFUNC(xf86qsort)
- SYMFUNC(xf86read)
- SYMFUNC(xf86realloc)
- SYMFUNC(xf86remove)
- SYMFUNC(xf86rename)
- SYMFUNC(xf86rewind)
- SYMFUNC(xf86setbuf)
- SYMFUNC(xf86setvbuf)
- SYMFUNC(xf86sin)
- SYMFUNC(xf86snprintf)
- SYMFUNC(xf86sprintf)
- SYMFUNC(xf86sqrt)
- SYMFUNC(xf86sscanf)
- SYMFUNC(xf86strcat)
- SYMFUNC(xf86strcmp)
- SYMFUNC(xf86strcasecmp)
- SYMFUNC(xf86strcpy)
- SYMFUNC(xf86strcspn)
- SYMFUNC(xf86strerror)
- SYMFUNC(xf86strlcat)
- SYMFUNC(xf86strlcpy)
- SYMFUNC(xf86strlen)
- SYMFUNC(xf86strncasecmp)
- SYMFUNC(xf86strncat)
- SYMFUNC(xf86strncmp)
- SYMFUNC(xf86strncpy)
- SYMFUNC(xf86strpbrk)
- SYMFUNC(xf86strchr)
- SYMFUNC(xf86strrchr)
- SYMFUNC(xf86strspn)
- SYMFUNC(xf86strstr)
- SYMFUNC(xf86strtod)
- SYMFUNC(xf86strtok)
- SYMFUNC(xf86strtol)
- SYMFUNC(xf86strtoul)
- SYMFUNC(xf86tan)
- SYMFUNC(xf86tmpfile)
- SYMFUNC(xf86tolower)
- SYMFUNC(xf86toupper)
- SYMFUNC(xf86ungetc)
- SYMFUNC(xf86vfprintf)
- SYMFUNC(xf86vsnprintf)
- SYMFUNC(xf86vsprintf)
- SYMFUNC(xf86write)
-
- /* non-ANSI C functions */
- SYMFUNC(xf86opendir)
- SYMFUNC(xf86closedir)
- SYMFUNC(xf86readdir)
- SYMFUNC(xf86rewinddir)
- SYMFUNC(xf86ffs)
- SYMFUNC(xf86strdup)
- SYMFUNC(xf86bzero)
- SYMFUNC(xf86usleep)
- SYMFUNC(xf86execl)
-
- SYMFUNC(xf86getsecs)
- SYMFUNC(xf86fpossize) /* for returning sizeof(fpos_t) */
-
- /* Some of these were added for DRI support. */
- SYMFUNC(xf86stat)
- SYMFUNC(xf86fstat)
- SYMFUNC(xf86access)
- SYMFUNC(xf86geteuid)
- SYMFUNC(xf86getegid)
- SYMFUNC(xf86getpid)
- SYMFUNC(xf86mknod)
- SYMFUNC(xf86chmod)
- SYMFUNC(xf86chown)
- SYMFUNC(xf86sleep)
- SYMFUNC(xf86mkdir)
- SYMFUNC(xf86shmget)
- SYMFUNC(xf86shmat)
- SYMFUNC(xf86shmdt)
- SYMFUNC(xf86shmctl)
-#ifdef HAS_GLIBC_SIGSETJMP
- SYMFUNC(xf86setjmp)
- SYMFUNC(xf86setjmp0)
-#if defined(__GLIBC__) && (__GLIBC__ >= 2)
- SYMFUNCALIAS("xf86setjmp1", __sigsetjmp)
-#else
- SYMFUNC(xf86setjmp1) /* For libc5 */
-#endif
-#else
- SYMFUNCALIAS("xf86setjmp", setjmp)
- SYMFUNC(xf86setjmp0)
- SYMFUNC(xf86setjmp1)
-#endif
- SYMFUNCALIAS("xf86longjmp", longjmp)
- SYMFUNC(xf86getjmptype)
- SYMFUNC(xf86setjmp1_arg2)
- SYMFUNC(xf86setjmperror)
#ifdef XF86DRI
/*
* These may have more general uses, but for now, they are only used
@@ -1091,17 +908,9 @@ _X_HIDDEN void *xfree86LookupTab[] = {
#endif
#endif
- /* Some variables. */
-
- SYMVAR(xf86stdin)
- SYMVAR(xf86stdout)
- SYMVAR(xf86stderr)
- SYMVAR(xf86errno)
- SYMVAR(xf86HUGE_VAL)
-
/* General variables (from xf86.h) */
- SYMVAR(xf86ScreenIndex)
- SYMVAR(xf86PixmapIndex)
+ SYMVAR(xf86ScreenKey)
+ SYMVAR(xf86PixmapKey)
SYMVAR(xf86Screens)
SYMVAR(byte_reversed)
SYMVAR(xf86inSuspend)
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index bb416fddc..e00fdf3f3 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -36,6 +36,7 @@
#include "xf86DDC.h"
#include "xf86Crtc.h"
#include "xf86Modes.h"
+#include "xf86Priv.h"
#include "xf86RandR12.h"
#include "X11/extensions/render.h"
#define DPMS_SERVER
@@ -259,6 +260,30 @@ xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
crtc->y = y;
crtc->rotation = rotation;
+ /* Shift offsets that move us out of virtual size */
+ if (x + mode->HDisplay > xf86_config->maxWidth ||
+ y + mode->VDisplay > xf86_config->maxHeight)
+ {
+ if (x + mode->HDisplay > xf86_config->maxWidth)
+ crtc->x = xf86_config->maxWidth - mode->HDisplay;
+ if (y + mode->VDisplay > xf86_config->maxHeight)
+ crtc->y = xf86_config->maxHeight - mode->VDisplay;
+ if (crtc->x < 0 || crtc->y < 0)
+ {
+ xf86DrvMsg (scrn->scrnIndex, X_ERROR,
+ "Mode %dx%d does not fit virtual size %dx%d - "
+ "internal error\n", mode->HDisplay, mode->VDisplay,
+ xf86_config->maxWidth, xf86_config->maxHeight);
+ goto done;
+ }
+ xf86DrvMsg (scrn->scrnIndex, X_ERROR,
+ "Mode %dx%d+%d+%d does not fit virtual size %dx%d - "
+ "offset updated to +%d+%d\n",
+ mode->HDisplay, mode->VDisplay, x, y,
+ xf86_config->maxWidth, xf86_config->maxHeight,
+ crtc->x, crtc->y);
+ }
+
/* XXX short-circuit changes to base location only */
/* Pass our mode to the outputs and the CRTC to give them a chance to
@@ -300,7 +325,7 @@ xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
/* Set up the DPLL and any output state that needs to adjust or depend
* on the DPLL.
*/
- crtc->funcs->mode_set(crtc, mode, adjusted_mode, x, y);
+ crtc->funcs->mode_set(crtc, mode, adjusted_mode, crtc->x, crtc->y);
for (i = 0; i < xf86_config->num_output; i++)
{
xf86OutputPtr output = xf86_config->output[i];
@@ -438,7 +463,7 @@ xf86OutputSetMonitor (xf86OutputPtr output)
}
static Bool
-xf86OutputEnabled (xf86OutputPtr output)
+xf86OutputEnabled (xf86OutputPtr output, Bool strict)
{
Bool enable, disable;
@@ -456,8 +481,16 @@ xf86OutputEnabled (xf86OutputPtr output)
"Output %s disabled by config file\n", output->name);
return FALSE;
}
- /* otherwise, enable if it is not disconnected */
- enable = output->status != XF86OutputStatusDisconnected;
+
+ /* If not, try to only light up the ones we know are connected */
+ if (strict) {
+ enable = output->status == XF86OutputStatusConnected;
+ }
+ /* But if that fails, try to light up even outputs we're unsure of */
+ else {
+ enable = output->status != XF86OutputStatusDisconnected;
+ }
+
xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
"Output %s %sconnected\n", output->name, enable ? "" : "dis");
return enable;
@@ -704,9 +737,9 @@ xf86DefaultMode (xf86OutputPtr output, int width, int height)
mm_height = output->mm_height;
if (!mm_height)
- mm_height = 203; /* 768 pixels at 96dpi */
+ mm_height = (768 * 25.4) / DEFAULT_DPI;
/*
- * Pick a mode closest to 96dpi
+ * Pick a mode closest to DEFAULT_DPI
*/
for (mode = output->probed_modes; mode; mode = mode->next)
{
@@ -721,7 +754,7 @@ xf86DefaultMode (xf86OutputPtr output, int width, int height)
/* yes, use VDisplay here, not xf86ModeHeight */
dpi = (mode->VDisplay * 254) / (mm_height * 10);
- diff = dpi - 96;
+ diff = dpi - DEFAULT_DPI;
diff = diff < 0 ? -diff : diff;
if (target_mode == NULL || (preferred > target_preferred) ||
(preferred == target_preferred && diff < target_diff))
@@ -1054,6 +1087,16 @@ xf86InitialOutputPositions (ScrnInfoPtr scrn, DisplayModePtr *modes)
any_set = TRUE;
continue;
}
+ if (!modes[or])
+ {
+ xf86DrvMsg (scrn->scrnIndex, X_ERROR,
+ "Cannot position output %s relative to output %s without modes\n",
+ output->name, relative_name);
+ output->initial_x = 0;
+ output->initial_y = 0;
+ any_set = TRUE;
+ continue;
+ }
if (relative->initial_x == POSITION_UNSET)
{
keep_going = TRUE;
@@ -1069,10 +1112,10 @@ xf86InitialOutputPositions (ScrnInfoPtr scrn, DisplayModePtr *modes)
output->initial_x += xf86ModeWidth (modes[or], relative->initial_rotation);
break;
case OPTION_ABOVE:
- output->initial_y -= xf86ModeHeight (modes[or], relative->initial_rotation);
+ output->initial_y -= xf86ModeHeight (modes[o], relative->initial_rotation);
break;
case OPTION_LEFT_OF:
- output->initial_x -= xf86ModeWidth (modes[or], relative->initial_rotation);
+ output->initial_x -= xf86ModeWidth (modes[o], relative->initial_rotation);
break;
default:
break;
@@ -1536,7 +1579,7 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
Rotation target_rotation = RR_Rotate_0;
xf86CrtcPtr *crtcs;
DisplayModePtr *modes;
- Bool *enabled;
+ Bool *enabled, any_enabled = FALSE;
int width;
int height;
@@ -1569,9 +1612,23 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
xf86OutputPtr output = config->output[o];
modes[o] = NULL;
- enabled[o] = xf86OutputEnabled (output);
+ any_enabled |= (enabled[o] = xf86OutputEnabled (output, TRUE));
}
+ if (!any_enabled)
+ {
+ xf86DrvMsg (scrn->scrnIndex, X_WARNING,
+ "No outputs definitely connected, trying again...\n");
+
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+
+ modes[o] = NULL;
+ enabled[o] = xf86OutputEnabled (output, FALSE);
+ }
+ }
+
/*
* User preferred > preferred > other modes
*/
@@ -2129,7 +2186,8 @@ xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus)
xf86MonPtr mon;
mon = xf86DoEDID_DDC2 (scrn->scrnIndex, pDDCBus);
- xf86DDCApplyQuirks (scrn->scrnIndex, pDDCBus);
+ if (mon)
+ xf86DDCApplyQuirks (scrn->scrnIndex, mon);
return mon;
}
diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c
index ba4fd84ec..f3b1ebb7a 100644
--- a/hw/xfree86/modes/xf86Cursors.c
+++ b/hw/xfree86/modes/xf86Cursors.c
@@ -227,7 +227,8 @@ xf86_set_cursor_colors (ScrnInfoPtr scrn, int bg, int fg)
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
CursorPtr cursor = xf86_config->cursor;
int c;
- CARD8 *bits = cursor ? cursor->devPriv[screen->myNum] : NULL;
+ CARD8 *bits = cursor ? dixLookupPrivate(&cursor->devPrivates,
+ screen) : NULL;
/* Save ARGB versions of these colors */
xf86_config->cursor_fg = (CARD32) fg | 0xff000000;
@@ -613,7 +614,7 @@ xf86_reload_cursors (ScreenPtr screen)
else
#endif
(*cursor_info->LoadCursorImage)(cursor_info->pScrn,
- cursor->devPriv[screen->myNum]);
+ dixLookupPrivate(&cursor->devPrivates, screen));
(*cursor_info->SetCursorPosition)(cursor_info->pScrn, x, y);
(*cursor_info->ShowCursor)(cursor_info->pScrn);
diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c
index 2f26a6450..a125d8c82 100644
--- a/hw/xfree86/modes/xf86EdidModes.c
+++ b/hw/xfree86/modes/xf86EdidModes.c
@@ -72,7 +72,8 @@ static Bool quirk_prefer_large_60 (int scrnIndex, xf86MonPtr DDC)
{
/* Belinea 10 15 55 */
if (memcmp (DDC->vendor.name, "MAX", 4) == 0 &&
- DDC->vendor.prod_id == 1516)
+ ((DDC->vendor.prod_id == 1516) ||
+ (DDC->vendor.prod_id == 0x77e)))
return TRUE;
/* Acer AL1706 */
@@ -327,6 +328,12 @@ DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing,
Mode->VSyncEnd = Mode->VSyncStart + timing->v_sync_width;
Mode->VTotal = timing->v_active + timing->v_blanking;
+ /* perform basic check on the detail timing */
+ if (Mode->HSyncEnd > Mode->HTotal || Mode->VSyncEnd > Mode->VTotal) {
+ xfree(Mode);
+ return NULL;
+ }
+
xf86SetModeDefaultName(Mode);
/* We ignore h/v_size and h/v_border for now. */
diff --git a/hw/xfree86/modes/xf86Modes.c b/hw/xfree86/modes/xf86Modes.c
index 3879b9103..3d222cc73 100644
--- a/hw/xfree86/modes/xf86Modes.c
+++ b/hw/xfree86/modes/xf86Modes.c
@@ -38,12 +38,14 @@
extern XF86ConfigPtr xf86configptr;
-/**
- * @file this file contains symbols from xf86Mode.c and friends that are static
- * there but we still want to use. We need to come up with better API here.
+/*
+ * This is the version number where we epoched. These files get copied
+ * into drivers that want to use this setup infrastructure on pre-1.3
+ * servers, so when that happens they need to define these symbols
+ * themselves. However, _in_ the server, we basically always define them now.
*/
-
#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,2,99,2,0)
+
/**
* Calculates the horizontal sync rate of a mode.
*
@@ -116,6 +118,24 @@ xf86ModeHeight (DisplayModePtr mode, Rotation rotation)
}
}
+/** Calculates the memory bandwidth (in MiB/sec) of a mode. */
+_X_EXPORT unsigned int
+xf86ModeBandwidth(DisplayModePtr mode, int depth)
+{
+ float a_active, a_total, active_percent, pixels_per_second;
+ int bytes_per_pixel = (depth + 7) / 8;
+
+ if (!mode->HTotal || !mode->VTotal || !mode->Clock)
+ return 0;
+
+ a_active = mode->HDisplay * mode->VDisplay;
+ a_total = mode->HTotal * mode->VTotal;
+ active_percent = a_active / a_total;
+ pixels_per_second = active_percent * mode->Clock * 1000.0;
+
+ return (unsigned int)(pixels_per_second * bytes_per_pixel / (1024 * 1024));
+}
+
/** Sets a default mode name of <width>x<height> on a mode. */
_X_EXPORT void
xf86SetModeDefaultName(DisplayModePtr mode)
@@ -319,12 +339,10 @@ xf86PrintModeline(int scrnIndex,DisplayModePtr mode)
/**
* Marks as bad any modes with unsupported flags.
*
- * \param modeList doubly-linked or circular list of modes.
+ * \param modeList doubly-linked list of modes.
* \param flags flags supported by the driver.
*
* \bug only V_INTERLACE and V_DBLSCAN are supported. Is that enough?
- *
- * This is not in xf86Modes.c, but would be part of the proposed new API.
*/
_X_EXPORT void
xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
@@ -343,9 +361,7 @@ xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
/**
* Marks as bad any modes extending beyond the given max X, Y, or pitch.
*
- * \param modeList doubly-linked or circular list of modes.
- *
- * This is not in xf86Modes.c, but would be part of the proposed new API.
+ * \param modeList doubly-linked list of modes.
*/
_X_EXPORT void
xf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList,
@@ -372,9 +388,7 @@ xf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList,
* Marks as bad any modes that aren't supported by the given monitor's
* hsync and vrefresh ranges.
*
- * \param modeList doubly-linked or circular list of modes.
- *
- * This is not in xf86Modes.c, but would be part of the proposed new API.
+ * \param modeList doubly-linked list of modes.
*/
_X_EXPORT void
xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList,
@@ -416,12 +430,10 @@ xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList,
/**
* Marks as bad any modes extending beyond outside of the given clock ranges.
*
- * \param modeList doubly-linked or circular list of modes.
+ * \param modeList doubly-linked list of modes.
* \param min pointer to minimums of clock ranges
* \param max pointer to maximums of clock ranges
* \param n_ranges number of ranges.
- *
- * This is not in xf86Modes.c, but would be part of the proposed new API.
*/
_X_EXPORT void
xf86ValidateModesClocks(ScrnInfoPtr pScrn, DisplayModePtr modeList,
@@ -454,9 +466,7 @@ xf86ValidateModesClocks(ScrnInfoPtr pScrn, DisplayModePtr modeList,
*
* MODE_BAD is used as the rejection flag, for lack of a better flag.
*
- * \param modeList doubly-linked or circular list of modes.
- *
- * This is not in xf86Modes.c, but would be part of the proposed new API.
+ * \param modeList doubly-linked list of modes.
*/
_X_EXPORT void
xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList)
@@ -484,13 +494,30 @@ xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList)
/**
+ * Marks as bad any modes exceeding the given bandwidth.
+ *
+ * \param modeList doubly-linked list of modes.
+ * \param bandwidth bandwidth in MHz.
+ * \param depth color depth.
+ */
+_X_EXPORT void
+xf86ValidateModesBandwidth(ScrnInfoPtr pScrn, DisplayModePtr modeList,
+ unsigned int bandwidth, int depth)
+{
+ DisplayModePtr mode;
+
+ for (mode = modeList; mode != NULL; mode = mode->next) {
+ if (xf86ModeBandwidth(mode, depth) > bandwidth)
+ mode->status = MODE_BANDWIDTH;
+ }
+}
+
+/**
* Frees any modes from the list with a status other than MODE_OK.
*
* \param modeList pointer to a doubly-linked or circular list of modes.
* \param verbose determines whether the reason for mode invalidation is
* printed.
- *
- * This is not in xf86Modes.c, but would be part of the proposed new API.
*/
_X_EXPORT void
xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr *modeList,
diff --git a/hw/xfree86/modes/xf86Modes.h b/hw/xfree86/modes/xf86Modes.h
index 3722d25a0..9ad5ee653 100644
--- a/hw/xfree86/modes/xf86Modes.h
+++ b/hw/xfree86/modes/xf86Modes.h
@@ -42,6 +42,7 @@
double xf86ModeHSync(DisplayModePtr mode);
double xf86ModeVRefresh(DisplayModePtr mode);
+unsigned int xf86ModeBandwidth(DisplayModePtr mode, int depth);
int
xf86ModeWidth (DisplayModePtr mode, Rotation rotation);
@@ -79,6 +80,10 @@ xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList,
MonPtr mon);
void
+xf86ValidateModesBandwidth(ScrnInfoPtr pScrn, DisplayModePtr modeList,
+ unsigned int bandwidth, int depth);
+
+void
xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr *modeList,
Bool verbose);
diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index 48e7efe00..1c20082ce 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -60,11 +60,11 @@ static Bool xf86RandR12Init12 (ScreenPtr pScreen);
static Bool xf86RandR12CreateScreenResources12 (ScreenPtr pScreen);
#endif
-static int xf86RandR12Index;
-static int xf86RandR12Generation;
+static int xf86RandR12Generation;
+static DevPrivateKey xf86RandR12Key;
-#define XF86RANDRINFO(p) \
- ((XF86RandRInfoPtr)(p)->devPrivates[xf86RandR12Index].ptr)
+#define XF86RANDRINFO(p) ((XF86RandRInfoPtr) \
+ dixLookupPrivate(&(p)->devPrivates, xf86RandR12Key))
static int
xf86RandR12ModeRefresh (DisplayModePtr mode)
@@ -341,10 +341,12 @@ xf86RandR12ScreenSetSize (ScreenPtr pScreen,
PixmapPtr pScrnPix = (*pScreen->GetScreenPixmap)(pScreen);
Bool ret = FALSE;
- if (randrp->virtualX == -1 || randrp->virtualY == -1)
- {
- randrp->virtualX = pScrn->virtualX;
- randrp->virtualY = pScrn->virtualY;
+ if (xf86RandR12Key) {
+ if (randrp->virtualX == -1 || randrp->virtualY == -1)
+ {
+ randrp->virtualX = pScrn->virtualX;
+ randrp->virtualY = pScrn->virtualY;
+ }
}
if (pRoot && pScrn->vtSema)
(*pScrn->EnableDisableFBAccess) (pScreen->myNum, FALSE);
@@ -367,7 +369,7 @@ finish:
if (pRoot && pScrn->vtSema)
(*pScrn->EnableDisableFBAccess) (pScreen->myNum, TRUE);
#if RANDR_12_INTERFACE
- if (WindowTable[pScreen->myNum] && ret)
+ if (xf86RandR12Key && WindowTable[pScreen->myNum] && ret)
RRScreenSizeNotify (pScreen);
#endif
return ret;
@@ -451,10 +453,10 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen)
else
{
/*
- * Otherwise, just set the screen to 96dpi
+ * Otherwise, just set the screen to DEFAULT_DPI
*/
- mmWidth = width * 25.4 / 96;
- mmHeight = height * 25.4 / 96;
+ mmWidth = width * 25.4 / DEFAULT_DPI;
+ mmHeight = height * 25.4 / DEFAULT_DPI;
}
}
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -467,6 +469,9 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen)
mmHeight);
}
+ if (xf86RandR12Key == NULL)
+ return TRUE;
+
if (randrp->virtualX == -1 || randrp->virtualY == -1)
{
randrp->virtualX = pScrn->virtualX;
@@ -492,11 +497,11 @@ xf86RandR12Init (ScreenPtr pScreen)
if (!noPanoramiXExtension)
return TRUE;
#endif
+
if (xf86RandR12Generation != serverGeneration)
- {
- xf86RandR12Index = AllocateScreenPrivateIndex();
xf86RandR12Generation = serverGeneration;
- }
+
+ xf86RandR12Key = &xf86RandR12Key;
randrp = xalloc (sizeof (XF86RandRInfoRec));
if (!randrp)
@@ -522,7 +527,7 @@ xf86RandR12Init (ScreenPtr pScreen)
randrp->maxX = randrp->maxY = 0;
- pScreen->devPrivates[xf86RandR12Index].ptr = randrp;
+ dixSetPrivate(&pScreen->devPrivates, xf86RandR12Key, randrp);
#if RANDR_12_INTERFACE
if (!xf86RandR12Init12 (pScreen))
@@ -534,12 +539,18 @@ xf86RandR12Init (ScreenPtr pScreen)
_X_EXPORT void
xf86RandR12SetRotations (ScreenPtr pScreen, Rotation rotations)
{
- XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ XF86RandRInfoPtr randrp;
#if RANDR_12_INTERFACE
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
int c;
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+#endif
+
+ if (xf86RandR12Key == NULL)
+ return;
+ randrp = XF86RANDRINFO(pScreen);
+#if RANDR_12_INTERFACE
for (c = 0; c < config->num_crtc; c++) {
xf86CrtcPtr crtc = config->crtc[c];
@@ -684,11 +695,8 @@ xf86RandRModeConvert (ScrnInfoPtr scrn,
RRModePtr randr_mode,
DisplayModePtr mode)
{
- mode->prev = NULL;
- mode->next = NULL;
- mode->name = NULL;
+ memset(mode, 0, sizeof(DisplayModeRec));
mode->status = MODE_OK;
- mode->type = 0;
mode->Clock = randr_mode->mode.dotClock / 1000;
@@ -1069,9 +1077,11 @@ xf86RandR12CreateScreenResources12 (ScreenPtr pScreen)
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ if (xf86RandR12Key == NULL)
+ return TRUE;
+
for (c = 0; c < config->num_crtc; c++)
- xf86RandR12CrtcNotify (config->crtc[c]->randr_crtc);
-
+ xf86RandR12CrtcNotify (config->crtc[c]->randr_crtc);
RRScreenSetSizeRange (pScreen, config->minWidth, config->minHeight,
config->maxWidth, config->maxHeight);
@@ -1088,11 +1098,11 @@ xf86RandR12TellChanged (ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
- XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
int c;
- if (!randrp)
+ if (xf86RandR12Key == NULL)
return;
+
xf86RandR12SetInfo12 (pScreen);
for (c = 0; c < config->num_crtc; c++)
xf86RandR12CrtcNotify (config->crtc[c]->randr_crtc);
diff --git a/hw/xfree86/os-support/Makefile.am b/hw/xfree86/os-support/Makefile.am
index e5a71c00a..f9a82c68d 100644
--- a/hw/xfree86/os-support/Makefile.am
+++ b/hw/xfree86/os-support/Makefile.am
@@ -1,7 +1,7 @@
SUBDIRS = bus @XORG_OS_SUBDIR@ misc $(DRI_SUBDIRS)
DIST_SUBDIRS = bsd bus misc linux lynxos solaris sysv sco usl hurd
-sdk_HEADERS = xf86_OSproc.h xf86_OSlib.h xf86_ansic.h xf86_libc.h \
+sdk_HEADERS = xf86_OSproc.h xf86_OSlib.h \
assyntax.h xf86OSmouse.h
EXTRA_DIST = int10Defines.h xf86OSpriv.h README.OS-lib
diff --git a/hw/xfree86/os-support/bsd/Makefile.am b/hw/xfree86/os-support/bsd/Makefile.am
index 446b69ee2..4fc270aa9 100644
--- a/hw/xfree86/os-support/bsd/Makefile.am
+++ b/hw/xfree86/os-support/bsd/Makefile.am
@@ -54,7 +54,6 @@ AM_CFLAGS = -DUSESTDRES $(XORG_CFLAGS) $(DIX_CFLAGS)
INCLUDES = $(XORG_INCS)
libbsd_la_SOURCES = \
- $(srcdir)/../shared/libc_wrapper.c \
$(srcdir)/../shared/posix_tty.c \
$(srcdir)/../shared/sigio.c \
$(srcdir)/../shared/vidmem.c \
diff --git a/hw/xfree86/os-support/bsd/alpha_video.c b/hw/xfree86/os-support/bsd/alpha_video.c
index a1b19d0f6..523c4488e 100644
--- a/hw/xfree86/os-support/bsd/alpha_video.c
+++ b/hw/xfree86/os-support/bsd/alpha_video.c
@@ -368,7 +368,7 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
return(-1);
}
- psize = xf86getpagesize();
+ psize = getpagesize();
Offset += Base & (psize - 1);
Base &= ~(psize - 1);
mlen = (Offset + Len + psize - 1) & ~(psize - 1);
diff --git a/hw/xfree86/os-support/bsd/arm_video.c b/hw/xfree86/os-support/bsd/arm_video.c
index b556563d3..23948b5d6 100644
--- a/hw/xfree86/os-support/bsd/arm_video.c
+++ b/hw/xfree86/os-support/bsd/arm_video.c
@@ -246,7 +246,7 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
return(-1);
}
- psize = xf86getpagesize();
+ psize = getpagesize();
Offset += Base & (psize - 1);
Base &= ~(psize - 1);
mlen = (Offset + Len + psize - 1) & ~(psize - 1);
diff --git a/hw/xfree86/os-support/bsd/i386_video.c b/hw/xfree86/os-support/bsd/i386_video.c
index e7db6c10e..42b905483 100644
--- a/hw/xfree86/os-support/bsd/i386_video.c
+++ b/hw/xfree86/os-support/bsd/i386_video.c
@@ -301,7 +301,7 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
return(-1);
}
- psize = xf86getpagesize();
+ psize = getpagesize();
Offset += Base & (psize - 1);
Base &= ~(psize - 1);
mlen = (Offset + Len + psize - 1) & ~(psize - 1);
diff --git a/hw/xfree86/os-support/bus/Pci.h b/hw/xfree86/os-support/bus/Pci.h
index 6bd0eb7fc..0abb34f98 100644
--- a/hw/xfree86/os-support/bus/Pci.h
+++ b/hw/xfree86/os-support/bus/Pci.h
@@ -210,7 +210,7 @@
# define ARCH_PCI_INIT ia64linuxPciInit
# endif
# define XF86SCANPCI_WRAPPER ia64ScanPCIWrapper
-#elif defined(__i386__)
+#elif defined(__i386__) || defined(__i386)
# if defined(linux)
# define ARCH_PCI_INIT linuxPciInit
# else
diff --git a/hw/xfree86/os-support/bus/Sbus.c b/hw/xfree86/os-support/bus/Sbus.c
index c864e3385..ff257a8c7 100644
--- a/hw/xfree86/os-support/bus/Sbus.c
+++ b/hw/xfree86/os-support/bus/Sbus.c
@@ -559,7 +559,7 @@ _X_EXPORT pointer
xf86MapSbusMem(sbusDevicePtr psdp, unsigned long offset, unsigned long size)
{
pointer ret;
- unsigned long pagemask = xf86getpagesize() - 1;
+ unsigned long pagemask = getpagesize() - 1;
unsigned long off = offset & ~pagemask;
unsigned long len = ((offset + size + pagemask) & ~pagemask) - off;
@@ -585,7 +585,7 @@ xf86MapSbusMem(sbusDevicePtr psdp, unsigned long offset, unsigned long size)
_X_EXPORT void
xf86UnmapSbusMem(sbusDevicePtr psdp, pointer addr, unsigned long size)
{
- unsigned long mask = xf86getpagesize() - 1;
+ unsigned long mask = getpagesize() - 1;
unsigned long base = (unsigned long)addr & ~mask;
unsigned long len = (((unsigned long)addr + size + mask) & ~mask) - base;
diff --git a/hw/xfree86/os-support/bus/sparcPci.c b/hw/xfree86/os-support/bus/sparcPci.c
index 6f7113f15..2d8039c29 100644
--- a/hw/xfree86/os-support/bus/sparcPci.c
+++ b/hw/xfree86/os-support/bus/sparcPci.c
@@ -270,7 +270,7 @@ sparcPciInit(void)
}
sparcPromInit();
- pagemask = xf86getpagesize() - 1;
+ pagemask = getpagesize() - 1;
for (node = promGetChild(promRootNode);
node;
diff --git a/hw/xfree86/os-support/bus/zx1PCI.c b/hw/xfree86/os-support/bus/zx1PCI.c
index 561fbd9f7..d78e0c434 100644
--- a/hw/xfree86/os-support/bus/zx1PCI.c
+++ b/hw/xfree86/os-support/bus/zx1PCI.c
@@ -469,7 +469,7 @@ void
xf86PreScanZX1(void)
{
resRange range;
- unsigned long mapSize = xf86getpagesize();
+ unsigned long mapSize = getpagesize();
unsigned long tmp, base, ioaaddr;
unsigned long flagsd, based, lastd, maskd, routed;
unsigned long flags0, base0, last0, mask0, route0;
diff --git a/hw/xfree86/os-support/hurd/Makefile.am b/hw/xfree86/os-support/hurd/Makefile.am
index e6543e133..2214b1c2d 100644
--- a/hw/xfree86/os-support/hurd/Makefile.am
+++ b/hw/xfree86/os-support/hurd/Makefile.am
@@ -4,7 +4,6 @@ libhurd_la_SOURCES = hurd_bell.c hurd_init.c hurd_mmap.c \
hurd_mouse.c hurd_video.c \
$(srcdir)/../shared/VTsw_noop.c \
$(srcdir)/../shared/posix_tty.c \
- $(srcdir)/../shared/libc_wrapper.c \
$(srcdir)/../shared/stdResource.c \
$(srcdir)/../shared/sigiostubs.c \
$(srcdir)/../shared/pm_noop.c \
diff --git a/hw/xfree86/os-support/hurd/hurd_video.c b/hw/xfree86/os-support/hurd/hurd_video.c
index 8e6ae8d36..04763ada7 100644
--- a/hw/xfree86/os-support/hurd/hurd_video.c
+++ b/hw/xfree86/os-support/hurd/hurd_video.c
@@ -126,7 +126,7 @@ extern int ioperm(unsigned long __from, unsigned long __num, int __turn_on);
Bool
xf86EnableIO()
{
- if (ioperm(0, 0xffff, 1)) {
+ if (ioperm(0, 0x10000, 1)) {
FatalError("xf86EnableIO: ioperm() failed (%s)\n", strerror(errno));
return FALSE;
}
@@ -138,7 +138,7 @@ xf86EnableIO()
void
xf86DisableIO()
{
- ioperm(0,0xffff,0);
+ ioperm(0,0x10000,0);
return;
}
diff --git a/hw/xfree86/os-support/linux/Makefile.am b/hw/xfree86/os-support/linux/Makefile.am
index 5bb252be3..5a52ffdd4 100644
--- a/hw/xfree86/os-support/linux/Makefile.am
+++ b/hw/xfree86/os-support/linux/Makefile.am
@@ -34,7 +34,6 @@ liblinux_la_SOURCES = lnx_init.c lnx_video.c lnx_mouse.c \
$(srcdir)/../shared/vidmem.c \
$(srcdir)/../shared/sigio.c \
$(srcdir)/../shared/stdResource.c \
- $(srcdir)/../shared/libc_wrapper.c \
$(ACPI_SRCS) \
$(APM_SRCS) \
$(PLATFORM_PCI_SUPPORT)
diff --git a/hw/xfree86/os-support/misc/Delay.c b/hw/xfree86/os-support/misc/Delay.c
index e3e93faa4..b18789a3a 100644
--- a/hw/xfree86/os-support/misc/Delay.c
+++ b/hw/xfree86/os-support/misc/Delay.c
@@ -18,7 +18,7 @@ xf86UDelay(long usec)
int sigio;
sigio = xf86BlockSIGIO();
- xf86usleep(usec);
+ usleep(usec);
xf86UnblockSIGIO(sigio);
#endif
diff --git a/hw/xfree86/os-support/shared/bios_mmap.c b/hw/xfree86/os-support/shared/bios_mmap.c
index cccf86a04..8bac87ebe 100644
--- a/hw/xfree86/os-support/shared/bios_mmap.c
+++ b/hw/xfree86/os-support/shared/bios_mmap.c
@@ -55,7 +55,7 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
DEV_MEM, strerror(errno));
return(-1);
}
- psize = xf86getpagesize();
+ psize = getpagesize();
Offset += Base & (psize - 1);
Base &= ~(psize - 1);
mlen = (Offset + Len + psize - 1) & ~(psize - 1);
@@ -137,7 +137,7 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
return(-1);
}
- psize = xf86getpagesize();
+ psize = getpagesize();
Offset += Base & (psize - 1);
Base &= ~(psize - 1);
mlen = (Offset + Len + psize - 1) & ~(psize - 1);
diff --git a/hw/xfree86/os-support/shared/libc_wrapper.c b/hw/xfree86/os-support/shared/libc_wrapper.c
deleted file mode 100644
index 959424110..000000000
--- a/hw/xfree86/os-support/shared/libc_wrapper.c
+++ /dev/null
@@ -1,2123 +0,0 @@
-/*
- * Copyright 1997-2003 by The XFree86 Project, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the names of Orest Zborowski and David Wexelblat
- * not be used in advertising or publicity pertaining to distribution of
- * the software without specific, written prior permission. Orest Zborowski
- * and David Wexelblat make no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * THE XFREE86 PROJECT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD
- * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL OREST ZBOROWSKI OR DAVID WEXELBLAT BE LIABLE
- * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#if defined(linux) && !defined(__GLIBC__)
-#undef __STRICT_ANSI__
-#endif
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include <X11/Xos.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#if defined(__bsdi__)
-#undef _POSIX_SOURCE
-#undef _ANSI_SOURCE
-#endif
-#include <sys/time.h>
-#include <math.h>
-#ifdef sun
-#include <ieeefp.h>
-#endif
-#include <stdarg.h>
-#include <fcntl.h>
-#include <X11/Xfuncproto.h>
-#include "os.h"
-#include <ctype.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <stdio.h>
-#include <sys/ioctl.h>
-#ifdef HAS_SVR3_MMAPDRV
-#define NO_MMAP
-#ifdef SELF_CONTAINED_WRAPPER
-#include <sys/at_ansi.h>
-#include <sys/kd.h>
-#include <sys/sysmacros.h>
-#if !defined(_NEED_SYSI86)
-# include <sys/immu.h>
-# include <sys/region.h>
-#endif
-#include <sys/mmap.h>
-struct kd_memloc MapDSC;
-int mmapFd = -2;
-#else
-extern struct kd_memloc MapDSC;
-extern int mmapFd;
-#endif
-#endif
-#ifndef NO_MMAP
-#include <sys/mman.h>
-#ifndef MAP_FAILED
-#define MAP_FAILED ((caddr_t)-1)
-#endif
-#endif
-#if !defined(ISC)
-#include <stdlib.h>
-#endif
-
-#define NEED_XF86_TYPES 1
-#define NEED_XF86_PROTOTYPES 1
-#define DONT_DEFINE_WRAPPERS
-#include "xf86_ansic.h"
-
-#ifndef SELF_CONTAINED_WRAPPER
-#include "xf86.h"
-#include "xf86Priv.h"
-#define NO_OSLIB_PROTOTYPES
-#define XF86_OS_PRIVS
-#define HAVE_WRAPPER_DECLS
-#include "xf86_OSlib.h"
-#else
-void xf86WrapperInit(void);
-#endif
-
-
-#ifndef X_NOT_POSIX
-#include <dirent.h>
-#else
-#ifdef SYSV
-#include <dirent.h>
-#else
-#ifdef USG
-#include <dirent.h>
-#else
-#include <sys/dir.h>
-#ifndef dirent
-#define dirent direct
-#endif
-#endif
-#endif
-#endif
-typedef struct dirent DIRENTRY;
-
-#ifdef ISC202
-#include <sys/types.h>
-#define WIFEXITED(a) ((a & 0x00ff) == 0) /* LSB will be 0 */
-#define WEXITSTATUS(a) ((a & 0xff00) >> 8)
-#define WIFSIGNALED(a) ((a & 0xff00) == 0) /* MSB will be 0 */
-#define WTERMSIG(a) (a & 0x00ff)
-#else
-#if defined(ISC) && !defined(_POSIX_SOURCE)
-#define _POSIX_SOURCE
-#include <sys/types.h>
-#include <sys/wait.h>
-#undef _POSIX_SOURCE
-#else
-#if (defined(ISC) && defined(_POSIX_SOURCE)) || defined(Lynx) || (defined (__alpha__) && defined(linux))
-#include <sys/types.h>
-#endif
-#include <sys/wait.h>
-#endif
-#endif
-#ifdef Lynx
-#if !defined(S_IFIFO) && defined(S_IFFIFO)
-#define S_IFIFO S_IFFIFO
-#endif
-#endif
-
-/* For xf86getpagesize() */
-#if defined(linux)
-#define HAS_SC_PAGESIZE
-#define HAS_GETPAGESIZE
-#elif defined(CSRG_BASED)
-#define HAS_GETPAGESIZE
-#elif defined(DGUX)
-#define HAS_GETPAGESIZE
-#elif defined(sun) && !defined(SVR4)
-#define HAS_GETPAGESIZE
-#endif
-#ifdef XNO_SYSCONF
-#undef _SC_PAGESIZE
-#endif
-#ifdef HAVE_SYSV_IPC
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#endif
-#include <setjmp.h>
-
-#if defined(setjmp) && defined(__GNU_LIBRARY__) && \
- (!defined(__GLIBC__) || (__GLIBC__ < 2) || \
- ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 3)))
-#define HAS_GLIBC_SIGSETJMP 1
-#endif
-
-#if 0
-#define SETBUF_RETURNS_INT
-#endif
-
-_X_EXPORT double xf86HUGE_VAL;
-
-#ifndef SELF_CONTAINED_WRAPPERS
-extern void xf86DisableIO(void);
-#endif
-
-/*
- * This file contains the XFree86 wrappers for libc functions that can be
- * called by loadable modules
- */
-
-_X_EXPORT double
-xf86hypot(double x, double y)
-{
- return(hypot(x,y));
-}
-
-_X_EXPORT void
-xf86qsort(void *base, xf86size_t nmemb, xf86size_t size,
- int (*comp)(const void *, const void *))
-{
- qsort(base, nmemb, size, comp);
-}
-
-/* string functions */
-
-_X_EXPORT char*
-xf86strcat(char* dest, const char* src)
-{
- return(strcat(dest,src));
-}
-
-_X_EXPORT char*
-xf86strchr(const char* s, int c)
-{
- return strchr(s,c);
-}
-
-_X_EXPORT int
-xf86strcmp(const char* s1, const char* s2)
-{
- return strcmp(s1,s2);
-}
-
-/* Just like the BSD version. It assumes that tolower() is ANSI-compliant */
-_X_EXPORT int
-xf86strcasecmp(const char* s1, const char* s2)
-{
- const unsigned char *us1 = (const unsigned char *)s1;
- const unsigned char *us2 = (const unsigned char *)s2;
-
- while (tolower(*us1) == tolower(*us2++))
- if (*us1++ == '\0')
- return 0;
-
- return tolower(*us1) - tolower(*--us2);
-}
-
-_X_EXPORT char*
-xf86strcpy(char* dest, const char* src)
-{
- return strcpy(dest,src);
-}
-
-_X_EXPORT xf86size_t
-xf86strcspn(const char* s1, const char* s2)
-{
- return (xf86size_t)strcspn(s1,s2);
-}
-
-_X_EXPORT xf86size_t
-xf86strlen(const char* s)
-{
- return (xf86size_t)strlen(s);
-}
-
-_X_EXPORT xf86size_t
-xf86strlcat(char *dest, const char *src, xf86size_t size)
-{
- return(strlcat(dest, src, size));
-}
-
-_X_EXPORT xf86size_t
-xf86strlcpy(char *dest, const char *src, xf86size_t size)
-{
- return strlcpy(dest, src, size);
-}
-
-_X_EXPORT char*
-xf86strncat(char* dest, const char* src, xf86size_t n)
-{
- return strncat(dest,src,(size_t)n);
-}
-
-_X_EXPORT int
-xf86strncmp(const char* s1, const char* s2, xf86size_t n)
-{
- return strncmp(s1,s2,(size_t)n);
-}
-
-/* Just like the BSD version. It assumes that tolower() is ANSI-compliant */
-_X_EXPORT int
-xf86strncasecmp(const char* s1, const char* s2, xf86size_t n)
-{
- if (n != 0) {
- const unsigned char *us1 = (const unsigned char *)s1;
- const unsigned char *us2 = (const unsigned char *)s2;
-
- do {
- if (tolower(*us1) != tolower(*us2++))
- return tolower(*us1) - tolower(*--us2);
- if (*us1++ == '\0')
- break;
- } while (--n != 0);
- }
- return 0;
-}
-
-_X_EXPORT char*
-xf86strncpy(char* dest, const char* src, xf86size_t n)
-{
- return strncpy(dest,src,(size_t)n);
-}
-
-_X_EXPORT char*
-xf86strpbrk(const char* s1, const char* s2)
-{
- return strpbrk(s1,s2);
-}
-
-_X_EXPORT char*
-xf86strrchr(const char* s, int c)
-{
- return strrchr(s,c);
-}
-
-_X_EXPORT xf86size_t
-xf86strspn(const char* s1, const char* s2)
-{
- return strspn(s1,s2);
-}
-
-_X_EXPORT char*
-xf86strstr(const char* s1, const char* s2)
-{
- return strstr(s1,s2);
-}
-
-_X_EXPORT char*
-xf86strtok(char* s1, const char* s2)
-{
- return strtok(s1,s2);
-}
-
-_X_EXPORT char*
-xf86strdup(const char* s)
-{
- return xstrdup(s);
-}
-
-_X_EXPORT int
-xf86sprintf(char *s, const char *format, ...)
-{
- int ret;
- va_list args;
- va_start(args, format);
- ret = vsprintf(s, format, args);
- va_end(args);
- return ret;
-}
-
-_X_EXPORT int
-xf86snprintf(char *s, xf86size_t len, const char *format, ...)
-{
- int ret;
- va_list args;
- va_start(args, format);
- ret = vsnprintf(s, (size_t)len, format, args);
- va_end(args);
- return ret;
-}
-
-_X_EXPORT void
-xf86bzero(void* s, unsigned int n)
-{
- memset(s, 0, n);
-}
-
-#ifdef HAVE_VSSCANF
-_X_EXPORT int
-xf86sscanf(char *s, const char *format, ...)
-#else
-_X_EXPORT int
-xf86sscanf(char *s, const char *format, char *a0, char *a1, char *a2,
- char *a3, char *a4, char *a5, char *a6, char *a7, char *a8,
- char *a9) /* limit of ten args */
-#endif
-{
-#ifdef HAVE_VSSCANF
- int ret;
- va_list args;
- va_start(args, format);
-
- ret = vsscanf(s,format,args);
- va_end(args);
- return ret;
-#else
- return sscanf(s, format, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
-#endif
-}
-
-/* Basic I/O */
-
-_X_EXPORT int xf86errno;
-
-/* XXX This is not complete */
-
-static int
-xfToOsOpenFlags(int xfflags)
-{
- int flags = 0;
-
- /* XXX This assumes O_RDONLY is 0 */
- if (xfflags & XF86_O_WRONLY)
- flags |= O_WRONLY;
- if (xfflags & XF86_O_RDWR)
- flags |= O_RDWR;
- if (xfflags & XF86_O_CREAT)
- flags |= O_CREAT;
-
- return flags;
-}
-
-_X_EXPORT int
-xf86open(const char *path, int flags, ...)
-{
- int fd;
- va_list ap;
-
- va_start(ap, flags);
- flags = xfToOsOpenFlags(flags);
- if (flags & O_CREAT) {
- /* can't request a mode_t directly on systems where mode_t
- is an unsigned short */
- mode_t mode = (mode_t)va_arg(ap, unsigned int);
- fd = open(path, flags, mode);
- } else {
- fd = open(path, flags);
- }
- va_end(ap);
- xf86errno = xf86GetErrno();
-
- return fd;
-}
-
-_X_EXPORT int
-xf86close(int fd)
-{
- int status = close(fd);
-
- xf86errno = xf86GetErrno();
- return status;
-}
-
-_X_EXPORT long
-xf86lseek(int fd, long offset, int whence)
-{
- switch (whence) {
- case XF86_SEEK_SET:
- whence = SEEK_SET;
- break;
- case XF86_SEEK_CUR:
- whence = SEEK_CUR;
- break;
- case XF86_SEEK_END:
- whence = SEEK_END;
- break;
- }
- return (long)lseek(fd, (off_t)offset, whence);
-}
-
-_X_EXPORT int
-xf86ioctl(int fd, unsigned long request, pointer argp)
-{
- int status = ioctl(fd, request, argp);
-
- xf86errno = xf86GetErrno();
- return status;
-}
-
-_X_EXPORT xf86ssize_t
-xf86read(int fd, void *buf, xf86size_t nbytes)
-{
- xf86ssize_t n = read(fd, buf, (size_t)nbytes);
-
- xf86errno = xf86GetErrno();
- return n;
-}
-
-_X_EXPORT xf86ssize_t
-xf86write(int fd, const void *buf, xf86size_t nbytes)
-{
- xf86ssize_t n = write(fd, buf, (size_t)nbytes);
-
- xf86errno = xf86GetErrno();
- return n;
-}
-
-_X_EXPORT void*
-xf86mmap(void *start, xf86size_t length, int prot,
- int flags, int fd, xf86size_t /* off_t */ offset)
-{
-#ifndef NO_MMAP
- int p=0, f=0;
- void *rc;
-
- if (flags & XF86_MAP_FIXED) f |= MAP_FIXED;
- if (flags & XF86_MAP_SHARED) f |= MAP_SHARED;
- if (flags & XF86_MAP_PRIVATE) f |= MAP_PRIVATE;
-#if defined(__amd64__) && defined(linux)
- if (flags & XF86_MAP_32BIT) f |= MAP_32BIT;
-#endif
- if (prot & XF86_PROT_EXEC) p |= PROT_EXEC;
- if (prot & XF86_PROT_READ) p |= PROT_READ;
- if (prot & XF86_PROT_WRITE) p |= PROT_WRITE;
- if (prot & XF86_PROT_NONE) p |= PROT_NONE;
-
- rc = mmap(start,(size_t)length,p,f,fd,(off_t)offset);
-
- xf86errno = xf86GetErrno();
- if (rc == MAP_FAILED)
- return XF86_MAP_FAILED;
- else
- return rc;
-#else
-#ifdef HAS_SVR3_MMAPDRV
- void *rc;
-#ifdef SELF_CONTAINED_WRAPPER
- if(mmapFd < 0) {
- if ((mmapFd = open("/dev/mmap", O_RDWR)) == -1) {
- ErrorF("Warning: failed to open /dev/mmap \n");
- xf86errno = xf86_ENOSYS;
- return XF86_MAP_FAILED;
- }
- }
-#endif
- MapDSC.vaddr = (char *)start;
- MapDSC.physaddr = (char *)offset;
- MapDSC.length = length;
- MapDSC.ioflg = 1;
-
- rc = (pointer)ioctl(mmapFd, MAP, &MapDSC);
- xf86errno = xf86GetErrno();
- if (rc == NULL)
- return XF86_MAP_FAILED;
- else
- return rc;
-#else
- ErrorF("Warning: mmap() is not supported on this platform\n");
- xf86errno = xf86_ENOSYS;
- return XF86_MAP_FAILED;
-#endif
-#endif
-}
-
-_X_EXPORT int
-xf86munmap(void *start, xf86size_t length)
-{
-#ifndef NO_MMAP
- int rc = munmap(start,(size_t)length);
-
- xf86errno = xf86GetErrno();
- return rc;
-#else
-#ifdef HAS_SVR3_MMAPDRV
- int rc = ioctl(mmapFd, UNMAPRM , start);
-
- xf86errno = xf86GetErrno();
- return rc;
-#else
- ErrorF("Warning: munmap() is not supported on this platform\n");
- xf86errno = xf86_ENOSYS;
- return -1;
-#endif
-#endif
-}
-
-_X_EXPORT int
-xf86stat(const char *file_name, struct xf86stat *xfst)
-{
- int rc;
- struct stat st;
-
- rc = stat(file_name, &st);
- xf86errno = xf86GetErrno();
- xfst->st_rdev = st.st_rdev; /* Not much is currently supported */
- return rc;
-}
-
-_X_EXPORT int
-xf86fstat(int fd, struct xf86stat *xfst)
-{
- int rc;
- struct stat st;
-
- rc = fstat(fd, &st);
- xf86errno = xf86GetErrno();
- xfst->st_rdev = st.st_rdev; /* Not much is currently supported */
- return rc;
-}
-
-static int
-xfToOsAccessMode(int xfmode)
-{
- switch(xfmode) {
- case XF86_R_OK: return R_OK;
- case XF86_W_OK: return W_OK;
- case XF86_X_OK: return X_OK;
- case XF86_F_OK: return F_OK;
- }
- return 0;
-}
-
-_X_EXPORT int
-xf86access(const char *pathname, int mode)
-{
- int rc;
-
- mode = xfToOsAccessMode(mode);
- rc = access(pathname, mode);
- xf86errno = xf86GetErrno();
- return rc;
-}
-
-
-
-/* limited stdio support */
-
-#define XF86FILE_magic 0x58464856 /* "XFHV" */
-
-typedef struct _xf86_file_ {
- INT32 fileno;
- INT32 magic;
- FILE* filehnd;
- char* fname;
-} XF86FILE_priv;
-
-static XF86FILE_priv stdhnd[3] = {
- { 0, XF86FILE_magic, NULL, "$stdinp$" },
- { 0, XF86FILE_magic, NULL, "$stdout$" },
- { 0, XF86FILE_magic, NULL, "$stderr$" }
-};
-
-_X_EXPORT XF86FILE* xf86stdin = (XF86FILE*)&stdhnd[0];
-_X_EXPORT XF86FILE* xf86stdout = (XF86FILE*)&stdhnd[1];
-_X_EXPORT XF86FILE* xf86stderr = (XF86FILE*)&stdhnd[2];
-
-void
-xf86WrapperInit()
-{
- if (stdhnd[0].filehnd == NULL)
- stdhnd[0].filehnd = stdin;
- if (stdhnd[1].filehnd == NULL)
- stdhnd[1].filehnd = stdout;
- if (stdhnd[2].filehnd == NULL)
- stdhnd[2].filehnd = stderr;
- xf86HUGE_VAL = HUGE_VAL;
-}
-
-_X_EXPORT XF86FILE*
-xf86fopen(const char* fn, const char* mode)
-{
- XF86FILE_priv* fp;
- FILE *f = fopen(fn,mode);
- xf86errno = xf86GetErrno();
- if (!f) return 0;
-
- fp = xalloc(sizeof(XF86FILE_priv));
- fp->magic = XF86FILE_magic;
- fp->filehnd = f;
- fp->fileno = fileno(f);
- fp->fname = xf86strdup(fn);
-#ifdef DEBUG
- ErrorF("xf86fopen(%s,%s) yields FILE %p XF86FILE %p\n",
- fn,mode,f,fp);
-#endif
- return (XF86FILE*)fp;
-}
-
-static void _xf86checkhndl(XF86FILE_priv* f,const char *func)
-{
- if (!f || f->magic != XF86FILE_magic ||
- !f->filehnd || !f->fname) {
- FatalError("libc_wrapper error: passed invalid FILE handle to %s",
- func);
- exit(42);
- }
-}
-
-_X_EXPORT int
-xf86fclose(XF86FILE* f)
-{
- XF86FILE_priv* fp = (XF86FILE_priv*)f;
- int ret;
-
- _xf86checkhndl(fp,"xf86fclose");
-
- /* somewhat bad check */
- if (fp->fileno < 3 && fp->fname[0]=='$') {
- /* assume this is stdin/out/err, don't dispose */
- ret = fclose(fp->filehnd);
- } else {
- ret = fclose(fp->filehnd);
- fp->magic = 0; /* invalidate */
- xfree(fp->fname);
- xfree(fp);
- }
- return ret ? -1 : 0;
-}
-
-_X_EXPORT int
-xf86printf(const char *format, ...)
-{
- int ret;
- va_list args;
- va_start(args, format);
-
- ret = printf(format,args);
- va_end(args);
- return ret;
-}
-
-_X_EXPORT int
-xf86fprintf(XF86FILE* f, const char *format, ...)
-{
- XF86FILE_priv* fp = (XF86FILE_priv*)f;
-
- int ret;
- va_list args;
- va_start(args, format);
-
-#ifdef DEBUG
- ErrorF("xf86fprintf for XF86FILE %p\n", fp);
-#endif
- _xf86checkhndl(fp,"xf86fprintf");
-
- ret = vfprintf(fp->filehnd,format,args);
- va_end(args);
- return ret;
-}
-
-_X_EXPORT int
-xf86vfprintf(XF86FILE* f, const char *format, va_list ap)
-{
- XF86FILE_priv* fp = (XF86FILE_priv*)f;
-
-#ifdef DEBUG
- ErrorF("xf86vfprintf for XF86FILE %p\n", fp);
-#endif
- _xf86checkhndl(fp,"xf86vfprintf");
-
- return vfprintf(fp->filehnd,format,ap);
-}
-
-_X_EXPORT int
-xf86vsprintf(char *s, const char *format, va_list ap)
-{
- return vsprintf(s, format, ap);
-}
-
-_X_EXPORT int
-xf86vsnprintf(char *s, xf86size_t len, const char *format, va_list ap)
-{
- return vsnprintf(s, (size_t)len, format, ap);
-}
-
-#ifdef HAVE_VFSCANF
-_X_EXPORT int
-xf86fscanf(XF86FILE* f, const char *format, ...)
-#else
-_X_EXPORT int
-xf86fscanf(XF86FILE* f, const char *format, char *a0, char *a1, char *a2,
- char *a3, char *a4, char *a5, char *a6, char *a7, char *a8,
- char *a9) /* limit of ten args */
-#endif
-{
- XF86FILE_priv* fp = (XF86FILE_priv*)f;
-
-#ifdef HAVE_VFSCANF
- int ret;
- va_list args;
- va_start(args, format);
-
- _xf86checkhndl(fp,"xf86fscanf");
-
- ret = vfscanf(fp->filehnd,format,args);
- va_end(args);
- return ret;
-#else
- _xf86checkhndl(fp,"xf86fscanf");
- return fscanf(fp->filehnd, format, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
-#endif
-}
-
-_X_EXPORT char *
-xf86fgets(char *buf, INT32 n, XF86FILE* f)
-{
- XF86FILE_priv* fp = (XF86FILE_priv*)f;
-
- _xf86checkhndl(fp,"xf86fgets");
- return fgets(buf,(int)n,fp->filehnd);
-}
-
-_X_EXPORT int
-xf86fputs(const char *buf, XF86FILE* f)
-{
- XF86FILE_priv* fp = (XF86FILE_priv*)f;
-
- _xf86checkhndl(fp,"xf86fputs");
- return fputs(buf,fp->filehnd);
-}
-
-_X_EXPORT int
-xf86getc(XF86FILE* f)
-{
- XF86FILE_priv* fp = (XF86FILE_priv*)f;
-
- _xf86checkhndl(fp,"xf86getc");
- return getc(fp->filehnd);
-}
-
-_X_EXPORT int
-xf86fgetc(XF86FILE* f)
-{
- XF86FILE_priv* fp = (XF86FILE_priv*)f;
-
- _xf86checkhndl(fp,"xf86fgetc");
- return fgetc(fp->filehnd);
-}
-
-_X_EXPORT int
-xf86fputc(int c,XF86FILE* f)
-{
- XF86FILE_priv* fp = (XF86FILE_priv*)f;
-
- _xf86checkhndl(fp,"xf86fputc");
- return fputc(c,fp->filehnd);
-}
-
-_X_EXPORT int
-xf86fflush(XF86FILE* f)
-{
- XF86FILE_priv* fp = (XF86FILE_priv*)f;
-
- _xf86checkhndl(fp,"xf86fflush");
- return fflush(fp->filehnd);
-}
-
-_X_EXPORT xf86size_t
-xf86fread(void* buf, xf86size_t sz, xf86size_t cnt, XF86FILE* f)
-{
- XF86FILE_priv* fp = (XF86FILE_priv*)f;
-
-#ifdef DEBUG
- ErrorF("xf86fread for XF86FILE %p\n", fp);
-#endif
- _xf86checkhndl(fp,"xf86fread");
- return fread(buf,(size_t)sz,(size_t)cnt,fp->filehnd);
-}
-
-_X_EXPORT xf86size_t
-xf86fwrite(const void* buf, xf86size_t sz, xf86size_t cnt, XF86FILE* f)
-{
- XF86FILE_priv* fp = (XF86FILE_priv*)f;
-
- _xf86checkhndl(fp,"xf86fwrite");
- return fwrite(buf,(size_t)sz,(size_t)cnt,fp->filehnd);
-}
-
-_X_EXPORT int
-xf86fseek(XF86FILE* f, long offset, int whence)
-{
- XF86FILE_priv* fp = (XF86FILE_priv*)f;
-
- _xf86checkhndl(fp,"xf86fseek");
- switch (whence) {
- case XF86_SEEK_SET:
- whence = SEEK_SET;
- break;
- case XF86_SEEK_CUR:
- whence = SEEK_CUR;
- break;
- case XF86_SEEK_END:
- whence = SEEK_END;
- break;
- }
- return fseek(fp->filehnd,offset,whence);
-}
-
-_X_EXPORT long
-xf86ftell(XF86FILE* f)
-{
- XF86FILE_priv* fp = (XF86FILE_priv*)f;
-
- _xf86checkhndl(fp,"xf86ftell");
- return ftell(fp->filehnd);
-}
-
-#define mapnum(e) case (xf86_##e): err = e; break;
-
-_X_EXPORT char*
-xf86strerror(int n)
-{
- int err;
-
- switch (n)
- {
- case 0: err = 0; break;
- mapnum (EACCES);
- mapnum (EAGAIN);
- mapnum (EBADF);
- mapnum (EEXIST);
- mapnum (EFAULT);
- mapnum (EINTR);
- mapnum (EINVAL);
- mapnum (EISDIR);
- mapnum (ELOOP); /* not POSIX 1 */
- mapnum (EMFILE);
- mapnum (ENAMETOOLONG);
- mapnum (ENFILE);
- mapnum (ENOENT);
- mapnum (ENOMEM);
- mapnum (ENOSPC);
- mapnum (ENOTDIR);
- mapnum (EPIPE);
- mapnum (EROFS);
- mapnum (ETXTBSY); /* not POSIX 1 */
- mapnum (ENOTTY);
-#ifdef ENOSYS
- mapnum (ENOSYS);
-#endif
- mapnum (EBUSY);
- mapnum (ENODEV);
- mapnum (EIO);
-#ifdef ESRCH
- mapnum (ESRCH);
-#endif
-#ifdef ENXIO
- mapnum (ENXIO);
-#endif
-#ifdef E2BIG
- mapnum (E2BIG);
-#endif
-#ifdef ENOEXEC
- mapnum (ENOEXEC);
-#endif
-#ifdef ECHILD
- mapnum (ECHILD);
-#endif
-#ifdef ENOTBLK
- mapnum (ENOTBLK);
-#endif
-#ifdef EXDEV
- mapnum (EXDEV);
-#endif
-#ifdef EFBIG
- mapnum (EFBIG);
-#endif
-#ifdef ESPIPE
- mapnum (ESPIPE);
-#endif
-#ifdef EMLINK
- mapnum (EMLINK);
-#endif
-#ifdef EDOM
- mapnum (EDOM);
-#endif
-#ifdef ERANGE
- mapnum (ERANGE);
-#endif
-
- default:
- err = 999;
- }
- return strerror(err);
-}
-
-#undef mapnum
-
-
-/* required for portable fgetpos/fsetpos,
- * use as
- * XF86fpos_t* pos = xalloc(xf86fpossize());
- */
-_X_EXPORT long
-xf86fpossize()
-{
- return sizeof(fpos_t);
-}
-
-_X_EXPORT int
-xf86fgetpos(XF86FILE* f,XF86fpos_t* pos)
-{
- XF86FILE_priv* fp = (XF86FILE_priv*)f;
- fpos_t *ppos = (fpos_t*)pos;
-
- _xf86checkhndl(fp,"xf86fgetpos");
-#ifndef ISC
- return fgetpos(fp->filehnd,ppos);
-#else
- *ppos = ftell(fp->filehnd);
- if (*ppos < 0L)
- return(-1);
- return(0);
-#endif
-}
-
-_X_EXPORT int
-xf86fsetpos(XF86FILE* f,const XF86fpos_t* pos)
-{
- XF86FILE_priv* fp = (XF86FILE_priv*)f;
- fpos_t *ppos = (fpos_t*)pos;
-
- /* XXX need to handle xf86errno here */
- _xf86checkhndl(fp,"xf86fsetpos");
-#ifndef ISC
- return fsetpos(fp->filehnd,ppos);
-#else
- if (ppos == NULL)
- {
- errno = EINVAL;
- return EOF;
- }
- return fseek(fp->filehnd, *ppos, SEEK_SET);
-#endif
-}
-
-_X_EXPORT void
-xf86perror(const char *s)
-{
- perror(s);
-}
-
-_X_EXPORT int
-xf86remove(const char *s)
-{
-#ifdef _POSIX_SOURCE
- return remove(s);
-#else
- return unlink(s);
-#endif
-}
-
-_X_EXPORT int
-xf86rename(const char *old, const char *new)
-{
-#ifdef _POSIX_SOURCE
- return rename(old,new);
-#else
- int ret = link(old,new);
- if (!ret) {
- ret = unlink(old);
- if (ret) unlink(new);
- } else
- ret = unlink(new);
- return ret;
-#endif
-}
-
-_X_EXPORT void
-xf86rewind(XF86FILE* f)
-{
- XF86FILE_priv* fp = (XF86FILE_priv*)f;
-
- _xf86checkhndl(fp,"xf86fsetpos");
- rewind(fp->filehnd);
-}
-
-_X_EXPORT void
-xf86clearerr(XF86FILE* f)
-{
- XF86FILE_priv* fp = (XF86FILE_priv*)f;
-
- _xf86checkhndl(fp,"xf86clearerr");
- clearerr(fp->filehnd);
-}
-
-_X_EXPORT int
-xf86feof(XF86FILE* f)
-{
- XF86FILE_priv* fp = (XF86FILE_priv*)f;
-
- _xf86checkhndl(fp,"xf86feof");
- return feof(fp->filehnd);
-}
-
-_X_EXPORT int
-xf86ferror(XF86FILE* f)
-{
- XF86FILE_priv* fp = (XF86FILE_priv*)f;
-
- _xf86checkhndl(fp,"xf86ferror");
- return ferror(fp->filehnd);
-}
-
-_X_EXPORT XF86FILE*
-xf86freopen(const char* fname,const char* mode,XF86FILE* fold)
-{
- XF86FILE_priv* fp = (XF86FILE_priv*)fold;
- FILE *fnew;
-
- _xf86checkhndl(fp,"xf86freopen");
- fnew = freopen(fname,mode,fp->filehnd);
- xf86errno = xf86GetErrno();
- if (!fnew) {
- xf86fclose(fold); /* discard old XF86FILE structure */
- return 0;
- }
- /* recycle the old XF86FILE structure */
- fp->magic = XF86FILE_magic;
- fp->filehnd = fnew;
- fp->fileno = fileno(fnew);
- fp->fname = xf86strdup(fname);
-#ifdef DEBUG
- ErrorF("xf86freopen(%s,%s,%p) yields FILE %p XF86FILE %p\n",
- fname,mode,fold,fnew,fp);
-#endif
- return (XF86FILE*)fp;
-}
-
-_X_EXPORT int
-xf86setbuf(XF86FILE* f, char *buf)
-{
- XF86FILE_priv* fp = (XF86FILE_priv*)f;
-
- _xf86checkhndl(fp,"xf86fsetbuf");
-#ifdef SETBUF_RETURNS_INT
- return setbuf(fp->filehnd, buf);
-#else
- setbuf(fp->filehnd, buf);
- return 0;
-#endif
-}
-
-_X_EXPORT int
-xf86setvbuf(XF86FILE* f, char *buf, int mode, xf86size_t size)
-{
- XF86FILE_priv* fp = (XF86FILE_priv*)f;
- int vbufmode;
-
- _xf86checkhndl(fp,"xf86fsetvbuf");
-
- switch (mode) {
- case XF86_IONBF:
- vbufmode = _IONBF;
- break;
- case XF86_IOLBF:
- vbufmode = _IOFBF;
- break;
- case XF86_IOFBF:
- vbufmode = _IOLBF;
- break;
- default:
- FatalError("libc_wrapper error: mode in setvbuf incorrect");
- exit(42);
- }
-
- return setvbuf(fp->filehnd,buf,vbufmode,(size_t)size);
-}
-
-_X_EXPORT XF86FILE*
-xf86tmpfile(void)
-{
-#ifdef NEED_TMPFILE
- return xf86fopen(tmpnam((char*)0),"w+");
-#else
- XF86FILE_priv* fp;
- FILE *f = tmpfile();
- xf86errno = xf86GetErrno();
- if (!f) return 0;
-
- fp = xalloc(sizeof(XF86FILE_priv));
- fp->magic = XF86FILE_magic;
- fp->filehnd = f;
- fp->fileno = fileno(f);
- fp->fname = xf86strdup("*tmpfile*"); /* so that it can be xfree()'d */
-#ifdef DEBUG
- ErrorF("xf86tmpfile() yields FILE %p XF86FILE %p\n",f,fp);
-#endif
- return (XF86FILE*)fp;
-}
-#endif /* HAS_TMPFILE */
-
-
-_X_EXPORT int
-xf86ungetc(int c,XF86FILE* f)
-{
- XF86FILE_priv* fp = (XF86FILE_priv*)f;
-
- _xf86checkhndl(fp,"xf86ungetc");
- return ungetc(c,fp->filehnd);
-}
-
-/* Misc functions. Some are ANSI C, some are not. */
-
-_X_EXPORT void
-xf86usleep(usec)
- unsigned long usec;
-{
-#if (defined(SYSV) || defined(SVR4)) && !defined(sun)
- syscall(3112, (usec) / 1000 + 1);
-#else
- usleep(usec);
-#endif
-}
-
-_X_EXPORT void
-xf86getsecs(long * secs, long * usecs)
-{
- struct timeval tv;
-
- X_GETTIMEOFDAY(&tv);
- if (secs)
- *secs = tv.tv_sec;
- if (usecs)
- *usecs= tv.tv_usec;
-
- return;
-}
-
-_X_EXPORT int
-xf86ffs(int mask)
-{
- int n;
- if (mask == 0) return 0;
- for (n = 1; (mask & 1)==0; n++)
- mask >>= 1;
- return n;
-}
-
-_X_EXPORT char *
-xf86getenv(const char * a)
-{
- /* Only allow this when the real and effective uids are the same */
- if (getuid() != geteuid())
- return NULL;
- else
- return(getenv(a));
-}
-
-_X_EXPORT void *
-xf86bsearch(const void *key, const void *base, xf86size_t nmemb,
- xf86size_t size, int (*compar)(const void *, const void *))
-{
- return bsearch(key, base, (size_t)nmemb, (size_t)size, compar);
-}
-
-_X_EXPORT int
-xf86execl(const char *pathname, const char *arg, ...)
-{
- int i;
- pid_t pid;
- int exit_status;
- char *arglist[5];
- va_list args;
- va_start(args, arg);
- arglist[0] = (char*)&args;
- i = 1;
- while (i < 5 && (arglist[i++] = va_arg(args, char *)) != NULL)
- ;
- va_end(args);
-
- if ((pid = fork()) < 0) {
- ErrorF("Fork failed (%s)\n", strerror(errno));
- return -1;
- } else if (pid == 0) { /* child */
- /*
- * Make sure that the child doesn't inherit any I/O permissions it
- * shouldn't have. It's better to put constraints on the development
- * of a clock program than to give I/O permissions to a bogus program
- * in someone's XF86Config file
- */
-#ifndef SELF_CONTAINED_WRAPPER
- xf86DisableIO();
-#endif
- if (setuid(getuid()) == -1) {
- ErrorF("xf86Execl: setuid() failed: %s\n", strerror(errno));
- exit(255);
- }
-#if !defined(SELF_CONTAINED_WRAPPER)
- /* set stdin, stdout to the consoleFD, and leave stderr alone */
- for (i = 0; i < 2; i++)
- {
- if (xf86Info.consoleFd != i)
- {
- close(i);
- dup(xf86Info.consoleFd);
- }
- }
-#endif
-
- execv(pathname, arglist);
- ErrorF("Exec failed for command \"%s\" (%s)\n",
- pathname, strerror(errno));
- exit(255);
- }
-
- /* parent */
- wait(&exit_status);
- if (WIFEXITED(exit_status))
- {
- switch (WEXITSTATUS(exit_status))
- {
- case 0: /* OK */
- return 0;
- case 255: /* exec() failed */
- return(255);
- default: /* bad exit status */
- ErrorF("Program \"%s\" had bad exit status %d\n",
- pathname, WEXITSTATUS(exit_status));
- return(WEXITSTATUS(exit_status));
- }
- }
- else if (WIFSIGNALED(exit_status))
- {
- ErrorF("Program \"%s\" died on signal %d\n",
- pathname, WTERMSIG(exit_status));
- return(WTERMSIG(exit_status));
- }
-#ifdef WIFSTOPPED
- else if (WIFSTOPPED(exit_status))
- {
- ErrorF("Program \"%s\" stopped by signal %d\n",
- pathname, WSTOPSIG(exit_status));
- return(WSTOPSIG(exit_status));
- }
-#endif
- else /* should never get to this point */
- {
- ErrorF("Program \"%s\" has unknown exit condition\n",
- pathname);
- return(1);
- }
-}
-
-_X_EXPORT void
-xf86abort(void)
-{
- ErrorF("Module called abort() function\n");
- abort();
-}
-
-_X_EXPORT void
-xf86exit(int ex)
-{
- ErrorF("Module called exit() function with value=%d\n",ex);
- exit(ex);
-}
-
-/* directory handling functions */
-#define XF86DIR_magic 0x78666876 /* "xfhv" */
-
-typedef struct _xf86_dir_ {
- DIR *dir;
- INT32 magic;
- XF86DIRENT *dirent;
-} XF86DIR_priv;
-
-static void
-_xf86checkdirhndl(XF86DIR_priv* f,const char *func)
-{
- if (!f || f->magic != XF86DIR_magic || !f->dir || !f->dirent) {
- FatalError("libc_wrapper error: passed invalid DIR handle to %s",
- func);
- exit(42);
- }
-}
-
-_X_EXPORT XF86DIR *
-xf86opendir(const char *name)
-{
- XF86DIR_priv *dp;
- DIR *dirp;
-
- dirp = opendir(name);
- if (!dirp)
- return (XF86DIR*)0;
-
- dp = xalloc(sizeof(XF86DIR_priv));
- dp->magic = XF86DIR_magic; /* This time I have this, Dirk! :-) */
- dp->dir = dirp;
- dp->dirent = xalloc(sizeof(struct _xf86dirent));
-
- return (XF86DIR*)dp;
-}
-
-_X_EXPORT XF86DIRENT*
-xf86readdir(XF86DIR* dirp)
-{
- XF86DIR_priv* dp = (XF86DIR_priv*)dirp;
- DIRENTRY *de;
- XF86DIRENT* xde;
- int sz;
-
- _xf86checkdirhndl(dp,"xf86readdir");
-
- de = readdir(dp->dir);
- if (!de)
- return (XF86DIRENT*)0;
- xde = dp->dirent;
- sz = strlen(de->d_name);
- strncpy(xde->d_name,de->d_name, sz>_XF86NAMELEN ? (_XF86NAMELEN+1) : (sz+1));
- xde->d_name[_XF86NAMELEN] = '\0'; /* be sure to have a 0 byte */
- return xde;
-}
-
-_X_EXPORT void
-xf86rewinddir(XF86DIR* dirp)
-{
- XF86DIR_priv* dp = (XF86DIR_priv*)dirp;
-
- _xf86checkdirhndl(dp,"xf86readdir");
- rewinddir(dp->dir);
-}
-
-_X_EXPORT int
-xf86closedir(XF86DIR* dir)
-{
- XF86DIR_priv* dp = (XF86DIR_priv*)dir;
- int n;
-
- _xf86checkdirhndl(dp,"xf86readdir");
-
- n = closedir(dp->dir);
- dp->magic = 0;
- xfree(dp->dirent);
- xfree(dp);
-
- return n;
-}
-
-static mode_t
-xfToOsChmodMode(xf86mode_t xfmode)
-{
- mode_t mode = 0;
-
- if (xfmode & XF86_S_ISUID) mode |= S_ISUID;
- if (xfmode & XF86_S_ISGID) mode |= S_ISGID;
- if (xfmode & XF86_S_ISVTX) mode |= S_ISVTX;
- if (xfmode & XF86_S_IRUSR) mode |= S_IRUSR;
- if (xfmode & XF86_S_IWUSR) mode |= S_IWUSR;
- if (xfmode & XF86_S_IXUSR) mode |= S_IXUSR;
- if (xfmode & XF86_S_IRGRP) mode |= S_IRGRP;
- if (xfmode & XF86_S_IWGRP) mode |= S_IWGRP;
- if (xfmode & XF86_S_IXGRP) mode |= S_IXGRP;
- if (xfmode & XF86_S_IROTH) mode |= S_IROTH;
- if (xfmode & XF86_S_IWOTH) mode |= S_IWOTH;
- if (xfmode & XF86_S_IXOTH) mode |= S_IXOTH;
-
- return mode;
-}
-
-_X_EXPORT int
-xf86chmod(const char *path, xf86mode_t xfmode)
-{
- mode_t mode = xfToOsChmodMode(xfmode);
- int rc = chmod(path, mode);
-
- xf86errno = xf86GetErrno();
- return rc;
-}
-
-_X_EXPORT int
-xf86chown(const char *path, xf86uid_t owner, xf86gid_t group)
-{
- int rc = chown(path, owner, group);
- xf86errno = xf86GetErrno();
- return rc;
-}
-
-_X_EXPORT xf86uid_t
-xf86geteuid(void)
-{
- return geteuid();
-}
-
-_X_EXPORT xf86gid_t
-xf86getegid(void)
-{
- return getegid();
-}
-
-_X_EXPORT int
-xf86getpid(void)
-{
- return getpid();
-}
-
-static mode_t
-xfToOsMknodMode(xf86mode_t xfmode)
-{
- mode_t mode = xfToOsChmodMode(xfmode);
-
- if (xfmode & XF86_S_IFREG) mode |= S_IFREG;
- if (xfmode & XF86_S_IFCHR) mode |= S_IFCHR;
- if (xfmode & XF86_S_IFBLK) mode |= S_IFBLK;
- if (xfmode & XF86_S_IFIFO) mode |= S_IFIFO;
-
- return mode;
-}
-
-_X_EXPORT int xf86mknod(const char *pathname, xf86mode_t xfmode, xf86dev_t dev)
-{
- mode_t mode = xfToOsMknodMode(xfmode);
- int rc = mknod(pathname, mode, dev);
- xf86errno = xf86GetErrno();
- return rc;
-}
-
-_X_EXPORT unsigned int xf86sleep(unsigned int seconds)
-{
- return sleep(seconds);
-}
-
-_X_EXPORT int xf86mkdir(const char *pathname, xf86mode_t xfmode)
-{
- mode_t mode = xfToOsChmodMode(xfmode);
- int rc = mkdir(pathname, mode);
-
- xf86errno = xf86GetErrno();
- return rc;
-}
-
-
-/* Several math functions */
-
-_X_EXPORT int
-xf86abs(int x)
-{
- return abs(x);
-}
-
-_X_EXPORT double
-xf86acos(double x)
-{
- return acos(x);
-}
-
-_X_EXPORT double
-xf86asin(double x)
-{
- return asin(x);
-}
-
-_X_EXPORT double
-xf86atan(double x)
-{
- return atan(x);
-}
-
-_X_EXPORT double
-xf86atan2(double x,double y)
-{
- return atan2(x,y);
-}
-
-_X_EXPORT double
-xf86atof(const char* s)
-{
- return atof(s);
-}
-
-_X_EXPORT int
-xf86atoi(const char* s)
-{
- return atoi(s);
-}
-
-_X_EXPORT long
-xf86atol(const char* s)
-{
- return atol(s);
-}
-
-_X_EXPORT double
-xf86ceil(double x)
-{
- return ceil(x);
-}
-
-_X_EXPORT double
-xf86cos(double x)
-{
- return(cos(x));
-}
-
-_X_EXPORT double
-xf86exp(double x)
-{
- return(exp(x));
-}
-
-_X_EXPORT double
-xf86fabs(double x)
-{
- return(fabs(x));
-}
-
-_X_EXPORT int
-xf86finite(double x)
-{
-#ifndef QNX4
- return(finite(x));
-#else
- /* XXX Replace this with something that really works. */
- return 1;
-#endif
-}
-
-_X_EXPORT double
-xf86floor(double x)
-{
- return floor(x);
-}
-
-_X_EXPORT double
-xf86fmod(double x,double y)
-{
- return fmod(x,y);
-}
-
-_X_EXPORT long
-xf86labs(long x)
-{
- return labs(x);
-}
-
-_X_EXPORT double
-xf86ldexp(double x, int exp)
-{
- return ldexp(x, exp);
-}
-
-_X_EXPORT double
-xf86log(double x)
-{
- return(log(x));
-}
-
-_X_EXPORT double
-xf86log10(double x)
-{
- return(log10(x));
-}
-
-_X_EXPORT double
-xf86modf(double x,double* y)
-{
- return modf(x,y);
-}
-
-_X_EXPORT double
-xf86pow(double x, double y)
-{
- return(pow(x,y));
-}
-
-_X_EXPORT double
-xf86sin(double x)
-{
- return sin(x);
-}
-
-_X_EXPORT double
-xf86sqrt(double x)
-{
- return(sqrt(x));
-}
-
-_X_EXPORT double
-xf86strtod(const char *s, char **end)
-{
- return strtod(s,end);
-}
-
-_X_EXPORT long
-xf86strtol(const char *s, char **end, int radix)
-{
- return strtol(s,end,radix);
-}
-
-_X_EXPORT unsigned long
-xf86strtoul(const char *s, char **end,int radix)
-{
- return strtoul(s,end,radix);
-}
-
-_X_EXPORT double
-xf86tan(double x)
-{
- return tan(x);
-}
-
-/* memory functions */
-_X_EXPORT void*
-xf86memchr(const void* s, int c, xf86size_t n)
-{
- return memchr(s,c,(size_t)n);
-}
-
-_X_EXPORT int
-xf86memcmp(const void* s1, const void* s2, xf86size_t n)
-{
- return(memcmp(s1,s2,(size_t)n));
-}
-
-_X_EXPORT void*
-xf86memcpy(void* dest, const void* src, xf86size_t n)
-{
- return(memcpy(dest,src,(size_t)n));
-}
-
-_X_EXPORT void*
-xf86memmove(void* dest, const void* src, xf86size_t n)
-{
- return(memmove(dest,src,(size_t)n));
-}
-
-_X_EXPORT void*
-xf86memset(void* s, int c, xf86size_t n)
-{
- return(memset(s,c,(size_t)n));
-}
-
-/* ctype functions */
-
-_X_EXPORT int
-xf86isalnum(int c)
-{
- return isalnum(c) ? 1 : 0;
-}
-
-_X_EXPORT int
-xf86isalpha(int c)
-{
- return isalpha(c) ? 1 : 0;
-}
-
-_X_EXPORT int
-xf86iscntrl(int c)
-{
- return iscntrl(c) ? 1 : 0;
-}
-
-_X_EXPORT int
-xf86isdigit(int c)
-{
- return isdigit(c) ? 1 : 0;
-}
-
-_X_EXPORT int
-xf86isgraph(int c)
-{
- return isgraph(c) ? 1 : 0;
-}
-
-_X_EXPORT int
-xf86islower(int c)
-{
- return islower(c) ? 1 : 0;
-}
-
-_X_EXPORT int
-xf86isprint(int c)
-{
- return isprint(c) ? 1 : 0;
-}
-
-_X_EXPORT int
-xf86ispunct(int c)
-{
- return ispunct(c) ? 1 : 0;
-}
-
-_X_EXPORT int
-xf86isspace(int c)
-{
- return isspace(c) ? 1 : 0;
-}
-
-_X_EXPORT int
-xf86isupper(int c)
-{
- return isupper(c) ? 1 : 0;
-}
-
-_X_EXPORT int
-xf86isxdigit(int c)
-{
- return isxdigit(c) ? 1 : 0;
-}
-
-_X_EXPORT int
-xf86tolower(int c)
-{
- return tolower(c);
-}
-
-_X_EXPORT int
-xf86toupper(int c)
-{
- return toupper(c);
-}
-
-/* memory allocation functions */
-_X_EXPORT void*
-xf86calloc(xf86size_t sz,xf86size_t n)
-{
- return xcalloc(sz, n);
-}
-
-_X_EXPORT void
-xf86free(void* p)
-{
- xfree(p);
-}
-
-_X_EXPORT double
-xf86frexp(double x, int *exp)
-{
- return frexp(x, exp);
-}
-
-_X_EXPORT void*
-xf86malloc(xf86size_t n)
-{
- return xalloc(n);
-}
-
-_X_EXPORT void*
-xf86realloc(void* p, xf86size_t n)
-{
- return xrealloc(p,n);
-}
-
-/*
- * XXX This probably doesn't belong here.
- */
-_X_EXPORT int
-xf86getpagesize()
-{
- static int pagesize = -1;
-
- if (pagesize != -1)
- return pagesize;
-
-#if defined(_SC_PAGESIZE) || defined(HAS_SC_PAGESIZE)
- pagesize = sysconf(_SC_PAGESIZE);
-#endif
-#ifdef _SC_PAGE_SIZE
- if (pagesize == -1)
- pagesize = sysconf(_SC_PAGE_SIZE);
-#endif
-#ifdef HAS_GETPAGESIZE
- if (pagesize == -1)
- pagesize = getpagesize();
-#endif
-#ifdef PAGE_SIZE
- if (pagesize == -1)
- pagesize = PAGE_SIZE;
-#endif
- if (pagesize == -1)
- FatalError("xf86getpagesize: Cannot determine page size");
-
- return pagesize;
-}
-
-
-#define mapnum(e) case (e): return (xf86_##e)
-
-_X_EXPORT int
-xf86GetErrno ()
-{
- switch (errno)
- {
- case 0: return 0;
- mapnum (EACCES);
- mapnum (EAGAIN);
- mapnum (EBADF);
- mapnum (EEXIST);
- mapnum (EFAULT);
- mapnum (EINTR);
- mapnum (EINVAL);
- mapnum (EISDIR);
- mapnum (ELOOP); /* not POSIX 1 */
- mapnum (EMFILE);
- mapnum (ENAMETOOLONG);
- mapnum (ENFILE);
- mapnum (ENOENT);
- mapnum (ENOMEM);
- mapnum (ENOSPC);
- mapnum (ENOTDIR);
- mapnum (EPIPE);
- mapnum (EROFS);
- mapnum (ETXTBSY); /* not POSIX 1 */
- mapnum (ENOTTY);
-#ifdef ENOSYS
- mapnum (ENOSYS);
-#endif
- mapnum (EBUSY);
- mapnum (ENODEV);
- mapnum (EIO);
-#ifdef ESRCH
- mapnum (ESRCH);
-#endif
-#ifdef ENXIO
- mapnum (ENXIO);
-#endif
-#ifdef E2BIG
- mapnum (E2BIG);
-#endif
-#ifdef ENOEXEC
- mapnum (ENOEXEC);
-#endif
-#ifdef ECHILD
- mapnum (ECHILD);
-#endif
-#ifdef ENOTBLK
- mapnum (ENOTBLK);
-#endif
-#ifdef EXDEV
- mapnum (EXDEV);
-#endif
-#ifdef EFBIG
- mapnum (EFBIG);
-#endif
-#ifdef ESPIPE
- mapnum (ESPIPE);
-#endif
-#ifdef EMLINK
- mapnum (EMLINK);
-#endif
-#ifdef EDOM
- mapnum (EDOM);
-#endif
-#ifdef ERANGE
- mapnum (ERANGE);
-#endif
- default:
- return (xf86_UNKNOWN);
- }
-}
-
-#undef mapnum
-
-
-
-#ifdef HAVE_SYSV_IPC
-
-_X_EXPORT int
-xf86shmget(xf86key_t key, int size, int xf86shmflg)
-{
- int shmflg;
- int ret;
-
- /* This copies the permissions (SHM_R, SHM_W for u, g, o). */
- shmflg = xf86shmflg & 0777;
-
- if (key == XF86IPC_PRIVATE) key = IPC_PRIVATE;
-
- if (xf86shmflg & XF86IPC_CREAT) shmflg |= IPC_CREAT;
- if (xf86shmflg & XF86IPC_EXCL) shmflg |= IPC_EXCL;
- if (xf86shmflg & XF86IPC_NOWAIT) shmflg |= IPC_NOWAIT;
- ret = shmget((key_t) key, size, shmflg);
-
- if (ret == -1)
- xf86errno = xf86GetErrno();
-
- return ret;
-}
-
-_X_EXPORT char *
-xf86shmat(int id, char *addr, int xf86shmflg)
-{
- int shmflg = 0;
- pointer ret;
-
-#ifdef SHM_RDONLY
- if (xf86shmflg & XF86SHM_RDONLY) shmflg |= SHM_RDONLY;
-#endif
-#ifdef SHM_RND
- if (xf86shmflg & XF86SHM_RND) shmflg |= SHM_RND;
-#endif
-#ifdef SHM_REMAP
- if (xf86shmflg & XF86SHM_REMAP) shmflg |= SHM_REMAP;
-#endif
-
- ret = shmat(id,addr,shmflg);
-
- if (ret == (pointer) -1)
- xf86errno = xf86GetErrno();
-
- return ret;
-}
-
-_X_EXPORT int
-xf86shmdt(char *addr)
-{
- int ret;
-
- ret = shmdt(addr);
-
- if (ret == -1)
- xf86errno = xf86GetErrno();
-
- return ret;
-}
-
-/*
- * for now only implement the rmid command.
- */
-_X_EXPORT int
-xf86shmctl(int id, int xf86cmd, pointer buf)
-{
- int cmd;
- int ret;
-
- switch (xf86cmd) {
- case XF86IPC_RMID:
- cmd = IPC_RMID;
- break;
- default:
- return 0;
- }
-
- ret = shmctl(id, cmd, buf);
-
- if (ret == -1)
- xf86errno = xf86GetErrno();
-
- return ret;
-}
-#else
-
-int
-xf86shmget(xf86key_t key, int size, int xf86shmflg)
-{
- xf86errno = ENOSYS;
-
- return -1;
-}
-
-char *
-xf86shmat(int id, char *addr, int xf86shmflg)
-{
- xf86errno = ENOSYS;
-
- return (char *)-1;
-}
-
-int
-xf86shmctl(int id, int xf86cmd, pointer buf)
-{
- xf86errno = ENOSYS;
-
- return -1;
-}
-
-int
-xf86shmdt(char *addr)
-{
- xf86errno = ENOSYS;
-
- return -1;
-}
-#endif /* HAVE_SYSV_IPC */
-
-_X_EXPORT int
-xf86getjmptype()
-{
-#ifdef HAS_GLIBC_SIGSETJMP
- return 1;
-#else
- return 0;
-#endif
-}
-
-#ifdef HAS_GLIBC_SIGSETJMP
-
-_X_EXPORT int
-xf86setjmp(xf86jmp_buf env)
-{
-#if defined(__GLIBC__) && (__GLIBC__ >= 2)
- return __sigsetjmp((void *)env, xf86setjmp1_arg2());
-#else
- return xf86setjmp1(env, xf86setjmp1_arg2());
-#endif
-}
-
-_X_EXPORT int
-xf86setjmp0(xf86jmp_buf env)
-{
- FatalError("setjmp: type 0 called instead of type %d", xf86getjmptype());
-}
-
-#if !defined(__GLIBC__) || (__GLIBC__ < 2) /* libc5 */
-
-_X_EXPORT int
-xf86setjmp1(xf86jmp_buf env, int arg2)
-{
- __sigjmp_save((void *)env, arg2);
- return __setjmp((void *)env);
-}
-
-#endif
-
-#else /* HAS_GLIBC_SIGSETJMP */
-
-int
-xf86setjmp1(xf86jmp_buf env, int arg2)
-{
- FatalError("setjmp: type 1 called instead of type %d", xf86getjmptype());
-}
-
-int
-xf86setjmp0(xf86jmp_buf env)
-{
- return setjmp((void *)env);
-}
-
-#endif /* HAS_GLIBC_SIGSETJMP */
-
-_X_EXPORT int
-xf86setjmp1_arg2()
-{
- return 1;
-}
-
-_X_EXPORT int
-xf86setjmperror(xf86jmp_buf env)
-{
- FatalError("setjmp: don't know how to handle setjmp() type %d",
- xf86getjmptype());
-}
-
-long
-xf86random()
-{
- return random();
-}
diff --git a/hw/xfree86/os-support/solaris/Makefile.am b/hw/xfree86/os-support/solaris/Makefile.am
index 5ed60bc55..68f6b4cd0 100644
--- a/hw/xfree86/os-support/solaris/Makefile.am
+++ b/hw/xfree86/os-support/solaris/Makefile.am
@@ -20,7 +20,6 @@ solaris-@SOLARIS_INOUT_ARCH@.il: solaris-@SOLARIS_INOUT_ARCH@.S
noinst_LTLIBRARIES = libsolaris.la
libsolaris_la_SOURCES = sun_bios.c sun_init.c \
sun_mouse.c sun_vid.c sun_bell.c $(AGP_SRC) sun_apm.c \
- $(srcdir)/../shared/libc_wrapper.c \
$(srcdir)/../shared/kmod_noop.c \
$(srcdir)/../shared/posix_tty.c $(srcdir)/../shared/sigiostubs.c \
$(srcdir)/../shared/stdResource.c \
diff --git a/hw/xfree86/os-support/solaris/sun_bios.c b/hw/xfree86/os-support/solaris/sun_bios.c
index 1223dcd68..a27a5a5a7 100644
--- a/hw/xfree86/os-support/solaris/sun_bios.c
+++ b/hw/xfree86/os-support/solaris/sun_bios.c
@@ -26,7 +26,7 @@
#include <xorg-config.h>
#endif
-#ifdef __i386__
+#if defined(__i386__) || defined(__i386)
#define _NEED_SYSI86
#endif
#include "xf86.h"
@@ -62,11 +62,11 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
*
* Use /dev/xsvc for everything.
*/
- psize = xf86getpagesize();
+ psize = getpagesize();
Offset += Base & (psize - 1);
Base &= ~(psize - 1);
mlen = (Offset + Len + psize - 1) & ~(psize - 1);
-#if defined(__i386__) && !defined(__SOL8__)
+#if (defined(__i386__) || defined(__i386)) && !defined(__SOL8__)
if (Base >= 0xA0000 && Base + mlen < 0xFFFFF && xf86Info.vtno >= 0)
sprintf(solx86_vtname, "/dev/vt%02d", xf86Info.vtno);
else
diff --git a/hw/xfree86/os-support/solaris/sun_init.c b/hw/xfree86/os-support/solaris/sun_init.c
index c7fac524f..1f389cb40 100644
--- a/hw/xfree86/os-support/solaris/sun_init.c
+++ b/hw/xfree86/os-support/solaris/sun_init.c
@@ -29,7 +29,7 @@
#include "xf86.h"
#include "xf86Priv.h"
#include "xf86_OSlib.h"
-#if defined(__i386__) || defined(__x86)
+#if defined(__i386__) || defined(__i386) || defined(__x86)
# include <sys/kd.h>
#endif
@@ -40,7 +40,7 @@ static int VTnum = -1;
static int xf86StartVT = -1;
#endif
-#if defined(__SOL8__) || !defined(__i386__)
+#if defined(__SOL8__) || (!defined(__i386__) && !defined(__i386))
static char fb_dev[PATH_MAX] = "/dev/fb";
#else
static char fb_dev[PATH_MAX] = "/dev/console";
@@ -209,11 +209,8 @@ xf86CloseConsole(void)
#ifdef HAS_USL_VTS
struct vt_mode VT;
#endif
-#if defined(__SOL8__) || !defined(__i386__)
- int tmp;
-#endif
-#if !defined(__i386__) && !defined(__x86)
+#if !defined(__i386__) && !defined(__i386) && !defined(__x86)
if (!xf86DoProbe && !xf86DoConfigure) {
int fd;
@@ -332,7 +329,7 @@ xf86ProcessArgument(int argc, char **argv, int i)
#endif /* HAS_USL_VTS */
-#if defined(__SOL8__) || !defined(__i386__)
+#if defined(__SOL8__) || (!defined(__i386__) && !defined(__i386))
if ((i + 1) < argc) {
if (!strcmp(argv[i], "-dev")) {
diff --git a/hw/xfree86/os-support/solaris/sun_mouse.c b/hw/xfree86/os-support/solaris/sun_mouse.c
index aa509d08b..b1b7797f1 100644
--- a/hw/xfree86/os-support/solaris/sun_mouse.c
+++ b/hw/xfree86/os-support/solaris/sun_mouse.c
@@ -121,8 +121,11 @@ static void vuidMouseSendScreenSize(ScreenPtr pScreen, VuidMsePtr pVuidMse);
static void vuidMouseAdjustFrame(int index, int x, int y, int flags);
static int vuidMouseGeneration = 0;
-static int vuidMouseScreenIndex;
-#define vuidMouseScreenPrivate(s) ((s)->devPrivates[vuidMouseScreenIndex].ptr)
+static DevPrivateKey vuidMouseScreenKey = &vuidMouseScreenKey;
+#define vuidGetMouseScreenPrivate(s) ((VuidMsePtr) \
+ dixLookupPrivate(&(s)->devPrivates, vuidMouseScreenKey))
+#define vuidSetMouseScreenPrivate(s,p) \
+ dixSetPrivate(&(s)->devPrivates, vuidMouseScreenKey, p)
#endif /* HAVE_ABSOLUTE_MOUSE_SCALING */
static inline
@@ -455,7 +458,7 @@ static void vuidMouseAdjustFrame(int index, int x, int y, int flags)
ScrnInfoPtr pScrn = xf86Screens[index];
ScreenPtr pScreen = pScrn->pScreen;
xf86AdjustFrameProc *wrappedAdjustFrame
- = (xf86AdjustFrameProc *) vuidMouseScreenPrivate(pScreen);
+ = (xf86AdjustFrameProc *) vuidMouseGetScreenPrivate(pScreen);
VuidMsePtr m;
if(wrappedAdjustFrame) {
@@ -496,15 +499,12 @@ vuidMouseProc(DeviceIntPtr pPointer, int what)
case DEVICE_INIT:
#ifdef HAVE_ABSOLUTE_MOUSE_SCALING
if (vuidMouseGeneration != serverGeneration) {
- if ((vuidMouseScreenIndex = AllocateScreenPrivateIndex()) >= 0) {
for (i = 0; i < screenInfo.numScreens; i++) {
ScreenPtr pScreen = screenInfo.screens[i];
ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
- vuidMouseScreenPrivate(pScreen)
- = (pointer) pScrn->AdjustFrame;
+ vuidMouseSetScreenPrivate(pScreen, pScrn->AdjustFrame);
pScrn->AdjustFrame = vuidMouseAdjustFrame;
}
- }
vuidMouseGeneration = serverGeneration;
}
#endif
diff --git a/hw/xfree86/os-support/solaris/sun_vid.c b/hw/xfree86/os-support/solaris/sun_vid.c
index 494b2cfbf..e7b529ccb 100644
--- a/hw/xfree86/os-support/solaris/sun_vid.c
+++ b/hw/xfree86/os-support/solaris/sun_vid.c
@@ -28,7 +28,7 @@
#include <sys/types.h> /* get __x86 definition if not set by compiler */
-#if defined(__i386__) || defined(__x86)
+#if defined(__i386__) || defined(__i386) || defined(__x86)
#define _NEED_SYSI86
#endif
#include "xf86.h"
@@ -148,14 +148,14 @@ xf86UnMapVidMem(int ScreenNum, pointer Base, unsigned long Size)
/* I/O Permissions section */
/***************************************************************************/
-#if defined(__i386__) || defined(__x86)
+#if defined(__i386__) || defined(__i386) || defined(__x86)
static Bool ExtendedEnabled = FALSE;
#endif
_X_EXPORT Bool
xf86EnableIO(void)
{
-#if defined(__i386__) || defined(__x86)
+#if defined(__i386__) || defined(__i386) || defined(__x86)
if (ExtendedEnabled)
return TRUE;
@@ -171,7 +171,7 @@ xf86EnableIO(void)
_X_EXPORT void
xf86DisableIO(void)
{
-#if defined(__i386__) || defined(__x86)
+#if defined(__i386__) || defined(__i386) || defined(__x86)
if(!ExtendedEnabled)
return;
@@ -188,7 +188,7 @@ xf86DisableIO(void)
_X_EXPORT Bool xf86DisableInterrupts(void)
{
-#if defined(__i386__) || defined(__x86)
+#if defined(__i386__) || defined(__i386) || defined(__x86)
if (!ExtendedEnabled && (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0))
return FALSE;
@@ -207,7 +207,7 @@ _X_EXPORT Bool xf86DisableInterrupts(void)
_X_EXPORT void xf86EnableInterrupts(void)
{
-#if defined(__i386__) || defined(__x86)
+#if defined(__i386__) || defined(__i386) || defined(__x86)
if (!ExtendedEnabled && (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0))
return;
diff --git a/hw/xfree86/os-support/xf86_OSlib.h b/hw/xfree86/os-support/xf86_OSlib.h
index 662dbaace..aba47581f 100644
--- a/hw/xfree86/os-support/xf86_OSlib.h
+++ b/hw/xfree86/os-support/xf86_OSlib.h
@@ -76,21 +76,6 @@
#include <X11/Xos.h>
#include <X11/Xfuncproto.h>
-/*
- * Define some things from the "ANSI" C wrappers that are needed in the
- * the core server.
- */
-#ifndef HAVE_WRAPPER_DECLS
-#define HAVE_WRAPPER_DECLS
-#undef usleep
-#define usleep(a) xf86usleep(a)
-extern void xf86usleep(unsigned long);
-extern int xf86getpagesize(void);
-extern int xf86GetErrno(void);
-typedef unsigned long xf86size_t;
-typedef signed long xf86ssize_t;
-#endif
-
#include <stdio.h>
#include <ctype.h>
#include <stddef.h>
@@ -140,7 +125,7 @@ typedef signed long xf86ssize_t;
# endif /* SVR4 && !sun */
/* V86SC_IOPL was moved to <sys/sysi86.h> on Solaris 7 and later */
# if defined(sun) && defined (SVR4) /* Solaris? */
-# if defined(__i386__) || defined(__x86) /* on x86 or x64? */
+# if defined(__i386__) || defined(__i386) || defined(__x86) /* on x86 or x64? */
# if !defined(V86SC_IOPL) /* Solaris 7 or later? */
# include <sys/v86.h> /* Nope */
# endif
@@ -148,7 +133,7 @@ typedef signed long xf86ssize_t;
# else
# include <sys/v86.h> /* Not solaris */
# endif /* sun && i386 && SVR4 */
-# if defined(sun) && (defined (__i386__) || defined(__x86)) && defined (SVR4)
+# if defined(sun) && (defined (__i386__) || defined(__i386) || defined(__x86)) && defined (SVR4)
# include <sys/psw.h>
# endif
# endif /* _NEED_SYSI86 */
@@ -224,7 +209,7 @@ typedef signed long xf86ssize_t;
# define POSIX_TTY
# endif
-# if defined(sun) && defined (__i386__) && defined (SVR4) && !defined(__SOL8__)
+# if defined(sun) && (defined (__i386__) || defined(__i386)) && defined (SVR4) && !defined(__SOL8__)
# define USE_VT_SYSREQ
# define VT_SYSREQ_DEFAULT TRUE
# endif
diff --git a/hw/xfree86/os-support/xf86_ansic.h b/hw/xfree86/os-support/xf86_ansic.h
deleted file mode 100644
index 0afd96744..000000000
--- a/hw/xfree86/os-support/xf86_ansic.h
+++ /dev/null
@@ -1,314 +0,0 @@
-/*
- * Copyright 1997-2003 by The XFree86 Project, Inc
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the names of the above listed copyright holders
- * not be used in advertising or publicity pertaining to distribution of
- * the software without specific, written prior permission. The above listed
- * copyright holders make no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * THE ABOVE LISTED COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD
- * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
- * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
- * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
- * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-
-#ifndef _XF86_ANSIC_H
-#define _XF86_ANSIC_H
-
-#include <stdarg.h>
-
-/*
- * The first set of definitions are required both for modules and
- * libc_wrapper.c.
- */
-
-#if !defined(SYSV) && !defined(SVR4) && !defined(Lynx) || \
- defined(__SCO__) || defined(__UNIXWARE__)
-#define HAVE_VSSCANF
-#define HAVE_VFSCANF
-#endif
-
-#ifndef NULL
-#if (defined(SVR4) || defined(SYSV)) && !defined(__GNUC__)
-#define NULL 0
-#else
-#define NULL ((void *)0)
-#endif
-#endif
-#ifndef EOF
-#define EOF (-1)
-#endif
-
-#ifndef PATH_MAX
-#define PATH_MAX 1024
-#endif
-
-/* <limits.h> stuff */
-#define x_BITSPERBYTE 8
-#define x_BITS(type) (x_BITSPERBYTE * (int)sizeof(type))
-#define x_SHORTBITS x_BITS(short)
-#define x_INTBITS x_BITS(int)
-#define x_LONGBITS x_BITS(long)
-#ifndef SHRT_MIN
-#define SHRT_MIN ((short)(1 << (x_SHORTBITS - 1)))
-#endif
-
-#ifndef FONTMODULE
-#include "misc.h"
-#endif
-#include "xf86_libc.h"
-#ifndef SHRT_MAX
-#define SHRT_MAX ((short)~SHRT_MIN)
-#endif
-#ifndef USHRT_MAX
-#define USHRT_MAX ((unsigned short)~0)
-#endif
-#ifndef MINSHORT
-#define MINSHORT SHRT_MIN
-#endif
-#ifndef MAXSHORT
-#define MAXSHORT SHRT_MAX
-#endif
-#ifndef INT_MIN
-#define INT_MIN (1 << (x_INTBITS - 1))
-#endif
-#ifndef INT_MAX
-#define INT_MAX (~INT_MIN)
-#endif
-#ifndef UINT_MAX
-#define UINT_MAX (~0)
-#endif
-#ifndef MININT
-#define MININT INT_MIN
-#endif
-#ifndef MAXINT
-#define MAXINT INT_MAX
-#endif
-#ifndef LONG_MIN
-#define LONG_MIN ((long)(1 << (x_LONGBITS - 1)))
-#endif
-#ifndef LONG_MAX
-#define LONG_MAX ((long)~LONG_MIN)
-#endif
-#ifndef ULONG_MAX
-#define ULONG_MAX ((unsigned long)~0UL)
-#endif
-#ifndef MINLONG
-#define MINLONG LONG_MIN
-#endif
-#ifndef MAXLONG
-#define MAXLONG LONG_MAX
-#endif
-
-/*
- * ANSI C compilers only.
- */
-
-/* ANSI C emulation library */
-
-extern void xf86abort(void);
-extern int xf86abs(int);
-extern double xf86acos(double);
-extern double xf86asin(double);
-extern double xf86atan(double);
-extern double xf86atan2(double,double);
-extern double xf86atof(const char*);
-extern int xf86atoi(const char*);
-extern long xf86atol(const char*);
-extern void *xf86bsearch(const void *, const void *, xf86size_t, xf86size_t,
- int (*)(const void *, const void *));
-extern double xf86ceil(double);
-extern void* xf86calloc(xf86size_t,xf86size_t);
-extern void xf86clearerr(XF86FILE*);
-extern double xf86cos(double);
-extern void xf86exit(int);
-extern double xf86exp(double);
-extern double xf86fabs(double);
-extern int xf86fclose(XF86FILE*);
-extern int xf86feof(XF86FILE*);
-extern int xf86ferror(XF86FILE*);
-extern int xf86fflush(XF86FILE*);
-extern int xf86fgetc(XF86FILE*);
-extern int xf86getc(XF86FILE*);
-extern int xf86fgetpos(XF86FILE*,XF86fpos_t*);
-extern char* xf86fgets(char*,INT32,XF86FILE*);
-extern int xf86finite(double);
-extern double xf86floor(double);
-extern double xf86fmod(double,double);
-extern XF86FILE* xf86fopen(const char*,const char*);
-extern double xf86frexp(double, int*);
-extern int xf86printf(const char*,...);
-extern int xf86fprintf(XF86FILE*,const char*,...);
-extern int xf86fputc(int,XF86FILE*);
-extern int xf86fputs(const char*,XF86FILE*);
-extern xf86size_t xf86fread(void*,xf86size_t,xf86size_t,XF86FILE*);
-extern void xf86free(void*);
-extern XF86FILE* xf86freopen(const char*,const char*,XF86FILE*);
-#if defined(HAVE_VFSCANF) || !defined(NEED_XF86_PROTOTYPES)
-extern int xf86fscanf(XF86FILE*,const char*,...);
-#else
-extern int xf86fscanf(/*XF86FILE*,const char*,char *,char *,char *,char *,
- char *,char *,char *,char *,char *,char * */);
-#endif
-extern int xf86fseek(XF86FILE*,long,int);
-extern int xf86fsetpos(XF86FILE*,const XF86fpos_t*);
-extern long xf86ftell(XF86FILE*);
-extern xf86size_t xf86fwrite(const void*,xf86size_t,xf86size_t,XF86FILE*);
-extern char* xf86getenv(const char*);
-extern int xf86isalnum(int);
-extern int xf86isalpha(int);
-extern int xf86iscntrl(int);
-extern int xf86isdigit(int);
-extern int xf86isgraph(int);
-extern int xf86islower(int);
-extern int xf86isprint(int);
-extern int xf86ispunct(int);
-extern int xf86isspace(int);
-extern int xf86isupper(int);
-extern int xf86isxdigit(int);
-extern long xf86labs(long);
-extern double xf86ldexp(double,int);
-extern double xf86log(double);
-extern double xf86log10(double);
-extern void* xf86malloc(xf86size_t);
-extern void* xf86memchr(const void*,int,xf86size_t);
-extern int xf86memcmp(const void*,const void*,xf86size_t);
-extern void* xf86memcpy(void*,const void*,xf86size_t);
-extern void* xf86memmove(void*,const void*,xf86size_t);
-extern void* xf86memset(void*,int,xf86size_t);
-extern double xf86modf(double,double*);
-extern void xf86perror(const char*);
-extern double xf86pow(double,double);
-extern void xf86qsort(void*, xf86size_t, xf86size_t,
- int(*)(const void*, const void*));
-extern void* xf86realloc(void*,xf86size_t);
-extern long xf86random(void);
-extern int xf86remove(const char*);
-extern int xf86rename(const char*,const char*);
-extern void xf86rewind(XF86FILE*);
-extern int xf86setbuf(XF86FILE*,char*);
-extern int xf86setvbuf(XF86FILE*,char*,int,xf86size_t);
-extern double xf86sin(double);
-extern int xf86sprintf(char*,const char*,...);
-extern int xf86snprintf(char*,xf86size_t,const char*,...);
-extern double xf86sqrt(double);
-#if defined(HAVE_VSSCANF) || !defined(NEED_XF86_PROTOTYPES)
-extern int xf86sscanf(char*,const char*,...);
-#else
-extern int xf86sscanf(/*char*,const char*,char *,char *,char *,char *,
- char *,char *,char *,char *,char *,char * */);
-#endif
-extern char* xf86strcat(char*,const char*);
-extern char* xf86strchr(const char*, int c);
-extern int xf86strcmp(const char*,const char*);
-extern int xf86strcasecmp(const char*,const char*);
-extern char* xf86strcpy(char*,const char*);
-extern xf86size_t xf86strcspn(const char*,const char*);
-extern char* xf86strerror(int);
-extern xf86size_t xf86strlcat(char*,const char*,xf86size_t);
-extern xf86size_t xf86strlcpy(char*,const char*,xf86size_t);
-extern xf86size_t xf86strlen(const char*);
-extern char* xf86strncat(char *, const char *, xf86size_t);
-extern int xf86strncmp(const char*,const char*,xf86size_t);
-extern int xf86strncasecmp(const char*,const char*,xf86size_t);
-extern char* xf86strncpy(char*,const char*,xf86size_t);
-extern char* xf86strpbrk(const char*,const char*);
-extern char* xf86strrchr(const char*,int);
-extern xf86size_t xf86strspn(const char*,const char*);
-extern char* xf86strstr(const char*,const char*);
-extern double xf86strtod(const char*,char**);
-extern char* xf86strtok(char*,const char*);
-extern long xf86strtol(const char*,char**,int);
-extern unsigned long xf86strtoul(const char*,char**,int);
-extern double xf86tan(double);
-extern XF86FILE* xf86tmpfile(void);
-extern char* xf86tmpnam(char*);
-extern int xf86tolower(int);
-extern int xf86toupper(int);
-extern int xf86ungetc(int,XF86FILE*);
-extern int xf86vfprintf(XF86FILE*,const char*,va_list);
-extern int xf86vsprintf(char*,const char*,va_list);
-extern int xf86vsnprintf(char*,xf86size_t,const char*,va_list);
-
-extern int xf86open(const char*, int,...);
-extern int xf86close(int);
-extern long xf86lseek(int, long, int);
-extern int xf86ioctl(int, unsigned long, pointer);
-extern xf86ssize_t xf86read(int, void *, xf86size_t);
-extern xf86ssize_t xf86write(int, const void *, xf86size_t);
-extern void* xf86mmap(void*, xf86size_t, int, int, int, xf86size_t /* off_t */);
-extern int xf86munmap(void*, xf86size_t);
-extern int xf86stat(const char *, struct xf86stat *);
-extern int xf86fstat(int, struct xf86stat *);
-extern int xf86access(const char *, int);
-extern int xf86errno;
-extern int xf86GetErrno(void);
-
-extern double xf86HUGE_VAL;
-
-extern double xf86hypot(double,double);
-
-/* non-ANSI C functions */
-extern XF86DIR* xf86opendir(const char*);
-extern int xf86closedir(XF86DIR*);
-extern XF86DIRENT* xf86readdir(XF86DIR*);
-extern void xf86rewinddir(XF86DIR*);
-extern void xf86bcopy(const void*,void*,xf86size_t);
-extern int xf86ffs(int);
-extern char* xf86strdup(const char*);
-extern void xf86bzero(void*,unsigned int);
-extern int xf86execl(const char *, const char *, ...);
-extern long xf86fpossize(void);
-extern int xf86chmod(const char *, xf86mode_t);
-extern int xf86chown(const char *, xf86uid_t, xf86gid_t);
-extern xf86uid_t xf86geteuid(void);
-extern xf86gid_t xf86getegid(void);
-extern int xf86getpid(void);
-extern int xf86mknod(const char *, xf86mode_t, xf86dev_t);
-extern int xf86mkdir(const char *, xf86mode_t);
-unsigned int xf86sleep(unsigned int seconds);
-/* sysv IPC */
-extern int xf86shmget(xf86key_t key, int size, int xf86shmflg);
-extern char * xf86shmat(int id, char *addr, int xf86shmflg);
-extern int xf86shmdt(char *addr);
-extern int xf86shmctl(int id, int xf86cmd, pointer buf);
-
-extern int xf86setjmp(xf86jmp_buf env);
-extern int xf86setjmp0(xf86jmp_buf env);
-extern int xf86setjmp1(xf86jmp_buf env, int);
-extern int xf86setjmp1_arg2(void);
-extern int xf86setjmperror(xf86jmp_buf env);
-extern int xf86getjmptype(void);
-extern void xf86longjmp(xf86jmp_buf env, int val);
-#define xf86setjmp_macro(env) \
- (xf86getjmptype() == 0 ? xf86setjmp0((env)) : \
- (xf86getjmptype() == 1 ? xf86setjmp1((env), xf86setjmp1_arg2()) : \
- xf86setjmperror((env))))
-
-/*
- * These things are always required by drivers (but not by libc_wrapper.c),
- * even for a static server because some OSs don't provide them.
- */
-
-extern int xf86getpagesize(void);
-extern void xf86usleep(unsigned long);
-extern void xf86getsecs(long *, long *);
-#ifndef DONT_DEFINE_WRAPPERS
-#undef getpagesize
-#define getpagesize() xf86getpagesize()
-#undef usleep
-#define usleep(ul) xf86usleep(ul)
-#undef getsecs
-#define getsecs(a, b) xf86getsecs(a, b)
-#endif
-#endif /* _XF86_ANSIC_H */
diff --git a/hw/xfree86/os-support/xf86_libc.h b/hw/xfree86/os-support/xf86_libc.h
deleted file mode 100644
index 199fcd6b9..000000000
--- a/hw/xfree86/os-support/xf86_libc.h
+++ /dev/null
@@ -1,721 +0,0 @@
-/*
- * Copyright (c) 1997-2003 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).
- */
-
-/*
- * This file is an attempt to make developing code for the new loadable module
- * architecure simpler. It tries to use macros to hide all libc wrappers so
- * that all that is needed to "port" a module to this architecture is to
- * include this one header file
- *
- * Revision history:
- *
- *
- * 0.4 Apr 12 1997 add the ANSI defines
- * 0.3 Feb 24 1997 handle getenv
- * 0.2 Feb 24 1997 hide few FILE functions
- * 0.1 Feb 24 1997 hide the trivial functions mem* str*
- */
-
-#ifndef XF86_LIBC_H
-#define XF86_LIBC_H 1
-
-#include <X11/Xfuncs.h>
-#include <stddef.h>
-
-/*
- * The first set of definitions are required both for modules and
- * libc_wrapper.c.
- */
-
-/*
- * First, the new data types
- *
- * note: if some pointer is declared "opaque" here, pass it between
- * xf86* functions only, and don't rely on it having a whatever internal
- * structure, even if some source file might reveal the existence of
- * such a structure.
- */
-typedef void XF86FILE; /* opaque FILE replacement */
-extern XF86FILE* xf86stdin;
-extern XF86FILE* xf86stdout;
-extern XF86FILE* xf86stderr;
-
-typedef void XF86fpos_t; /* opaque fpos_t replacement */
-
-#define _XF86NAMELEN 263 /* enough for a larger filename */
- /* (divisble by 8) */
-typedef void XF86DIR; /* opaque DIR replacement */
-
-/* Note: the following is POSIX! POSIX only requires the d_name member.
- * Normal Unix has often a number of other members, but don't rely on that
- */
-struct _xf86dirent { /* types in struct dirent/direct: */
- char d_name[_XF86NAMELEN+1]; /* char [MAXNAMLEN]; might be smaller or unaligned */
-};
-typedef struct _xf86dirent XF86DIRENT;
-
-typedef unsigned long xf86size_t;
-typedef signed long xf86ssize_t;
-typedef unsigned long xf86dev_t;
-typedef unsigned int xf86mode_t;
-typedef unsigned int xf86uid_t;
-typedef unsigned int xf86gid_t;
-
-struct xf86stat {
- xf86dev_t st_rdev; /* This is incomplete, and makes assumptions */
-};
-
-/* sysv IPC */
-typedef int xf86key_t;
-
-/* setjmp/longjmp */
-#if defined(__ia64__)
-typedef int xf86jmp_buf[1024] __attribute__ ((aligned (16))); /* guarantees 128-bit alignment! */
-#else
-typedef int xf86jmp_buf[1024];
-#endif
-
-/* for setvbuf */
-#define XF86_IONBF 1
-#define XF86_IOFBF 2
-#define XF86_IOLBF 3
-
-/* for open (XXX not complete) */
-#define XF86_O_RDONLY 0x0000
-#define XF86_O_WRONLY 0x0001
-#define XF86_O_RDWR 0x0002
-#define XF86_O_CREAT 0x0200
-
-/* for mmap */
-#define XF86_PROT_EXEC 0x0001
-#define XF86_PROT_READ 0x0002
-#define XF86_PROT_WRITE 0x0004
-#define XF86_PROT_NONE 0x0008
-#define XF86_MAP_FIXED 0x0001
-#define XF86_MAP_SHARED 0x0002
-#define XF86_MAP_PRIVATE 0x0004
-#define XF86_MAP_32BIT 0x0040
-#define XF86_MAP_FAILED ((void *)-1)
-
-/* for fseek */
-#define XF86_SEEK_SET 0
-#define XF86_SEEK_CUR 1
-#define XF86_SEEK_END 2
-
-/* for access */
-#define XF86_R_OK 0
-#define XF86_W_OK 1
-#define XF86_X_OK 2
-#define XF86_F_OK 3
-
-/* for chmod */
-#define XF86_S_ISUID 04000 /* set user ID on execution */
-#define XF86_S_ISGID 02000 /* set group ID on execution */
-#define XF86_S_ISVTX 01000 /* sticky bit */
-#define XF86_S_IRUSR 00400 /* read by owner */
-#define XF86_S_IWUSR 00200 /* write by owner */
-#define XF86_S_IXUSR 00100 /* execute/search by owner */
-#define XF86_S_IRGRP 00040 /* read by group */
-#define XF86_S_IWGRP 00020 /* write by group */
-#define XF86_S_IXGRP 00010 /* execute/search by group */
-#define XF86_S_IROTH 00004 /* read by others */
-#define XF86_S_IWOTH 00002 /* write by others */
-#define XF86_S_IXOTH 00001 /* execute/search by others */
-
-/* for mknod */
-#define XF86_S_IFREG 0010000
-#define XF86_S_IFCHR 0020000
-#define XF86_S_IFBLK 0040000
-#define XF86_S_IFIFO 0100000
-
-/*
- * errno values
- * They start at 1000 just so they don't match real errnos at all
- */
-#define xf86_UNKNOWN 1000
-#define xf86_EACCES 1001
-#define xf86_EAGAIN 1002
-#define xf86_EBADF 1003
-#define xf86_EEXIST 1004
-#define xf86_EFAULT 1005
-#define xf86_EINTR 1006
-#define xf86_EINVAL 1007
-#define xf86_EISDIR 1008
-#define xf86_ELOOP 1009
-#define xf86_EMFILE 1010
-#define xf86_ENAMETOOLONG 1011
-#define xf86_ENFILE 1012
-#define xf86_ENOENT 1013
-#define xf86_ENOMEM 1014
-#define xf86_ENOSPC 1015
-#define xf86_ENOTDIR 1016
-#define xf86_EPIPE 1017
-#define xf86_EROFS 1018
-#define xf86_ETXTBSY 1019
-#define xf86_ENOTTY 1020
-#define xf86_ENOSYS 1021
-#define xf86_EBUSY 1022
-#define xf86_ENODEV 1023
-#define xf86_EIO 1024
-
-#define xf86_ESRCH 1025
-#define xf86_ENXIO 1026
-#define xf86_E2BIG 1027
-#define xf86_ENOEXEC 1028
-#define xf86_ECHILD 1029
-#define xf86_ENOTBLK 1030
-#define xf86_EXDEV 1031
-#define xf86_EFBIG 1032
-#define xf86_ESPIPE 1033
-#define xf86_EMLINK 1034
-#define xf86_EDOM 1035
-#define xf86_ERANGE 1036
-
-
-/* sysv IPV */
-/* xf86shmget() */
-#define XF86IPC_CREAT 01000
-#define XF86IPC_EXCL 02000
-#define XF86IPC_NOWAIT 04000
-#define XF86SHM_R 0400
-#define XF86SHM_W 0200
-#define XF86IPC_PRIVATE ((xf86key_t)0)
-/* xf86shmat() */
-#define XF86SHM_RDONLY 010000 /* attach read-only else read-write */
-#define XF86SHM_RND 020000 /* round attach address to SHMLBA */
-#define XF86SHM_REMAP 040000 /* take-over region on attach */
-/* xf86shmclt() */
-#define XF86IPC_RMID 0
-
-/*
- * the rest of this file should only be included for code that is supposed
- * to go into modules
- */
-
-#if !defined(DONT_DEFINE_WRAPPERS)
-
-#undef abort
-#define abort() xf86abort()
-#undef abs
-#define abs(i) xf86abs(i)
-#undef acos
-#define acos(d) xf86acos(d)
-#undef asin
-#define asin(d) xf86asin(d)
-#undef atan
-#define atan(d) xf86atan(d)
-#undef atan2
-#define atan2(d1,d2) xf86atan2(d1,d2)
-#undef atof
-#define atof(ccp) xf86atof(ccp)
-#undef atoi
-#define atoi(ccp) xf86atoi(ccp)
-#undef atol
-#define atol(ccp) xf86atol(ccp)
-#undef bsearch
-#define bsearch(a,b,c,d,e) xf86bsearch(a,b,c,d,e)
-#undef ceil
-#define ceil(d) xf86ceil(d)
-#undef calloc
-#define calloc(I1,I2) xf86calloc(I1,I2)
-#undef clearerr
-#define clearerr(FP) xf86clearerr(FP)
-#undef cos
-#define cos(d) xf86cos(d)
-#undef exit
-#define exit(i) xf86exit(i)
-#undef exp
-#define exp(d) xf86exp(d)
-#undef fabs
-#define fabs(d) xf86fabs(d)
-#undef fclose
-#define fclose(FP) xf86fclose(FP)
-#undef feof
-#define feof(FP) xf86feof(FP)
-#undef ferror
-#define ferror(FP) xf86ferror(FP)
-#undef fflush
-#define fflush(FP) xf86fflush(FP)
-#undef fgetc
-#define fgetc(FP) xf86fgetc(FP)
-#undef getc
-#define getc(FP) xf86getc(FP)
-#undef fgetpos
-#define fgetpos(FP,fpp) xf86fgetpos(FP,fpp)
-#undef fgets
-#define fgets(cp,i,FP) xf86fgets(cp,i,FP)
-#undef finite
-#define finite(d) xf86finite(d)
-#undef floor
-#define floor(d) xf86floor(d)
-#undef fmod
-#define fmod(d1,d2) xf86fmod(d1,d2)
-#undef fopen
-#define fopen(ccp1,ccp2) xf86fopen(ccp1,ccp2)
-#undef printf
-#define printf xf86printf
-#undef fprintf
-#define fprintf xf86fprintf
-#undef fputc
-#define fputc(i,FP) xf86fputc(i,FP)
-#undef fputs
-#define fputs(ccp,FP) xf86fputs(ccp,FP)
-#undef fread
-#define fread(vp,I1,I2,FP) xf86fread(vp,I1,I2,FP)
-#undef free
-#define free(vp) xf86free(vp)
-#undef freopen
-#define freopen(ccp1,ccp2,FP) xf86freopen(ccp1,ccp2,FP)
-#undef frexp
-#define frexp(x,exp) xf86frexp(x,exp)
-#undef fscanf
-#define fscanf xf86fscanf
-#undef fseek
-#define fseek(FP,l,i) xf86fseek(FP,l,i)
-#undef fsetpos
-#define fsetpos(FP,cfpp) xf86fsetpos(FP,cfpp)
-#undef ftell
-#define ftell(FP) xf86ftell(FP)
-#undef fwrite
-#define fwrite(cvp,I1,I2,FP) xf86fwrite(cvp,I1,I2,FP)
-#undef getenv
-#define getenv(ccp) xf86getenv(ccp)
-#undef isalnum
-#define isalnum(i) xf86isalnum(i)
-#undef isalpha
-#define isalpha(i) xf86isalpha(i)
-#undef iscntrl
-#define iscntrl(i) xf86iscntrl(i)
-#undef isdigit
-#define isdigit(i) xf86isdigit(i)
-#undef isgraph
-#define isgraph(i) xf86isgraph(i)
-#undef islower
-#define islower(i) xf86islower(i)
-#undef isprint
-#define isprint(i) xf86isprint(i)
-#undef ispunct
-#define ispunct(i) xf86ispunct(i)
-#undef isspace
-#define isspace(i) xf86isspace(i)
-#undef isupper
-#define isupper(i) xf86isupper(i)
-#undef isxdigit
-#define isxdigit(i) xf86isxdigit(i)
-#undef labs
-#define labs(l) xf86labs(l)
-#undef ldexp
-#define ldexp(x, exp) xf86ldexp(x, exp)
-#undef log
-#define log(d) xf86log(d)
-#undef log10
-#define log10(d) xf86log10(d)
-#undef malloc
-#define malloc(I) xf86malloc(I)
-#undef memchr
-#define memchr(cvp,i,I) xf86memchr(cvp,i,I)
-#undef memcmp
-#define memcmp(cvp1,cvp2,I) xf86memcmp(cvp1,cvp2,I)
-#undef memcpy
-#define memcpy(vp,cvp,I) xf86memcpy(vp,cvp,I)
-#undef memmove
-#define memmove(vp,cvp,I) xf86memmove(vp,cvp,I)
-#undef memset
-#define memset(vp,int,I) xf86memset(vp,int,I)
-#undef modf
-#define modf(d,dp) xf86modf(d,dp)
-#undef perror
-#define perror(ccp) xf86perror(ccp)
-#undef pow
-#define pow(d1,d2) xf86pow(d1,d2)
-#undef random
-#define random() xf86random()
-#undef realloc
-#define realloc(vp,I) xf86realloc(vp,I)
-#undef remove
-#define remove(ccp) xf86remove(ccp)
-#undef rename
-#define rename(ccp1,ccp2) xf86rename(ccp1,ccp2)
-#undef rewind
-#define rewind(FP) xf86rewind(FP)
-#undef setbuf
-#define setbuf(FP,cp) xf86setbuf(FP,cp)
-#undef setvbuf
-#define setvbuf(FP,cp,i,I) xf86setvbuf(FP,cp,i,I)
-#undef sin
-#define sin(d) xf86sin(d)
-#undef snprintf
-#define snprintf xf86snprintf
-#undef sprintf
-#define sprintf xf86sprintf
-#undef sqrt
-#define sqrt(d) xf86sqrt(d)
-#undef sscanf
-#define sscanf xf86sscanf
-#undef strcat
-#define strcat(cp,ccp) xf86strcat(cp,ccp)
-#undef strcmp
-#define strcmp(ccp1,ccp2) xf86strcmp(ccp1,ccp2)
-#undef strcasecmp
-#define strcasecmp(ccp1,ccp2) xf86strcasecmp(ccp1,ccp2)
-#undef strcpy
-#define strcpy(cp,ccp) xf86strcpy(cp,ccp)
-#undef strcspn
-#define strcspn(ccp1,ccp2) xf86strcspn(ccp1,ccp2)
-#undef strerror
-#define strerror(i) xf86strerror(i)
-#undef strlcat
-#define strlcat(cp,ccp,I) xf86strlcat(cp,ccp,I)
-#undef strlcpy
-#define strlcpy(cp,ccp,I) xf86strlcpy(cp,ccp,I)
-#undef strlen
-#define strlen(ccp) xf86strlen(ccp)
-#undef strncmp
-#define strncmp(ccp1,ccp2,I) xf86strncmp(ccp1,ccp2,I)
-#undef strncasecmp
-#define strncasecmp(ccp1,ccp2,I) xf86strncasecmp(ccp1,ccp2,I)
-#undef strncpy
-#define strncpy(cp,ccp,I) xf86strncpy(cp,ccp,I)
-#undef strpbrk
-#define strpbrk(ccp1,ccp2) xf86strpbrk(ccp1,ccp2)
-#undef strchr
-#define strchr(ccp,i) xf86strchr(ccp,i)
-#undef strrchr
-#define strrchr(ccp,i) xf86strrchr(ccp,i)
-#undef strspn
-#define strspn(ccp1,ccp2) xf86strspn(ccp1,ccp2)
-#undef strstr
-#define strstr(ccp1,ccp2) xf86strstr(ccp1,ccp2)
-#undef srttod
-#define strtod(ccp,cpp) xf86strtod(ccp,cpp)
-#undef strtok
-#define strtok(cp,ccp) xf86strtok(cp,ccp)
-#undef strtol
-#define strtol(ccp,cpp,i) xf86strtol(ccp,cpp,i)
-#undef strtoul
-#define strtoul(ccp,cpp,i) xf86strtoul(ccp,cpp,i)
-#undef tan
-#define tan(d) xf86tan(d)
-#undef tmpfile
-#define tmpfile() xf86tmpfile()
-#undef tolower
-#define tolower(i) xf86tolower(i)
-#undef toupper
-#define toupper(i) xf86toupper(i)
-#undef ungetc
-#define ungetc(i,FP) xf86ungetc(i,FP)
-#undef vfprintf
-#define vfprintf(p,f,a) xf86vfprintf(p,f,a)
-#undef vsnprintf
-#define vsnprintf(s,n,f,a) xf86vsnprintf(s,n,f,a)
-#undef vsprintf
-#define vsprintf(s,f,a) xf86vsprintf(s,f,a)
-/* XXX Disable assert as if NDEBUG was defined */
-/* Some X headers defined this away too */
-#undef assert
-#define assert(a) ((void)0)
-#undef HUGE_VAL
-#define HUGE_VAL xf86HUGE_VAL
-
-#undef hypot
-#define hypot(x,y) xf86hypot(x,y)
-
-#undef qsort
-#define qsort(b, n, s, f) xf86qsort(b, n, s, f)
-
-/* non-ANSI C functions */
-#undef opendir
-#define opendir(cp) xf86opendir(cp)
-#undef closedir
-#define closedir(DP) xf86closedir(DP)
-#undef readdir
-#define readdir(DP) xf86readdir(DP)
-#undef rewinddir
-#define rewinddir(DP) xf86rewinddir(DP)
-#undef bcopy
-#define bcopy(vp,cvp,I) xf86memmove(cvp,vp,I)
-#undef ffs
-#define ffs(i) xf86ffs(i)
-#undef strdup
-#define strdup(ccp) xf86strdup(ccp)
-#undef bzero
-#define bzero(vp,ui) xf86bzero(vp,ui)
-#undef execl
-#define execl xf86execl
-#undef chmod
-#define chmod(a,b) xf86chmod(a,b)
-#undef chown
-#define chown(a,b,c) xf86chown(a,b,c)
-#undef geteuid
-#define geteuid xf86geteuid
-#undef getegid
-#define getegid xf86getegid
-#undef getpid
-#define getpid xf86getpid
-#undef mknod
-#define mknod(a,b,c) xf86mknod(a,b,c)
-#undef sleep
-#define sleep(a) xf86sleep(a)
-#undef mkdir
-#define mkdir(a,b) xf86mkdir(a,b)
-#undef getpagesize
-#define getpagesize xf86getpagesize
-#undef shmget
-#define shmget(a,b,c) xf86shmget(a,b,c)
-#undef shmat
-#define shmat(a,b,c) xf86shmat(a,b,c)
-#undef shmdt
-#define shmdt(a) xf86shmdt(a)
-#undef shmctl
-#define shmctl(a,b,c) xf86shmctl(a,b,c)
-
-#undef S_ISUID
-#define S_ISUID XF86_S_ISUID
-#undef S_ISGID
-#define S_ISGID XF86_S_ISGID
-#undef S_ISVTX
-#define S_ISVTX XF86_S_ISVTX
-#undef S_IRUSR
-#define S_IRUSR XF86_S_IRUSR
-#undef S_IWUSR
-#define S_IWUSR XF86_S_IWUSR
-#undef S_IXUSR
-#define S_IXUSR XF86_S_IXUSR
-#undef S_IRGRP
-#define S_IRGRP XF86_S_IRGRP
-#undef S_IWGRP
-#define S_IWGRP XF86_S_IWGRP
-#undef S_IXGRP
-#define S_IXGRP XF86_S_IXGRP
-#undef S_IROTH
-#define S_IROTH XF86_S_IROTH
-#undef S_IWOTH
-#define S_IWOTH XF86_S_IWOTH
-#undef S_IXOTH
-#define S_IXOTH XF86_S_IXOTH
-#undef S_IFREG
-#define S_IFREG XF86_S_IFREG
-#undef S_IFCHR
-#define S_IFCHR XF86_S_IFCHR
-#undef S_IFBLK
-#define S_IFBLK XF86_S_IFBLK
-#undef S_IFIFO
-#define S_IFIFO XF86_S_IFIFO
-
-/* some types */
-#undef FILE
-#define FILE XF86FILE
-#undef fpos_t
-#define fpos_t XF86fpos_t
-#undef DIR
-#define DIR XF86DIR
-#undef DIRENT
-#define DIRENT XF86DIRENT
-#undef size_t
-#define size_t xf86size_t
-#undef ssize_t
-#define ssize_t xf86ssize_t
-#undef dev_t
-#define dev_t xf86dev_t
-#undef mode_t
-#define mode_t xf86mode_t
-#undef uid_t
-#define uid_t xf86uid_t
-#undef gid_t
-#define gid_t xf86gid_t
-#undef stat_t
-#define stat_t struct xf86stat
-
-#undef ulong
-#define ulong unsigned long
-
-/*
- * There should be no need to #undef any of these. If they are already
- * defined it is because some illegal header has been included.
- */
-
-/* some vars */
-#undef stdin
-#define stdin xf86stdin
-#undef stdout
-#define stdout xf86stdout
-#undef stderr
-#define stderr xf86stderr
-
-#undef SEEK_SET
-#define SEEK_SET XF86_SEEK_SET
-#undef SEEK_CUR
-#define SEEK_CUR XF86_SEEK_CUR
-#undef SEEK_END
-#define SEEK_END XF86_SEEK_END
-
-/*
- * XXX Basic I/O functions BAD,BAD,BAD!
- */
-#define open xf86open
-#define close(a) xf86close(a)
-#define lseek(a,b,c) xf86lseek(a,b,c)
-#if !defined(__DragonFly__)
-#define ioctl(a,b,c) xf86ioctl(a,b,c)
-#endif
-#define read(a,b,c) xf86read(a,b,c)
-#define write(a,b,c) xf86write(a,b,c)
-#define mmap(a,b,c,d,e,f) xf86mmap(a,b,c,d,e,f)
-#define munmap(a,b) xf86munmap(a,b)
-#define stat(a,b) xf86stat(a,b)
-#define fstat(a,b) xf86fstat(a,b)
-#define access(a,b) xf86access(a,b)
-#undef O_RDONLY
-#define O_RDONLY XF86_O_RDONLY
-#undef O_WRONLY
-#define O_WRONLY XF86_O_WRONLY
-#undef O_RDWR
-#define O_RDWR XF86_O_RDWR
-#undef O_CREAT
-#define O_CREAT XF86_O_CREAT
-#undef PROT_EXEC
-#define PROT_EXEC XF86_PROT_EXEC
-#undef PROT_READ
-#define PROT_READ XF86_PROT_READ
-#undef PROT_WRITE
-#define PROT_WRITE XF86_PROT_WRITE
-#undef PROT_NONE
-#define PROT_NONE XF86_PROT_NONE
-#undef MAP_FIXED
-#define MAP_FIXED XF86_MAP_FIXED
-#undef MAP_SHARED
-#define MAP_SHARED XF86_MAP_SHARED
-#undef MAP_PRIVATE
-#define MAP_PRIVATE XF86_MAP_PRIVATE
-#undef MAP_FAILED
-#define MAP_FAILED XF86_MAP_FAILED
-#undef R_OK
-#define R_OK XF86_R_OK
-#undef W_OK
-#define W_OK XF86_W_OK
-#undef X_OK
-#define X_OK XF86_X_OK
-#undef F_OK
-#define F_OK XF86_F_OK
-#undef errno
-#define errno xf86errno
-#undef putchar
-#define putchar(i) xf86fputc(i, xf86stdout)
-#undef puts
-#define puts(s) xf86fputs(s, xf86stdout)
-
-#undef EACCES
-#define EACCES xf86_EACCES
-#undef EAGAIN
-#define EAGAIN xf86_EAGAIN
-#undef EBADF
-#define EBADF xf86_EBADF
-#undef EEXIST
-#define EEXIST xf86_EEXIST
-#undef EFAULT
-#define EFAULT xf86_EFAULT
-#undef EINTR
-#define EINTR xf86_EINTR
-#undef EINVAL
-#define EINVAL xf86_EINVAL
-#undef EISDIR
-#define EISDIR xf86_EISDIR
-#undef ELOOP
-#define ELOOP xf86_ELOOP
-#undef EMFILE
-#define EMFILE xf86_EMFILE
-#undef ENAMETOOLONG
-#define ENAMETOOLONG xf86_ENAMETOOLONG
-#undef ENFILE
-#define ENFILE xf86_ENFILE
-#undef ENOENT
-#define ENOENT xf86_ENOENT
-#undef ENOMEM
-#define ENOMEM xf86_ENOMEM
-#undef ENOSPC
-#define ENOSPC xf86_ENOSPC
-#undef ENOTDIR
-#define ENOTDIR xf86_ENOTDIR
-#undef EPIPE
-#define EPIPE xf86_EPIPE
-#undef EROFS
-#define EROFS xf86_EROFS
-#undef ETXTBSY
-#define ETXTBSY xf86_ETXTBSY
-#undef ENOTTY
-#define ENOTTY xf86_ENOTTY
-#undef ENOSYS
-#define ENOSYS xf86_ENOSYS
-#undef EBUSY
-#define EBUSY xf86_EBUSY
-#undef ENODEV
-#define ENODEV xf86_ENODEV
-#undef EIO
-#define EIO xf86_EIO
-
-/* IPC stuff */
-#undef SHM_RDONLY
-#define SHM_RDONLY XF86SHM_RDONLY
-#undef SHM_RND
-#define SHM_RND XF86SHM_RND
-#undef SHM_REMAP
-#define SHM_REMAP XF86SHM_REMAP
-#undef IPC_RMID
-#define IPC_RMID XF86IPC_RMID
-#undef IPC_CREAT
-#define IPC_CREAT XF86IPC_CREAT
-#undef IPC_EXCL
-#define IPC_EXCL XF86IPC_EXCL
-#undef PC_NOWAIT
-#define IPC_NOWAIT XF86IPC_NOWAIT
-#undef SHM_R
-#define SHM_R XF86SHM_R
-#undef SHM_W
-#define SHM_W XF86SHM_W
-#undef IPC_PRIVATE
-#define IPC_PRIVATE XF86IPC_PRIVATE
-
-/* Some ANSI macros */
-#undef FILENAME_MAX
-#define FILENAME_MAX 1024
-
-#if (defined(sun) && defined(__SVR4))
-# define _FILEDEFED /* Already have FILE defined, don't redefine it */
-#endif
-
-#endif /* !DONT_DEFINE_WRAPPERS */
-
-#if (!defined(DONT_DEFINE_WRAPPERS) || defined(DEFINE_SETJMP_WRAPPERS))
-#undef setjmp
-#define setjmp(a) xf86setjmp_macro(a)
-#undef longjmp
-#define longjmp(a,b) xf86longjmp(a,b)
-#undef jmp_buf
-#define jmp_buf xf86jmp_buf
-#endif
-
-#endif /* XF86_LIBC_H */
diff --git a/hw/xfree86/parser/Flags.c b/hw/xfree86/parser/Flags.c
index 730ea0cab..19b9d1477 100644
--- a/hw/xfree86/parser/Flags.c
+++ b/hw/xfree86/parser/Flags.c
@@ -63,6 +63,7 @@
#include "xf86tokens.h"
#include "Configint.h"
#include <math.h>
+#include <X11/Xfuncproto.h>
extern LexRec val;
@@ -330,7 +331,7 @@ xf86findOption (XF86OptionPtr list, const char *name)
* returned. If the option is not found, a NULL is returned.
*/
-__attribute__((visibility("default"))) char *
+_X_EXPORT char *
xf86findOptionValue (XF86OptionPtr list, const char *name)
{
XF86OptionPtr p = xf86findOption (list, name);
diff --git a/hw/xfree86/parser/Screen.c b/hw/xfree86/parser/Screen.c
index 4524f17f6..ad08c1382 100644
--- a/hw/xfree86/parser/Screen.c
+++ b/hw/xfree86/parser/Screen.c
@@ -214,6 +214,7 @@ static xf86ConfigSymTabRec ScreenTab[] =
{DEFAULTDEPTH, "defaultdepth"},
{DEFAULTBPP, "defaultbpp"},
{DEFAULTFBBPP, "defaultfbbpp"},
+ {VIRTUAL, "virtual"},
{OPTION, "option"},
{-1, ""},
};
@@ -299,6 +300,14 @@ xf86parseScreenSection (void)
}
}
break;
+ case VIRTUAL:
+ if (xf86getSubToken (&(ptr->scrn_comment)) != NUMBER)
+ Error (VIRTUAL_MSG, NULL);
+ ptr->scrn_virtualX = val.num;
+ if (xf86getSubToken (&(ptr->scrn_comment)) != NUMBER)
+ Error (VIRTUAL_MSG, NULL);
+ ptr->scrn_virtualY = val.num;
+ break;
case OPTION:
ptr->scrn_option_lst = xf86parseOption(ptr->scrn_option_lst);
break;
@@ -364,6 +373,10 @@ xf86printScreenSection (FILE * cf, XF86ConfScreenPtr ptr)
{
fprintf (cf, "\tVideoAdaptor \"%s\"\n", aptr->al_adaptor_str);
}
+ if (ptr->scrn_virtualX && ptr->scrn_virtualY)
+ fprintf (cf, "\tVirtual %d %d\n",
+ ptr->scrn_virtualX,
+ ptr->scrn_virtualY);
for (dptr = ptr->scrn_display_lst; dptr; dptr = dptr->list.next)
{
fprintf (cf, "\tSubSection \"Display\"\n");
diff --git a/hw/xfree86/parser/cpconfig.c b/hw/xfree86/parser/cpconfig.c
index 46a5a8b56..0347f7d2a 100644
--- a/hw/xfree86/parser/cpconfig.c
+++ b/hw/xfree86/parser/cpconfig.c
@@ -62,7 +62,7 @@ xrealloc (void *p, int size)
#endif
#define CONFPATH "%A,%R,/etc/X11/%R,%P/etc/X11/%R,%E,%F,/etc/X11/%F," \
- "%P/etc/X11/%F,%D/%X,/etc/X11/%X,/etc/%X,%P/etc/X11/%X.%H," \
+ "%P/etc/X11/%F,/etc/X11/%X,/etc/%X,%P/etc/X11/%X.%H," \
"%P/etc/X11/%X,%P/lib/X11/%X.%H,%P/lib/X11/%X"
int
diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c
index e7989d107..9706d483b 100644
--- a/hw/xfree86/parser/scan.c
+++ b/hw/xfree86/parser/scan.c
@@ -64,6 +64,7 @@
#include <string.h>
#include <unistd.h>
#include <stdarg.h>
+#include <X11/Xfuncproto.h>
#if !defined(X_NOT_POSIX)
#if defined(_POSIX_SOURCE)
@@ -558,7 +559,6 @@ xf86pathIsSafe(const char *path)
* %E config file environment ($XORGCONFIG) as an absolute path
* %F config file environment ($XORGCONFIG) as a relative path
* %G config file environment ($XORGCONFIG) as a safe path
- * %D $HOME
* %P projroot
* %M major version number
* %% %
@@ -703,14 +703,6 @@ DoSubstitution(const char *template, const char *cmdline, const char *projroot,
} else
BAIL_OUT;
break;
- case 'D':
- if (!home)
- home = getenv("HOME");
- if (home && xf86pathIsAbsolute(home))
- APPEND_STR(home);
- else
- BAIL_OUT;
- break;
case 'P':
if (projroot && xf86pathIsAbsolute(projroot))
APPEND_STR(projroot);
@@ -948,7 +940,7 @@ StringToToken (char *str, xf86ConfigSymTabRec * tab)
* Compare two names. The characters '_', ' ', and '\t' are ignored
* in the comparison.
*/
-__attribute__((visibility("default"))) int
+_X_EXPORT int
xf86nameCompare (const char *s1, const char *s2)
{
char c1, c2;
diff --git a/hw/xfree86/parser/xf86Parser.h b/hw/xfree86/parser/xf86Parser.h
index a078361d3..fd6cc530b 100644
--- a/hw/xfree86/parser/xf86Parser.h
+++ b/hw/xfree86/parser/xf86Parser.h
@@ -307,6 +307,7 @@ typedef struct
XF86ConfDisplayPtr scrn_display_lst;
XF86OptionPtr scrn_option_lst;
char *scrn_comment;
+ int scrn_virtualX, scrn_virtualY;
}
XF86ConfScreenRec, *XF86ConfScreenPtr;
diff --git a/hw/xfree86/rac/xf86RAC.c b/hw/xfree86/rac/xf86RAC.c
index 24566ab2c..8215f9827 100644
--- a/hw/xfree86/rac/xf86RAC.c
+++ b/hw/xfree86/rac/xf86RAC.c
@@ -39,9 +39,8 @@
pScreen->x = y;}
#define UNWRAP_SCREEN(x) pScreen->x = pScreenPriv->x
-#define SCREEN_PROLOG(x) \
- pScreen->x = \
- ((RACScreenPtr) (pScreen)->devPrivates[RACScreenIndex].ptr)->x
+#define SCREEN_PROLOG(x) pScreen->x = ((RACScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, RACScreenKey))->x
#define SCREEN_EPILOG(x,y) pScreen->x = y;
#define WRAP_PICT_COND(x,y,cond) if (ps)\
@@ -50,9 +49,8 @@
ps->x = y;}
#define UNWRAP_PICT(x) if (ps) {ps->x = pScreenPriv->x;}
-#define PICTURE_PROLOGUE(field) \
- ps->field = \
- ((RACScreenPtr) (pScreen)->devPrivates[RACScreenIndex].ptr)->field
+#define PICTURE_PROLOGUE(field) ps->field = \
+ ((RACScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, RACScreenKey))->field
#define PICTURE_EPILOGUE(field, wrap) \
ps->field = wrap
@@ -65,9 +63,9 @@
#define UNWRAP_SCREEN_INFO(x) pScrn->x = pScreenPriv->x
#define SPRITE_PROLOG miPointerScreenPtr PointPriv = \
-(miPointerScreenPtr)pScreen->devPrivates[miPointerScreenIndex].ptr;\
- RACScreenPtr pScreenPriv = \
-((RACScreenPtr) (pScreen)->devPrivates[RACScreenIndex].ptr);\
+ (miPointerScreenPtr)dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey); \
+ RACScreenPtr pScreenPriv = \
+ ((RACScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, RACScreenKey));\
PointPriv->spriteFuncs = pScreenPriv->miSprite;
#define SPRITE_EPILOG pScreenPriv->miSprite = PointPriv->spriteFuncs;\
PointPriv->spriteFuncs = &RACSpriteFuncs;
@@ -82,7 +80,7 @@
(x)->ops = &RACGCOps;\
(x)->funcs = &RACGCFuncs;
#define GC_UNWRAP(x)\
- RACGCPtr pGCPriv = (RACGCPtr) (x)->devPrivates[RACGCIndex].ptr;\
+ RACGCPtr pGCPriv = (RACGCPtr)dixLookupPrivate(&(x)->devPrivates, RACGCKey);\
(x)->ops = pGCPriv->wrapOps;\
(x)->funcs = pGCPriv->wrapFuncs;
@@ -258,9 +256,8 @@ static miPointerSpriteFuncRec RACSpriteFuncs = {
RACSpriteMoveCursor
};
-static int RACScreenIndex = -1;
-static int RACGCIndex = -1;
-static unsigned long RACGeneration = 0;
+static DevPrivateKey RACScreenKey = &RACScreenKey;
+static DevPrivateKey RACGCKey = &RACGCKey;
Bool
@@ -274,24 +271,17 @@ xf86RACInit(ScreenPtr pScreen, unsigned int flag)
#endif
pScrn = xf86Screens[pScreen->myNum];
- PointPriv = (miPointerScreenPtr)pScreen->devPrivates[miPointerScreenIndex].ptr;
-
+ PointPriv = (miPointerScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ miPointerScreenKey);
DPRINT_S("RACInit",pScreen->myNum);
- if (RACGeneration != serverGeneration) {
- if ( ((RACScreenIndex = AllocateScreenPrivateIndex()) < 0) ||
- ((RACGCIndex = AllocateGCPrivateIndex()) < 0))
- return FALSE;
-
- RACGeneration = serverGeneration;
- }
- if (!AllocateGCPrivate(pScreen, RACGCIndex, sizeof(RACGCRec)))
+ if (!dixRequestPrivate(RACGCKey, sizeof(RACGCRec)))
return FALSE;
if (!(pScreenPriv = xalloc(sizeof(RACScreenRec))))
return FALSE;
- pScreen->devPrivates[RACScreenIndex].ptr = (pointer)pScreenPriv;
+ dixSetPrivate(&pScreen->devPrivates, RACScreenKey, pScreenPriv);
WRAP_SCREEN(CloseScreen, RACCloseScreen);
WRAP_SCREEN(SaveScreen, RACSaveScreen);
@@ -328,10 +318,10 @@ static Bool
RACCloseScreen (int i, ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- RACScreenPtr pScreenPriv =
- (RACScreenPtr) pScreen->devPrivates[RACScreenIndex].ptr;
- miPointerScreenPtr PointPriv
- = (miPointerScreenPtr)pScreen->devPrivates[miPointerScreenIndex].ptr;
+ RACScreenPtr pScreenPriv = (RACScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, RACScreenKey);
+ miPointerScreenPtr PointPriv = (miPointerScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, miPointerScreenKey);
#ifdef RENDER
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
#endif
@@ -592,8 +582,8 @@ static void
RACAdjustFrame(int index, int x, int y, int flags)
{
ScreenPtr pScreen = screenInfo.screens[index];
- RACScreenPtr pScreenPriv =
- (RACScreenPtr) pScreen->devPrivates[RACScreenIndex].ptr;
+ RACScreenPtr pScreenPriv = (RACScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, RACScreenKey);
DPRINT_S("RACAdjustFrame",index);
xf86EnableAccess(xf86Screens[index]);
@@ -605,8 +595,8 @@ static Bool
RACSwitchMode(int index, DisplayModePtr mode, int flags)
{
ScreenPtr pScreen = screenInfo.screens[index];
- RACScreenPtr pScreenPriv =
- (RACScreenPtr) pScreen->devPrivates[RACScreenIndex].ptr;
+ RACScreenPtr pScreenPriv = (RACScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, RACScreenKey);
DPRINT_S("RACSwitchMode",index);
xf86EnableAccess(xf86Screens[index]);
@@ -618,8 +608,8 @@ static Bool
RACEnterVT(int index, int flags)
{
ScreenPtr pScreen = screenInfo.screens[index];
- RACScreenPtr pScreenPriv =
- (RACScreenPtr) pScreen->devPrivates[RACScreenIndex].ptr;
+ RACScreenPtr pScreenPriv = (RACScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, RACScreenKey);
DPRINT_S("RACEnterVT",index);
xf86EnableAccess(xf86Screens[index]);
@@ -631,8 +621,8 @@ static void
RACLeaveVT(int index, int flags)
{
ScreenPtr pScreen = screenInfo.screens[index];
- RACScreenPtr pScreenPriv =
- (RACScreenPtr) pScreen->devPrivates[RACScreenIndex].ptr;
+ RACScreenPtr pScreenPriv = (RACScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, RACScreenKey);
DPRINT_S("RACLeaveVT",index);
xf86EnableAccess(xf86Screens[index]);
@@ -644,8 +634,8 @@ static void
RACFreeScreen(int index, int flags)
{
ScreenPtr pScreen = screenInfo.screens[index];
- RACScreenPtr pScreenPriv =
- (RACScreenPtr) pScreen->devPrivates[RACScreenIndex].ptr;
+ RACScreenPtr pScreenPriv = (RACScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, RACScreenKey);
DPRINT_S("RACFreeScreen",index);
xf86EnableAccess(xf86Screens[index]);
@@ -657,7 +647,7 @@ static Bool
RACCreateGC(GCPtr pGC)
{
ScreenPtr pScreen = pGC->pScreen;
- RACGCPtr pGCPriv = (RACGCPtr) (pGC)->devPrivates[RACGCIndex].ptr;
+ RACGCPtr pGCPriv = (RACGCPtr)dixLookupPrivate(&pGC->devPrivates, RACGCKey);
Bool ret;
DPRINT_S("RACCreateGC",pScreen->myNum);
diff --git a/hw/xfree86/ramdac/xf86Cursor.c b/hw/xfree86/ramdac/xf86Cursor.c
index c968f185f..5c909c7c4 100644
--- a/hw/xfree86/ramdac/xf86Cursor.c
+++ b/hw/xfree86/ramdac/xf86Cursor.c
@@ -12,14 +12,13 @@
* MPX.
* inputInfo is needed to pass the core pointer as the default argument into
* the cursor functions.
- *
+ *
* Externing inputInfo is not the nice way to do it but it works.
*/
#include "inputstr.h"
extern InputInfo inputInfo;
-int xf86CursorScreenIndex = -1;
-static unsigned long xf86CursorGeneration = 0;
+DevPrivateKey xf86CursorScreenKey = &xf86CursorScreenKey;
/* sprite functions */
@@ -58,12 +57,6 @@ xf86InitCursor(
xf86CursorScreenPtr ScreenPriv;
miPointerScreenPtr PointPriv;
- if (xf86CursorGeneration != serverGeneration) {
- if ((xf86CursorScreenIndex = AllocateScreenPrivateIndex()) < 0)
- return FALSE;
- xf86CursorGeneration = serverGeneration;
- }
-
if (!xf86InitHardwareCursor(pScreen, infoPtr))
return FALSE;
@@ -71,7 +64,7 @@ xf86InitCursor(
if (!ScreenPriv)
return FALSE;
- pScreen->devPrivates[xf86CursorScreenIndex].ptr = ScreenPriv;
+ dixSetPrivate(&pScreen->devPrivates, xf86CursorScreenKey, ScreenPriv);
ScreenPriv->SWCursor = TRUE;
ScreenPriv->isUp = FALSE;
@@ -94,7 +87,7 @@ xf86InitCursor(
ScreenPriv->PalettedCursor = TRUE;
}
- PointPriv = pScreen->devPrivates[miPointerScreenIndex].ptr;
+ PointPriv = dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);
ScreenPriv->showTransparent = PointPriv->showTransparent;
if (infoPtr->Flags & HARDWARE_CURSOR_SHOW_TRANSPARENT)
@@ -123,10 +116,10 @@ static Bool
xf86CursorCloseScreen(int i, ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- miPointerScreenPtr PointPriv =
- pScreen->devPrivates[miPointerScreenIndex].ptr;
- xf86CursorScreenPtr ScreenPriv =
- pScreen->devPrivates[xf86CursorScreenIndex].ptr;
+ miPointerScreenPtr PointPriv = (miPointerScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, miPointerScreenKey);
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
if (ScreenPriv->isUp && pScrn->vtSema)
xf86SetCursor(pScreen, NullCursor, ScreenPriv->x, ScreenPriv->y);
@@ -156,8 +149,8 @@ xf86CursorQueryBestSize(
unsigned short *height,
ScreenPtr pScreen)
{
- xf86CursorScreenPtr ScreenPriv =
- pScreen->devPrivates[xf86CursorScreenIndex].ptr;
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
if (class == CursorShape) {
if(*width > ScreenPriv->CursorInfoPtr->MaxWidth)
@@ -171,8 +164,8 @@ xf86CursorQueryBestSize(
static void
xf86CursorInstallColormap(ColormapPtr pMap)
{
- xf86CursorScreenPtr ScreenPriv =
- pMap->pScreen->devPrivates[xf86CursorScreenIndex].ptr;
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pMap->pScreen->devPrivates, xf86CursorScreenKey);
ScreenPriv->pInstalledMap = pMap;
@@ -186,8 +179,8 @@ xf86CursorRecolorCursor(
CursorPtr pCurs,
Bool displayed)
{
- xf86CursorScreenPtr ScreenPriv =
- pScreen->devPrivates[xf86CursorScreenIndex].ptr;
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
if (!displayed)
return;
@@ -208,8 +201,8 @@ xf86CursorEnableDisableFBAccess(
DeviceIntPtr pDev = inputInfo.pointer;
ScreenPtr pScreen = screenInfo.screens[index];
- xf86CursorScreenPtr ScreenPriv =
- pScreen->devPrivates[xf86CursorScreenIndex].ptr;
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
if (!enable && ScreenPriv->CurrentCursor != NullCursor) {
CursorPtr currentCursor = ScreenPriv->CurrentCursor;
@@ -240,10 +233,10 @@ xf86CursorSwitchMode(int index, DisplayModePtr mode, int flags)
{
Bool ret;
ScreenPtr pScreen = screenInfo.screens[index];
- xf86CursorScreenPtr ScreenPriv =
- pScreen->devPrivates[xf86CursorScreenIndex].ptr;
- miPointerScreenPtr PointPriv =
- pScreen->devPrivates[miPointerScreenIndex].ptr;
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
+ miPointerScreenPtr PointPriv = (miPointerScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, miPointerScreenKey);
if (ScreenPriv->isUp) {
xf86SetCursor(pScreen, NullCursor, ScreenPriv->x, ScreenPriv->y);
@@ -268,11 +261,11 @@ xf86CursorSwitchMode(int index, DisplayModePtr mode, int flags)
static Bool
xf86CursorRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs)
{
- xf86CursorScreenPtr ScreenPriv =
- pScreen->devPrivates[xf86CursorScreenIndex].ptr;
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
if (pCurs->refcnt <= 1)
- pCurs->devPriv[pScreen->myNum] = NULL;
+ dixSetPrivate(&pCurs->devPrivates, pScreen, NULL);
return (*ScreenPriv->spriteFuncs->RealizeCursor)(pDev, pScreen, pCurs);
}
@@ -281,12 +274,12 @@ static Bool
xf86CursorUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
CursorPtr pCurs)
{
- xf86CursorScreenPtr ScreenPriv =
- pScreen->devPrivates[xf86CursorScreenIndex].ptr;
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
if (pCurs->refcnt <= 1) {
- xfree(pCurs->devPriv[pScreen->myNum]);
- pCurs->devPriv[pScreen->myNum] = NULL;
+ xfree(dixLookupPrivate(&pCurs->devPrivates, pScreen));
+ dixSetPrivate(&pCurs->devPrivates, pScreen, NULL);
}
return (*ScreenPriv->spriteFuncs->UnrealizeCursor)(pDev, pScreen, pCurs);
@@ -296,8 +289,8 @@ static void
xf86CursorSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs,
int x, int y)
{
- xf86CursorScreenPtr ScreenPriv =
- pScreen->devPrivates[xf86CursorScreenIndex].ptr;
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr;
miPointerScreenPtr PointPriv;
@@ -324,8 +317,8 @@ xf86CursorSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs,
ScreenPriv->HotX = pCurs->bits->xhot;
ScreenPriv->HotY = pCurs->bits->yhot;
- PointPriv = pScreen->devPrivates[miPointerScreenIndex].ptr;
-
+ PointPriv = (miPointerScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ miPointerScreenKey);
if (infoPtr->pScrn->vtSema && (ScreenPriv->ForceHWCursorCount || ((
#ifdef ARGB_CURSOR
pCurs->bits->argb && infoPtr->UseHWCursorARGB &&
@@ -369,8 +362,8 @@ xf86CursorSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs,
static void
xf86CursorMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
{
- xf86CursorScreenPtr ScreenPriv =
- pScreen->devPrivates[xf86CursorScreenIndex].ptr;
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
ScreenPriv->x = x;
ScreenPriv->y = y;
@@ -388,9 +381,8 @@ void
xf86ForceHWCursor (ScreenPtr pScreen, Bool on)
{
DeviceIntPtr pDev = inputInfo.pointer;
-
- xf86CursorScreenPtr ScreenPriv =
- pScreen->devPrivates[xf86CursorScreenIndex].ptr;
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
if (on)
{
diff --git a/hw/xfree86/ramdac/xf86CursorPriv.h b/hw/xfree86/ramdac/xf86CursorPriv.h
index 472e2b06b..f82be2edc 100644
--- a/hw/xfree86/ramdac/xf86CursorPriv.h
+++ b/hw/xfree86/ramdac/xf86CursorPriv.h
@@ -45,6 +45,6 @@ Bool xf86InitHardwareCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr);
CARD32 xf86ReverseBitOrder(CARD32 data);
-extern int xf86CursorScreenIndex;
+extern DevPrivateKey xf86CursorScreenKey;
#endif /* _XF86CURSORPRIV_H */
diff --git a/hw/xfree86/ramdac/xf86HWCurs.c b/hw/xfree86/ramdac/xf86HWCurs.c
index 2dfc4b27b..4c5ef4039 100644
--- a/hw/xfree86/ramdac/xf86HWCurs.c
+++ b/hw/xfree86/ramdac/xf86HWCurs.c
@@ -117,8 +117,8 @@ xf86InitHardwareCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr)
void
xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y)
{
- xf86CursorScreenPtr ScreenPriv =
- pScreen->devPrivates[xf86CursorScreenIndex].ptr;
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr;
unsigned char *bits;
@@ -127,7 +127,7 @@ xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y)
return;
}
- bits = pCurs->devPriv[pScreen->myNum];
+ bits = (unsigned char *)dixLookupPrivate(&pCurs->devPrivates, pScreen);
x -= infoPtr->pScrn->frameX0 + ScreenPriv->HotX;
y -= infoPtr->pScrn->frameY0 + ScreenPriv->HotY;
@@ -137,7 +137,7 @@ xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y)
#endif
if (!bits) {
bits = (*infoPtr->RealizeCursor)(infoPtr, pCurs);
- pCurs->devPriv[pScreen->myNum] = bits;
+ dixSetPrivate(&pCurs->devPrivates, pScreen, bits);
}
if (!(infoPtr->Flags & HARDWARE_CURSOR_UPDATE_UNHIDDEN))
@@ -161,8 +161,8 @@ xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y)
void
xf86SetTransparentCursor(ScreenPtr pScreen)
{
- xf86CursorScreenPtr ScreenPriv =
- pScreen->devPrivates[xf86CursorScreenIndex].ptr;
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr;
if (!ScreenPriv->transparentData)
@@ -182,8 +182,8 @@ xf86SetTransparentCursor(ScreenPtr pScreen)
void
xf86MoveCursor(ScreenPtr pScreen, int x, int y)
{
- xf86CursorScreenPtr ScreenPriv =
- pScreen->devPrivates[xf86CursorScreenIndex].ptr;
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr;
x -= infoPtr->pScrn->frameX0 + ScreenPriv->HotX;
@@ -195,8 +195,8 @@ xf86MoveCursor(ScreenPtr pScreen, int x, int y)
void
xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool displayed)
{
- xf86CursorScreenPtr ScreenPriv =
- pScreen->devPrivates[xf86CursorScreenIndex].ptr;
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr;
#ifdef ARGB_CURSOR
diff --git a/hw/xfree86/shadowfb/shadow.c b/hw/xfree86/shadowfb/shadow.c
index 52fdcbef6..74beefb67 100644
--- a/hw/xfree86/shadowfb/shadow.c
+++ b/hw/xfree86/shadowfb/shadow.c
@@ -94,14 +94,13 @@ typedef struct {
} ShadowGCRec, *ShadowGCPtr;
-static int ShadowScreenIndex = -1;
-static int ShadowGCIndex = -1;
-static unsigned long ShadowGeneration = 0;
+static DevPrivateKey ShadowScreenKey = &ShadowScreenKey;
+static DevPrivateKey ShadowGCKey = &ShadowGCKey;
#define GET_SCREEN_PRIVATE(pScreen) \
- (ShadowScreenPtr)((pScreen)->devPrivates[ShadowScreenIndex].ptr)
+ (ShadowScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, ShadowScreenKey)
#define GET_GC_PRIVATE(pGC) \
- (ShadowGCPtr)((pGC)->devPrivates[ShadowGCIndex].ptr)
+ (ShadowGCPtr)dixLookupPrivate(&(pGC)->devPrivates, ShadowGCKey);
#define SHADOW_GC_FUNC_PROLOGUE(pGC)\
ShadowGCPtr pGCPriv = GET_GC_PRIVATE(pGC);\
@@ -172,20 +171,13 @@ ShadowFBInit2 (
if(!preRefreshArea && !postRefreshArea) return FALSE;
- if (ShadowGeneration != serverGeneration) {
- if(((ShadowScreenIndex = AllocateScreenPrivateIndex ()) < 0) ||
- ((ShadowGCIndex = AllocateGCPrivateIndex()) < 0))
- return FALSE;
- ShadowGeneration = serverGeneration;
- }
-
- if(!AllocateGCPrivate(pScreen, ShadowGCIndex, sizeof(ShadowGCRec)))
+ if(!dixRequestPrivate(ShadowGCKey, sizeof(ShadowGCRec)))
return FALSE;
if(!(pPriv = (ShadowScreenPtr)xalloc(sizeof(ShadowScreenRec))))
return FALSE;
- pScreen->devPrivates[ShadowScreenIndex].ptr = (pointer)pPriv;
+ dixSetPrivate(&pScreen->devPrivates, ShadowScreenKey, pPriv);
pPriv->pScrn = pScrn;
pPriv->preRefresh = preRefreshArea;
diff --git a/hw/xfree86/utils/xorgcfg/Makefile.am b/hw/xfree86/utils/xorgcfg/Makefile.am
index e7113035f..31d1b3f00 100644
--- a/hw/xfree86/utils/xorgcfg/Makefile.am
+++ b/hw/xfree86/utils/xorgcfg/Makefile.am
@@ -42,7 +42,6 @@ xorgcfg_LDADD = $(XORGCFG_DEP_LIBS) ../../parser/libxf86config.a $(LOADERLIB) \
#if DoLoadableServer
LDSRCS = \
- $(top_srcdir)/hw/xfree86/os-support/shared/libc_wrapper.c \
loader.c loadmod.c
LOADERLIB = ../../loader/libloader.a
#endif
diff --git a/hw/xfree86/utils/xorgcfg/config.h b/hw/xfree86/utils/xorgcfg/config.h
index b5baba465..ea12e8879 100644
--- a/hw/xfree86/utils/xorgcfg/config.h
+++ b/hw/xfree86/utils/xorgcfg/config.h
@@ -101,7 +101,6 @@ extern int config_mode;
"/etc/X11/%R," "%P/etc/X11/%R," \
"%E," "%F," \
"/etc/X11/%F," "%P/etc/X11/%F," \
- "%D/%X," \
"/etc/X11/%X-%M," "/etc/X11/%X," "/etc/%X," \
"%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \
"%P/etc/X11/%X," \
diff --git a/hw/xfree86/utils/xorgconfig/xorgconfig.c b/hw/xfree86/utils/xorgconfig/xorgconfig.c
index efabc9d1f..30eb83182 100644
--- a/hw/xfree86/utils/xorgconfig/xorgconfig.c
+++ b/hw/xfree86/utils/xorgconfig/xorgconfig.c
@@ -631,7 +631,7 @@ mouse_configuration(void) {
config_emulate3buttons = 0;
printf("\n");
-#if (defined(sun) && (defined(__i386__) || defined(__x86)))
+#if (defined(sun) && (defined(__i386) || defined(__x86)))
/* SPARC & USB mice (VUID or AUTO protocols) default to /dev/mouse,
but PS/2 mice default to /dev/kdmouse */
if ((config_mousetype != M_AUTO) && (config_mousetype != M_VUID)) {
diff --git a/hw/xfree86/xaa/xaaDashLine.c b/hw/xfree86/xaa/xaaDashLine.c
index 1a4732baa..63233e05d 100644
--- a/hw/xfree86/xaa/xaaDashLine.c
+++ b/hw/xfree86/xaa/xaaDashLine.c
@@ -35,7 +35,8 @@ XAAPolyLinesDashed(
#endif
){
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- XAAGCPtr pGCPriv = (XAAGCPtr) (pGC)->devPrivates[XAAGetGCIndex()].ptr;
+ XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&pGC->devPrivates,
+ XAAGetGCKey());
BoxPtr pboxInit = REGION_RECTS(pGC->pCompositeClip);
int nboxInit = REGION_NUM_RECTS(pGC->pCompositeClip);
unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
diff --git a/hw/xfree86/xaa/xaaGC.c b/hw/xfree86/xaa/xaaGC.c
index b3dc83ada..e6083d529 100644
--- a/hw/xfree86/xaa/xaaGC.c
+++ b/hw/xfree86/xaa/xaaGC.c
@@ -38,7 +38,8 @@ Bool
XAACreateGC(GCPtr pGC)
{
ScreenPtr pScreen = pGC->pScreen;
- XAAGCPtr pGCPriv = (XAAGCPtr)(pGC->devPrivates[XAAGetGCIndex()].ptr);
+ XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&pGC->devPrivates,
+ XAAGetGCKey());
Bool ret;
XAA_SCREEN_PROLOGUE(pScreen,CreateGC);
diff --git a/hw/xfree86/xaa/xaaGCmisc.c b/hw/xfree86/xaa/xaaGCmisc.c
index a7a3f4081..5823cc064 100644
--- a/hw/xfree86/xaa/xaaGCmisc.c
+++ b/hw/xfree86/xaa/xaaGCmisc.c
@@ -305,7 +305,8 @@ XAAValidatePolylines(
DrawablePtr pDraw )
{
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- XAAGCPtr pGCPriv = (XAAGCPtr) (pGC)->devPrivates[XAAGetGCIndex()].ptr;
+ XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&pGC->devPrivates,
+ XAAGetGCKey());
if(pGC->lineStyle == LineSolid) changes &= ~GCDashList;
if(!changes) return;
diff --git a/hw/xfree86/xaa/xaaInit.c b/hw/xfree86/xaa/xaaInit.c
index 196569278..892cbcfc3 100644
--- a/hw/xfree86/xaa/xaaInit.c
+++ b/hw/xfree86/xaa/xaaInit.c
@@ -39,22 +39,20 @@ static int XAASetDGAMode(int index, int num, DGADevicePtr devRet);
static void XAAEnableDisableFBAccess (int index, Bool enable);
static Bool XAAChangeWindowAttributes (WindowPtr pWin, unsigned long mask);
-static int XAAScreenIndex = -1;
-static int XAAGCIndex = -1;
-static int XAAPixmapIndex = -1;
+static DevPrivateKey XAAScreenKey = &XAAScreenKey;
+static DevPrivateKey XAAGCKey = &XAAGCKey;
+static DevPrivateKey XAAPixmapKey = &XAAPixmapKey;
-static unsigned long XAAGeneration = 0;
-
-int XAAGetScreenIndex(void) {
- return XAAScreenIndex;
+DevPrivateKey XAAGetScreenKey(void) {
+ return XAAScreenKey;
}
-int XAAGetGCIndex(void) {
- return XAAGCIndex;
+DevPrivateKey XAAGetGCKey(void) {
+ return XAAGCKey;
}
-int XAAGetPixmapIndex(void) {
- return XAAPixmapIndex;
+DevPrivateKey XAAGetPixmapKey(void) {
+ return XAAPixmapKey;
}
/* temp kludge */
@@ -104,25 +102,16 @@ XAAInit(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
if (!infoRec)
return TRUE;
- if (XAAGeneration != serverGeneration) {
- if ( ((XAAScreenIndex = AllocateScreenPrivateIndex()) < 0) ||
- ((XAAGCIndex = AllocateGCPrivateIndex()) < 0) ||
- ((XAAPixmapIndex = AllocatePixmapPrivateIndex()) < 0))
- return FALSE;
-
- XAAGeneration = serverGeneration;
- }
-
- if (!AllocateGCPrivate(pScreen, XAAGCIndex, sizeof(XAAGCRec)))
+ if (!dixRequestPrivate(XAAGCKey, sizeof(XAAGCRec)))
return FALSE;
- if (!AllocatePixmapPrivate(pScreen, XAAPixmapIndex, sizeof(XAAPixmapRec)))
+ if (!dixRequestPrivate(XAAPixmapKey, sizeof(XAAPixmapRec)))
return FALSE;
if (!(pScreenPriv = xalloc(sizeof(XAAScreenRec))))
return FALSE;
- pScreen->devPrivates[XAAScreenIndex].ptr = (pointer)pScreenPriv;
+ dixSetPrivate(&pScreen->devPrivates, XAAScreenKey, pScreenPriv);
if(!xf86FBManagerRunning(pScreen))
infoRec->Flags &= ~(PIXMAP_CACHE | OFFSCREEN_PIXMAPS);
@@ -219,7 +208,7 @@ XAACloseScreen (int i, ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
XAAScreenPtr pScreenPriv =
- (XAAScreenPtr) pScreen->devPrivates[XAAScreenIndex].ptr;
+ (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
pScrn->EnterVT = pScreenPriv->EnterVT;
pScrn->LeaveVT = pScreenPriv->LeaveVT;
@@ -516,7 +505,7 @@ XAAEnterVT(int index, int flags)
{
ScreenPtr pScreen = screenInfo.screens[index];
XAAScreenPtr pScreenPriv =
- (XAAScreenPtr) pScreen->devPrivates[XAAScreenIndex].ptr;
+ (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
return((*pScreenPriv->EnterVT)(index, flags));
}
@@ -526,7 +515,7 @@ XAALeaveVT(int index, int flags)
{
ScreenPtr pScreen = screenInfo.screens[index];
XAAScreenPtr pScreenPriv =
- (XAAScreenPtr) pScreen->devPrivates[XAAScreenIndex].ptr;
+ (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
XAAInfoRecPtr infoRec = pScreenPriv->AccelInfoRec;
if(infoRec->NeedToSync) {
@@ -549,7 +538,7 @@ XAASetDGAMode(int index, int num, DGADevicePtr devRet)
ScreenPtr pScreen = screenInfo.screens[index];
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
XAAScreenPtr pScreenPriv =
- (XAAScreenPtr) pScreen->devPrivates[XAAScreenIndex].ptr;
+ (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
int ret;
if (!num && infoRec->dgaSaves) { /* restore old pixmap cache state */
@@ -611,7 +600,7 @@ XAAEnableDisableFBAccess (int index, Bool enable)
ScreenPtr pScreen = screenInfo.screens[index];
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
XAAScreenPtr pScreenPriv =
- (XAAScreenPtr) pScreen->devPrivates[XAAScreenIndex].ptr;
+ (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
if(!enable) {
if((infoRec->Flags & OFFSCREEN_PIXMAPS) && (infoRec->OffscreenPixmaps))
diff --git a/hw/xfree86/xaa/xaaLineMisc.c b/hw/xfree86/xaa/xaaLineMisc.c
index 537b08b97..cefb59a8e 100644
--- a/hw/xfree86/xaa/xaaLineMisc.c
+++ b/hw/xfree86/xaa/xaaLineMisc.c
@@ -64,7 +64,8 @@ void
XAAComputeDash(GCPtr pGC)
{
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- XAAGCPtr pGCPriv = (XAAGCPtr) (pGC)->devPrivates[XAAGetGCIndex()].ptr;
+ XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&pGC->devPrivates,
+ XAAGetGCKey());
Bool EvenDash = (pGC->numInDashList & 0x01) ? FALSE : TRUE;
int PatternLength = 0;
unsigned char* DashPtr = (unsigned char*)pGC->dash;
diff --git a/hw/xfree86/xaa/xaaOverlayDF.c b/hw/xfree86/xaa/xaaOverlayDF.c
index 47599d7d3..64ca998ee 100644
--- a/hw/xfree86/xaa/xaaOverlayDF.c
+++ b/hw/xfree86/xaa/xaaOverlayDF.c
@@ -151,11 +151,10 @@ typedef struct {
int (*TiledFillChooser)(GCPtr);
} XAAOverlayRec, *XAAOverlayPtr;
-static int XAAOverlayIndex = -1;
-static unsigned long XAAOverlayGeneration = 0;
+static DevPrivateKey XAAOverlayKey = &XAAOverlayKey;
#define GET_OVERLAY_PRIV(pScreen) \
- ((XAAOverlayPtr)((pScreen)->devPrivates[XAAOverlayIndex].ptr))
+ (XAAOverlayPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAOverlayKey)
#define SWITCH_DEPTH(d) \
if(pOverPriv->currentDepth != d) { \
@@ -173,18 +172,10 @@ XAAInitDualFramebufferOverlay(
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
XAAOverlayPtr pOverPriv;
- if (XAAOverlayGeneration != serverGeneration) {
- if((XAAOverlayIndex = AllocateScreenPrivateIndex()) < 0)
- return FALSE;
-
- XAAOverlayGeneration = serverGeneration;
- }
-
-
if(!(pOverPriv = xalloc(sizeof(XAAOverlayRec))))
return FALSE;
- pScreen->devPrivates[XAAOverlayIndex].ptr = (pointer)pOverPriv;
+ dixSetPrivate(&pScreen->devPrivates, XAAOverlayKey, pOverPriv);
pOverPriv->pScrn = pScrn;
pOverPriv->callback = callback;
diff --git a/hw/xfree86/xaa/xaaStateChange.c b/hw/xfree86/xaa/xaaStateChange.c
index 02c556b33..443bda628 100644
--- a/hw/xfree86/xaa/xaaStateChange.c
+++ b/hw/xfree86/xaa/xaaStateChange.c
@@ -274,18 +274,17 @@ typedef struct _XAAStateWrapRec {
#endif
} XAAStateWrapRec, *XAAStateWrapPtr;
-static int XAAStateIndex = -1;
-static unsigned long XAAStateGeneration = 0;
+static DevPrivateKey XAAStateKey = &XAAStateKey;
/* Wrap functions start here */
#define GET_STATEPRIV_GC(pGC) XAAStateWrapPtr pStatePriv =\
-(XAAStateWrapPtr)(pGC->pScreen->devPrivates[XAAStateIndex].ptr)
+(XAAStateWrapPtr)dixLookupPrivate(&(pGC)->pScreen->devPrivates, XAAStateKey)
#define GET_STATEPRIV_SCREEN(pScreen) XAAStateWrapPtr pStatePriv =\
-(XAAStateWrapPtr)(pScreen->devPrivates[XAAStateIndex].ptr)
+(XAAStateWrapPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAStateKey)
#define GET_STATEPRIV_PSCRN(pScrn) XAAStateWrapPtr pStatePriv =\
-(XAAStateWrapPtr)(pScrn->pScreen->devPrivates[XAAStateIndex].ptr)
+(XAAStateWrapPtr)dixLookupPrivate(&(pScrn)->pScreen->devPrivates, XAAStateKey)
#define STATE_CHECK_SP(pStatePriv) {\
ScrnInfoPtr pScrn = pStatePriv->pScrn;\
@@ -1504,12 +1503,8 @@ XAAInitStateWrap(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
XAAStateWrapPtr pStatePriv;
int i = 0;
- if (XAAStateGeneration != serverGeneration) {
- if((XAAStateIndex = AllocateScreenPrivateIndex()) < 0) return FALSE;
- XAAStateGeneration = serverGeneration;
- }
if(!(pStatePriv = xalloc(sizeof(XAAStateWrapRec)))) return FALSE;
- pScreen->devPrivates[XAAStateIndex].ptr = (pointer)pStatePriv;
+ dixSetPrivate(&pScreen->devPrivates, XAAStateKey, pStatePriv);
pStatePriv->RestoreAccelState = infoRec->RestoreAccelState;
pStatePriv->pScrn = pScrn;
diff --git a/hw/xfree86/xaa/xaaWrapper.c b/hw/xfree86/xaa/xaaWrapper.c
index b0176f03f..5d6ea05cf 100644
--- a/hw/xfree86/xaa/xaaWrapper.c
+++ b/hw/xfree86/xaa/xaaWrapper.c
@@ -86,10 +86,8 @@ typedef struct {
int depth;
} xaaWrapperScrPrivRec, *xaaWrapperScrPrivPtr;
-#define xaaWrapperGetScrPriv(s) ((xaaWrapperScrPrivPtr)( \
- (xaaWrapperScrPrivateIndex != -1) \
- ? (s)->devPrivates[xaaWrapperScrPrivateIndex].ptr\
- : NULL))
+#define xaaWrapperGetScrPriv(s) ((xaaWrapperScrPrivPtr) \
+ dixLookupPrivate(&(s)->devPrivates, xaaWrapperScrPrivateKey))
#define xaaWrapperScrPriv(s) xaaWrapperScrPrivPtr pScrPriv = xaaWrapperGetScrPriv(s)
#define wrap(priv,real,mem,func) {\
@@ -127,13 +125,12 @@ typedef struct _xaaWrapperGCPriv {
} xaaWrapperGCPrivRec, *xaaWrapperGCPrivPtr;
#define xaaWrapperGetGCPriv(pGC) ((xaaWrapperGCPrivPtr) \
- (pGC)->devPrivates[xaaWrapperGCPrivateIndex].ptr)
+ dixLookupPrivate(&(pGC)->devPrivates, xaaWrapperGCPrivateKey))
#define xaaWrapperGCPriv(pGC) xaaWrapperGCPrivPtr pGCPriv = xaaWrapperGetGCPriv(pGC)
-static int xaaWrapperScrPrivateIndex = -1;
-static int xaaWrapperGCPrivateIndex = -1;
-static int xaaWrapperGeneration = -1;
+static DevPrivateKey xaaWrapperScrPrivateKey = &xaaWrapperScrPrivateKey;
+static DevPrivateKey xaaWrapperGCPrivateKey = &xaaWrapperGCPrivateKey;
static Bool
xaaWrapperCreateScreenResources(ScreenPtr pScreen)
@@ -274,18 +271,8 @@ xaaSetupWrapper(ScreenPtr pScreen, XAAInfoRecPtr infoPtr, int depth, SyncFunc *f
#ifdef RENDER
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
#endif
- if (xaaWrapperGeneration != serverGeneration) {
- xaaWrapperScrPrivateIndex = AllocateScreenPrivateIndex ();
- if (xaaWrapperScrPrivateIndex == -1)
- return FALSE;
- xaaWrapperGCPrivateIndex = AllocateGCPrivateIndex ();
- if (xaaWrapperGCPrivateIndex == -1)
- return FALSE;
- xaaWrapperGeneration = serverGeneration;
- }
- if (!AllocateGCPrivate (pScreen, xaaWrapperGCPrivateIndex,
- sizeof (xaaWrapperGCPrivRec)))
+ if (!dixRequestPrivate(xaaWrapperGCPrivateKey, sizeof(xaaWrapperGCPrivRec)))
return FALSE;
pScrPriv = (xaaWrapperScrPrivPtr) xalloc (sizeof (xaaWrapperScrPrivRec));
@@ -335,7 +322,7 @@ xaaSetupWrapper(ScreenPtr pScreen, XAAInfoRecPtr infoPtr, int depth, SyncFunc *f
}
#endif
pScrPriv->depth = depth;
- pScreen->devPrivates[xaaWrapperScrPrivateIndex].ptr = (pointer) pScrPriv;
+ dixSetPrivate(&pScreen->devPrivates, xaaWrapperScrPrivateKey, pScrPriv);
*func = XAASync;
@@ -486,8 +473,8 @@ xaaWrapperGlyphs (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
void
XAASync(ScreenPtr pScreen)
{
- XAAScreenPtr pScreenPriv =
- (XAAScreenPtr) pScreen->devPrivates[XAAGetScreenIndex()].ptr;
+ XAAScreenPtr pScreenPriv = (XAAScreenPtr)
+ dixLookupPrivate(&pScreen->devPrivates, XAAGetScreenKey());
XAAInfoRecPtr infoRec = pScreenPriv->AccelInfoRec;
if(infoRec->NeedToSync) {
diff --git a/hw/xfree86/xaa/xaalocal.h b/hw/xfree86/xaa/xaalocal.h
index 686cc876d..e25b9df52 100644
--- a/hw/xfree86/xaa/xaalocal.h
+++ b/hw/xfree86/xaa/xaalocal.h
@@ -1629,9 +1629,9 @@ XAAGetPixelFromRGBA (
extern GCOps XAAFallbackOps;
extern GCOps *XAAGetFallbackOps(void);
extern GCFuncs XAAGCFuncs;
-extern int XAAGetScreenIndex(void);
-extern int XAAGetGCIndex(void);
-extern int XAAGetPixmapIndex(void);
+extern DevPrivateKey XAAGetScreenKey(void);
+extern DevPrivateKey XAAGetGCKey(void);
+extern DevPrivateKey XAAGetPixmapKey(void);
extern unsigned int XAAShiftMasks[32];
@@ -1640,28 +1640,28 @@ extern unsigned int byte_expand3[256], byte_reversed_expand3[256];
CARD32 XAAReverseBitOrder(CARD32 data);
#define GET_XAASCREENPTR_FROM_SCREEN(pScreen)\
- (pScreen)->devPrivates[XAAGetScreenIndex()].ptr
+ dixLookupPrivate(&(pScreen)->devPrivates, XAAGetScreenKey())
#define GET_XAASCREENPTR_FROM_GC(pGC)\
- (pGC)->pScreen->devPrivates[XAAGetScreenIndex()].ptr
+ dixLookupPrivate(&(pGC)->pScreen->devPrivates, XAAGetScreenKey())
#define GET_XAASCREENPTR_FROM_DRAWABLE(pDraw)\
- (pDraw)->pScreen->devPrivates[XAAGetScreenIndex()].ptr
+ dixLookupPrivate(&(pDraw)->pScreen->devPrivates, XAAGetScreenKey())
#define GET_XAAINFORECPTR_FROM_SCREEN(pScreen)\
- ((XAAScreenPtr)((pScreen)->devPrivates[XAAGetScreenIndex()].ptr))->AccelInfoRec
+((XAAScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAGetScreenKey()))->AccelInfoRec
#define GET_XAAINFORECPTR_FROM_GC(pGC)\
-((XAAScreenPtr)((pGC)->pScreen->devPrivates[XAAGetScreenIndex()].ptr))->AccelInfoRec
+((XAAScreenPtr)dixLookupPrivate(&(pGC)->pScreen->devPrivates, XAAGetScreenKey()))->AccelInfoRec
#define GET_XAAINFORECPTR_FROM_DRAWABLE(pDraw)\
-((XAAScreenPtr)((pDraw)->pScreen->devPrivates[XAAGetScreenIndex()].ptr))->AccelInfoRec
+((XAAScreenPtr)dixLookupPrivate(&(pDraw)->pScreen->devPrivates, XAAGetScreenKey()))->AccelInfoRec
#define GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn)\
-((XAAScreenPtr)((pScrn)->pScreen->devPrivates[XAAGetScreenIndex()].ptr))->AccelInfoRec
+((XAAScreenPtr)dixLookupPrivate(&(pScrn)->pScreen->devPrivates, XAAGetScreenKey()))->AccelInfoRec
#define XAA_GET_PIXMAP_PRIVATE(pix)\
- (XAAPixmapPtr)((pix)->devPrivates[XAAGetPixmapIndex()].ptr)
+ (XAAPixmapPtr)dixLookupPrivate(&(pix)->devPrivates, XAAGetPixmapKey())
#define CHECK_RGB_EQUAL(c) (!((((c) >> 8) ^ (c)) & 0xffff))
diff --git a/hw/xfree86/xaa/xaawrap.h b/hw/xfree86/xaa/xaawrap.h
index 32c17a60c..38c97d70b 100644
--- a/hw/xfree86/xaa/xaawrap.h
+++ b/hw/xfree86/xaa/xaawrap.h
@@ -1,14 +1,14 @@
#define XAA_SCREEN_PROLOGUE(pScreen, field)\
((pScreen)->field = \
- ((XAAScreenPtr) (pScreen)->devPrivates[XAAGetScreenIndex()].ptr)->field)
+ ((XAAScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAGetScreenKey()))->field)
#define XAA_SCREEN_EPILOGUE(pScreen, field, wrapper)\
((pScreen)->field = wrapper)
#define XAA_GC_FUNC_PROLOGUE(pGC)\
- XAAGCPtr pGCPriv = (XAAGCPtr) (pGC)->devPrivates[XAAGetGCIndex()].ptr;\
+ XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&(pGC)->devPrivates, XAAGetGCKey()); \
(pGC)->funcs = pGCPriv->wrapFuncs;\
if(pGCPriv->flags)\
(pGC)->ops = pGCPriv->wrapOps
@@ -24,13 +24,13 @@
#define XAA_GC_OP_PROLOGUE(pGC)\
- XAAGCPtr pGCPriv = (XAAGCPtr)(pGC->devPrivates[XAAGetGCIndex()].ptr);\
+ XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&(pGC)->devPrivates, XAAGetGCKey()); \
GCFuncs *oldFuncs = pGC->funcs;\
pGC->funcs = pGCPriv->wrapFuncs;\
pGC->ops = pGCPriv->wrapOps
#define XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC)\
- XAAGCPtr pGCPriv = (XAAGCPtr)(pGC->devPrivates[XAAGetGCIndex()].ptr);\
+ XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&(pGC)->devPrivates, XAAGetGCKey()); \
GCFuncs *oldFuncs = pGC->funcs;\
if(!REGION_NUM_RECTS(pGC->pCompositeClip)) return; \
pGC->funcs = pGCPriv->wrapFuncs;\
@@ -44,7 +44,7 @@
#define XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw)\
- XAAGCPtr pGCPriv = (XAAGCPtr)(pGC->devPrivates[XAAGetGCIndex()].ptr);\
+ XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&(pGC)->devPrivates, XAAGetGCKey()); \
XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pDraw));\
GCFuncs *oldFuncs = pGC->funcs;\
pGC->funcs = pGCPriv->wrapFuncs;\
@@ -64,7 +64,7 @@
#ifdef RENDER
#define XAA_RENDER_PROLOGUE(pScreen,field)\
(GetPictureScreen(pScreen)->field = \
- ((XAAScreenPtr) (pScreen)->devPrivates[XAAGetScreenIndex()].ptr)->field)
+ ((XAAScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAGetScreenKey()))->field)
#define XAA_RENDER_EPILOGUE(pScreen, field, wrapper)\
(GetPictureScreen(pScreen)->field = wrapper)
@@ -74,7 +74,7 @@
#define SYNC_CHECK(pGC) {\
XAAInfoRecPtr infoRec =\
-((XAAScreenPtr)((pGC)->pScreen->devPrivates[XAAGetScreenIndex()].ptr))->AccelInfoRec;\
+((XAAScreenPtr)dixLookupPrivate(&(pGC)->pScreen->devPrivates, XAAGetScreenKey()))->AccelInfoRec; \
if(infoRec->NeedToSync) {\
(*infoRec->Sync)(infoRec->pScrn);\
infoRec->NeedToSync = FALSE;\
diff --git a/hw/xfree86/xf4bpp/mfbfillarc.c b/hw/xfree86/xf4bpp/mfbfillarc.c
index d5b5372f5..89aeadd2b 100644
--- a/hw/xfree86/xf4bpp/mfbfillarc.c
+++ b/hw/xfree86/xf4bpp/mfbfillarc.c
@@ -253,7 +253,8 @@ xf4bppPolyFillArcSolid
mfbPrivGC *priv;
int rop;
- priv = (mfbPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr;
+ priv = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
+ mfbGetGCPrivateKey());
rop = priv->rop;
if ((rop == RROP_NOP) || !(pGC->planemask & 1))
#else
diff --git a/hw/xfree86/xf4bpp/mfbimggblt.c b/hw/xfree86/xf4bpp/mfbimggblt.c
index 73e7ce064..4f9561161 100644
--- a/hw/xfree86/xf4bpp/mfbimggblt.c
+++ b/hw/xfree86/xf4bpp/mfbimggblt.c
@@ -149,7 +149,8 @@ xf4bppImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
backrect.height = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font);
- pPrivGC = pGC->devPrivates[mfbGetGCPrivateIndex()].ptr;
+ pPrivGC = (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates,
+ mfbGetGCPrivateKey());
oldfillStyle = pPrivGC->colorRrop.fillStyle; /* GJA */
oldfg = pPrivGC->colorRrop.fgPixel; /* GJA */
oldalu = pPrivGC->colorRrop.alu; /* GJA */
diff --git a/hw/xfree86/xf4bpp/mfbzerarc.c b/hw/xfree86/xf4bpp/mfbzerarc.c
index c7a8c4d56..61fc7b184 100644
--- a/hw/xfree86/xf4bpp/mfbzerarc.c
+++ b/hw/xfree86/xf4bpp/mfbzerarc.c
@@ -108,7 +108,8 @@ v16ZeroArcSS
int pmask;
register int *paddr;
- if (((mfbPrivGC *)(pGC->devPrivates[mfbGetGCPrivateIndex()].ptr))->rop ==
+ if (((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
+ mfbGetGCPrivateKey()))->rop ==
RROP_BLACK)
pixel = 0;
else
diff --git a/hw/xfree86/xf4bpp/ppcArea.c b/hw/xfree86/xf4bpp/ppcArea.c
index e95696260..df7856a35 100644
--- a/hw/xfree86/xf4bpp/ppcArea.c
+++ b/hw/xfree86/xf4bpp/ppcArea.c
@@ -49,7 +49,7 @@ int alu ;
unsigned long int fg, bg, pm ;
int xSrc, ySrc ;
PixmapPtr pPixmap ;
-ppcPrivGC *pPrivGC = pGC->devPrivates[mfbGetGCPrivateIndex()].ptr;
+ppcPrivGC *pPrivGC = dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey());
TRACE( ( "xf4bppFillArea(0x%x,%d,0x%x,0x%x)\n", pWin, nboxes, pBox, pGC ) ) ;
diff --git a/hw/xfree86/xf4bpp/ppcGC.c b/hw/xfree86/xf4bpp/ppcGC.c
index 674a38b78..7ef312d39 100644
--- a/hw/xfree86/xf4bpp/ppcGC.c
+++ b/hw/xfree86/xf4bpp/ppcGC.c
@@ -182,7 +182,7 @@ register GCPtr pGC ;
* a pointer to a ppcPrivGC in its slot.
*/
*pPriv = vgaPrototypeGCPriv;
- (pGC->devPrivates[mfbGetGCPrivateIndex()].ptr) = (pointer) pPriv;
+ dixSetPrivate(&pGC->devPrivates, mfbGetGCPrivateKey(), pPriv);
/* Set the vgaGCOps */
*pOps = vgaGCOps;
@@ -202,7 +202,7 @@ xf4bppDestroyGC( pGC )
if ( pGC->freeCompClip && pGC->pCompositeClip )
REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip);
if(pGC->ops->devPrivate.val) xfree( pGC->ops );
- xfree( pGC->devPrivates[mfbGetGCPrivateIndex()].ptr ) ;
+ xfree(dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()));
return ;
}
@@ -213,7 +213,7 @@ ppcChangePixmapGC
register Mask changes
)
{
-register ppcPrivGCPtr devPriv = (ppcPrivGCPtr) (pGC->devPrivates[mfbGetGCPrivateIndex()].ptr ) ;
+register ppcPrivGCPtr devPriv = (ppcPrivGCPtr)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey());
register unsigned long int idx ; /* used for stepping through bitfields */
#define LOWBIT( x ) ( x & - x ) /* Two's complement */
@@ -291,8 +291,8 @@ xf4bppValidateGC( pGC, changes, pDrawable )
register ppcPrivGCPtr devPriv ;
WindowPtr pWin ;
- devPriv = (ppcPrivGCPtr) (pGC->devPrivates[mfbGetGCPrivateIndex()].ptr ) ;
-
+ devPriv = (ppcPrivGCPtr)dixLookupPrivate(&pGC->devPrivates,
+ mfbGetGCPrivateKey());
if ( pDrawable->type != devPriv->lastDrawableType ) {
devPriv->lastDrawableType = pDrawable->type ;
xf4bppChangeGCtype( pGC, devPriv ) ;
diff --git a/hw/xfree86/xf4bpp/ppcPixFS.c b/hw/xfree86/xf4bpp/ppcPixFS.c
index dfc648660..9fd29efce 100644
--- a/hw/xfree86/xf4bpp/ppcPixFS.c
+++ b/hw/xfree86/xf4bpp/ppcPixFS.c
@@ -124,7 +124,7 @@ xf4bppSolidPixmapFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
return ;
}
- if ( ( alu = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.alu ) == GXnoop )
+ if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()))->colorRrop.alu ) == GXnoop )
return ;
n = nInit * miFindMaxBand(pGC->pCompositeClip) ;
@@ -142,8 +142,8 @@ xf4bppSolidPixmapFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
n = miClipSpans( pGC->pCompositeClip, pptInit, pwidthInit, nInit,
ppt, pwidth, fSorted ) ;
- pm = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.planemask ;
- fg = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.fgPixel ;
+ pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
+ fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ;
npm = ( ~ pm ) & ( ( 1 << pDrawable->depth ) - 1 ) ;
for ( ; n-- ; ppt++, pwidth++ ) {
@@ -258,14 +258,14 @@ int fSorted ;
return ;
}
- if ( ( alu = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.alu ) == GXnoop )
+ if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
return ;
SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit,
pptFree, pwidth, ppt, fSorted ) ;
- pm = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.planemask ;
- fg = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.fgPixel ;
+ pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
+ fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ;
pTile = pGC->stipple ;
tlwidth = pTile->devKind ;
@@ -356,15 +356,15 @@ int fSorted ;
return ;
}
- if ( ( alu = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.alu ) == GXnoop )
+ if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
return ;
SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit,
pptFree, pwidth, ppt, fSorted ) ;
- fg = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.fgPixel ;
- bg = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.bgPixel ;
- pm = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.planemask ;
+ fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ;
+ bg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.bgPixel ;
+ pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
npm = ( ~ pm ) & ( ( 1 << pDrawable->depth ) - 1 ) ;
pTile = pGC->stipple ;
@@ -459,14 +459,14 @@ int fSorted ;
return ;
}
- if ( ( alu = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.alu ) == GXnoop )
+ if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
return ;
SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit,
pptFree, pwidth, ppt, fSorted ) ;
/* the following code is for 8 bits per pixel addressable memory only */
- pm = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.planemask ;
+ pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
npm = ( ~ pm ) & ( ( 1 << pDrawable->depth ) - 1 ) ;
pTile = pGC->tile.pixmap ;
tileWidth = pTile->drawable.width ;
diff --git a/hw/xfree86/xf4bpp/ppcPixmap.c b/hw/xfree86/xf4bpp/ppcPixmap.c
index 241217bf4..d04aacf82 100644
--- a/hw/xfree86/xf4bpp/ppcPixmap.c
+++ b/hw/xfree86/xf4bpp/ppcPixmap.c
@@ -123,6 +123,7 @@ xf4bppCreatePixmap( pScreen, width, height, depth, usage_hint )
pPixmap->devPrivate.ptr = (pointer) (((CARD8*)pPixmap)
+ pScreen->totalPixmapSize);
bzero( (char *) pPixmap->devPrivate.ptr, size ) ;
+ pPixmap->usage_hint = usage_hint;
return pPixmap ;
}
@@ -138,6 +139,7 @@ xf4bppCopyPixmap(pSrc)
pDst = xalloc(sizeof(PixmapRec) + size);
if (!pDst)
return NullPixmap;
+ pDst->devPrivates = NULL;
pDst->drawable = pSrc->drawable;
pDst->drawable.id = 0;
pDst->drawable.serialNumber = NEXT_SERIAL_NUMBER;
diff --git a/hw/xfree86/xf4bpp/ppcPolyPnt.c b/hw/xfree86/xf4bpp/ppcPolyPnt.c
index 1d6905563..c61fd6d26 100644
--- a/hw/xfree86/xf4bpp/ppcPolyPnt.c
+++ b/hw/xfree86/xf4bpp/ppcPolyPnt.c
@@ -102,7 +102,7 @@ if ( pDrawable->type == DRAWABLE_PIXMAP ) {
return ;
}
-devPriv = (ppcPrivGC *) ( pGC->devPrivates[mfbGetGCPrivateIndex()].ptr ) ;
+devPriv = (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey());
if ( ( alu = devPriv->colorRrop.alu ) == GXnoop )
return ;
diff --git a/hw/xfree86/xf4bpp/ppcWinFS.c b/hw/xfree86/xf4bpp/ppcWinFS.c
index 78001d793..1522afd9e 100644
--- a/hw/xfree86/xf4bpp/ppcWinFS.c
+++ b/hw/xfree86/xf4bpp/ppcWinFS.c
@@ -96,7 +96,7 @@ xf4bppSolidWindowFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
return ;
}
- if ( ( alu = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.alu ) == GXnoop )
+ if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
return ;
n = nInit * miFindMaxBand( pGC->pCompositeClip ) ;
@@ -114,8 +114,8 @@ xf4bppSolidWindowFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
n = miClipSpans( pGC->pCompositeClip, pptInit, pwidthInit, nInit,
ppt, pwidth, fSorted ) ;
- pm = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.planemask ;
- fg = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.fgPixel ;
+ pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
+ fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ;
for ( ; n-- ; ppt++, pwidth++ )
if ( *pwidth )
@@ -163,14 +163,14 @@ int fSorted ;
return ;
}
- if ( ( alu = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.alu ) == GXnoop )
+ if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
return ;
SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit,
pptFree, pwidth, ppt, fSorted ) ;
- pm = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.planemask ;
- fg = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.fgPixel ;
+ pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
+ fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ;
xSrc = pGC->patOrg.x + pDrawable->x ;
ySrc = pGC->patOrg.y + pDrawable->y ;
@@ -215,15 +215,15 @@ int fSorted ;
return ;
}
- if ( ( alu = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.alu ) == GXnoop )
+ if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
return ;
SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit,
pptFree, pwidth, ppt, fSorted ) ;
- pm = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.planemask ;
- fg = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.fgPixel ;
- bg = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.bgPixel ;
+ pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
+ fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ;
+ bg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.bgPixel ;
xSrc = pGC->patOrg.x + pDrawable->x ;
ySrc = pGC->patOrg.y + pDrawable->y ;
@@ -260,7 +260,7 @@ int fSorted ;
TRACE( ( "xf4bppTileWindowFS(pDrawable=0x%x,pGC=0x%x,nInit=%d,pptInit=0x%x,pwidthInit=0x%x,fSorted=%d)\n",
pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ) ;
- if ( ( alu = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.alu ) == GXnoop )
+ if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
return ;
SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit,
@@ -268,7 +268,7 @@ int fSorted ;
xSrc = pGC->patOrg.x + pDrawable->x ;
ySrc = pGC->patOrg.y + pDrawable->y ;
- pm = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.planemask ;
+ pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
for ( ; n-- ; ppt++, pwidth++ )
xf4bppTileRect( (WindowPtr)pDrawable, pGC->tile.pixmap, alu, pm,
diff --git a/hw/xfree86/xf4bpp/vgaGC.c b/hw/xfree86/xf4bpp/vgaGC.c
index 5a8604090..6495e5638 100644
--- a/hw/xfree86/xf4bpp/vgaGC.c
+++ b/hw/xfree86/xf4bpp/vgaGC.c
@@ -107,7 +107,7 @@ xf4bppChangeWindowGC( pGC, changes )
register GC *pGC ;
register Mask changes ;
{
-register ppcPrivGCPtr devPriv = (ppcPrivGCPtr) (pGC->devPrivates[mfbGetGCPrivateIndex()].ptr) ;
+register ppcPrivGCPtr devPriv = (ppcPrivGCPtr)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey());
register unsigned long int idx ; /* used for stepping through bitfields */
#define LOWBIT( x ) ( x & - x ) /* Two's complement */
diff --git a/hw/xfree86/xf8_32bpp/cfb8_32.h b/hw/xfree86/xf8_32bpp/cfb8_32.h
index e14096568..6e985da20 100644
--- a/hw/xfree86/xf8_32bpp/cfb8_32.h
+++ b/hw/xfree86/xf8_32bpp/cfb8_32.h
@@ -22,10 +22,8 @@ typedef struct {
} cfb8_32ScreenRec, *cfb8_32ScreenPtr;
-extern int cfb8_32GCPrivateIndex; /* XXX */
-extern int cfb8_32GetGCPrivateIndex(void);
-extern int cfb8_32ScreenPrivateIndex; /* XXX */
-extern int cfb8_32GetScreenPrivateIndex(void);
+extern DevPrivateKey cfb8_32GetGCPrivateKey(void);
+extern DevPrivateKey cfb8_32GetScreenPrivateKey(void);
RegionPtr
cfb8_32CopyArea(
@@ -182,11 +180,11 @@ cfb8_32ChangeWindowAttributes(
);
-#define CFB8_32_GET_GC_PRIVATE(pGC)\
- (cfb8_32GCPtr)((pGC)->devPrivates[cfb8_32GetGCPrivateIndex()].ptr)
+#define CFB8_32_GET_GC_PRIVATE(pGC) ((cfb8_32GCPtr) \
+ dixLookupPrivate(&(pGC)->devPrivates, cfb8_32GetGCPrivateKey()))
-#define CFB8_32_GET_SCREEN_PRIVATE(pScreen)\
- (cfb8_32ScreenPtr)((pScreen)->devPrivates[cfb8_32GetScreenPrivateIndex()].ptr)
+#define CFB8_32_GET_SCREEN_PRIVATE(pScreen) ((cfb8_32ScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, cfb8_32GetScreenPrivateKey()))
Bool xf86Overlay8Plus32Init (ScreenPtr pScreen);
diff --git a/hw/xfree86/xf8_32bpp/cfbscrinit.c b/hw/xfree86/xf8_32bpp/cfbscrinit.c
index 5e2657f2b..c3432b803 100644
--- a/hw/xfree86/xf8_32bpp/cfbscrinit.c
+++ b/hw/xfree86/xf8_32bpp/cfbscrinit.c
@@ -31,38 +31,37 @@
/* CAUTION: We require that cfb8 and cfb32 were NOT
compiled with CFB_NEED_SCREEN_PRIVATE */
-int cfb8_32GCPrivateIndex;
-int cfb8_32GetGCPrivateIndex(void) { return cfb8_32GCPrivateIndex; }
-int cfb8_32ScreenPrivateIndex;
-int cfb8_32GetScreenPrivateIndex(void) { return cfb8_32ScreenPrivateIndex; }
-static unsigned long cfb8_32Generation = 0;
+static DevPrivateKey cfb8_32GCPrivateKey = &cfb8_32GCPrivateKey;
+DevPrivateKey cfb8_32GetGCPrivateKey(void)
+{
+ return cfb8_32GCPrivateKey;
+}
+
+static DevPrivateKey cfb8_32ScreenPrivateKey = &cfb8_32ScreenPrivateKey;
+DevPrivateKey cfb8_32GetScreenPrivateKey(void)
+{
+ return cfb8_32ScreenPrivateKey;
+}
static Bool
cfb8_32AllocatePrivates(ScreenPtr pScreen)
{
cfb8_32ScreenPtr pScreenPriv;
- if(cfb8_32Generation != serverGeneration) {
- if(((cfb8_32GCPrivateIndex = AllocateGCPrivateIndex()) < 0) ||
- ((cfb8_32ScreenPrivateIndex = AllocateScreenPrivateIndex()) < 0))
- return FALSE;
- cfb8_32Generation = serverGeneration;
- }
-
if (!(pScreenPriv = xalloc(sizeof(cfb8_32ScreenRec))))
return FALSE;
- pScreen->devPrivates[cfb8_32ScreenPrivateIndex].ptr = (pointer)pScreenPriv;
+ dixSetPrivate(&pScreen->devPrivates, cfb8_32ScreenPrivateKey, pScreenPriv);
/* All cfb will have the same GC and Window private indicies */
- if(!mfbAllocatePrivates(pScreen, &cfbGCPrivateIndex))
+ if(!mfbAllocatePrivates(pScreen, &cfbGCPrivateKey))
return FALSE;
- if(!AllocateGCPrivate(pScreen, cfbGCPrivateIndex, sizeof(cfbPrivGC)))
+ if(!dixRequestPrivate(cfbGCPrivateKey, sizeof(cfbPrivGC)))
return FALSE;
- if(!AllocateGCPrivate(pScreen, cfb8_32GCPrivateIndex, sizeof(cfb8_32GCRec)))
+ if(!dixRequestPrivate(cfb8_32GCPrivateKey, sizeof(cfb8_32GCRec)))
return FALSE;
return TRUE;
@@ -160,7 +159,7 @@ cfb8_32CloseScreen (int i, ScreenPtr pScreen)
xfree(pScreenPriv->visualData);
xfree((pointer) pScreenPriv);
- pScreen->devPrivates[cfb8_32ScreenPrivateIndex].ptr = NULL;
+ dixSetPrivate(&pScreen->devPrivates, cfb8_32ScreenPrivateKey, NULL);
return(cfb32CloseScreen(i, pScreen));
}
diff --git a/hw/xfree86/xf8_32bpp/xf86overlay.c b/hw/xfree86/xf8_32bpp/xf86overlay.c
index 47b2b52db..c63b3cfd1 100644
--- a/hw/xfree86/xf8_32bpp/xf86overlay.c
+++ b/hw/xfree86/xf8_32bpp/xf86overlay.c
@@ -177,23 +177,22 @@ typedef struct {
} OverlayPixmapRec, *OverlayPixmapPtr;
-static int OverlayScreenIndex = -1;
-static int OverlayGCIndex = -1;
-static int OverlayPixmapIndex = -1;
-static unsigned long OverlayGeneration = 0;
+static DevPrivateKey OverlayScreenKey = &OverlayScreenKey;
+static DevPrivateKey OverlayGCKey = &OverlayGCKey;
+static DevPrivateKey OverlayPixmapKey = &OverlayPixmapKey;
/** Macros **/
#define TILE_EXISTS(pGC) (!(pGC)->tileIsPixel && (pGC)->tile.pixmap)
-#define OVERLAY_GET_PIXMAP_PRIVATE(pPix) \
- (OverlayPixmapPtr)((pPix)->devPrivates[OverlayPixmapIndex].ptr)
+#define OVERLAY_GET_PIXMAP_PRIVATE(pPix) ((OverlayPixmapPtr) \
+ dixLookupPrivate(&(pPix)->devPrivates, OverlayPixmapKey))
-#define OVERLAY_GET_SCREEN_PRIVATE(pScreen) \
- (OverlayScreenPtr)((pScreen)->devPrivates[OverlayScreenIndex].ptr)
+#define OVERLAY_GET_SCREEN_PRIVATE(pScreen) ((OverlayScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, OverlayScreenKey))
-#define OVERLAY_GET_GC_PRIVATE(pGC) \
- (OverlayGCPtr)((pGC)->devPrivates[OverlayGCIndex].ptr)
+#define OVERLAY_GET_GC_PRIVATE(pGC) ((OverlayGCPtr) \
+ dixLookupPrivate(&(pGC)->devPrivates, OverlayGCKey))
#define OVERLAY_GC_FUNC_PROLOGUE(pGC)\
OverlayGCPtr pGCPriv = OVERLAY_GET_GC_PRIVATE(pGC);\
@@ -255,26 +254,16 @@ xf86Overlay8Plus32Init (ScreenPtr pScreen)
{
OverlayScreenPtr pScreenPriv;
- if(OverlayGeneration != serverGeneration) {
- if(((OverlayScreenIndex = AllocateScreenPrivateIndex()) < 0) ||
- ((OverlayGCIndex = AllocateGCPrivateIndex()) < 0) ||
- ((OverlayPixmapIndex = AllocatePixmapPrivateIndex()) < 0))
- return FALSE;
-
- OverlayGeneration = serverGeneration;
- }
-
- if (!AllocateGCPrivate(pScreen, OverlayGCIndex, sizeof(OverlayGCRec)))
+ if (!dixRequestPrivate(OverlayGCKey, sizeof(OverlayGCRec)))
return FALSE;
- if (!AllocatePixmapPrivate(pScreen, OverlayPixmapIndex,
- sizeof(OverlayPixmapRec)))
+ if (!dixRequestPrivate(OverlayPixmapKey, sizeof(OverlayPixmapRec)))
return FALSE;
if (!(pScreenPriv = xalloc(sizeof(OverlayScreenRec))))
return FALSE;
- pScreen->devPrivates[OverlayScreenIndex].ptr = (pointer)pScreenPriv;
+ dixSetPrivate(&pScreen->devPrivates, OverlayScreenKey, pScreenPriv);
pScreenPriv->CreateGC = pScreen->CreateGC;
pScreenPriv->CloseScreen = pScreen->CloseScreen;