aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/common
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2009-09-09 05:23:48 +0000
committermarha <marha@users.sourceforge.net>2009-09-09 05:23:48 +0000
commit81f91c615982e50bb62708201569c33a3cd3d973 (patch)
tree4f32ecc48a3b7b5e76642f3792338263c53879bd /xorg-server/hw/xfree86/common
parentb571a562410f565af2bdde52d9f7f9a23ffae04f (diff)
parenta915739887477b28d924ecc8417ee107d125bd6c (diff)
downloadvcxsrv-81f91c615982e50bb62708201569c33a3cd3d973.tar.gz
vcxsrv-81f91c615982e50bb62708201569c33a3cd3d973.tar.bz2
vcxsrv-81f91c615982e50bb62708201569c33a3cd3d973.zip
svn merge https://vcxsrv.svn.sourceforge.net/svnroot/vcxsrv/branches/released .
Diffstat (limited to 'xorg-server/hw/xfree86/common')
-rw-r--r--xorg-server/hw/xfree86/common/Makefile.am38
-rw-r--r--xorg-server/hw/xfree86/common/Makefile.in159
-rw-r--r--xorg-server/hw/xfree86/common/compiler.h813
-rw-r--r--xorg-server/hw/xfree86/common/modeline2c.awk3
-rw-r--r--xorg-server/hw/xfree86/common/vidmodeproc.h77
-rw-r--r--xorg-server/hw/xfree86/common/xf86.h401
-rw-r--r--xorg-server/hw/xfree86/common/xf86AutoConfig.c145
-rw-r--r--xorg-server/hw/xfree86/common/xf86Bus.c1990
-rw-r--r--xorg-server/hw/xfree86/common/xf86Bus.h74
-rw-r--r--xorg-server/hw/xfree86/common/xf86Config.c135
-rw-r--r--xorg-server/hw/xfree86/common/xf86Config.h4
-rw-r--r--xorg-server/hw/xfree86/common/xf86Configure.c260
-rw-r--r--xorg-server/hw/xfree86/common/xf86Cursor.c5
-rw-r--r--xorg-server/hw/xfree86/common/xf86DGA.c271
-rw-r--r--xorg-server/hw/xfree86/common/xf86DPMS.c76
-rw-r--r--xorg-server/hw/xfree86/common/xf86Events.c213
-rw-r--r--xorg-server/hw/xfree86/common/xf86Globals.c21
-rw-r--r--xorg-server/hw/xfree86/common/xf86Helper.c426
-rw-r--r--xorg-server/hw/xfree86/common/xf86Init.c350
-rw-r--r--xorg-server/hw/xfree86/common/xf86Mode.c142
-rw-r--r--xorg-server/hw/xfree86/common/xf86Module.h40
-rw-r--r--xorg-server/hw/xfree86/common/xf86Opt.h82
-rw-r--r--xorg-server/hw/xfree86/common/xf86Option.c84
-rw-r--r--xorg-server/hw/xfree86/common/xf86PM.c11
-rw-r--r--xorg-server/hw/xfree86/common/xf86Priv.h161
-rw-r--r--xorg-server/hw/xfree86/common/xf86Privstr.h11
-rw-r--r--xorg-server/hw/xfree86/common/xf86RandR.c5
-rw-r--r--xorg-server/hw/xfree86/common/xf86ShowOpts.c3
-rw-r--r--xorg-server/hw/xfree86/common/xf86VGAarbiter.c1157
-rw-r--r--xorg-server/hw/xfree86/common/xf86VGAarbiter.h48
-rw-r--r--xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h266
-rw-r--r--xorg-server/hw/xfree86/common/xf86VidMode.c76
-rw-r--r--xorg-server/hw/xfree86/common/xf86Xinput.c369
-rw-r--r--xorg-server/hw/xfree86/common/xf86Xinput.h76
-rw-r--r--xorg-server/hw/xfree86/common/xf86cmap.c75
-rw-r--r--xorg-server/hw/xfree86/common/xf86cmap.h10
-rw-r--r--xorg-server/hw/xfree86/common/xf86fbBus.c22
-rw-r--r--xorg-server/hw/xfree86/common/xf86fbman.c70
-rw-r--r--xorg-server/hw/xfree86/common/xf86fbman.h34
-rw-r--r--xorg-server/hw/xfree86/common/xf86noBus.c13
-rw-r--r--xorg-server/hw/xfree86/common/xf86pciBus.c601
-rw-r--r--xorg-server/hw/xfree86/common/xf86pciBus.h36
-rw-r--r--xorg-server/hw/xfree86/common/xf86sbusBus.c48
-rw-r--r--xorg-server/hw/xfree86/common/xf86sbusBus.h53
-rw-r--r--xorg-server/hw/xfree86/common/xf86str.h187
-rw-r--r--xorg-server/hw/xfree86/common/xf86xv.c28
-rw-r--r--xorg-server/hw/xfree86/common/xf86xv.h31
-rw-r--r--xorg-server/hw/xfree86/common/xf86xvmc.c9
-rw-r--r--xorg-server/hw/xfree86/common/xf86xvmc.h9
-rw-r--r--xorg-server/hw/xfree86/common/xf86xvpriv.h3
-rw-r--r--xorg-server/hw/xfree86/common/xisb.c12
-rw-r--r--xorg-server/hw/xfree86/common/xisb.h12
-rw-r--r--xorg-server/hw/xfree86/common/xorgHelper.c2
53 files changed, 3556 insertions, 5691 deletions
diff --git a/xorg-server/hw/xfree86/common/Makefile.am b/xorg-server/hw/xfree86/common/Makefile.am
index b38c14a7d..ad27210cd 100644
--- a/xorg-server/hw/xfree86/common/Makefile.am
+++ b/xorg-server/hw/xfree86/common/Makefile.am
@@ -1,4 +1,3 @@
-noinst_LIBRARIES = libinit.a
noinst_LTLIBRARIES = libcommon.la
if XORG_BUS_SPARC
@@ -7,7 +6,15 @@ endif
if XV
XVSOURCES = xf86xv.c xf86xvmc.c
-XVSDKINCS = xf86xv.h xf86xvmc.h
+XVSDKINCS = xf86xv.h xf86xvmc.h xf86xvpriv.h
+endif
+
+if XF86VIDMODE
+XF86VMODE_SDK = vidmodeproc.h
+endif
+
+if DGA
+DGASOURCES = xf86DGA.c
endif
XISOURCES = xf86Xinput.c xisb.c
@@ -26,28 +33,26 @@ BUILT_SOURCES = xf86DefModeSet.c
AM_LDFLAGS = -r
libcommon_la_SOURCES = xf86Configure.c xf86ShowOpts.c xf86Bus.c xf86Config.c \
- xf86Cursor.c xf86DGA.c xf86DPMS.c \
+ xf86Cursor.c $(DGASOURCES) xf86DPMS.c \
xf86Events.c xf86Globals.c xf86AutoConfig.c \
- xf86Option.c \
+ xf86Option.c xf86Init.c xf86VGAarbiter.c \
xf86VidMode.c xf86fbman.c xf86cmap.c \
- xf86Helper.c xf86PM.c xf86RAC.c xf86Xinput.c xisb.c \
+ xf86Helper.c xf86PM.c xf86Xinput.c xisb.c \
xf86Mode.c xorgHelper.c \
$(XVSOURCES) $(BUSSOURCES) $(RANDRSOURCES)
-nodist_libcommon_la_SOURCES = xf86DefModeSet.c
-libinit_a_SOURCES = xf86Init.c
-nodist_libinit_a_SOURCES = xf86Build.h
+nodist_libcommon_la_SOURCES = xf86DefModeSet.c xf86Build.h
INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \
- -I$(srcdir)/../loader -I$(srcdir)/../rac -I$(srcdir)/../parser \
+ -I$(srcdir)/../loader -I$(srcdir)/../parser \
-I$(srcdir)/../vbe -I$(srcdir)/../int10 \
-I$(srcdir)/../vgahw -I$(srcdir)/../dixmods/extmod \
- -I$(srcdir)/../modes
+ -I$(srcdir)/../modes -I$(srcdir)/../ramdac
sdk_HEADERS = compiler.h fourcc.h xf86.h xf86Module.h xf86Opt.h \
- xf86PciInfo.h xf86Priv.h xf86Privstr.h xf86Resources.h \
- xf86cmap.h xf86fbman.h xf86str.h xf86RAC.h xf86Xinput.h xisb.h \
- $(XVSDKINCS) xorgVersion.h \
- xf86sbusBus.h xf86xvpriv.h
+ xf86PciInfo.h xf86Priv.h xf86Privstr.h \
+ xf86cmap.h xf86fbman.h xf86str.h xf86Xinput.h xisb.h \
+ $(XVSDKINCS) $(XF86VMODE_SDK) xorgVersion.h \
+ xf86sbusBus.h xf86VGAarbiter.h
DISTCLEANFILES = xf86Build.h
CLEANFILES = $(BUILT_SOURCES)
@@ -56,6 +61,7 @@ EXTRA_DIST = \
compiler.h \
fourcc.h \
scoasm.h \
+ vidmodeproc.h \
xf86.h \
xf86Bus.h \
xf86Config.h \
@@ -65,7 +71,6 @@ EXTRA_DIST = \
xf86PciInfo.h \
xf86Priv.h \
xf86Privstr.h \
- xf86Resources.h \
xf86Xinput.h \
xf86cmap.h \
xf86fbman.h \
@@ -76,9 +81,10 @@ EXTRA_DIST = \
xf86xvpriv.h \
xisb.h \
xorgVersion.h \
- xf86Date.h \
$(MODEDEFSOURCES) \
modeline2c.awk \
+ xf86VGAarbiter.h \
+ xf86VGAarbiterPriv.h \
$(DISTKBDSOURCES)
if LNXACPI
diff --git a/xorg-server/hw/xfree86/common/Makefile.in b/xorg-server/hw/xfree86/common/Makefile.in
index f4ec5a585..9c300e4c5 100644
--- a/xorg-server/hw/xfree86/common/Makefile.in
+++ b/xorg-server/hw/xfree86/common/Makefile.in
@@ -16,7 +16,6 @@
@SET_MAKE@
-
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
@@ -41,8 +40,11 @@ subdir = hw/xfree86/common
DIST_COMMON = $(am__sdk_HEADERS_DIST) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/xf86Build.h.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \
+ $(top_srcdir)/m4/dolt.m4 $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/m4/shave.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -52,38 +54,32 @@ CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
$(top_builddir)/include/xorg-config.h \
$(top_builddir)/include/xkb-config.h \
$(top_builddir)/include/xwin-config.h \
- $(top_builddir)/include/kdrive-config.h
+ $(top_builddir)/include/kdrive-config.h \
+ $(top_builddir)/include/version-config.h
CONFIG_CLEAN_FILES = xf86Build.h
CONFIG_CLEAN_VPATH_FILES =
-LIBRARIES = $(noinst_LIBRARIES)
-ARFLAGS = cru
-libinit_a_AR = $(AR) $(ARFLAGS)
-libinit_a_LIBADD =
-am_libinit_a_OBJECTS = xf86Init.$(OBJEXT)
-nodist_libinit_a_OBJECTS =
-libinit_a_OBJECTS = $(am_libinit_a_OBJECTS) \
- $(nodist_libinit_a_OBJECTS)
LTLIBRARIES = $(noinst_LTLIBRARIES)
libcommon_la_LIBADD =
am__libcommon_la_SOURCES_DIST = xf86Configure.c xf86ShowOpts.c \
xf86Bus.c xf86Config.c xf86Cursor.c xf86DGA.c xf86DPMS.c \
xf86Events.c xf86Globals.c xf86AutoConfig.c xf86Option.c \
- xf86VidMode.c xf86fbman.c xf86cmap.c xf86Helper.c xf86PM.c \
- xf86RAC.c xf86Xinput.c xisb.c xf86Mode.c xorgHelper.c xf86xv.c \
- xf86xvmc.c xf86pciBus.c xf86fbBus.c xf86noBus.c xf86sbusBus.c \
- xf86RandR.c
-@XV_TRUE@am__objects_1 = xf86xv.lo xf86xvmc.lo
-@XORG_BUS_SPARC_TRUE@am__objects_2 = xf86sbusBus.lo
-am__objects_3 = xf86pciBus.lo xf86fbBus.lo xf86noBus.lo \
- $(am__objects_2)
-am__objects_4 = xf86RandR.lo
+ xf86Init.c xf86VGAarbiter.c xf86VidMode.c xf86fbman.c \
+ xf86cmap.c xf86Helper.c xf86PM.c xf86Xinput.c xisb.c \
+ xf86Mode.c xorgHelper.c xf86xv.c xf86xvmc.c xf86pciBus.c \
+ xf86fbBus.c xf86noBus.c xf86sbusBus.c xf86RandR.c
+@DGA_TRUE@am__objects_1 = xf86DGA.lo
+@XV_TRUE@am__objects_2 = xf86xv.lo xf86xvmc.lo
+@XORG_BUS_SPARC_TRUE@am__objects_3 = xf86sbusBus.lo
+am__objects_4 = xf86pciBus.lo xf86fbBus.lo xf86noBus.lo \
+ $(am__objects_3)
+am__objects_5 = xf86RandR.lo
am_libcommon_la_OBJECTS = xf86Configure.lo xf86ShowOpts.lo xf86Bus.lo \
- xf86Config.lo xf86Cursor.lo xf86DGA.lo xf86DPMS.lo \
+ xf86Config.lo xf86Cursor.lo $(am__objects_1) xf86DPMS.lo \
xf86Events.lo xf86Globals.lo xf86AutoConfig.lo xf86Option.lo \
- xf86VidMode.lo xf86fbman.lo xf86cmap.lo xf86Helper.lo \
- xf86PM.lo xf86RAC.lo xf86Xinput.lo xisb.lo xf86Mode.lo \
- xorgHelper.lo $(am__objects_1) $(am__objects_3) \
- $(am__objects_4)
+ xf86Init.lo xf86VGAarbiter.lo xf86VidMode.lo xf86fbman.lo \
+ xf86cmap.lo xf86Helper.lo xf86PM.lo xf86Xinput.lo xisb.lo \
+ xf86Mode.lo xorgHelper.lo $(am__objects_2) $(am__objects_4) \
+ $(am__objects_5)
nodist_libcommon_la_OBJECTS = xf86DefModeSet.lo
libcommon_la_OBJECTS = $(am_libcommon_la_OBJECTS) \
$(nodist_libcommon_la_OBJECTS)
@@ -97,14 +93,13 @@ CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
-SOURCES = $(libinit_a_SOURCES) $(nodist_libinit_a_SOURCES) \
- $(libcommon_la_SOURCES) $(nodist_libcommon_la_SOURCES)
-DIST_SOURCES = $(libinit_a_SOURCES) $(am__libcommon_la_SOURCES_DIST)
+SOURCES = $(libcommon_la_SOURCES) $(nodist_libcommon_la_SOURCES)
+DIST_SOURCES = $(am__libcommon_la_SOURCES_DIST)
am__sdk_HEADERS_DIST = compiler.h fourcc.h xf86.h xf86Module.h \
- xf86Opt.h xf86PciInfo.h xf86Priv.h xf86Privstr.h \
- xf86Resources.h xf86cmap.h xf86fbman.h xf86str.h xf86RAC.h \
- xf86Xinput.h xisb.h xf86xv.h xf86xvmc.h xorgVersion.h \
- xf86sbusBus.h xf86xvpriv.h
+ xf86Opt.h xf86PciInfo.h xf86Priv.h xf86Privstr.h xf86cmap.h \
+ xf86fbman.h xf86str.h xf86Xinput.h xisb.h xf86xv.h xf86xvmc.h \
+ xf86xvpriv.h vidmodeproc.h xorgVersion.h xf86sbusBus.h \
+ xf86VGAarbiter.h
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -136,6 +131,7 @@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
ALLOCA = @ALLOCA@
AMTAR = @AMTAR@
+AM_MAKEFLAGS = @AM_MAKEFLAGS@
APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
APPLE_APPLICATION_ID = @APPLE_APPLICATION_ID@
APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@
@@ -156,9 +152,12 @@ CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
+CHANGELOG_CMD = @CHANGELOG_CMD@
COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CWARNFLAGS = @CWARNFLAGS@
+CXX = @CXX@
CYGPATH_W = @CYGPATH_W@
DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
@@ -187,7 +186,9 @@ DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
DRIPROTO_LIBS = @DRIPROTO_LIBS@
DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_CFLAGS = @DRI_CFLAGS@
DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DRI_LIBS = @DRI_LIBS@
DSYMUTIL = @DSYMUTIL@
DTRACE = @DTRACE@
DUMPBIN = @DUMPBIN@
@@ -196,9 +197,13 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
+F77 = @F77@
+FC = @FC@
FGREP = @FGREP@
FILE_MAN_DIR = @FILE_MAN_DIR@
FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_LIBS = @GLIB_LIBS@
GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
GLX_DEFINES = @GLX_DEFINES@
GL_CFLAGS = @GL_CFLAGS@
@@ -237,12 +242,13 @@ LTCOMPILE = @LTCOMPILE@
LTCXXCOMPILE = @LTCXXCOMPILE@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
+MAIN_LIB = @MAIN_LIB@
+MAKEFLAGS = @MAKEFLAGS@
MAKEINFO = @MAKEINFO@
MAKE_HTML = @MAKE_HTML@
MAKE_PDF = @MAKE_PDF@
MAKE_PS = @MAKE_PS@
MAKE_TEXT = @MAKE_TEXT@
-MESA_SOURCE = @MESA_SOURCE@
MISC_MAN_DIR = @MISC_MAN_DIR@
MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
MKDIR_P = @MKDIR_P@
@@ -262,7 +268,6 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
@@ -272,6 +277,7 @@ PERL = @PERL@
PKG_CONFIG = @PKG_CONFIG@
PROJECTROOT = @PROJECTROOT@
PS2PDF = @PS2PDF@
+Q = @Q@
RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
@@ -285,11 +291,10 @@ STRIP = @STRIP@
TSLIB_CFLAGS = @TSLIB_CFLAGS@
TSLIB_LIBS = @TSLIB_LIBS@
UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
-VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
-VENDOR_NAME = @VENDOR_NAME@
+V = @V@
VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
-VENDOR_RELEASE = @VENDOR_RELEASE@
VERSION = @VERSION@
+WINDRES = @WINDRES@
X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
XDMCP_CFLAGS = @XDMCP_CFLAGS@
@@ -325,6 +330,7 @@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
XORG_SYS_LIBS = @XORG_SYS_LIBS@
XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@
XPBPROXY_LIBS = @XPBPROXY_LIBS@
+XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@
XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
XSDL_INCS = @XSDL_INCS@
@@ -349,7 +355,6 @@ YFLAGS = @YFLAGS@
__XCONFIGFILE__ = @__XCONFIGFILE__@
abi_ansic = @abi_ansic@
abi_extension = @abi_extension@
-abi_font = @abi_font@
abi_videodrv = @abi_videodrv@
abi_xinput = @abi_xinput@
abs_builddir = @abs_builddir@
@@ -372,6 +377,7 @@ build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
+distcleancheck_listfiles = @distcleancheck_listfiles@
docdir = @docdir@
driverdir = @driverdir@
dvidir = @dvidir@
@@ -403,17 +409,20 @@ psdir = @psdir@
sbindir = @sbindir@
sdkdir = @sdkdir@
sharedstatedir = @sharedstatedir@
+shavedir = @shavedir@
srcdir = @srcdir@
+symbol_visibility = @symbol_visibility@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-noinst_LIBRARIES = libinit.a
noinst_LTLIBRARIES = libcommon.la
@XORG_BUS_SPARC_TRUE@SBUS_SOURCES = xf86sbusBus.c
@XV_TRUE@XVSOURCES = xf86xv.c xf86xvmc.c
-@XV_TRUE@XVSDKINCS = xf86xv.h xf86xvmc.h
+@XV_TRUE@XVSDKINCS = xf86xv.h xf86xvmc.h xf86xvpriv.h
+@XF86VIDMODE_TRUE@XF86VMODE_SDK = vidmodeproc.h
+@DGA_TRUE@DGASOURCES = xf86DGA.c
XISOURCES = xf86Xinput.c xisb.c
XISDKINCS = xf86Xinput.h xisb.h
RANDRSOURCES = xf86RandR.c
@@ -422,28 +431,26 @@ MODEDEFSOURCES = $(srcdir)/vesamodes $(srcdir)/extramodes
BUILT_SOURCES = xf86DefModeSet.c
AM_LDFLAGS = -r
libcommon_la_SOURCES = xf86Configure.c xf86ShowOpts.c xf86Bus.c xf86Config.c \
- xf86Cursor.c xf86DGA.c xf86DPMS.c \
+ xf86Cursor.c $(DGASOURCES) xf86DPMS.c \
xf86Events.c xf86Globals.c xf86AutoConfig.c \
- xf86Option.c \
+ xf86Option.c xf86Init.c xf86VGAarbiter.c \
xf86VidMode.c xf86fbman.c xf86cmap.c \
- xf86Helper.c xf86PM.c xf86RAC.c xf86Xinput.c xisb.c \
+ xf86Helper.c xf86PM.c xf86Xinput.c xisb.c \
xf86Mode.c xorgHelper.c \
$(XVSOURCES) $(BUSSOURCES) $(RANDRSOURCES)
-nodist_libcommon_la_SOURCES = xf86DefModeSet.c
-libinit_a_SOURCES = xf86Init.c
-nodist_libinit_a_SOURCES = xf86Build.h
+nodist_libcommon_la_SOURCES = xf86DefModeSet.c xf86Build.h
INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \
- -I$(srcdir)/../loader -I$(srcdir)/../rac -I$(srcdir)/../parser \
+ -I$(srcdir)/../loader -I$(srcdir)/../parser \
-I$(srcdir)/../vbe -I$(srcdir)/../int10 \
-I$(srcdir)/../vgahw -I$(srcdir)/../dixmods/extmod \
- -I$(srcdir)/../modes
+ -I$(srcdir)/../modes -I$(srcdir)/../ramdac
sdk_HEADERS = compiler.h fourcc.h xf86.h xf86Module.h xf86Opt.h \
- xf86PciInfo.h xf86Priv.h xf86Privstr.h xf86Resources.h \
- xf86cmap.h xf86fbman.h xf86str.h xf86RAC.h xf86Xinput.h xisb.h \
- $(XVSDKINCS) xorgVersion.h \
- xf86sbusBus.h xf86xvpriv.h
+ xf86PciInfo.h xf86Priv.h xf86Privstr.h \
+ xf86cmap.h xf86fbman.h xf86str.h xf86Xinput.h xisb.h \
+ $(XVSDKINCS) $(XF86VMODE_SDK) xorgVersion.h \
+ xf86sbusBus.h xf86VGAarbiter.h
DISTCLEANFILES = xf86Build.h
CLEANFILES = $(BUILT_SOURCES)
@@ -451,6 +458,7 @@ EXTRA_DIST = \
compiler.h \
fourcc.h \
scoasm.h \
+ vidmodeproc.h \
xf86.h \
xf86Bus.h \
xf86Config.h \
@@ -460,7 +468,6 @@ EXTRA_DIST = \
xf86PciInfo.h \
xf86Priv.h \
xf86Privstr.h \
- xf86Resources.h \
xf86Xinput.h \
xf86cmap.h \
xf86fbman.h \
@@ -471,9 +478,10 @@ EXTRA_DIST = \
xf86xvpriv.h \
xisb.h \
xorgVersion.h \
- xf86Date.h \
$(MODEDEFSOURCES) \
modeline2c.awk \
+ xf86VGAarbiter.h \
+ xf86VGAarbiterPriv.h \
$(DISTKBDSOURCES)
AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
@@ -515,13 +523,6 @@ $(am__aclocal_m4_deps):
xf86Build.h: $(top_builddir)/config.status $(srcdir)/xf86Build.h.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
-clean-noinstLIBRARIES:
- -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
-libinit.a: $(libinit_a_OBJECTS) $(libinit_a_DEPENDENCIES)
- -rm -f libinit.a
- $(libinit_a_AR) libinit.a $(libinit_a_OBJECTS) $(libinit_a_LIBADD)
- $(RANLIB) libinit.a
-
clean-noinstLTLIBRARIES:
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
@@ -550,13 +551,13 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Events.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Globals.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Helper.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Init.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Init.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Mode.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Option.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86PM.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86RAC.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86RandR.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86ShowOpts.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86VGAarbiter.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86VidMode.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Xinput.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86cmap.Plo@am__quote@
@@ -702,7 +703,7 @@ distdir: $(DISTFILES)
check-am: all-am
check: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) check-am
-all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(HEADERS)
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(sdkdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
@@ -738,8 +739,8 @@ maintainer-clean-generic:
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
clean: clean-am
-clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
- clean-noinstLTLIBRARIES mostlyclean-am
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
@@ -810,18 +811,18 @@ uninstall-am: uninstall-sdkHEADERS
.MAKE: all check install install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
- clean-libtool clean-noinstLIBRARIES clean-noinstLTLIBRARIES \
- ctags distclean distclean-compile distclean-generic \
- distclean-libtool distclean-tags distdir dvi dvi-am html \
- html-am info info-am install install-am install-data \
- install-data-am install-dvi install-dvi-am install-exec \
- install-exec-am install-html install-html-am install-info \
- install-info-am install-man install-pdf install-pdf-am \
- install-ps install-ps-am install-sdkHEADERS install-strip \
- installcheck installcheck-am installdirs maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-compile \
- mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- tags uninstall uninstall-am uninstall-sdkHEADERS
+ clean-libtool clean-noinstLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-sdkHEADERS install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-sdkHEADERS
xf86DefModeSet.c: $(srcdir)/modeline2c.awk $(MODEDEFSOURCES)
diff --git a/xorg-server/hw/xfree86/common/compiler.h b/xorg-server/hw/xfree86/common/compiler.h
index a14daea25..f5aa04ea9 100644
--- a/xorg-server/hw/xfree86/common/compiler.h
+++ b/xorg-server/hw/xfree86/common/compiler.h
@@ -55,6 +55,12 @@
# define DO_PROTOTYPES
#endif
+#ifndef _X_EXPORT
+# include <X11/Xfuncproto.h>
+#endif
+
+# include <pixman.h> /* for uint*_t types */
+
/* Allow drivers to use the GCC-supported __inline__ and/or __inline. */
# ifndef __inline__
# if defined(__GNUC__)
@@ -87,25 +93,26 @@
&& !(defined(__alpha__) && defined(linux)) \
&& !(defined(__ia64__) && defined(linux)) \
-extern void outb(unsigned short, unsigned char);
-extern void outw(unsigned short, unsigned short);
-extern void outl(unsigned short, unsigned int);
-extern unsigned int inb(unsigned short);
-extern unsigned int inw(unsigned short);
-extern unsigned int inl(unsigned short);
+extern _X_EXPORT void outb(unsigned short, unsigned char);
+extern _X_EXPORT void outw(unsigned short, unsigned short);
+extern _X_EXPORT void outl(unsigned short, unsigned int);
+extern _X_EXPORT unsigned int inb(unsigned short);
+extern _X_EXPORT unsigned int inw(unsigned short);
+extern _X_EXPORT unsigned int inl(unsigned short);
# else /* __sparc__, __arm32__, __alpha__*/
-extern void outb(unsigned long, unsigned char);
-extern void outw(unsigned long, unsigned short);
-extern void outl(unsigned long, unsigned int);
-extern unsigned int inb(unsigned long);
-extern unsigned int inw(unsigned long);
-extern unsigned int inl(unsigned long);
+extern _X_EXPORT void outb(unsigned long, unsigned char);
+extern _X_EXPORT void outw(unsigned long, unsigned short);
+extern _X_EXPORT void outl(unsigned long, unsigned int);
+extern _X_EXPORT unsigned int inb(unsigned long);
+extern _X_EXPORT unsigned int inw(unsigned long);
+extern _X_EXPORT unsigned int inl(unsigned long);
# endif /* __sparc__, __arm32__, __alpha__ */
# endif /* __arm__ */
+# if defined(__powerpc__) && !defined(__OpenBSD__)
extern unsigned long ldq_u(unsigned long *);
extern unsigned long ldl_u(unsigned int *);
extern unsigned long ldw_u(unsigned short *);
@@ -118,9 +125,186 @@ extern void stl_brx(unsigned long, volatile unsigned char *, int);
extern void stw_brx(unsigned short, volatile unsigned char *, int);
extern unsigned long ldl_brx(volatile unsigned char *, int);
extern unsigned short ldw_brx(volatile unsigned char *, int);
+# endif /* __powerpc__ && !__OpenBSD */
+
+# endif /* NO_INLINE || DO_PROTOTYPES */
+
+# ifndef NO_INLINE
+# ifdef __GNUC__
+# ifdef __i386__
+
+# ifdef __SSE__
+# define write_mem_barrier() __asm__ __volatile__ ("sfence" : : : "memory")
+# else
+# define write_mem_barrier() __asm__ __volatile__ ("lock; addl $0,0(%%esp)" : : : "memory")
+# endif
+
+# ifdef __SSE2__
+# define mem_barrier() __asm__ __volatile__ ("mfence" : : : "memory")
+# else
+# define mem_barrier() __asm__ __volatile__ ("lock; addl $0,0(%%esp)" : : : "memory")
+# endif
+
+# elif defined __alpha__
+
+# define mem_barrier() __asm__ __volatile__ ("mb" : : : "memory")
+# define write_mem_barrier() __asm__ __volatile__ ("wmb" : : : "memory")
+
+# elif defined __amd64__
+
+# define mem_barrier() __asm__ __volatile__ ("mfence" : : : "memory")
+# define write_mem_barrier() __asm__ __volatile__ ("sfence" : : : "memory")
+
+# elif defined __ia64__
+
+# ifndef __INTEL_COMPILER
+# define mem_barrier() __asm__ __volatile__ ("mf" : : : "memory")
+# define write_mem_barrier() __asm__ __volatile__ ("mf" : : : "memory")
+# else
+# include "ia64intrin.h"
+# define mem_barrier() __mf()
+# define write_mem_barrier() __mf()
+# endif
+
+# elif defined __mips__
+ /* Note: sync instruction requires MIPS II instruction set */
+# define mem_barrier() \
+ __asm__ __volatile__( \
+ ".set push\n\t" \
+ ".set noreorder\n\t" \
+ ".set mips2\n\t" \
+ "sync\n\t" \
+ ".set pop" \
+ : /* no output */ \
+ : /* no input */ \
+ : "memory")
+# define write_mem_barrier() mem_barrier()
+
+# elif defined __powerpc__
+
+# if defined(linux) && defined(__powerpc64__)
+# include <linux/version.h>
+# if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
+# include <asm/memory.h>
+# endif
+# endif /* defined(linux) && defined(__powerpc64__) */
+
+# ifndef eieio /* We deal with arch-specific eieio() routines above... */
+# define eieio() __asm__ __volatile__ ("eieio" ::: "memory")
+# endif /* eieio */
+# define mem_barrier() eieio()
+# define write_mem_barrier() eieio()
+# elif defined __sparc__
+
+# define barrier() __asm__ __volatile__ (".word 0x8143e00a" : : : "memory")
+# define mem_barrier() /* XXX: nop for now */
+# define write_mem_barrier() /* XXX: nop for now */
+# endif
+# endif /* __GNUC__ */
+# endif /* NO_INLINE */
+
+# ifndef mem_barrier
+# define mem_barrier() /* NOP */
+# endif
+
+# ifndef write_mem_barrier
+# define write_mem_barrier() /* NOP */
# endif
+
+# ifndef NO_INLINE
+# ifdef __GNUC__
+
+/* Define some packed structures to use with unaligned accesses */
+
+struct __una_u64 { uint64_t x __attribute__((packed)); };
+struct __una_u32 { uint32_t x __attribute__((packed)); };
+struct __una_u16 { uint16_t x __attribute__((packed)); };
+
+/* Elemental unaligned loads */
+
+static __inline__ uint64_t ldq_u(uint64_t *p)
+{
+ const struct __una_u64 *ptr = (const struct __una_u64 *) p;
+ return ptr->x;
+}
+
+static __inline__ uint32_t ldl_u(uint32_t *p)
+{
+ const struct __una_u32 *ptr = (const struct __una_u32 *) p;
+ return ptr->x;
+}
+
+static __inline__ uint16_t ldw_u(uint16_t *p)
+{
+ const struct __una_u16 *ptr = (const struct __una_u16 *) p;
+ return ptr->x;
+}
+
+/* Elemental unaligned stores */
+
+static __inline__ void stq_u(uint64_t val, uint64_t *p)
+{
+ struct __una_u64 *ptr = (struct __una_u64 *) p;
+ ptr->x = val;
+}
+
+static __inline__ void stl_u(uint32_t val, uint32_t *p)
+{
+ struct __una_u32 *ptr = (struct __una_u32 *) p;
+ ptr->x = val;
+}
+
+static __inline__ void stw_u(uint16_t val, uint16_t *p)
+{
+ struct __una_u16 *ptr = (struct __una_u16 *) p;
+ ptr->x = val;
+}
+# else /* !__GNUC__ */
+
+static __inline__ uint64_t ldq_u(uint64_t *p)
+{
+ uint64_t ret;
+ memmove(&ret, p, sizeof(*p));
+ return ret;
+}
+
+static __inline__ uint32_t ldl_u(uint32_t *p)
+{
+ uint32_t ret;
+ memmove(&ret, p, sizeof(*p));
+ return ret;
+}
+
+static __inline__ uint16_t ldw_u(uint16_t *p)
+{
+ uint16_t ret;
+ memmove(&ret, p, sizeof(*p));
+ return ret;
+}
+
+static __inline__ void stq_u(uint64_t val, uint64_t *p)
+{
+ uint64_t tmp = val;
+ memmove(p, &tmp, sizeof(*p));
+}
+
+static __inline__ void stl_u(uint32_t val, uint32_t *p)
+{
+ uint32_t tmp = val;
+ memmove(p, &tmp, sizeof(*p));
+}
+
+static __inline__ void stw_u(uint16_t val, uint16_t *p)
+{
+ uint16_t tmp = val;
+ memmove(p, &tmp, sizeof(*p));
+}
+
+# endif /* __GNUC__ */
+# endif /* NO_INLINE */
+
# ifndef NO_INLINE
# ifdef __GNUC__
# if (defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)) && (defined(__alpha__))
@@ -130,42 +314,42 @@ extern unsigned short ldw_brx(volatile unsigned char *, int);
/* note that the appropriate setup via "ioperm" needs to be done */
/* *before* any inx/outx is done. */
-extern void (*_alpha_outb)(char val, unsigned long port);
+extern _X_EXPORT void (*_alpha_outb)(char val, unsigned long port);
static __inline__ void
outb(unsigned long port, unsigned char val)
{
_alpha_outb(val, port);
}
-extern void (*_alpha_outw)(short val, unsigned long port);
+extern _X_EXPORT void (*_alpha_outw)(short val, unsigned long port);
static __inline__ void
outw(unsigned long port, unsigned short val)
{
_alpha_outw(val, port);
}
-extern void (*_alpha_outl)(int val, unsigned long port);
+extern _X_EXPORT void (*_alpha_outl)(int val, unsigned long port);
static __inline__ void
outl(unsigned long port, unsigned int val)
{
_alpha_outl(val, port);
}
-extern unsigned int (*_alpha_inb)(unsigned long port);
+extern _X_EXPORT unsigned int (*_alpha_inb)(unsigned long port);
static __inline__ unsigned int
inb(unsigned long port)
{
return _alpha_inb(port);
}
-extern unsigned int (*_alpha_inw)(unsigned long port);
+extern _X_EXPORT unsigned int (*_alpha_inw)(unsigned long port);
static __inline__ unsigned int
inw(unsigned long port)
{
return _alpha_inw(port);
}
-extern unsigned int (*_alpha_inl)(unsigned long port);
+extern _X_EXPORT unsigned int (*_alpha_inl)(unsigned long port);
static __inline__ unsigned int
inl(unsigned long port)
{
@@ -182,12 +366,12 @@ inl(unsigned long port)
/* note that the appropriate setup via "ioperm" needs to be done */
/* *before* any inx/outx is done. */
-extern void outb(unsigned int port, unsigned char val);
-extern void outw(unsigned int port, unsigned short val);
-extern void outl(unsigned int port, unsigned int val);
-extern unsigned char inb(unsigned int port);
-extern unsigned short inw(unsigned int port);
-extern unsigned int inl(unsigned int port);
+extern _X_EXPORT void outb(unsigned int port, unsigned char val);
+extern _X_EXPORT void outw(unsigned int port, unsigned short val);
+extern _X_EXPORT void outl(unsigned int port, unsigned int val);
+extern _X_EXPORT unsigned char inb(unsigned int port);
+extern _X_EXPORT unsigned short inw(unsigned int port);
+extern _X_EXPORT unsigned int inl(unsigned int port);
# endif /* (__FreeBSD__ || __OpenBSD__ ) && !DO_PROTOTYPES */
@@ -196,292 +380,29 @@ extern unsigned int inl(unsigned int port);
#include <machine/pio.h>
#endif /* __NetBSD__ */
-/*
- * inline functions to do unaligned accesses
- * from linux/include/asm-alpha/unaligned.h
- */
-
-/*
- * EGCS 1.1 knows about arbitrary unaligned loads. Define some
- * packed structures to talk about such things with.
- */
-
-struct __una_u64 { unsigned long x __attribute__((packed)); };
-struct __una_u32 { unsigned int x __attribute__((packed)); };
-struct __una_u16 { unsigned short x __attribute__((packed)); };
-
-/*
- * Elemental unaligned loads
- */
-/* let's try making these things static */
-
-static __inline__ unsigned long ldq_u(unsigned long * r11)
-{
-# if defined(__GNUC__)
- const struct __una_u64 *ptr = (const struct __una_u64 *) r11;
- return ptr->x;
-# else
- unsigned long r1,r2;
- __asm__("ldq_u %0,%3\n\t"
- "ldq_u %1,%4\n\t"
- "extql %0,%2,%0\n\t"
- "extqh %1,%2,%1"
- :"=&r" (r1), "=&r" (r2)
- :"r" (r11),
- "m" (*r11),
- "m" (*(const unsigned long *)(7+(char *) r11)));
- return r1 | r2;
-# endif
-}
-
-static __inline__ unsigned long ldl_u(unsigned int * r11)
-{
-# if defined(__GNUC__)
- const struct __una_u32 *ptr = (const struct __una_u32 *) r11;
- return ptr->x;
-# else
- unsigned long r1,r2;
- __asm__("ldq_u %0,%3\n\t"
- "ldq_u %1,%4\n\t"
- "extll %0,%2,%0\n\t"
- "extlh %1,%2,%1"
- :"=&r" (r1), "=&r" (r2)
- :"r" (r11),
- "m" (*r11),
- "m" (*(const unsigned long *)(3+(char *) r11)));
- return r1 | r2;
-# endif
-}
-
-static __inline__ unsigned long ldw_u(unsigned short * r11)
-{
-# if defined(__GNUC__)
- const struct __una_u16 *ptr = (const struct __una_u16 *) r11;
- return ptr->x;
-# else
- unsigned long r1,r2;
- __asm__("ldq_u %0,%3\n\t"
- "ldq_u %1,%4\n\t"
- "extwl %0,%2,%0\n\t"
- "extwh %1,%2,%1"
- :"=&r" (r1), "=&r" (r2)
- :"r" (r11),
- "m" (*r11),
- "m" (*(const unsigned long *)(1+(char *) r11)));
- return r1 | r2;
-# endif
-}
-
-/*
- * Elemental unaligned stores
- */
-
-static __inline__ void stq_u(unsigned long r5, unsigned long * r11)
-{
-# if defined(__GNUC__)
- struct __una_u64 *ptr = (struct __una_u64 *) r11;
- ptr->x = r5;
-# else
- unsigned long r1,r2,r3,r4;
-
- __asm__("ldq_u %3,%1\n\t"
- "ldq_u %2,%0\n\t"
- "insqh %6,%7,%5\n\t"
- "insql %6,%7,%4\n\t"
- "mskqh %3,%7,%3\n\t"
- "mskql %2,%7,%2\n\t"
- "bis %3,%5,%3\n\t"
- "bis %2,%4,%2\n\t"
- "stq_u %3,%1\n\t"
- "stq_u %2,%0"
- :"=m" (*r11),
- "=m" (*(unsigned long *)(7+(char *) r11)),
- "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4)
- :"r" (r5), "r" (r11));
-# endif
-}
-
-static __inline__ void stl_u(unsigned long r5, unsigned int * r11)
-{
-# if defined(__GNUC__)
- struct __una_u32 *ptr = (struct __una_u32 *) r11;
- ptr->x = r5;
-# else
- unsigned long r1,r2,r3,r4;
-
- __asm__("ldq_u %3,%1\n\t"
- "ldq_u %2,%0\n\t"
- "inslh %6,%7,%5\n\t"
- "insll %6,%7,%4\n\t"
- "msklh %3,%7,%3\n\t"
- "mskll %2,%7,%2\n\t"
- "bis %3,%5,%3\n\t"
- "bis %2,%4,%2\n\t"
- "stq_u %3,%1\n\t"
- "stq_u %2,%0"
- :"=m" (*r11),
- "=m" (*(unsigned long *)(3+(char *) r11)),
- "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4)
- :"r" (r5), "r" (r11));
-# endif
-}
-
-static __inline__ void stw_u(unsigned long r5, unsigned short * r11)
-{
-# if defined(__GNUC__)
- struct __una_u16 *ptr = (struct __una_u16 *) r11;
- ptr->x = r5;
-# else
- unsigned long r1,r2,r3,r4;
-
- __asm__("ldq_u %3,%1\n\t"
- "ldq_u %2,%0\n\t"
- "inswh %6,%7,%5\n\t"
- "inswl %6,%7,%4\n\t"
- "mskwh %3,%7,%3\n\t"
- "mskwl %2,%7,%2\n\t"
- "bis %3,%5,%3\n\t"
- "bis %2,%4,%2\n\t"
- "stq_u %3,%1\n\t"
- "stq_u %2,%0"
- :"=m" (*r11),
- "=m" (*(unsigned long *)(1+(char *) r11)),
- "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4)
- :"r" (r5), "r" (r11));
-# endif
-}
-
-/* to flush the I-cache before jumping to code which just got loaded */
-# define PAL_imb 134
-# define istream_mem_barrier() \
- __asm__ __volatile__("call_pal %0 #imb" : : "i" (PAL_imb) : "memory")
-# define mem_barrier() __asm__ __volatile__("mb" : : : "memory")
-# ifdef __ELF__
-# define write_mem_barrier() __asm__ __volatile__("wmb" : : : "memory")
-# else /* ECOFF gas 2.6 doesn't know "wmb" :-( */
-# define write_mem_barrier() mem_barrier()
-# endif
-
-
# elif defined(linux) && defined(__ia64__)
# include <inttypes.h>
# include <sys/io.h>
-struct __una_u64 { uint64_t x __attribute__((packed)); };
-struct __una_u32 { uint32_t x __attribute__((packed)); };
-struct __una_u16 { uint16_t x __attribute__((packed)); };
-
-static __inline__ unsigned long
-__uldq (const unsigned long * r11)
-{
- const struct __una_u64 *ptr = (const struct __una_u64 *) r11;
- return ptr->x;
-}
-
-static __inline__ unsigned long
-__uldl (const unsigned int * r11)
-{
- const struct __una_u32 *ptr = (const struct __una_u32 *) r11;
- return ptr->x;
-}
-
-static __inline__ unsigned long
-__uldw (const unsigned short * r11)
-{
- const struct __una_u16 *ptr = (const struct __una_u16 *) r11;
- return ptr->x;
-}
-
-static __inline__ void
-__ustq (unsigned long r5, unsigned long * r11)
-{
- struct __una_u64 *ptr = (struct __una_u64 *) r11;
- ptr->x = r5;
-}
-
-static __inline__ void
-__ustl (unsigned long r5, unsigned int * r11)
-{
- struct __una_u32 *ptr = (struct __una_u32 *) r11;
- ptr->x = r5;
-}
-
-static __inline__ void
-__ustw (unsigned long r5, unsigned short * r11)
-{
- struct __una_u16 *ptr = (struct __una_u16 *) r11;
- ptr->x = r5;
-}
-
-# define ldq_u(p) __uldq(p)
-# define ldl_u(p) __uldl(p)
-# define ldw_u(p) __uldw(p)
-# define stq_u(v,p) __ustq(v,p)
-# define stl_u(v,p) __ustl(v,p)
-# define stw_u(v,p) __ustw(v,p)
-
-# ifndef __INTEL_COMPILER
-# define mem_barrier() __asm__ __volatile__ ("mf" ::: "memory")
-# define write_mem_barrier() __asm__ __volatile__ ("mf" ::: "memory")
-# else
-# include "ia64intrin.h"
-# define mem_barrier() __mf()
-# define write_mem_barrier() __mf()
-# endif
-
-/*
- * This is overkill, but for different reasons depending on where it is used.
- * This is thus general enough to be used everywhere cache flushes are needed.
- * It doesn't handle memory access serialisation by other processors, though.
- */
-# ifndef __INTEL_COMPILER
-# define ia64_flush_cache(Addr) \
- __asm__ __volatile__ ( \
- "fc.i %0;;;" \
- "sync.i;;;" \
- "mf;;;" \
- "srlz.i;;;" \
- :: "r"(Addr) : "memory")
-# else
-# define ia64_flush_cache(Addr) { \
- __fc(Addr);\
- __synci();\
- __mf();\
- __isrlz();\
- }
-# endif
# undef outb
# undef outw
# undef outl
# undef inb
# undef inw
# undef inl
-extern void outb(unsigned long port, unsigned char val);
-extern void outw(unsigned long port, unsigned short val);
-extern void outl(unsigned long port, unsigned int val);
-extern unsigned int inb(unsigned long port);
-extern unsigned int inw(unsigned long port);
-extern unsigned int inl(unsigned long port);
+extern _X_EXPORT void outb(unsigned long port, unsigned char val);
+extern _X_EXPORT void outw(unsigned long port, unsigned short val);
+extern _X_EXPORT void outl(unsigned long port, unsigned int val);
+extern _X_EXPORT unsigned int inb(unsigned long port);
+extern _X_EXPORT unsigned int inw(unsigned long port);
+extern _X_EXPORT unsigned int inl(unsigned long port);
-# elif defined(linux) && defined(__amd64__)
+# elif (defined(linux) || defined(__FreeBSD__)) && defined(__amd64__)
# include <inttypes.h>
-# define ldq_u(p) (*((unsigned long *)(p)))
-# define ldl_u(p) (*((unsigned int *)(p)))
-# define ldw_u(p) (*((unsigned short *)(p)))
-# define stq_u(v,p) (*(unsigned long *)(p)) = (v)
-# define stl_u(v,p) (*(unsigned int *)(p)) = (v)
-# define stw_u(v,p) (*(unsigned short *)(p)) = (v)
-
-# define mem_barrier() \
- __asm__ __volatile__ ("lock; addl $0,0(%%rsp)": : :"memory")
-# define write_mem_barrier() \
- __asm__ __volatile__ ("": : :"memory")
-
-
static __inline__ void
outb(unsigned short port, unsigned char val)
{
@@ -537,8 +458,6 @@ inl(unsigned short port)
# define ASI_PL 0x88
# endif
-# define barrier() __asm__ __volatile__(".word 0x8143e00a": : :"memory")
-
static __inline__ void
outb(unsigned long port, unsigned char val)
{
@@ -771,98 +690,6 @@ xf86WriteMmio32LeNB(__volatile__ void *base, const unsigned long offset,
: "r" (val), "r" (addr), "i" (ASI_PL));
}
-
-/*
- * EGCS 1.1 knows about arbitrary unaligned loads. Define some
- * packed structures to talk about such things with.
- */
-
-# if defined(__arch64__) || defined(__sparcv9)
-struct __una_u64 { unsigned long x __attribute__((packed)); };
-# endif
-struct __una_u32 { unsigned int x __attribute__((packed)); };
-struct __una_u16 { unsigned short x __attribute__((packed)); };
-
-static __inline__ unsigned long ldq_u(unsigned long *p)
-{
-# if defined(__GNUC__)
-# if defined(__arch64__) || defined(__sparcv9)
- const struct __una_u64 *ptr = (const struct __una_u64 *) p;
-# else
- const struct __una_u32 *ptr = (const struct __una_u32 *) p;
-# endif
- return ptr->x;
-# else
- unsigned long ret;
- memmove(&ret, p, sizeof(*p));
- return ret;
-# endif
-}
-
-static __inline__ unsigned long ldl_u(unsigned int *p)
-{
-# if defined(__GNUC__)
- const struct __una_u32 *ptr = (const struct __una_u32 *) p;
- return ptr->x;
-# else
- unsigned int ret;
- memmove(&ret, p, sizeof(*p));
- return ret;
-# endif
-}
-
-static __inline__ unsigned long ldw_u(unsigned short *p)
-{
-# if defined(__GNUC__)
- const struct __una_u16 *ptr = (const struct __una_u16 *) p;
- return ptr->x;
-# else
- unsigned short ret;
- memmove(&ret, p, sizeof(*p));
- return ret;
-# endif
-}
-
-static __inline__ void stq_u(unsigned long val, unsigned long *p)
-{
-# if defined(__GNUC__)
-# if defined(__arch64__) || defined(__sparcv9)
- struct __una_u64 *ptr = (struct __una_u64 *) p;
-# else
- struct __una_u32 *ptr = (struct __una_u32 *) p;
-# endif
- ptr->x = val;
-# else
- unsigned long tmp = val;
- memmove(p, &tmp, sizeof(*p));
-# endif
-}
-
-static __inline__ void stl_u(unsigned long val, unsigned int *p)
-{
-# if defined(__GNUC__)
- struct __una_u32 *ptr = (struct __una_u32 *) p;
- ptr->x = val;
-# else
- unsigned int tmp = val;
- memmove(p, &tmp, sizeof(*p));
-# endif
-}
-
-static __inline__ void stw_u(unsigned long val, unsigned short *p)
-{
-# if defined(__GNUC__)
- struct __una_u16 *ptr = (struct __una_u16 *) p;
- ptr->x = val;
-# else
- unsigned short tmp = val;
- memmove(p, &tmp, sizeof(*p));
-# endif
-}
-
-# define mem_barrier() /* XXX: nop for now */
-# define write_mem_barrier() /* XXX: nop for now */
-
# elif defined(__mips__) || (defined(__arm32__) && !defined(__linux__))
# ifdef __arm32__
# define PORT_SIZE long
@@ -870,7 +697,7 @@ static __inline__ void stw_u(unsigned long val, unsigned short *p)
# define PORT_SIZE short
# endif
-unsigned int IOPortBase; /* Memory mapped I/O port area */
+_X_EXPORT unsigned int IOPortBase; /* Memory mapped I/O port area */
static __inline__ void
outb(unsigned PORT_SIZE port, unsigned char val)
@@ -910,65 +737,7 @@ inl(unsigned PORT_SIZE port)
# if defined(__mips__)
-static __inline__ unsigned long ldq_u(unsigned long * r11)
-{
- unsigned long r1;
- __asm__("lwr %0,%2\n\t"
- "lwl %0,%3\n\t"
- :"=&r" (r1)
- :"r" (r11),
- "m" (*r11),
- "m" (*(unsigned long *)(3+(char *) r11)));
- return r1;
-}
-
-static __inline__ unsigned long ldl_u(unsigned int * r11)
-{
- unsigned long r1;
- __asm__("lwr %0,%2\n\t"
- "lwl %0,%3\n\t"
- :"=&r" (r1)
- :"r" (r11),
- "m" (*r11),
- "m" (*(unsigned long *)(3+(char *) r11)));
- return r1;
-}
-
-static __inline__ unsigned long ldw_u(unsigned short * r11)
-{
- unsigned long r1;
- __asm__("lwr %0,%2\n\t"
- "lwl %0,%3\n\t"
- :"=&r" (r1)
- :"r" (r11),
- "m" (*r11),
- "m" (*(unsigned long *)(1+(char *) r11)));
- return r1;
-}
-
# ifdef linux /* don't mess with other OSs */
-
-/*
- * EGCS 1.1 knows about arbitrary unaligned loads (and we don't support older
- * versions anyway. Define some packed structures to talk about such things
- * with.
- */
-
-struct __una_u32 { unsigned int x __attribute__((packed)); };
-struct __una_u16 { unsigned short x __attribute__((packed)); };
-
-static __inline__ void stw_u(unsigned long val, unsigned short *p)
-{
- struct __una_u16 *ptr = (struct __una_u16 *) p;
- ptr->x = val;
-}
-
-static __inline__ void stl_u(unsigned long val, unsigned int *p)
-{
- struct __una_u32 *ptr = (struct __una_u32 *) p;
- ptr->x = val;
-}
-
# if X_BYTE_ORDER == X_BIG_ENDIAN
static __inline__ unsigned int
xf86ReadMmio32Be(__volatile__ void *base, const unsigned long offset)
@@ -993,62 +762,16 @@ xf86WriteMmio32Be(__volatile__ void *base, const unsigned long offset,
: "r" (val), "r" (addr));
}
# endif
-
-# define mem_barrier() \
- __asm__ __volatile__( \
- "# prevent instructions being moved around\n\t" \
- ".set\tnoreorder\n\t" \
- "# 8 nops to fool the R4400 pipeline\n\t" \
- "nop;nop;nop;nop;nop;nop;nop;nop\n\t" \
- ".set\treorder" \
- : /* no output */ \
- : /* no input */ \
- : "memory")
-# define write_mem_barrier() mem_barrier()
-
-# else /* !linux */
-
-# define stq_u(v,p) stl_u(v,p)
-# define stl_u(v,p) (*(unsigned char *)(p)) = (v); \
- (*(unsigned char *)(p)+1) = ((v) >> 8); \
- (*(unsigned char *)(p)+2) = ((v) >> 16); \
- (*(unsigned char *)(p)+3) = ((v) >> 24)
-
-# define stw_u(v,p) (*(unsigned char *)(p)) = (v); \
- (*(unsigned char *)(p)+1) = ((v) >> 8)
-
-# define mem_barrier() /* NOP */
# endif /* !linux */
# endif /* __mips__ */
-# if defined(__arm32__)
-# define ldq_u(p) (*((unsigned long *)(p)))
-# define ldl_u(p) (*((unsigned int *)(p)))
-# define ldw_u(p) (*((unsigned short *)(p)))
-# define stq_u(v,p) (*(unsigned long *)(p)) = (v)
-# define stl_u(v,p) (*(unsigned int *)(p)) = (v)
-# define stw_u(v,p) (*(unsigned short *)(p)) = (v)
-# define mem_barrier() /* NOP */
-# define write_mem_barrier() /* NOP */
-# endif /* __arm32__ */
-
# elif (defined(linux) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)) && defined(__powerpc__)
# ifndef MAP_FAILED
# define MAP_FAILED ((void *)-1)
# endif
-extern volatile unsigned char *ioBase;
-
-#if defined(linux) && defined(__powerpc64__)
-# include <linux/version.h>
-# if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
-# include <asm/memory.h>
-# endif
-#endif /* defined(linux) && defined(__powerpc64__) */
-#ifndef eieio /* We deal with arch-specific eieio() routines above... */
-# define eieio() __asm__ __volatile__ ("eieio" ::: "memory")
-#endif /* eieio */
+extern _X_EXPORT volatile unsigned char *ioBase;
static __inline__ unsigned char
xf86ReadMmio8(__volatile__ void *base, const unsigned long offset)
@@ -1248,36 +971,8 @@ inl(unsigned short port)
return xf86ReadMmio32Le((void *)ioBase, port);
}
-# define ldq_u(p) ldl_u(p)
-# define ldl_u(p) ((*(unsigned char *)(p)) | \
- (*((unsigned char *)(p)+1)<<8) | \
- (*((unsigned char *)(p)+2)<<16) | \
- (*((unsigned char *)(p)+3)<<24))
-# define ldw_u(p) ((*(unsigned char *)(p)) | \
- (*((unsigned char *)(p)+1)<<8))
-
-# define stq_u(v,p) stl_u(v,p)
-# define stl_u(v,p) (*(unsigned char *)(p)) = (v); \
- (*((unsigned char *)(p)+1)) = ((v) >> 8); \
- (*((unsigned char *)(p)+2)) = ((v) >> 16); \
- (*((unsigned char *)(p)+3)) = ((v) >> 24)
-# define stw_u(v,p) (*(unsigned char *)(p)) = (v); \
- (*((unsigned char *)(p)+1)) = ((v) >> 8)
-
-# define mem_barrier() eieio()
-# define write_mem_barrier() eieio()
-
#elif defined(__arm__) && defined(__linux__)
-#define ldq_u(p) (*((unsigned long *)(p)))
-#define ldl_u(p) (*((unsigned int *)(p)))
-#define ldw_u(p) (*((unsigned short *)(p)))
-#define stq_u(v,p) (*(unsigned long *)(p)) = (v)
-#define stl_u(v,p) (*(unsigned int *)(p)) = (v)
-#define stw_u(v,p) (*(unsigned short *)(p)) = (v)
-#define mem_barrier() /* NOP */
-#define write_mem_barrier() /* NOP */
-
/* for Linux on ARM, we use the LIBC inx/outx routines */
/* note that the appropriate setup via "ioperm" needs to be done */
/* *before* any inx/outx is done. */
@@ -1306,27 +1001,8 @@ xf_outl(unsigned short port, unsigned int val)
#define outw xf_outw
#define outl xf_outl
-#define arm_flush_cache(addr) \
-do { \
- register unsigned long _beg __asm ("a1") = (unsigned long) (addr); \
- register unsigned long _end __asm ("a2") = (unsigned long) (addr) + 4;\
- register unsigned long _flg __asm ("a3") = 0; \
- __asm __volatile ("swi 0x9f0002 @ sys_cacheflush" \
- : "=r" (_beg) \
- : "0" (_beg), "r" (_end), "r" (_flg)); \
-} while (0)
-
# else /* ix86 */
-# define ldq_u(p) (*((unsigned long *)(p)))
-# define ldl_u(p) (*((unsigned int *)(p)))
-# define ldw_u(p) (*((unsigned short *)(p)))
-# define stq_u(v,p) (*(unsigned long *)(p)) = (v)
-# define stl_u(v,p) (*(unsigned int *)(p)) = (v)
-# define stw_u(v,p) (*(unsigned short *)(p)) = (v)
-# define mem_barrier() /* NOP */
-# define write_mem_barrier() /* NOP */
-
# if !defined(__SUNPRO_C)
# if !defined(FAKEIT) && !defined(__mc68000__) && !defined(__arm__) && !defined(__sh__) && !defined(__hppa__) && !defined(__s390__) && !defined(__m32r__)
# ifdef GCCUSESGAS
@@ -1508,41 +1184,31 @@ inl(unsigned short port)
# pragma asm partial_optimization inw
# pragma asm partial_optimization inb
# endif
-# define ldq_u(p) (*((unsigned long *)(p)))
-# define ldl_u(p) (*((unsigned int *)(p)))
-# define ldw_u(p) (*((unsigned short *)(p)))
-# define stq_u(v,p) (*(unsigned long *)(p)) = (v)
-# define stl_u(v,p) (*(unsigned int *)(p)) = (v)
-# define stw_u(v,p) (*(unsigned short *)(p)) = (v)
-# define mem_barrier() /* NOP */
-# define write_mem_barrier() /* NOP */
# endif /* __GNUC__ */
# endif /* NO_INLINE */
# ifdef __alpha__
/* entry points for Mmio memory access routines */
-extern int (*xf86ReadMmio8)(void *, unsigned long);
-extern int (*xf86ReadMmio16)(void *, unsigned long);
+extern _X_EXPORT int (*xf86ReadMmio8)(void *, unsigned long);
+extern _X_EXPORT int (*xf86ReadMmio16)(void *, unsigned long);
# ifndef STANDALONE_MMIO
-extern int (*xf86ReadMmio32)(void *, unsigned long);
+extern _X_EXPORT int (*xf86ReadMmio32)(void *, unsigned long);
# else
/* Some DRI 3D drivers need MMIO_IN32. */
static __inline__ int
xf86ReadMmio32(void *Base, unsigned long Offset)
{
- __asm__ __volatile__("mb" : : : "memory");
+ mem_barrier();
return *(volatile unsigned int*)((unsigned long)Base+(Offset));
}
# endif
-extern void (*xf86WriteMmio8)(int, void *, unsigned long);
-extern void (*xf86WriteMmio16)(int, void *, unsigned long);
-extern void (*xf86WriteMmio32)(int, void *, unsigned long);
-extern void (*xf86WriteMmioNB8)(int, void *, unsigned long);
-extern void (*xf86WriteMmioNB16)(int, void *, unsigned long);
-extern void (*xf86WriteMmioNB32)(int, void *, unsigned long);
-extern void xf86SlowBCopyFromBus(unsigned char *, unsigned char *, int);
-extern void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
+extern _X_EXPORT void (*xf86WriteMmio8)(int, void *, unsigned long);
+extern _X_EXPORT void (*xf86WriteMmio16)(int, void *, unsigned long);
+extern _X_EXPORT void (*xf86WriteMmio32)(int, void *, unsigned long);
+extern _X_EXPORT void (*xf86WriteMmioNB8)(int, void *, unsigned long);
+extern _X_EXPORT void (*xf86WriteMmioNB16)(int, void *, unsigned long);
+extern _X_EXPORT void (*xf86WriteMmioNB32)(int, void *, unsigned long);
/* Some macros to hide the system dependencies for MMIO accesses */
/* Changed to kill noise generated by gcc's -Wcast-align */
@@ -1612,17 +1278,6 @@ extern void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
# define MMIO_MOVE32(base, offset, val) \
xf86WriteMmio32Be(base, offset, (CARD32)(val))
-static __inline__ void ppc_flush_icache(char *addr)
-{
- __asm__ volatile (
- "dcbf 0,%0;"
- "sync;"
- "icbi 0,%0;"
- "sync;"
- "isync;"
- : : "r"(addr) : "memory");
-}
-
# elif defined(__sparc__) || defined(sparc) || defined(__sparc)
/*
* Like powerpc, we provide byteswapping and no byteswapping functions
@@ -1685,18 +1340,4 @@ static __inline__ void ppc_flush_icache(char *addr)
# define MMIO_MOVE32(base, offset, val) MMIO_OUT32(base, offset, val)
# endif /* __alpha__ */
-
-/*
- * With Intel, the version in os-support/misc/SlowBcopy.s is used.
- * This avoids port I/O during the copy (which causes problems with
- * some hardware).
- */
-# ifdef __alpha__
-# define slowbcopy_tobus(src,dst,count) xf86SlowBCopyToBus(src,dst,count)
-# define slowbcopy_frombus(src,dst,count) xf86SlowBCopyFromBus(src,dst,count)
-# else /* __alpha__ */
-# define slowbcopy_tobus(src,dst,count) xf86SlowBcopy(src,dst,count)
-# define slowbcopy_frombus(src,dst,count) xf86SlowBcopy(src,dst,count)
-# endif /* __alpha__ */
-
#endif /* _COMPILER_H */
diff --git a/xorg-server/hw/xfree86/common/modeline2c.awk b/xorg-server/hw/xfree86/common/modeline2c.awk
index 71a956e05..038e7e935 100644
--- a/xorg-server/hw/xfree86/common/modeline2c.awk
+++ b/xorg-server/hw/xfree86/common/modeline2c.awk
@@ -56,9 +56,6 @@ BEGIN {
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\""
diff --git a/xorg-server/hw/xfree86/common/vidmodeproc.h b/xorg-server/hw/xfree86/common/vidmodeproc.h
new file mode 100644
index 000000000..da4d05e1c
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/vidmodeproc.h
@@ -0,0 +1,77 @@
+
+/* Prototypes for DGA functions that the DDX must provide */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef _VIDMODEPROC_H_
+#define _VIDMODEPROC_H_
+
+
+typedef enum {
+ VIDMODE_H_DISPLAY,
+ VIDMODE_H_SYNCSTART,
+ VIDMODE_H_SYNCEND,
+ VIDMODE_H_TOTAL,
+ VIDMODE_H_SKEW,
+ VIDMODE_V_DISPLAY,
+ VIDMODE_V_SYNCSTART,
+ VIDMODE_V_SYNCEND,
+ VIDMODE_V_TOTAL,
+ VIDMODE_FLAGS,
+ VIDMODE_CLOCK
+} VidModeSelectMode;
+
+typedef enum {
+ VIDMODE_MON_VENDOR,
+ VIDMODE_MON_MODEL,
+ VIDMODE_MON_NHSYNC,
+ VIDMODE_MON_NVREFRESH,
+ VIDMODE_MON_HSYNC_LO,
+ VIDMODE_MON_HSYNC_HI,
+ VIDMODE_MON_VREFRESH_LO,
+ VIDMODE_MON_VREFRESH_HI
+} VidModeSelectMonitor;
+
+typedef union {
+ pointer ptr;
+ int i;
+ float f;
+} vidMonitorValue;
+
+extern _X_EXPORT void XFree86VidModeExtensionInit(void);
+
+extern _X_EXPORT Bool VidModeAvailable(int scrnIndex);
+extern _X_EXPORT Bool VidModeGetCurrentModeline(int scrnIndex, pointer *mode, int *dotClock);
+extern _X_EXPORT Bool VidModeGetFirstModeline(int scrnIndex, pointer *mode, int *dotClock);
+extern _X_EXPORT Bool VidModeGetNextModeline(int scrnIndex, pointer *mode, int *dotClock);
+extern _X_EXPORT Bool VidModeDeleteModeline(int scrnIndex, pointer mode);
+extern _X_EXPORT Bool VidModeZoomViewport(int scrnIndex, int zoom);
+extern _X_EXPORT Bool VidModeGetViewPort(int scrnIndex, int *x, int *y);
+extern _X_EXPORT Bool VidModeSetViewPort(int scrnIndex, int x, int y);
+extern _X_EXPORT Bool VidModeSwitchMode(int scrnIndex, pointer mode);
+extern _X_EXPORT Bool VidModeLockZoom(int scrnIndex, Bool lock);
+extern _X_EXPORT Bool VidModeGetMonitor(int scrnIndex, pointer *monitor);
+extern _X_EXPORT int VidModeGetNumOfClocks(int scrnIndex, Bool *progClock);
+extern _X_EXPORT Bool VidModeGetClocks(int scrnIndex, int *Clocks);
+extern _X_EXPORT ModeStatus VidModeCheckModeForMonitor(int scrnIndex, pointer mode);
+extern _X_EXPORT ModeStatus VidModeCheckModeForDriver(int scrnIndex, pointer mode);
+extern _X_EXPORT void VidModeSetCrtcForMode(int scrnIndex, pointer mode);
+extern _X_EXPORT Bool VidModeAddModeline(int scrnIndex, pointer mode);
+extern _X_EXPORT int VidModeGetDotClock(int scrnIndex, int Clock);
+extern _X_EXPORT int VidModeGetNumOfModes(int scrnIndex);
+extern _X_EXPORT Bool VidModeSetGamma(int scrnIndex, float red, float green, float blue);
+extern _X_EXPORT Bool VidModeGetGamma(int scrnIndex, float *red, float *green, float *blue);
+extern _X_EXPORT pointer VidModeCreateMode(void);
+extern _X_EXPORT void VidModeCopyMode(pointer modefrom, pointer modeto);
+extern _X_EXPORT int VidModeGetModeValue(pointer mode, int valtyp);
+extern _X_EXPORT void VidModeSetModeValue(pointer mode, int valtyp, int val);
+extern _X_EXPORT vidMonitorValue VidModeGetMonitorValue(pointer monitor, int valtyp, int indx);
+extern _X_EXPORT Bool VidModeSetGammaRamp(int, int, CARD16 *, CARD16 *, CARD16 *);
+extern _X_EXPORT Bool VidModeGetGammaRamp(int, int, CARD16 *, CARD16 *, CARD16 *);
+extern _X_EXPORT int VidModeGetGammaRampSize(int scrnIndex);
+
+#endif
+
+
diff --git a/xorg-server/hw/xfree86/common/xf86.h b/xorg-server/hw/xfree86/common/xf86.h
index a32aa9bcc..e9266abd4 100644
--- a/xorg-server/hw/xfree86/common/xf86.h
+++ b/xorg-server/hw/xfree86/common/xf86.h
@@ -1,4 +1,3 @@
-
/*
* Copyright (c) 1997-2003 by The XFree86 Project, Inc.
*
@@ -55,24 +54,24 @@
#include "propertyst.h"
/* General parameters */
-extern int xf86DoConfigure;
-extern int xf86DoShowOptions;
-extern Bool xf86DoModalias;
-extern Bool xf86DoConfigurePass1;
-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;
-extern Bool pciSlotClaimed;
-extern Bool fbSlotClaimed;
+extern _X_EXPORT int xf86DoConfigure;
+extern _X_EXPORT int xf86DoShowOptions;
+extern _X_EXPORT Bool xf86DoConfigurePass1;
+extern _X_EXPORT DevPrivateKey xf86ScreenKey;
+extern _X_EXPORT DevPrivateKey xf86CreateRootWindowKey;
+extern _X_EXPORT DevPrivateKey xf86PixmapKey;
+extern _X_EXPORT ScrnInfoPtr *xf86Screens; /* List of pointers to ScrnInfoRecs */
+extern _X_EXPORT const unsigned char byte_reversed[256];
+extern _X_EXPORT Bool pciSlotClaimed;
+extern _X_EXPORT Bool fbSlotClaimed;
#if defined(__sparc__) || defined(__sparc)
-extern Bool sbusSlotClaimed;
+extern _X_EXPORT Bool sbusSlotClaimed;
#endif
-extern confDRIRec xf86ConfigDRI;
-extern Bool xf86inSuspend;
-extern Bool xf86DRI2Enabled(void);
+extern _X_EXPORT confDRIRec xf86ConfigDRI;
+extern _X_EXPORT Bool xf86inSuspend;
+extern _X_EXPORT Bool xf86DRI2Enabled(void);
+
+extern _X_EXPORT Bool VTSwitchEnabled; /* kbd driver */
#define XF86SCRNINFO(p) ((ScrnInfoPtr)dixLookupPrivate(&(p)->devPrivates, \
xf86ScreenKey))
@@ -94,285 +93,261 @@ extern Bool xf86DRI2Enabled(void);
/* xf86Bus.c */
-Bool xf86CheckPciSlot( const struct pci_device * );
-int xf86ClaimPciSlot( struct pci_device *, DriverPtr drvp,
+extern _X_EXPORT Bool xf86CheckPciSlot( const struct pci_device * );
+extern _X_EXPORT int xf86ClaimPciSlot( struct pci_device *, DriverPtr drvp,
int chipset, GDevPtr dev, Bool active);
-Bool xf86ParsePciBusString(const char *busID, int *bus, int *device,
+extern _X_EXPORT void xf86UnclaimPciSlot(struct pci_device *);
+extern _X_EXPORT Bool xf86ParsePciBusString(const char *busID, int *bus, int *device,
int *func);
-Bool xf86ComparePciBusString(const char *busID, int bus, int device, int func);
-void xf86FormatPciBusNumber(int busnum, char *buffer);
-resPtr xf86AddRangesToList(resPtr list, resRange *pRange, int entityIndex);
-int xf86GetFbInfoForScreen(int scrnIndex);
-int xf86ClaimFbSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active);
-int xf86ClaimNoSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active);
-void xf86EnableAccess(ScrnInfoPtr pScrn);
-void xf86SetCurrentAccess(Bool Enable, ScrnInfoPtr pScrn);
-Bool xf86IsPrimaryPci(struct pci_device * pPci);
+extern _X_EXPORT Bool xf86ComparePciBusString(const char *busID, int bus, int device, int func);
+extern _X_EXPORT void xf86FormatPciBusNumber(int busnum, char *buffer);
+extern _X_EXPORT int xf86GetFbInfoForScreen(int scrnIndex);
+extern _X_EXPORT int xf86ClaimFbSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active);
+extern _X_EXPORT int xf86ClaimNoSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active);
+extern _X_EXPORT void xf86EnableAccess(ScrnInfoPtr pScrn);
+extern _X_EXPORT Bool xf86IsPrimaryPci(struct pci_device * pPci);
/* new RAC */
-resPtr xf86AddResToList(resPtr rlist, resRange *Range, int entityIndex);
-void xf86FreeResList(resPtr rlist);
-void xf86ClaimFixedResources(resList list, int entityIndex);
-Bool xf86DriverHasEntities(DriverPtr drvp);
-void xf86AddEntityToScreen(ScrnInfoPtr pScrn, int entityIndex);
-void xf86SetEntityInstanceForScreen(ScrnInfoPtr pScrn, int entityIndex,
+extern _X_EXPORT Bool xf86DriverHasEntities(DriverPtr drvp);
+extern _X_EXPORT void xf86AddEntityToScreen(ScrnInfoPtr pScrn, int entityIndex);
+extern _X_EXPORT void xf86SetEntityInstanceForScreen(ScrnInfoPtr pScrn, int entityIndex,
int instance);
-int xf86GetNumEntityInstances(int entityIndex);
-GDevPtr xf86GetDevFromEntity(int entityIndex, int instance);
-void xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, int entityIndex);
-EntityInfoPtr xf86GetEntityInfo(int entityIndex);
-struct pci_device * xf86GetPciInfoForEntity(int entityIndex);
-Bool xf86SetEntityFuncs(int entityIndex, EntityProc init,
+extern _X_EXPORT int xf86GetNumEntityInstances(int entityIndex);
+extern _X_EXPORT GDevPtr xf86GetDevFromEntity(int entityIndex, int instance);
+extern _X_EXPORT void xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, int entityIndex);
+extern _X_EXPORT EntityInfoPtr xf86GetEntityInfo(int entityIndex);
+extern _X_EXPORT struct pci_device * xf86GetPciInfoForEntity(int entityIndex);
+extern _X_EXPORT Bool xf86SetEntityFuncs(int entityIndex, EntityProc init,
EntityProc enter, EntityProc leave, pointer);
-void xf86DeallocateResourcesForEntity(int entityIndex, unsigned long type);
-resPtr xf86RegisterResources(int entityIndex, resList list,
- unsigned long Access);
-Bool xf86CheckPciMemBase(struct pci_device * pPci, memType base);
-void xf86SetAccessFuncs(EntityInfoPtr pEnt, xf86SetAccessFuncPtr funcs,
- xf86SetAccessFuncPtr oldFuncs);
-Bool xf86IsEntityPrimary(int entityIndex);
-resPtr xf86ReallocatePciResources(int entityIndex, resPtr pRes);
-resPtr xf86SetOperatingState(resList list, int entityIndex, int mask);
-void xf86EnterServerState(xf86State state);
-ScrnInfoPtr xf86FindScreenForEntity(int entityIndex);
-Bool xf86NoSharedResources(int screenIndex, resType res);
-resPtr xf86FindIntersectOfLists(resPtr l1, resPtr l2);
-void xf86RegisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func, pointer arg);
-Bool xf86DeregisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func);
-
-int xf86GetLastScrnFlag(int entityIndex);
-void xf86SetLastScrnFlag(int entityIndex, int scrnIndex);
-Bool xf86IsEntityShared(int entityIndex);
-void xf86SetEntityShared(int entityIndex);
-Bool xf86IsEntitySharable(int entityIndex);
-void xf86SetEntitySharable(int entityIndex);
-Bool xf86IsPrimInitDone(int entityIndex);
-void xf86SetPrimInitDone(int entityIndex);
-void xf86ClearPrimInitDone(int entityIndex);
-int xf86AllocateEntityPrivateIndex(void);
-DevUnion *xf86GetEntityPrivate(int entityIndex, int privIndex);
+extern _X_EXPORT Bool xf86CheckPciMemBase(struct pci_device * pPci, memType base);
+extern _X_EXPORT Bool xf86IsEntityPrimary(int entityIndex);
+extern _X_EXPORT void xf86EnterServerState(xf86State state);
+extern _X_EXPORT ScrnInfoPtr xf86FindScreenForEntity(int entityIndex);
+
+extern _X_EXPORT int xf86GetLastScrnFlag(int entityIndex);
+extern _X_EXPORT void xf86SetLastScrnFlag(int entityIndex, int scrnIndex);
+extern _X_EXPORT Bool xf86IsEntityShared(int entityIndex);
+extern _X_EXPORT void xf86SetEntityShared(int entityIndex);
+extern _X_EXPORT Bool xf86IsEntitySharable(int entityIndex);
+extern _X_EXPORT void xf86SetEntitySharable(int entityIndex);
+extern _X_EXPORT Bool xf86IsPrimInitDone(int entityIndex);
+extern _X_EXPORT void xf86SetPrimInitDone(int entityIndex);
+extern _X_EXPORT void xf86ClearPrimInitDone(int entityIndex);
+extern _X_EXPORT int xf86AllocateEntityPrivateIndex(void);
+extern _X_EXPORT DevUnion *xf86GetEntityPrivate(int entityIndex, int privIndex);
/* xf86Configure.c */
-GDevPtr xf86AddBusDeviceToConfigure(const char *driver, BusType bus,
+extern _X_EXPORT GDevPtr xf86AddBusDeviceToConfigure(const char *driver, BusType bus,
void *busData, int chipset);
/* xf86Cursor.c */
-void xf86LockZoom(ScreenPtr pScreen, int lock);
-void xf86InitViewport(ScrnInfoPtr pScr);
-void xf86SetViewport(ScreenPtr pScreen, int x, int y);
-void xf86ZoomViewport(ScreenPtr pScreen, int zoom);
-Bool xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode);
-void *xf86GetPointerScreenFuncs(void);
-void xf86InitOrigins(void);
-void xf86ReconfigureLayout(void);
+extern _X_EXPORT void xf86LockZoom(ScreenPtr pScreen, int lock);
+extern _X_EXPORT void xf86InitViewport(ScrnInfoPtr pScr);
+extern _X_EXPORT void xf86SetViewport(ScreenPtr pScreen, int x, int y);
+extern _X_EXPORT void xf86ZoomViewport(ScreenPtr pScreen, int zoom);
+extern _X_EXPORT Bool xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode);
+extern _X_EXPORT void *xf86GetPointerScreenFuncs(void);
+extern _X_EXPORT void xf86InitOrigins(void);
+extern _X_EXPORT void xf86ReconfigureLayout(void);
/* xf86cvt.c */
-DisplayModePtr xf86CVTMode(int HDisplay, int VDisplay, float VRefresh,
+extern _X_EXPORT DisplayModePtr xf86CVTMode(int HDisplay, int VDisplay, float VRefresh,
Bool Reduced, Bool Interlaced);
/* xf86DPMS.c */
-Bool xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags);
+extern _X_EXPORT Bool xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags);
+
+#ifdef DPMSExtension
+extern _X_EXPORT int DPMSSet(ClientPtr client, int level);
+extern _X_EXPORT Bool DPMSSupported(void);
+#endif
+
/* xf86DGA.c */
-Bool DGAInit(ScreenPtr pScreen, DGAFunctionPtr funcs, DGAModePtr modes,
+#ifdef XFreeXDGA
+extern _X_EXPORT Bool DGAInit(ScreenPtr pScreen, DGAFunctionPtr funcs, DGAModePtr modes,
int num);
-Bool DGAReInitModes(ScreenPtr pScreen, DGAModePtr modes, int num);
-xf86SetDGAModeProc xf86SetDGAMode;
+extern _X_EXPORT Bool DGAReInitModes(ScreenPtr pScreen, DGAModePtr modes, int num);
+extern _X_EXPORT xf86SetDGAModeProc xf86SetDGAMode;
+#endif
/* xf86Events.c */
-void SetTimeSinceLastInputEvent(void);
-pointer xf86AddInputHandler(int fd, InputHandlerProc proc, pointer data);
-int xf86RemoveInputHandler(pointer handler);
-void xf86DisableInputHandler(pointer handler);
-void xf86EnableInputHandler(pointer handler);
-pointer xf86AddGeneralHandler(int fd, InputHandlerProc proc, pointer data);
-int xf86RemoveGeneralHandler(pointer handler);
-void xf86DisableGeneralHandler(pointer handler);
-void xf86EnableGeneralHandler(pointer handler);
-void xf86InterceptSignals(int *signo);
-void xf86InterceptSigIll(void (*sigillhandler)(void));
-Bool xf86EnableVTSwitch(Bool new);
-void xf86ProcessActionEvent(ActionEvent action, void *arg);
-void xf86PrintBacktrace(void);
+extern _X_EXPORT void SetTimeSinceLastInputEvent(void);
+extern _X_EXPORT pointer xf86AddInputHandler(int fd, InputHandlerProc proc, pointer data);
+extern _X_EXPORT int xf86RemoveInputHandler(pointer handler);
+extern _X_EXPORT void xf86DisableInputHandler(pointer handler);
+extern _X_EXPORT void xf86EnableInputHandler(pointer handler);
+extern _X_EXPORT pointer xf86AddGeneralHandler(int fd, InputHandlerProc proc, pointer data);
+extern _X_EXPORT int xf86RemoveGeneralHandler(pointer handler);
+extern _X_EXPORT void xf86DisableGeneralHandler(pointer handler);
+extern _X_EXPORT void xf86EnableGeneralHandler(pointer handler);
+extern _X_EXPORT void xf86InterceptSignals(int *signo);
+extern _X_EXPORT void xf86InterceptSigIll(void (*sigillhandler)(void));
+extern _X_EXPORT Bool xf86EnableVTSwitch(Bool new);
+extern _X_EXPORT void xf86ProcessActionEvent(ActionEvent action, void *arg);
+extern _X_EXPORT void xf86PrintBacktrace(void);
/* xf86Helper.c */
-void xf86AddDriver(DriverPtr driver, pointer module, int flags);
-void xf86DeleteDriver(int drvIndex);
-ScrnInfoPtr xf86AllocateScreen(DriverPtr drv, int flags);
-void xf86DeleteScreen(int scrnIndex, int flags);
-int xf86AllocateScrnInfoPrivateIndex(void);
-Bool xf86AddPixFormat(ScrnInfoPtr pScrn, int depth, int bpp, int pad);
-Bool xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int bpp, int fbbpp,
+extern _X_EXPORT void xf86AddDriver(DriverPtr driver, pointer module, int flags);
+extern _X_EXPORT void xf86DeleteDriver(int drvIndex);
+extern _X_EXPORT ScrnInfoPtr xf86AllocateScreen(DriverPtr drv, int flags);
+extern _X_EXPORT void xf86DeleteScreen(int scrnIndex, int flags);
+extern _X_EXPORT int xf86AllocateScrnInfoPrivateIndex(void);
+extern _X_EXPORT Bool xf86AddPixFormat(ScrnInfoPtr pScrn, int depth, int bpp, int pad);
+extern _X_EXPORT Bool xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int bpp, int fbbpp,
int depth24flags);
-void xf86PrintDepthBpp(ScrnInfoPtr scrp);
-Bool xf86SetWeight(ScrnInfoPtr scrp, rgb weight, rgb mask);
-Bool xf86SetDefaultVisual(ScrnInfoPtr scrp, int visual);
-Bool xf86SetGamma(ScrnInfoPtr scrp, Gamma newGamma);
-void xf86SetDpi(ScrnInfoPtr pScrn, int x, int y);
-void xf86SetBlackWhitePixels(ScreenPtr pScreen);
-void xf86EnableDisableFBAccess(int scrnIndex, Bool enable);
-void xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb,
+extern _X_EXPORT void xf86PrintDepthBpp(ScrnInfoPtr scrp);
+extern _X_EXPORT Bool xf86SetWeight(ScrnInfoPtr scrp, rgb weight, rgb mask);
+extern _X_EXPORT Bool xf86SetDefaultVisual(ScrnInfoPtr scrp, int visual);
+extern _X_EXPORT Bool xf86SetGamma(ScrnInfoPtr scrp, Gamma newGamma);
+extern _X_EXPORT void xf86SetDpi(ScrnInfoPtr pScrn, int x, int y);
+extern _X_EXPORT void xf86SetBlackWhitePixels(ScreenPtr pScreen);
+extern _X_EXPORT void xf86EnableDisableFBAccess(int scrnIndex, Bool enable);
+extern _X_EXPORT void xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb,
const char *format, va_list args);
-void xf86DrvMsgVerb(int scrnIndex, MessageType type, int verb,
+extern _X_EXPORT void xf86DrvMsgVerb(int scrnIndex, MessageType type, int verb,
const char *format, ...) _printf_attribute(4,5);
-void xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...)
+extern _X_EXPORT void xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...)
_printf_attribute(3,4);
-void xf86MsgVerb(MessageType type, int verb, const char *format, ...)
+extern _X_EXPORT void xf86MsgVerb(MessageType type, int verb, const char *format, ...)
_printf_attribute(3,4);
-void xf86Msg(MessageType type, const char *format, ...) _printf_attribute(2,3);
-void xf86ErrorFVerb(int verb, const char *format, ...) _printf_attribute(2,3);
-void xf86ErrorF(const char *format, ...) _printf_attribute(1,2);
-const char *xf86TokenToString(SymTabPtr table, int token);
-int xf86StringToToken(SymTabPtr table, const char *string);
-void xf86ShowClocks(ScrnInfoPtr scrp, MessageType from);
-void xf86PrintChipsets(const char *drvname, const char *drvmsg,
+extern _X_EXPORT void xf86Msg(MessageType type, const char *format, ...) _printf_attribute(2,3);
+extern _X_EXPORT void xf86ErrorFVerb(int verb, const char *format, ...) _printf_attribute(2,3);
+extern _X_EXPORT void xf86ErrorF(const char *format, ...) _printf_attribute(1,2);
+extern _X_EXPORT const char *xf86TokenToString(SymTabPtr table, int token);
+extern _X_EXPORT int xf86StringToToken(SymTabPtr table, const char *string);
+extern _X_EXPORT void xf86ShowClocks(ScrnInfoPtr scrp, MessageType from);
+extern _X_EXPORT void xf86PrintChipsets(const char *drvname, const char *drvmsg,
SymTabPtr chips);
-int xf86MatchDevice(const char *drivername, GDevPtr **driversectlist);
-int xf86MatchPciInstances(const char *driverName, int vendorID,
+extern _X_EXPORT int xf86MatchDevice(const char *drivername, GDevPtr **driversectlist);
+extern _X_EXPORT int xf86MatchPciInstances(const char *driverName, int vendorID,
SymTabPtr chipsets, PciChipsets *PCIchipsets,
GDevPtr *devList, int numDevs, DriverPtr drvp,
int **foundEntities);
-void xf86GetClocks(ScrnInfoPtr pScrn, int num,
+extern _X_EXPORT void xf86GetClocks(ScrnInfoPtr pScrn, int num,
Bool (*ClockFunc)(ScrnInfoPtr, int),
void (*ProtectRegs)(ScrnInfoPtr, Bool),
void (*BlankScreen)(ScrnInfoPtr, Bool),
IOADDRESS vertsyncreg, int maskval,
int knownclkindex, int knownclkvalue);
-void xf86SetPriority(Bool up);
-const char *xf86GetVisualName(int visual);
-int xf86GetVerbosity(void);
-Pix24Flags xf86GetPix24(void);
-int xf86GetDepth(void);
-rgb xf86GetWeight(void);
-Gamma xf86GetGamma(void);
-Bool xf86GetFlipPixels(void);
-const char *xf86GetServerName(void);
-Bool xf86ServerIsExiting(void);
-Bool xf86ServerIsResetting(void);
-Bool xf86ServerIsInitialising(void);
-Bool xf86ServerIsOnlyDetecting(void);
-Bool xf86ServerIsOnlyProbing(void);
-Bool xf86CaughtSignal(void);
-Bool xf86GetVidModeAllowNonLocal(void);
-Bool xf86GetVidModeEnabled(void);
-Bool xf86GetModInDevAllowNonLocal(void);
-Bool xf86GetModInDevEnabled(void);
-Bool xf86GetAllowMouseOpenFail(void);
-Bool xf86IsPc98(void);
-void xf86DisableRandR(void);
-CARD32 xorgGetVersion(void);
-CARD32 xf86GetModuleVersion(pointer module);
-pointer xf86LoadDrvSubModule(DriverPtr drv, const char *name);
-pointer xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name);
-pointer xf86LoadOneModule(char *name, pointer optlist);
-void xf86UnloadSubModule(pointer mod);
-Bool xf86LoaderCheckSymbol(const char *name);
-void xf86LoaderReqSymLists(const char **, ...);
-void xf86LoaderReqSymbols(const char *, ...);
-void xf86LoaderRefSymLists(const char **, ...);
-void xf86LoaderRefSymbols(const char *, ...);
-void xf86SetBackingStore(ScreenPtr pScreen);
-void xf86SetSilkenMouse(ScreenPtr pScreen);
-int xf86NewSerialNumber(WindowPtr p, pointer unused);
-pointer xf86FindXvOptions(int scrnIndex, int adapt_index, char *port_name,
+extern _X_EXPORT const char *xf86GetVisualName(int visual);
+extern _X_EXPORT int xf86GetVerbosity(void);
+extern _X_EXPORT Pix24Flags xf86GetPix24(void);
+extern _X_EXPORT int xf86GetDepth(void);
+extern _X_EXPORT rgb xf86GetWeight(void);
+extern _X_EXPORT Gamma xf86GetGamma(void);
+extern _X_EXPORT Bool xf86GetFlipPixels(void);
+extern _X_EXPORT const char *xf86GetServerName(void);
+extern _X_EXPORT Bool xf86ServerIsExiting(void);
+extern _X_EXPORT Bool xf86ServerIsResetting(void);
+extern _X_EXPORT Bool xf86ServerIsInitialising(void);
+extern _X_EXPORT Bool xf86ServerIsOnlyDetecting(void);
+extern _X_EXPORT Bool xf86CaughtSignal(void);
+extern _X_EXPORT Bool xf86GetVidModeAllowNonLocal(void);
+extern _X_EXPORT Bool xf86GetVidModeEnabled(void);
+extern _X_EXPORT Bool xf86GetModInDevAllowNonLocal(void);
+extern _X_EXPORT Bool xf86GetModInDevEnabled(void);
+extern _X_EXPORT Bool xf86GetAllowMouseOpenFail(void);
+extern _X_EXPORT Bool xf86IsPc98(void);
+extern _X_EXPORT void xf86DisableRandR(void);
+extern _X_EXPORT CARD32 xorgGetVersion(void);
+extern _X_EXPORT CARD32 xf86GetModuleVersion(pointer module);
+extern _X_EXPORT pointer xf86LoadDrvSubModule(DriverPtr drv, const char *name);
+extern _X_EXPORT pointer xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name);
+extern _X_EXPORT pointer xf86LoadOneModule(char *name, pointer optlist);
+extern _X_EXPORT void xf86UnloadSubModule(pointer mod);
+extern _X_EXPORT Bool xf86LoaderCheckSymbol(const char *name);
+extern _X_EXPORT void xf86SetBackingStore(ScreenPtr pScreen);
+extern _X_EXPORT void xf86SetSilkenMouse(ScreenPtr pScreen);
+extern _X_EXPORT pointer xf86FindXvOptions(int scrnIndex, int adapt_index, char *port_name,
char **adaptor_name, pointer *adaptor_options);
-void xf86GetOS(const char **name, int *major, int *minor, int *teeny);
-ScrnInfoPtr xf86ConfigPciEntity(ScrnInfoPtr pScrn, int scrnFlag,
+extern _X_EXPORT void xf86GetOS(const char **name, int *major, int *minor, int *teeny);
+extern _X_EXPORT ScrnInfoPtr xf86ConfigPciEntity(ScrnInfoPtr pScrn, int scrnFlag,
int entityIndex,PciChipsets *p_chip,
- resList res, EntityProc init,
+ void *dummy, EntityProc init,
EntityProc enter, EntityProc leave,
pointer private);
-ScrnInfoPtr xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag,
+extern _X_EXPORT ScrnInfoPtr xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag,
int entityIndex, EntityProc init,
EntityProc enter, EntityProc leave,
pointer private);
+
/* Obsolete! don't use */
-Bool xf86ConfigActivePciEntity(ScrnInfoPtr pScrn,
- int entityIndex,PciChipsets *p_chip,
- resList res, EntityProc init,
- EntityProc enter, EntityProc leave,
- pointer private);
-/* Obsolete! don't use */
-void xf86ConfigPciEntityInactive(EntityInfoPtr pEnt, PciChipsets *p_chip,
- resList res, EntityProc init,
- EntityProc enter, EntityProc leave,
- pointer private);
-void xf86ConfigFbEntityInactive(EntityInfoPtr pEnt, EntityProc init,
- EntityProc enter, EntityProc leave,
- pointer private);
-Bool xf86IsScreenPrimary(int scrnIndex);
-int xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type,
+extern _X_EXPORT Bool xf86ConfigActivePciEntity(ScrnInfoPtr pScrn,
+ int entityIndex,PciChipsets *p_chip,
+ void *dummy, EntityProc init,
+ EntityProc enter, EntityProc leave,
+ pointer private);
+
+extern _X_EXPORT Bool xf86IsScreenPrimary(int scrnIndex);
+extern _X_EXPORT int xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type,
int format, unsigned long len,
pointer value);
-Bool xf86IsUnblank(int mode);
-
-_X_DEPRECATED void xf86AddModuleInfo(pointer info, pointer module);
-_X_DEPRECATED void xf86DeleteModuleInfo(int idx);
+extern _X_EXPORT Bool xf86IsUnblank(int mode);
/* xf86Init.c */
-PixmapFormatPtr xf86GetPixFormat(ScrnInfoPtr pScrn, int depth);
-int xf86GetBppFromDepth(ScrnInfoPtr pScrn, int depth);
+extern _X_EXPORT PixmapFormatPtr xf86GetPixFormat(ScrnInfoPtr pScrn, int depth);
+extern _X_EXPORT int xf86GetBppFromDepth(ScrnInfoPtr pScrn, int depth);
/* xf86Mode.c */
-int xf86GetNearestClock(ScrnInfoPtr scrp, int freq, Bool allowDiv2,
+extern _X_EXPORT int xf86GetNearestClock(ScrnInfoPtr scrp, int freq, Bool allowDiv2,
int DivFactor, int MulFactor, int *divider);
-const char *xf86ModeStatusToString(ModeStatus status);
-ModeStatus xf86LookupMode(ScrnInfoPtr scrp, DisplayModePtr modep,
+extern _X_EXPORT const char *xf86ModeStatusToString(ModeStatus status);
+extern _X_EXPORT ModeStatus xf86LookupMode(ScrnInfoPtr scrp, DisplayModePtr modep,
ClockRangePtr clockRanges, LookupModeFlags strategy);
-ModeStatus xf86CheckModeForMonitor(DisplayModePtr mode, MonPtr monitor);
-ModeStatus xf86InitialCheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode,
+extern _X_EXPORT ModeStatus xf86CheckModeForMonitor(DisplayModePtr mode, MonPtr monitor);
+extern _X_EXPORT ModeStatus xf86InitialCheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode,
ClockRangePtr clockRanges,
LookupModeFlags strategy,
int maxPitch, int virtualX,
int virtualY);
-ModeStatus xf86CheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode,
+extern _X_EXPORT ModeStatus xf86CheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode,
int flags);
-int xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
+extern _X_EXPORT int xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
char **modeNames, ClockRangePtr clockRanges,
int *linePitches, int minPitch, int maxPitch,
int minHeight, int maxHeight, int pitchInc,
int virtualX, int virtualY, int apertureSize,
LookupModeFlags strategy);
-void xf86DeleteMode(DisplayModePtr *modeList, DisplayModePtr mode);
-void xf86PruneDriverModes(ScrnInfoPtr scrp);
-void xf86SetCrtcForModes(ScrnInfoPtr scrp, int adjustFlags);
-void xf86PrintModes(ScrnInfoPtr scrp);
-void xf86ShowClockRanges(ScrnInfoPtr scrp, ClockRangePtr clockRanges);
-double xf86ModeHSync(const DisplayModeRec *mode);
-double xf86ModeVRefresh(const DisplayModeRec *mode);
-void xf86SetModeDefaultName(DisplayModePtr mode);
-void xf86SetModeCrtc(DisplayModePtr p, int adjustFlags);
-DisplayModePtr xf86DuplicateMode(const DisplayModeRec *pMode);
-DisplayModePtr xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList);
-Bool xf86ModesEqual(const DisplayModeRec *pMode1,
+extern _X_EXPORT void xf86DeleteMode(DisplayModePtr *modeList, DisplayModePtr mode);
+extern _X_EXPORT void xf86PruneDriverModes(ScrnInfoPtr scrp);
+extern _X_EXPORT void xf86SetCrtcForModes(ScrnInfoPtr scrp, int adjustFlags);
+extern _X_EXPORT void xf86PrintModes(ScrnInfoPtr scrp);
+extern _X_EXPORT void xf86ShowClockRanges(ScrnInfoPtr scrp, ClockRangePtr clockRanges);
+extern _X_EXPORT double xf86ModeHSync(const DisplayModeRec *mode);
+extern _X_EXPORT double xf86ModeVRefresh(const DisplayModeRec *mode);
+extern _X_EXPORT void xf86SetModeDefaultName(DisplayModePtr mode);
+extern _X_EXPORT void xf86SetModeCrtc(DisplayModePtr p, int adjustFlags);
+extern _X_EXPORT DisplayModePtr xf86DuplicateMode(const DisplayModeRec *pMode);
+extern _X_EXPORT DisplayModePtr xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList);
+extern _X_EXPORT Bool xf86ModesEqual(const DisplayModeRec *pMode1,
const DisplayModeRec *pMode2);
-void xf86PrintModeline(int scrnIndex,DisplayModePtr mode);
-DisplayModePtr xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new);
+extern _X_EXPORT void xf86PrintModeline(int scrnIndex,DisplayModePtr mode);
+extern _X_EXPORT DisplayModePtr xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new);
/* xf86Option.c */
-void xf86CollectOptions(ScrnInfoPtr pScrn, pointer extraOpts);
+extern _X_EXPORT void xf86CollectOptions(ScrnInfoPtr pScrn, pointer extraOpts);
/* xf86RandR.c */
#ifdef RANDR
-Bool xf86RandRInit (ScreenPtr pScreen);
-void xf86RandRSetInitialMode (ScreenPtr pScreen);
-Rotation xf86GetRotation(ScreenPtr pScreen);
-Bool xf86RandRSetNewVirtualAndDimensions(ScreenPtr pScreen,
+extern _X_EXPORT Bool xf86RandRInit (ScreenPtr pScreen);
+extern _X_EXPORT Rotation xf86GetRotation(ScreenPtr pScreen);
+extern _X_EXPORT Bool xf86RandRSetNewVirtualAndDimensions(ScreenPtr pScreen,
int newvirtX, int newvirtY,
int newmmWidth, int newmmHeight, Bool resetMode);
#endif
/* xf86VidModeExtentionInit.c */
-Bool VidModeExtensionInit(ScreenPtr pScreen);
+extern _X_EXPORT Bool VidModeExtensionInit(ScreenPtr pScreen);
#endif /* _NO_XF86_PROTOTYPES */
diff --git a/xorg-server/hw/xfree86/common/xf86AutoConfig.c b/xorg-server/hw/xfree86/common/xf86AutoConfig.c
index a9a1fd207..b3c31fd70 100644
--- a/xorg-server/hw/xfree86/common/xf86AutoConfig.c
+++ b/xorg-server/hw/xfree86/common/xf86AutoConfig.c
@@ -144,11 +144,6 @@ static int
videoPtrToDriverList(struct pci_device *dev,
char *returnList[], int returnListMax)
{
- /*
- * things not handled yet:
- * cyrix/nsc. should be merged into geode anyway.
- * xgi.
- */
int i;
/* Add more entries here if we ever return more than 4 drivers for
any device */
@@ -156,11 +151,27 @@ videoPtrToDriverList(struct pci_device *dev,
switch (dev->vendor_id)
{
+ /* AMD Geode LX */
case 0x1022:
- if (dev->device_id == 0x2081) {
+ if (dev->device_id == 0x2081)
driverList[0] = "geode";
- driverList[1] = "amd";
- }
+ break;
+ /* older Geode products acquired by AMD still carry an NSC vendor_id */
+ case 0x100B:
+ if (dev->device_id == 0x0030) {
+ /* NSC Geode GX2 specifically ... */
+ driverList[0] = "geode";
+ /* GX2 support started its life in the NSC tree and was later
+ forked by AMD for GEODE so we keep it as a backup */
+ driverList[1] = "nsc";
+ } else
+ /* ... or any other NSC Geode e.g. SC series */
+ driverList[0] = "nsc";
+ break;
+ /* Cyrix Geode GX1 */
+ case 0x1078:
+ if (dev->device_id == 0x0104)
+ driverList[0] = "cyrix";
break;
case 0x1142: driverList[0] = "apm"; break;
case 0xedd8: driverList[0] = "ark"; break;
@@ -168,18 +179,21 @@ videoPtrToDriverList(struct pci_device *dev,
case 0x1002: driverList[0] = "ati"; break;
case 0x102c: driverList[0] = "chips"; break;
case 0x1013: driverList[0] = "cirrus"; break;
+ case 0x3d3d: driverList[0] = "glint"; break;
+ case 0x105d: driverList[0] = "i128"; break;
case 0x8086:
if ((dev->device_id == 0x00d1) || (dev->device_id == 0x7800)) {
driverList[0] = "i740";
+ } else if (dev->device_id == 0x8108) {
+ break; /* "hooray" for poulsbo */
} else {
driverList[0] = "intel";
- driverList[1] = "i810";
}
break;
case 0x102b: driverList[0] = "mga"; break;
case 0x10c8: driverList[0] = "neomagic"; break;
- case 0x105d: driverList[0] = "i128"; break;
case 0x10de: case 0x12d2: driverList[0] = "nv"; break;
+ case 0x1106: driverList[0] = "openchrome"; break;
case 0x1163: driverList[0] = "rendition"; break;
case 0x5333:
switch (dev->device_id)
@@ -202,11 +216,11 @@ videoPtrToDriverList(struct pci_device *dev,
else
driverList[0] = "tdfx";
break;
- case 0x3d3d: driverList[0] = "glint"; break;
+ case 0x1011: driverList[0] = "tga"; break;
case 0x1023: driverList[0] = "trident"; break;
- case 0x100c: driverList[0] = "tseng"; break;
- case 0x1106: driverList[0] = "openchrome"; break;
- case 0x15ad: driverList[0] = "vmware"; break;
+ case 0x100c: driverList[0] = "tseng"; break;
+ case 0x80ee: driverList[0] = "vboxvideo"; break;
+ case 0x15ad: driverList[0] = "vmware"; break;
case 0x18ca:
if (dev->device_id == 0x47)
driverList[0] = "xgixp";
@@ -269,7 +283,7 @@ xf86AutoConfig(void)
return (ret == CONFIG_OK);
}
-int
+static int
xchomp(char *line)
{
size_t len = 0;
@@ -285,46 +299,6 @@ xchomp(char *line)
return 0;
}
-GDevPtr
-autoConfigDevice(GDevPtr preconf_device)
-{
- GDevPtr ptr = NULL;
-
- if (!xf86configptr) {
- return NULL;
- }
-
- /* If there's a configured section with no driver chosen, use it */
- if (preconf_device) {
- ptr = preconf_device;
- } else {
- ptr = xcalloc(1, sizeof(GDevRec));
- if (!ptr) {
- return NULL;
- }
- ptr->chipID = -1;
- ptr->chipRev = -1;
- ptr->irq = -1;
-
- ptr->active = TRUE;
- ptr->claimed = FALSE;
- ptr->identifier = "Autoconfigured Video Device";
- ptr->driver = NULL;
- }
- if (!ptr->driver) {
- ptr->driver = chooseVideoDriver();
- }
-
- /* TODO Handle multiple screen sections */
- if (xf86ConfigLayout.screens && !xf86ConfigLayout.screens->screen->device) {
- xf86ConfigLayout.screens->screen->device = ptr;
- ptr->myScreenSection = xf86ConfigLayout.screens->screen;
- }
- xf86Msg(X_DEFAULT, "Assigned the driver to the xf86ConfigLayout\n");
-
- return ptr;
-}
-
#ifdef __linux__
/* This function is used to provide a workaround for binary drivers that
* don't export their PCI ID's properly. If distros don't end up using this
@@ -448,8 +422,25 @@ listPossibleVideoDrivers(char *matches[], int nmatches)
if (xf86Info.consoleFd >= 0) {
struct vis_identifier visid;
const char *cp;
+ extern char xf86SolarisFbDev[PATH_MAX];
+ int iret;
+
+ SYSCALL(iret = ioctl(xf86Info.consoleFd, VIS_GETIDENTIFIER, &visid));
+ if (iret < 0) {
+ int fbfd;
+
+ fbfd = open(xf86SolarisFbDev, O_RDONLY);
+ if (fbfd >= 0) {
+ SYSCALL(iret = ioctl(fbfd, VIS_GETIDENTIFIER, &visid));
+ close(fbfd);
+ }
+ }
- if (ioctl(xf86Info.consoleFd, VIS_GETIDENTIFIER, &visid) >= 0) {
+ if (iret < 0) {
+ xf86Msg(X_WARNING,
+ "could not get frame buffer identifier from %s\n",
+ xf86SolarisFbDev);
+ } else {
xf86Msg(X_PROBED, "console driver: %s\n", visid.name);
/* Special case from before the general case was set */
@@ -529,7 +520,7 @@ listPossibleVideoDrivers(char *matches[], int nmatches)
}
}
-char*
+static char*
chooseVideoDriver(void)
{
char *chosen_driver = NULL;
@@ -552,3 +543,43 @@ chooseVideoDriver(void)
return chosen_driver;
}
+
+GDevPtr
+autoConfigDevice(GDevPtr preconf_device)
+{
+ GDevPtr ptr = NULL;
+
+ if (!xf86configptr) {
+ return NULL;
+ }
+
+ /* If there's a configured section with no driver chosen, use it */
+ if (preconf_device) {
+ ptr = preconf_device;
+ } else {
+ ptr = xcalloc(1, sizeof(GDevRec));
+ if (!ptr) {
+ return NULL;
+ }
+ ptr->chipID = -1;
+ ptr->chipRev = -1;
+ ptr->irq = -1;
+
+ ptr->active = TRUE;
+ ptr->claimed = FALSE;
+ ptr->identifier = "Autoconfigured Video Device";
+ ptr->driver = NULL;
+ }
+ if (!ptr->driver) {
+ ptr->driver = chooseVideoDriver();
+ }
+
+ /* TODO Handle multiple screen sections */
+ if (xf86ConfigLayout.screens && !xf86ConfigLayout.screens->screen->device) {
+ xf86ConfigLayout.screens->screen->device = ptr;
+ ptr->myScreenSection = xf86ConfigLayout.screens->screen;
+ }
+ xf86Msg(X_DEFAULT, "Assigned the driver to the xf86ConfigLayout\n");
+
+ return ptr;
+}
diff --git a/xorg-server/hw/xfree86/common/xf86Bus.c b/xorg-server/hw/xfree86/common/xf86Bus.c
index b94d500f0..f0a0723f9 100644
--- a/xorg-server/hw/xfree86/common/xf86Bus.c
+++ b/xorg-server/hw/xfree86/common/xf86Bus.c
@@ -40,60 +40,28 @@
#include "os.h"
#include "xf86.h"
#include "xf86Priv.h"
-#include "xf86Resources.h"
/* Bus-specific headers */
#include "xf86Bus.h"
#define XF86_OS_PRIVS
-#define NEED_OS_RAC_PROTOS
#include "xf86_OSproc.h"
+#include "xf86VGAarbiter.h"
-#include "xf86RAC.h"
#include "Pci.h"
/* Entity data */
EntityPtr *xf86Entities = NULL; /* Bus slots claimed by drivers */
int xf86NumEntities = 0;
static int xf86EntityPrivateCount = 0;
-BusAccPtr xf86BusAccInfo = NULL;
-static void
-noopEnableDisable(void *arg) { }
-
-xf86AccessRec AccessNULL = { noopEnableDisable, noopEnableDisable, NULL };
-
-xf86CurrentAccessRec xf86CurrentAccess = {NULL,NULL};
-
-BusRec primaryBus = { BUS_NONE, {{0}}};
+BusRec primaryBus = { BUS_NONE, { 0 } };
static Bool xf86ResAccessEnter = FALSE;
-
-/* resource lists */
-resPtr Acc = NULL;
-
-/* predefined special resources */
-_X_EXPORT resRange resVgaExclusive[] = {_VGA_EXCLUSIVE, _END};
-_X_EXPORT resRange resVgaShared[] = {_VGA_SHARED, _END};
-_X_EXPORT resRange resVgaMemShared[] = {_VGA_SHARED_MEM,_END};
-_X_EXPORT resRange resVgaIoShared[] = {_VGA_SHARED_IO,_END};
-_X_EXPORT resRange resVgaUnusedExclusive[] = {_VGA_EXCLUSIVE_UNUSED, _END};
-_X_EXPORT resRange resVgaUnusedShared[] = {_VGA_SHARED_UNUSED, _END};
-_X_EXPORT resRange resVgaSparseExclusive[] = {_VGA_EXCLUSIVE_SPARSE, _END};
-_X_EXPORT resRange resVgaSparseShared[] = {_VGA_SHARED_SPARSE, _END};
-_X_EXPORT resRange res8514Exclusive[] = {_8514_EXCLUSIVE, _END};
-_X_EXPORT resRange res8514Shared[] = {_8514_SHARED, _END};
-
-/* Flag: do we need RAC ? */
-static Bool needRAC = FALSE;
static Bool doFramebufferMode = FALSE;
-/* state change notification callback list */
-static StateChangeNotificationPtr StateChangeNotificationList;
-static void notifyStateChange(xf86NotifyState state);
-
/*
* Call the bus probes relevant to the architecture.
*
@@ -152,17 +120,10 @@ void
xf86EntityInit(void)
{
int i;
- xf86AccessPtr pacc;
for (i = 0; i < xf86NumEntities; i++)
if (xf86Entities[i]->entityInit) {
- if (xf86Entities[i]->access->busAcc)
- ((BusAccPtr)xf86Entities[i]->access->busAcc)->set_f
- (xf86Entities[i]->access->busAcc);
- pacc = xf86Entities[i]->access->fallback;
- pacc->AccessEnable(pacc->arg);
xf86Entities[i]->entityInit(i,xf86Entities[i]->private);
- pacc->AccessDisable(pacc->arg);
}
}
@@ -182,17 +143,10 @@ static void
EntityEnter(void)
{
int i;
- xf86AccessPtr pacc;
for (i = 0; i < xf86NumEntities; i++)
if (xf86Entities[i]->entityEnter) {
- if (xf86Entities[i]->access->busAcc)
- ((BusAccPtr)xf86Entities[i]->access->busAcc)->set_f
- (xf86Entities[i]->access->busAcc);
- pacc = xf86Entities[i]->access->fallback;
- pacc->AccessEnable(pacc->arg);
xf86Entities[i]->entityEnter(i,xf86Entities[i]->private);
- pacc->AccessDisable(pacc->arg);
}
}
@@ -200,32 +154,25 @@ static void
EntityLeave(void)
{
int i;
- xf86AccessPtr pacc;
for (i = 0; i < xf86NumEntities; i++)
if (xf86Entities[i]->entityLeave) {
- if (xf86Entities[i]->access->busAcc)
- ((BusAccPtr)xf86Entities[i]->access->busAcc)->set_f
- (xf86Entities[i]->access->busAcc);
- pacc = xf86Entities[i]->access->fallback;
- pacc->AccessEnable(pacc->arg);
xf86Entities[i]->entityLeave(i,xf86Entities[i]->private);
- pacc->AccessDisable(pacc->arg);
}
}
-_X_EXPORT Bool
+Bool
xf86IsEntityPrimary(int entityIndex)
{
EntityPtr pEnt = xf86Entities[entityIndex];
- if (primaryBus.type != pEnt->busType) return FALSE;
+ if (primaryBus.type != pEnt->bus.type) return FALSE;
- switch (pEnt->busType) {
+ switch (pEnt->bus.type) {
case BUS_PCI:
return (pEnt->bus.id.pci == primaryBus.id.pci);
case BUS_SBUS:
- return (pEnt->sbusBusId.fbNum == primaryBus.id.sbus.fbNum);
+ return (pEnt->bus.id.sbus.fbNum == primaryBus.id.sbus.fbNum);
default:
return FALSE;
}
@@ -255,7 +202,7 @@ xf86DriverHasEntities(DriverPtr drvp)
return FALSE;
}
-_X_EXPORT void
+void
xf86AddEntityToScreen(ScrnInfoPtr pScrn, int entityIndex)
{
if (entityIndex == -1)
@@ -270,8 +217,6 @@ xf86AddEntityToScreen(ScrnInfoPtr pScrn, int entityIndex)
pScrn->entityList = xnfrealloc(pScrn->entityList,
pScrn->numEntities * sizeof(int));
pScrn->entityList[pScrn->numEntities - 1] = entityIndex;
- xf86Entities[entityIndex]->access->next = pScrn->access;
- pScrn->access = xf86Entities[entityIndex]->access;
xf86Entities[entityIndex]->inUse = TRUE;
pScrn->entityInstanceList = xnfrealloc(pScrn->entityInstanceList,
pScrn->numEntities * sizeof(int));
@@ -279,7 +224,7 @@ xf86AddEntityToScreen(ScrnInfoPtr pScrn, int entityIndex)
pScrn->domainIOBase = xf86Entities[entityIndex]->domainIO;
}
-_X_EXPORT void
+void
xf86SetEntityInstanceForScreen(ScrnInfoPtr pScrn, int entityIndex, int instance)
{
int i;
@@ -299,7 +244,7 @@ xf86SetEntityInstanceForScreen(ScrnInfoPtr pScrn, int entityIndex, int instance)
* XXX This needs to be updated for the case where a single entity may have
* instances associated with more than one screen.
*/
-_X_EXPORT ScrnInfoPtr
+ScrnInfoPtr
xf86FindScreenForEntity(int entityIndex)
{
int i,j;
@@ -317,30 +262,19 @@ xf86FindScreenForEntity(int entityIndex)
return NULL;
}
-_X_EXPORT void
+void
xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, int entityIndex)
{
int i;
- EntityAccessPtr *ptr = (EntityAccessPtr *)&pScrn->access;
- EntityAccessPtr peacc;
for (i = 0; i < pScrn->numEntities; i++) {
if (pScrn->entityList[i] == entityIndex) {
- peacc = xf86Entities[pScrn->entityList[i]]->access;
- (*ptr) = peacc->next;
- /* disable entity: call disable func */
- if (peacc->pAccess)
- peacc->pAccess->AccessDisable(peacc->pAccess->arg);
- /* also disable fallback - just in case */
- if (peacc->fallback)
- peacc->fallback->AccessDisable(peacc->fallback->arg);
for (i++; i < pScrn->numEntities; i++)
pScrn->entityList[i-1] = pScrn->entityList[i];
pScrn->numEntities--;
xf86Entities[entityIndex]->inUse = FALSE;
break;
}
- ptr = &(xf86Entities[pScrn->entityList[i]]->access->next);
}
}
@@ -352,7 +286,6 @@ void
xf86ClearEntityListForScreen(int scrnIndex)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
- EntityAccessPtr peacc;
int i, entityIndex;
if (pScrn->entityList == NULL || pScrn->numEntities == 0) return;
@@ -361,43 +294,13 @@ xf86ClearEntityListForScreen(int scrnIndex)
entityIndex = pScrn->entityList[i];
xf86Entities[entityIndex]->inUse = FALSE;
/* disable resource: call the disable function */
- peacc = xf86Entities[entityIndex]->access;
- if (peacc->pAccess)
- peacc->pAccess->AccessDisable(peacc->pAccess->arg);
- /* and the fallback function */
- if (peacc->fallback)
- peacc->fallback->AccessDisable(peacc->fallback->arg);
- /* shared resources are only needed when entity is active: remove */
- xf86DeallocateResourcesForEntity(entityIndex, ResShared);
}
xfree(pScrn->entityList);
xfree(pScrn->entityInstanceList);
- if (pScrn->CurrentAccess->pIoAccess == (EntityAccessPtr)pScrn->access)
- pScrn->CurrentAccess->pIoAccess = NULL;
- if (pScrn->CurrentAccess->pMemAccess == (EntityAccessPtr)pScrn->access)
- pScrn->CurrentAccess->pMemAccess = NULL;
pScrn->entityList = NULL;
pScrn->entityInstanceList = NULL;
}
-void
-xf86DeallocateResourcesForEntity(int entityIndex, unsigned long type)
-{
- resPtr *pprev_next = &Acc;
- resPtr res = Acc;
-
- while (res) {
- if (res->entityIndex == entityIndex &&
- (type & ResAccMask & res->res_type))
- {
- (*pprev_next) = res->next;
- xfree(res);
- } else
- pprev_next = &(res->next);
- res = (*pprev_next);
- }
-}
-
/*
* Add an extra device section (GDevPtr) to an entity.
*/
@@ -423,12 +326,15 @@ xf86AddDevToEntity(int entityIndex, GDevPtr dev)
* EntityRec struct to the drivers. The EntityRec structure itself
* remains invisible to the driver.
*/
-_X_EXPORT EntityInfoPtr
+EntityInfoPtr
xf86GetEntityInfo(int entityIndex)
{
EntityInfoPtr pEnt;
int i;
+ if (entityIndex == -1)
+ return NULL;
+
if (entityIndex >= xf86NumEntities)
return NULL;
@@ -437,7 +343,6 @@ xf86GetEntityInfo(int entityIndex)
pEnt->location = xf86Entities[entityIndex]->bus;
pEnt->active = xf86Entities[entityIndex]->active;
pEnt->chipset = xf86Entities[entityIndex]->chipset;
- pEnt->resources = xf86Entities[entityIndex]->resources;
pEnt->driver = xf86Entities[entityIndex]->driver;
if ( (xf86Entities[entityIndex]->devices) &&
(xf86Entities[entityIndex]->devices[0]) ) {
@@ -451,7 +356,7 @@ xf86GetEntityInfo(int entityIndex)
return pEnt;
}
-_X_EXPORT int
+int
xf86GetNumEntityInstances(int entityIndex)
{
if (entityIndex >= xf86NumEntities)
@@ -460,7 +365,7 @@ xf86GetNumEntityInstances(int entityIndex)
return xf86Entities[entityIndex]->numInstances;
}
-_X_EXPORT GDevPtr
+GDevPtr
xf86GetDevFromEntity(int entityIndex, int instance)
{
int i;
@@ -481,72 +386,12 @@ xf86GetDevFromEntity(int entityIndex, int instance)
}
/*
- * general generic disable function.
- */
-static void
-disableAccess(void)
-{
- int i;
- xf86AccessPtr pacc;
- EntityAccessPtr peacc;
-
- /* call disable funcs and reset current access pointer */
- /* the entity specific access funcs are in an enabled */
- /* state - driver must restore their state explicitely */
- for (i = 0; i < xf86NumScreens; i++) {
- peacc = xf86Screens[i]->CurrentAccess->pIoAccess;
- while (peacc) {
- if (peacc->pAccess)
- peacc->pAccess->AccessDisable(peacc->pAccess->arg);
- peacc = peacc->next;
- }
- xf86Screens[i]->CurrentAccess->pIoAccess = NULL;
- peacc = xf86Screens[i]->CurrentAccess->pMemAccess;
- while (peacc) {
- if (peacc->pAccess)
- peacc->pAccess->AccessDisable(peacc->pAccess->arg);
- peacc = peacc->next;
- }
- xf86Screens[i]->CurrentAccess->pMemAccess = NULL;
- }
- /* then call the generic entity disable funcs */
- for (i = 0; i < xf86NumEntities; i++) {
- pacc = xf86Entities[i]->access->fallback;
- pacc->AccessDisable(pacc->arg);
- }
-}
-
-static void
-clearAccess(void)
-{
- int i;
-
- /* call disable funcs and reset current access pointer */
- /* the entity specific access funcs are in an enabled */
- /* state - driver must restore their state explicitely */
- for (i = 0; i < xf86NumScreens; i++) {
- xf86Screens[i]->CurrentAccess->pIoAccess = NULL;
- xf86Screens[i]->CurrentAccess->pMemAccess = NULL;
- }
-
-}
-
-/*
- * Generic interface to bus specific code - add other buses here
- */
-
-/*
* xf86AccessInit() - set up everything needed for access control
* called only once on first server generation.
*/
void
xf86AccessInit(void)
{
- initPciState();
- initPciBusState();
- DisablePciBusAccess();
- DisablePciAccess();
-
xf86ResAccessEnter = TRUE;
}
@@ -564,12 +409,7 @@ xf86AccessEnter(void)
* on enter we simply disable routing of special resources
* to any bus and let the RAC code to "open" the right bridges.
*/
- PciBusStateEnter();
- DisablePciBusAccess();
- PciStateEnter();
- disableAccess();
EntityEnter();
- notifyStateChange(NOTIFY_ENTER);
xf86EnterServerState(SETUP);
xf86ResAccessEnter = TRUE;
}
@@ -588,35 +428,9 @@ xf86AccessLeave(void)
{
if (!xf86ResAccessEnter)
return;
- notifyStateChange(NOTIFY_LEAVE);
- disableAccess();
- DisablePciBusAccess();
EntityLeave();
}
-void
-xf86AccessLeaveState(void)
-{
- if (!xf86ResAccessEnter)
- return;
- xf86ResAccessEnter = FALSE;
- PciStateLeave();
- PciBusStateLeave();
-}
-
-/*
- * xf86AccessRestoreState() - Restore the access registers to the
- * state before X was started. This is handy for framebuffers.
- */
-static void
-xf86AccessRestoreState(void)
-{
- if (!xf86ResAccessEnter)
- return;
- PciStateLeave();
- PciBusStateLeave();
-}
-
/*
* xf86EnableAccess() -- enable access to controlled resources.
* To reduce latency when switching access the ScrnInfoRec has
@@ -632,896 +446,14 @@ xf86AccessRestoreState(void)
* by other resources!
*/
-_X_EXPORT void
-xf86EnableAccess(ScrnInfoPtr pScrn)
-{
- register EntityAccessPtr peAcc = (EntityAccessPtr) pScrn->access;
- register EntityAccessPtr pceAcc;
- register xf86AccessPtr pAcc;
- EntityAccessPtr tmp;
-
-#ifdef DEBUG
- ErrorF("Enable access %i\n",pScrn->scrnIndex);
-#endif
-
- /* Entity is not under access control or currently enabled */
- if (!pScrn->access) {
- if (pScrn->busAccess) {
- ((BusAccPtr)pScrn->busAccess)->set_f(pScrn->busAccess);
- }
- return;
- }
-
- switch (pScrn->resourceType) {
- case IO:
- pceAcc = pScrn->CurrentAccess->pIoAccess;
- if (peAcc == pceAcc) {
- return;
- }
- if (pScrn->CurrentAccess->pMemAccess == pceAcc)
- pScrn->CurrentAccess->pMemAccess = NULL;
- while (pceAcc) {
- pAcc = pceAcc->pAccess;
- if (pAcc)
- pAcc->AccessDisable(pAcc->arg);
- pceAcc = pceAcc->next;
- }
- if (pScrn->busAccess)
- ((BusAccPtr)pScrn->busAccess)->set_f(pScrn->busAccess);
- while (peAcc) {
- pAcc = peAcc->pAccess;
- if (pAcc)
- pAcc->AccessEnable(pAcc->arg);
- peAcc = peAcc->next;
- }
- pScrn->CurrentAccess->pIoAccess = (EntityAccessPtr) pScrn->access;
- return;
-
- case MEM_IO:
- pceAcc = pScrn->CurrentAccess->pIoAccess;
- if (peAcc != pceAcc) { /* current Io != pAccess */
- tmp = pceAcc;
- while (pceAcc) {
- pAcc = pceAcc->pAccess;
- if (pAcc)
- pAcc->AccessDisable(pAcc->arg);
- pceAcc = pceAcc->next;
- }
- pceAcc = pScrn->CurrentAccess->pMemAccess;
- if (peAcc != pceAcc /* current Mem != pAccess */
- && tmp !=pceAcc) {
- while (pceAcc) {
- pAcc = pceAcc->pAccess;
- if (pAcc)
- pAcc->AccessDisable(pAcc->arg);
- pceAcc = pceAcc->next;
- }
- }
- } else { /* current Io == pAccess */
- pceAcc = pScrn->CurrentAccess->pMemAccess;
- if (pceAcc == peAcc) { /* current Mem == pAccess */
- return;
- }
- while (pceAcc) { /* current Mem != pAccess */
- pAcc = pceAcc->pAccess;
- if (pAcc)
- pAcc->AccessDisable(pAcc->arg);
- pceAcc = pceAcc->next;
- }
- }
- if (pScrn->busAccess)
- ((BusAccPtr)pScrn->busAccess)->set_f(pScrn->busAccess);
- while (peAcc) {
- pAcc = peAcc->pAccess;
- if (pAcc)
- pAcc->AccessEnable(pAcc->arg);
- peAcc = peAcc->next;
- }
- pScrn->CurrentAccess->pMemAccess =
- pScrn->CurrentAccess->pIoAccess = (EntityAccessPtr) pScrn->access;
- return;
-
- case MEM:
- pceAcc = pScrn->CurrentAccess->pMemAccess;
- if (peAcc == pceAcc) {
- return;
- }
- if (pScrn->CurrentAccess->pIoAccess == pceAcc)
- pScrn->CurrentAccess->pIoAccess = NULL;
- while (pceAcc) {
- pAcc = pceAcc->pAccess;
- if (pAcc)
- pAcc->AccessDisable(pAcc->arg);
- pceAcc = pceAcc->next;
- }
- if (pScrn->busAccess)
- ((BusAccPtr)pScrn->busAccess)->set_f(pScrn->busAccess);
- while (peAcc) {
- pAcc = peAcc->pAccess;
- if (pAcc)
- pAcc->AccessEnable(pAcc->arg);
- peAcc = peAcc->next;
- }
- pScrn->CurrentAccess->pMemAccess = (EntityAccessPtr) pScrn->access;
- return;
-
- case NONE:
- if (pScrn->busAccess) {
- ((BusAccPtr)pScrn->busAccess)->set_f(pScrn->busAccess);
- }
- return;
- }
-}
-
-_X_EXPORT void
-xf86SetCurrentAccess(Bool Enable, ScrnInfoPtr pScrn)
-{
- EntityAccessPtr pceAcc2 = NULL;
- register EntityAccessPtr pceAcc = NULL;
- register xf86AccessPtr pAcc;
-
-
- switch(pScrn->resourceType) {
- case IO:
- pceAcc = pScrn->CurrentAccess->pIoAccess;
- break;
- case MEM:
- pceAcc = pScrn->CurrentAccess->pMemAccess;
- break;
- case MEM_IO:
- pceAcc = pScrn->CurrentAccess->pMemAccess;
- pceAcc2 = pScrn->CurrentAccess->pIoAccess;
- break;
- default:
- break;
- }
-
- while (pceAcc) {
- pAcc = pceAcc->pAccess;
- if (pAcc) {
- if (Enable) {
- pAcc->AccessEnable(pAcc->arg);
- } else {
- pAcc->AccessDisable(pAcc->arg);
- }
- }
- pceAcc = pceAcc->next;
- if (!pceAcc) {
- pceAcc = pceAcc2;
- pceAcc2 = NULL;
- }
- }
-}
-
-_X_EXPORT void
-xf86SetAccessFuncs(EntityInfoPtr pEnt, xf86SetAccessFuncPtr funcs,
- xf86SetAccessFuncPtr oldFuncs)
-{
- AccessFuncPtr rac;
-
- if (!xf86Entities[pEnt->index]->rac)
- xf86Entities[pEnt->index]->rac = xnfcalloc(1,sizeof(AccessFuncRec));
-
- rac = xf86Entities[pEnt->index]->rac;
-
- rac->mem_new = funcs->mem;
- rac->io_new = funcs->io;
- rac->io_mem_new = funcs->io_mem;
-
- rac->old = oldFuncs;
-}
-
-/*
- * Conflict checking
- */
-
-static memType
-getMask(memType val)
-{
- memType mask = 0;
- memType tmp = 0;
-
- mask=~mask;
- tmp = ~((~tmp) >> 1);
-
- while (!(val & tmp)) {
- mask = mask >> 1;
- val = val << 1;
- }
- return mask;
-}
-
-/*
- * checkConflictBlock() -- check for conflicts of a block resource range.
- * If conflict is found return end of conflicting range. Else return 0.
- */
-static memType
-checkConflictBlock(resRange *range, resPtr pRes)
-{
- memType val,tmp,prev;
- int i;
-
- switch (pRes->res_type & ResExtMask) {
- case ResBlock:
- if (range->rBegin < pRes->block_end &&
- range->rEnd > pRes->block_begin) {
-#ifdef DEBUG
- ErrorF("b-b conflict w: %lx %lx\n",
- pRes->block_begin,pRes->block_end);
-#endif
- return pRes->block_end < range->rEnd ?
- pRes->block_end : range->rEnd;
- }
- return 0;
- case ResSparse:
- if (pRes->sparse_base > range->rEnd) return 0;
-
- val = (~pRes->sparse_mask | pRes->sparse_base) & getMask(range->rEnd);
-#ifdef DEBUG
- ErrorF("base = 0x%lx, mask = 0x%lx, begin = 0x%lx, end = 0x%lx ,"
- "val = 0x%lx\n",
- pRes->sparse_base, pRes->sparse_mask, range->rBegin,
- range->rEnd, val);
-#endif
- i = sizeof(memType) * 8;
- tmp = prev = pRes->sparse_base;
-
- while (i) {
- tmp |= 1<< (--i) & val;
- if (tmp > range->rEnd)
- tmp = prev;
- else
- prev = tmp;
- }
- if (tmp >= range->rBegin) {
-#ifdef DEBUG
- ErrorF("conflict found at: 0x%lx\n",tmp);
- ErrorF("b-d conflict w: %lx %lx\n",
- pRes->sparse_base,pRes->sparse_mask);
-#endif
- return tmp;
- }
- else
- return 0;
- }
- return 0;
-}
-
-/*
- * checkConflictSparse() -- check for conflicts of a sparse resource range.
- * If conflict is found return base of conflicting region. Else return 0.
- */
-#define mt_max ~(memType)0
-#define length sizeof(memType) * 8
-static memType
-checkConflictSparse(resRange *range, resPtr pRes)
-{
- memType val, tmp, prev;
- int i;
-
- switch (pRes->res_type & ResExtMask) {
- case ResSparse:
- tmp = pRes->sparse_mask & range->rMask;
- if ((tmp & pRes->sparse_base) == (tmp & range->rBase)) {
-#ifdef DEBUG
- ErrorF("s-b conflict w: %lx %lx\n",
- pRes->sparse_base,pRes->sparse_mask);
-#endif
- return pRes->sparse_mask;
- }
- return 0;
-
- case ResBlock:
- if (pRes->block_end < range->rBase) return 0;
-
- val = (~range->rMask | range->rBase) & getMask(pRes->block_end);
- i = length;
- tmp = prev = range->rBase;
-
- while (i) {
-#ifdef DEBUG
- ErrorF("tmp = 0x%lx\n",tmp);
-#endif
- tmp |= 1<< (--i) & val;
- if (tmp > pRes->block_end)
- tmp = prev;
- else
- prev = tmp;
- }
- if (tmp < pRes->block_begin)
- return 0;
- else {
- /*
- * now we subdivide the block region in sparse regions
- * with base values = 2^n and find the smallest mask.
- * This might be done in a simpler way....
- */
- memType mask, m_mask = 0, base = pRes->block_begin;
- int i;
- while (base < pRes->block_end) {
- for (i = 1; i < length; i++)
- if ( base != (base & (mt_max << i))) break;
- mask = mt_max >> (length - i);
- do mask >>= 1;
- while ((mask + base + 1) > pRes->block_end);
- /* m_mask and are _inverted_ sparse masks */
- m_mask = mask > m_mask ? mask : m_mask;
- base = base + mask + 1;
- }
-#ifdef DEBUG
- ErrorF("conflict found at: 0x%lx\n",tmp);
- ErrorF("b-b conflict w: %lx %lx\n",
- pRes->block_begin,pRes->block_end);
-#endif
- return ~m_mask;
- }
- }
- return 0;
-}
-#undef mt_max
-#undef length
-
-/*
- * needCheck() -- this function decides whether to check for conflicts
- * depending on the types of the resource ranges and their locations
- */
-static Bool
-needCheck(resPtr pRes, unsigned long type, int entityIndex, xf86State state)
-{
- /* the same entity shouldn't conflict with itself */
- ScrnInfoPtr pScrn;
- int i;
- BusType loc = BUS_NONE;
- BusType r_loc = BUS_NONE;
-
- if ((pRes->res_type & ResTypeMask) != (type & ResTypeMask))
- return FALSE;
-
- /*
- * Resources set by BIOS (ResBios) are allowed to conflict
- * with resources marked (ResBios).
- */
- if (pRes->res_type & type & ResBios)
- return FALSE;
-
- if (type & pRes->res_type & ResUnused)
- return FALSE;
-
- if (state == OPERATING) {
- if (type & ResDisableOpr || pRes->res_type & ResDisableOpr)
- return FALSE;
- if (type & pRes->res_type & ResUnusedOpr) return FALSE;
- /*
- * Maybe we should have ResUnused set The resUnusedOpr
- * bit, too. This way we could avoid this confusion
- */
- if ((type & ResUnusedOpr && pRes->res_type & ResUnused) ||
- (type & ResUnused && pRes->res_type & ResUnusedOpr))
- return FALSE;
- }
-
- if (entityIndex > -1)
- loc = xf86Entities[entityIndex]->busType;
- if (pRes->entityIndex > -1)
- r_loc = xf86Entities[pRes->entityIndex]->busType;
-
- if ((type & ResAccMask) == ResShared &&
- (pRes->res_type & ResAccMask) == ResShared)
- return FALSE;
-
- if (pRes->entityIndex == entityIndex) return FALSE;
-
- if (pRes->entityIndex > -1 &&
- (pScrn = xf86FindScreenForEntity(entityIndex))) {
- for (i = 0; i < pScrn->numEntities; i++)
- if (pScrn->entityList[i] == pRes->entityIndex) return FALSE;
- }
- return TRUE;
-}
-
-/*
- * checkConflict() - main conflict checking function which all other
- * function call.
- */
-static memType
-checkConflict(resRange *rgp, resPtr pRes, int entityIndex,
- xf86State state, Bool ignoreIdentical)
-{
- memType ret;
-
- while(pRes) {
- if (!needCheck(pRes,rgp->type, entityIndex ,state)) {
- pRes = pRes->next;
- continue;
- }
- switch (rgp->type & ResExtMask) {
- case ResBlock:
- if (rgp->rEnd < rgp->rBegin) {
- xf86Msg(X_ERROR,"end of block range 0x%lx < begin 0x%lx\n",
- (long)rgp->rEnd, (long)rgp->rBegin);
- return 0;
- }
- if ((ret = checkConflictBlock(rgp, pRes))) {
- if (!ignoreIdentical || (rgp->rBegin != pRes->block_begin)
- || (rgp->rEnd != pRes->block_end))
- return ret;
- }
- break;
- case ResSparse:
- if ((rgp->rBase & rgp->rMask) != rgp->rBase) {
- xf86Msg(X_ERROR,"sparse io range (base: 0x%lx mask: 0x%lx)"
- "doesn't satisfy (base & mask = mask)\n",
- (long)rgp->rBase, (long)rgp->rMask);
- return 0;
- }
- if ((ret = checkConflictSparse(rgp, pRes))) {
- if (!ignoreIdentical || (rgp->rBase != pRes->sparse_base)
- || (rgp->rMask != pRes->sparse_mask))
- return ret;
- }
- break;
- }
- pRes = pRes->next;
- }
- return 0;
-}
-
-/*
- * xf86ChkConflict() - This function is the low level interface to
- * the resource broker that gets exported. Tests all resources ie.
- * performs test with SETUP flag.
- */
-static memType
-xf86ChkConflict(resRange *rgp, int entityIndex)
-{
- return checkConflict(rgp, Acc, entityIndex, SETUP, FALSE);
-}
-
-/*
- * Resources List handling
- */
-
-static resPtr
-xf86JoinResLists(resPtr rlist1, resPtr rlist2)
-{
- resPtr pRes;
-
- if (!rlist1)
- return rlist2;
-
- if (!rlist2)
- return rlist1;
-
- for (pRes = rlist1; pRes->next; pRes = pRes->next)
- ;
- pRes->next = rlist2;
- return rlist1;
-}
-
-resPtr
-xf86AddResToList(resPtr rlist, resRange *range, int entityIndex)
-{
- resPtr new;
-
- switch (range->type & ResExtMask) {
- case ResBlock:
- if (range->rEnd < range->rBegin) {
- xf86Msg(X_ERROR,"end of block range 0x%lx < begin 0x%lx\n",
- (long)range->rEnd, (long)range->rBegin);
- return rlist;
- }
- break;
- case ResSparse:
- if ((range->rBase & range->rMask) != range->rBase) {
- xf86Msg(X_ERROR,"sparse io range (base: 0x%lx mask: 0x%lx)"
- "doesn't satisfy (base & mask = mask)\n",
- (long)range->rBase, (long)range->rMask);
- return rlist;
- }
- break;
- }
-
- new = xnfalloc(sizeof(resRec));
- /*
- * Only background resources may be registered with ResBios
- * and ResEstimated set. Other resources only set it for
- * testing.
- */
- if (entityIndex != (-1))
- range->type &= ~(ResBios | ResEstimated);
- new->val = *range;
- new->entityIndex = entityIndex;
- new->next = rlist;
- return new;
-}
-
-_X_EXPORT void
-xf86FreeResList(resPtr rlist)
-{
- resPtr pRes;
-
- if (!rlist)
- return;
-
- for (pRes = rlist->next; pRes; rlist = pRes, pRes = pRes->next)
- xfree(rlist);
- xfree(rlist);
-}
-
-static resPtr
-xf86DupResList(const resPtr rlist)
-{
- resPtr pRes, ret, prev, new;
-
- if (!rlist)
- return NULL;
-
- ret = xnfalloc(sizeof(resRec));
- *ret = *rlist;
- prev = ret;
- for (pRes = rlist->next; pRes; pRes = pRes->next) {
- new = xnfalloc(sizeof(resRec));
- *new = *pRes;
- prev->next = new;
- prev = new;
- }
- return ret;
-}
-
-static void
-xf86PrintResList(int verb, resPtr list)
-{
- int i = 0;
- const char *s, *r;
- resPtr tmp = list;
- unsigned long type;
-
- if (!list)
- return;
-
- type = ResMem;
- r = "M";
- while (1) {
- while (list) {
- if ((list->res_type & ResPhysMask) == type) {
- switch (list->res_type & ResExtMask) {
- case ResBlock:
- xf86ErrorFVerb(verb,
- "\t[%d] %d\t%ld\t0x%08lx - 0x%08lx (0x%lx)",
- i, list->entityIndex,
- (list->res_type & ResDomain) >> 24,
- (long)list->block_begin,
- (long)list->block_end,
- (long)(list->block_end -
- list->block_begin + 1));
- break;
- case ResSparse:
- xf86ErrorFVerb(verb, "\t[%d] %d\t%ld\t0x%08lx - 0x%08lx ",
- i, list->entityIndex,
- (list->res_type & ResDomain) >> 24,
- (long)list->sparse_base,
- (long)list->sparse_mask);
- break;
- default:
- list = list->next;
- continue;
- }
- xf86ErrorFVerb(verb, " %s", r);
- switch (list->res_type & ResAccMask) {
- case ResExclusive:
- if (list->res_type & ResUnused)
- s = "x";
- else
- s = "X";
- break;
- case ResShared:
- if (list->res_type & ResUnused)
- s = "s";
- else
- s = "S";
- break;
- default:
- s = "?";
- }
- xf86ErrorFVerb(verb, "%s", s);
- switch (list->res_type & ResExtMask) {
- case ResBlock:
- s = "[B]";
- break;
- case ResSparse:
- s = "[S]";
- break;
- default:
- s = "[?]";
- }
- xf86ErrorFVerb(verb, "%s", s);
- if (list->res_type & ResInit)
- xf86ErrorFVerb(verb, "t");
- if (list->res_type & ResBios)
- xf86ErrorFVerb(verb, "(B)");
- if (list->res_type & ResBus)
- xf86ErrorFVerb(verb, "(b)");
- if (list->res_type & ResOprMask) {
- switch (list->res_type & ResOprMask) {
- case ResUnusedOpr:
- s = "(OprU)";
- break;
- case ResDisableOpr:
- s = "(OprD)";
- break;
- default:
- s = "(Opr?)";
- break;
- }
- xf86ErrorFVerb(verb, "%s", s);
- }
- xf86ErrorFVerb(verb, "\n");
- i++;
- }
- list = list->next;
- }
- if (type == ResIo) break;
- type = ResIo;
- r = "I";
- list = tmp;
- }
-}
-
-resPtr
-xf86AddRangesToList(resPtr list, resRange *pRange, int entityIndex)
-{
- while(pRange && pRange->type != ResEnd) {
- list = xf86AddResToList(list,pRange,entityIndex);
- pRange++;
- }
- return list;
-}
-
void
-xf86ResourceBrokerInit(void)
-{
- Acc = NULL;
-
- /* Get the ranges used exclusively by the system */
- Acc = xf86AccResFromOS(Acc);
- xf86MsgVerb(X_INFO, 3, "System resource ranges:\n");
- xf86PrintResList(3, Acc);
-}
-
-/*
- * Resource registration
- */
-
-static void
-convertRange2Host(int entityIndex, resRange *pRange)
-{
- if (pRange->type & ResBus) {
- switch (xf86Entities[entityIndex]->busType) {
- case BUS_PCI:
- pciConvertRange2Host(entityIndex,pRange);
- break;
- default:
- break;
- }
-
- pRange->type &= ~ResBus;
- }
-}
-
-static void
-xf86ConvertListToHost(int entityIndex, resPtr list)
-{
- while (list) {
- convertRange2Host(entityIndex, &list->val);
- list = list->next;
- }
-}
-
-/*
- * xf86RegisterResources() -- attempts to register listed resources.
- * Returns a resPtr listing all resources not successfully registered, by
- * which we mean, NULL.
- */
-
-_X_EXPORT resPtr
-xf86RegisterResources(int entityIndex, resList list, unsigned long access)
+xf86EnableAccess(ScrnInfoPtr pScrn)
{
- resRange range;
- resList list_f = NULL;
-
- if (!list)
- return NULL;
+ DebugF("Enable access %i\n",pScrn->scrnIndex);
- while(list->type != ResEnd) {
- range = *list;
-
- convertRange2Host(entityIndex,&range);
-
- if ((access != ResNone) && (access & ResAccMask)) {
- range.type = (range.type & ~ResAccMask) | (access & ResAccMask);
- }
- range.type &= ~ResEstimated; /* Not allowed for drivers */
- Acc = xf86AddResToList(Acc,&range,entityIndex);
- list++;
- }
- if (list_f)
- xfree(list_f);
-
-#ifdef DEBUG
- xf86MsgVerb(X_INFO, 3,"Resources after driver initialization\n");
- xf86PrintResList(3, Acc);
-#endif
- return NULL;
-
-}
-
-static void
-busTypeSpecific(EntityPtr pEnt, xf86AccessPtr *acc_mem,
- xf86AccessPtr *acc_io, xf86AccessPtr *acc_mem_io)
-{
- switch (pEnt->bus.type) {
- case BUS_SBUS:
- *acc_mem = *acc_io = *acc_mem_io = &AccessNULL;
- break;
- case BUS_PCI: {
- struct pci_device *const dev = pEnt->bus.id.pci;
-
- if ((dev != NULL) && ((void *)dev->user_data != NULL)) {
- pciAccPtr const paccp = (pciAccPtr) dev->user_data;
-
- *acc_io = & paccp->ioAccess;
- *acc_mem = & paccp->memAccess;
- *acc_mem_io = & paccp->io_memAccess;
- }
- else {
- /* FIXME: This is an error path. We should probably have an
- * FIXME: assertion here or something.
- */
- *acc_io = NULL;
- *acc_mem = NULL;
- *acc_mem_io = NULL;
- }
- break;
- }
- default:
- *acc_mem = *acc_io = *acc_mem_io = NULL;
- break;
- }
return;
}
-static void
-setAccess(EntityPtr pEnt, xf86State state)
-{
-
- xf86AccessPtr acc_mem, acc_io, acc_mem_io;
- xf86AccessPtr org_mem = NULL, org_io = NULL, org_mem_io = NULL;
- int prop;
-
- busTypeSpecific(pEnt, &acc_mem, &acc_io, &acc_mem_io);
-
- /* The replacement function needs to handle _all_ shared resources */
- /* unless they are handeled locally and disabled otherwise */
- if (pEnt->rac) {
- if (pEnt->rac->io_new) {
- org_io = acc_io;
- acc_io = pEnt->rac->io_new;
- }
- if (pEnt->rac->mem_new) {
- org_mem = acc_mem;
- acc_mem = pEnt->rac->mem_new;
- }
- if (pEnt->rac->io_mem_new) {
- org_mem_io = acc_mem_io;
- acc_mem_io = pEnt->rac->io_mem_new;
- }
- }
-
- if (state == OPERATING) {
- prop = pEnt->entityProp;
- switch(pEnt->entityProp & NEED_SHARED) {
- case NEED_SHARED:
- pEnt->access->rt = MEM_IO;
- break;
- case NEED_IO_SHARED:
- pEnt->access->rt = IO;
- break;
- case NEED_MEM_SHARED:
- pEnt->access->rt = MEM;
- break;
- default:
- pEnt->access->rt = NONE;
- }
- } else {
- prop = NEED_SHARED | NEED_MEM | NEED_IO;
- pEnt->access->rt = MEM_IO;
- }
-
- switch(pEnt->access->rt) {
- case IO:
- pEnt->access->pAccess = acc_io;
- break;
- case MEM:
- pEnt->access->pAccess = acc_mem;
- break;
- case MEM_IO:
- pEnt->access->pAccess = acc_mem_io;
- break;
- default: /* no conflicts at all */
- pEnt->access->pAccess = NULL; /* remove from RAC */
- break;
- }
-
- if (org_io) {
- /* does the driver want the old access func? */
- if (pEnt->rac->old) {
- /* give it to the driver, leave state disabled */
- pEnt->rac->old->io = org_io;
- } else {
- /* driver doesn't want it - enable generic access */
- org_io->AccessEnable(org_io->arg);
- }
- }
-
- if (org_mem_io) {
- /* does the driver want the old access func? */
- if (pEnt->rac->old) {
- /* give it to the driver, leave state disabled */
- pEnt->rac->old->io_mem = org_mem_io;
- } else {
- /* driver doesn't want it - enable generic access */
- org_mem_io->AccessEnable(org_mem_io->arg);
- }
- }
-
- if (org_mem) {
- /* does the driver want the old access func? */
- if (pEnt->rac->old) {
- /* give it to the driver, leave state disabled */
- pEnt->rac->old->mem = org_mem;
- } else {
- /* driver doesn't want it - enable generic access */
- org_mem->AccessEnable(org_mem->arg);
- }
- }
-
- if (!(prop & NEED_MEM_SHARED)){
- if (prop & NEED_MEM) {
- if (acc_mem)
- acc_mem->AccessEnable(acc_mem->arg);
- } else {
- if (acc_mem)
- acc_mem->AccessDisable(acc_mem->arg);
- }
- }
-
- if (!(prop & NEED_IO_SHARED)) {
- if (prop & NEED_IO) {
- if (acc_io)
- acc_io->AccessEnable(acc_io->arg);
- } else {
- if (acc_io)
- acc_io->AccessDisable(acc_io->arg);
- }
- }
-
- /* disable shared resources */
- if (pEnt->access->pAccess)
- pEnt->access->pAccess->AccessDisable(pEnt->access->pAccess->arg);
-
- /*
- * If device is not under access control it is enabled.
- * If it needs bus routing do it here as it isn't bus
- * type specific. Any conflicts should be checked at this
- * stage
- */
- if (!pEnt->access->pAccess
- && (pEnt->entityProp & (state == SETUP ? NEED_VGA_ROUTED_SETUP :
- NEED_VGA_ROUTED)))
- ((BusAccPtr)pEnt->busAcc)->set_f(pEnt->busAcc);
-}
-
-
/*
* xf86EnterServerState() -- set state the server is in.
*/
@@ -1546,11 +478,6 @@ SetSIGIOForState(xf86State state)
void
xf86EnterServerState(xf86State state)
{
- EntityPtr pEnt;
- ScrnInfoPtr pScrn;
- int i,j;
- int needVGA = 0;
- resType rt;
/*
* This is a good place to block SIGIO during SETUP state.
* SIGIO should be blocked in SETUP state otherwise (u)sleep()
@@ -1558,262 +485,12 @@ xf86EnterServerState(xf86State state)
* We take care not to call xf86BlockSIGIO() twice.
*/
SetSIGIOForState(state);
-#ifdef DEBUG
if (state == SETUP)
- ErrorF("Entering SETUP state\n");
+ DebugF("Entering SETUP state\n");
else
- ErrorF("Entering OPERATING state\n");
-#endif
+ DebugF("Entering OPERATING state\n");
- /* When servicing a dumb framebuffer we don't need to do anything */
- if (doFramebufferMode) return;
-
- for (i=0; i<xf86NumScreens; i++) {
- pScrn = xf86Screens[i];
- j = pScrn->entityList[pScrn->numEntities - 1];
- pScrn->access = xf86Entities[j]->access;
-
- for (j = 0; j<xf86Screens[i]->numEntities; j++) {
- pEnt = xf86Entities[xf86Screens[i]->entityList[j]];
- if (pEnt->entityProp & (state == SETUP ? NEED_VGA_ROUTED_SETUP
- : NEED_VGA_ROUTED))
- xf86Screens[i]->busAccess = pEnt->busAcc;
- }
- if (xf86Screens[i]->busAccess)
- needVGA ++;
- }
-
- /*
- * if we just have one screen we don't have RAC.
- * Therefore just enable the screen and return.
- */
- if (!needRAC) {
- xf86EnableAccess(xf86Screens[0]);
- notifyStateChange(NOTIFY_ENABLE);
- return;
- }
-
- if (state == SETUP)
- notifyStateChange(NOTIFY_SETUP_TRANSITION);
- else
- notifyStateChange(NOTIFY_OPERATING_TRANSITION);
-
- clearAccess();
- for (i=0; i<xf86NumScreens;i++) {
-
- rt = NONE;
-
- for (j = 0; j<xf86Screens[i]->numEntities; j++) {
- pEnt = xf86Entities[xf86Screens[i]->entityList[j]];
- setAccess(pEnt,state);
-
- if (pEnt->access->rt != NONE) {
- if (rt != NONE && rt != pEnt->access->rt)
- rt = MEM_IO;
- else
- rt = pEnt->access->rt;
- }
- }
- xf86Screens[i]->resourceType = rt;
- if (rt == NONE) {
- xf86Screens[i]->access = NULL;
- if (needVGA < 2)
- xf86Screens[i]->busAccess = NULL;
- }
-
-#ifdef DEBUG
- if (xf86Screens[i]->busAccess)
- ErrorF("Screen %i setting vga route\n",i);
-#endif
- switch (rt) {
- case MEM_IO:
- xf86MsgVerb(X_INFO, 3, "Screen %i shares mem & io resources\n",i);
- break;
- case IO:
- xf86MsgVerb(X_INFO, 3, "Screen %i shares io resources\n",i);
- break;
- case MEM:
- xf86MsgVerb(X_INFO, 3, "Screen %i shares mem resources\n",i);
- break;
- default:
- xf86MsgVerb(X_INFO, 3, "Entity %i shares no resources\n",i);
- break;
- }
- }
- if (state == SETUP)
- notifyStateChange(NOTIFY_SETUP);
- else
- notifyStateChange(NOTIFY_OPERATING);
-}
-
-/*
- * xf86SetOperatingState() -- Set ResOperMask for resources listed.
- */
-_X_EXPORT resPtr
-xf86SetOperatingState(resList list, int entityIndex, int mask)
-{
- resPtr acc;
- resPtr r_fail = NULL;
- resRange range;
-
- while (list->type != ResEnd) {
- range = *list;
- convertRange2Host(entityIndex,&range);
-
- acc = Acc;
- while (acc) {
-#define MASK (ResTypeMask | ResExtMask)
- if ((acc->entityIndex == entityIndex)
- && (acc->val.a == range.a) && (acc->val.b == range.b)
- && ((acc->val.type & MASK) == (range.type & MASK)))
- break;
-#undef MASK
- acc = acc->next;
- }
- if (acc)
- acc->val.type = (acc->val.type & ~ResOprMask)
- | (mask & ResOprMask);
- else {
- r_fail = xf86AddResToList(r_fail,&range,entityIndex);
- }
- list ++;
- }
-
- return r_fail;
-}
-
-/*
- * Stage specific code
- */
-
-/*
- * xf86ClaimFixedResources() is used to allocate non-relocatable resources.
- * This should only be done by a driver's Probe() function.
- */
-_X_EXPORT void
-xf86ClaimFixedResources(resList list, int entityIndex)
-{
- resPtr ptr = NULL;
- resRange range;
-
- if (!list) return;
-
- while (list->type !=ResEnd) {
- range = *list;
-
- convertRange2Host(entityIndex,&range);
-
- range.type &= ~ResEstimated; /* Not allowed for drivers */
- switch (range.type & ResAccMask) {
- case ResExclusive:
- if (!xf86ChkConflict(&range, entityIndex)) {
- Acc = xf86AddResToList(Acc, &range, entityIndex);
- } else FatalError("xf86ClaimFixedResources conflict\n");
- break;
- case ResShared:
- /* at this stage the resources are just added to the
- * EntityRec. After the Probe() phase this list is checked by
- * xf86PostProbe(). All resources which don't
- * conflict with already allocated ones are allocated
- * and removed from the EntityRec. Thus a non-empty resource
- * list in the EntityRec indicates resource conflicts the
- * driver should either handle or fail.
- */
- if (xf86Entities[entityIndex]->active)
- ptr = xf86AddResToList(ptr,&range,entityIndex);
- break;
- }
- list++;
- }
- xf86Entities[entityIndex]->resources =
- xf86JoinResLists(xf86Entities[entityIndex]->resources,ptr);
- xf86MsgVerb(X_INFO, 3,
- "resource ranges after xf86ClaimFixedResources() call:\n");
- xf86PrintResList(3,Acc);
-#ifdef DEBUG
- if (ptr) {
- xf86MsgVerb(X_INFO, 3, "to be registered later:\n");
- xf86PrintResList(3,ptr);
- }
-#endif
-}
-
-static void
-checkRoutingForScreens(xf86State state)
-{
- resList list = resVgaUnusedExclusive;
- resPtr pResVGA = NULL;
- resPtr pResVGAHost;
- pointer vga = NULL;
- int i,j;
- int entityIndex;
- EntityPtr pEnt;
- resPtr pAcc;
- resRange range;
-
- /*
- * find devices that need VGA routed: ie the ones that have
- * registered VGA resources without ResUnused. ResUnused
- * doesn't conflict with itself therefore use it here.
- */
- while (list->type != ResEnd) { /* create resPtr from resList for VGA */
- range = *list;
- range.type &= ~(ResBios | ResEstimated); /* if set remove them */
- pResVGA = xf86AddResToList(pResVGA, &range, -1);
- list++;
- }
-
- for (i = 0; i < xf86NumScreens; i++) {
- for (j = 0; j < xf86Screens[i]->numEntities; j++) {
- entityIndex = xf86Screens[i]->entityList[j];
- pEnt = xf86Entities[entityIndex];
- pAcc = Acc;
- vga = NULL;
- pResVGAHost = xf86DupResList(pResVGA);
- xf86ConvertListToHost(entityIndex,pResVGAHost);
- while (pAcc) {
- if (pAcc->entityIndex == entityIndex)
- if (checkConflict(&pAcc->val, pResVGAHost,
- entityIndex, state, FALSE)) {
- if (vga && vga != pEnt->busAcc) {
- xf86Msg(X_ERROR, "Screen %i needs vga routed to"
- "different buses - deleting\n",i);
- xf86DeleteScreen(i--,0);
- }
-#ifdef DEBUG
- {
- resPtr rlist = xf86AddResToList(NULL,&pAcc->val,
- pAcc->entityIndex);
- xf86MsgVerb(X_INFO,3,"====== %s\n",
- state == OPERATING ? "OPERATING"
- : "SETUP");
- xf86MsgVerb(X_INFO,3,"%s Resource:\n",
- (pAcc->val.type) & ResMem ? "Mem" :"Io");
- xf86PrintResList(3,rlist);
- xf86FreeResList(rlist);
- xf86MsgVerb(X_INFO,3,"Conflicts with:\n");
- xf86PrintResList(3,pResVGAHost);
- xf86MsgVerb(X_INFO,3,"=====\n");
- }
-#endif
- vga = pEnt->busAcc;
- pEnt->entityProp |= (state == SETUP
- ? NEED_VGA_ROUTED_SETUP : NEED_VGA_ROUTED);
- if (state == OPERATING) {
- if (pAcc->val.type & ResMem)
- pEnt->entityProp |= NEED_VGA_MEM;
- else
- pEnt->entityProp |= NEED_VGA_IO;
- }
- }
- pAcc = pAcc->next;
- }
- if (vga)
- xf86MsgVerb(X_INFO, 3,"Setting vga for screen %i.\n",i);
- xf86FreeResList(pResVGAHost);
- }
- }
- xf86FreeResList(pResVGA);
+ return;
}
/*
@@ -1823,10 +500,6 @@ checkRoutingForScreens(xf86State state)
void
xf86PostProbe(void)
{
- memType val;
- int i,j;
- resPtr resp, acc, tmp, resp_x;
-
if (fbSlotClaimed) {
if (pciSlotClaimed
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
@@ -1838,531 +511,40 @@ xf86PostProbe(void)
return;
} else {
xf86Msg(X_INFO,"Running in FRAMEBUFFER Mode\n");
- xf86AccessRestoreState();
- notifyStateChange(NOTIFY_ENABLE);
doFramebufferMode = TRUE;
return;
}
}
- acc = tmp = xf86DupResList(Acc);
-
- for (i=0; i<xf86NumEntities; i++) {
- resp = xf86Entities[i]->resources;
- xf86Entities[i]->resources = NULL;
- resp_x = NULL;
- while (resp) {
- if (! (val = checkConflict(&resp->val,acc,i,SETUP,FALSE))) {
- resp->res_type &= ~(ResBios); /* just used for chkConflict() */
- tmp = resp_x;
- resp_x = resp;
- resp = resp->next;
- resp_x->next = tmp;
- } else {
- xf86MsgVerb(X_INFO, 3, "Found conflict at: 0x%lx\n",
- (long)val);
- resp->res_type &= ~ResEstimated;
- tmp = xf86Entities[i]->resources;
- xf86Entities[i]->resources = resp;
- resp = resp->next;
- xf86Entities[i]->resources->next = tmp;
- }
- }
- xf86JoinResLists(Acc,resp_x);
- }
- xf86FreeResList(acc);
-
- xf86MsgVerb(X_INFO, 3, "resource ranges after probing:\n");
- xf86PrintResList(3, Acc);
- checkRoutingForScreens(SETUP);
-
- for (i = 0; i < xf86NumScreens; i++) {
- for (j = 0; j<xf86Screens[i]->numEntities; j++) {
- EntityPtr pEnt = xf86Entities[xf86Screens[i]->entityList[j]];
- if ((pEnt->entityProp & NEED_VGA_ROUTED_SETUP) &&
- ((xf86Screens[i]->busAccess = pEnt->busAcc)))
- break;
- }
- }
-}
-
-static void
-checkRequiredResources(int entityIndex)
-{
- resRange range;
- resPtr pAcc = Acc;
- const EntityPtr pEnt = xf86Entities[entityIndex];
- while (pAcc) {
- if (pAcc->entityIndex == entityIndex) {
- range = pAcc->val;
- /* ResAny to find conflicts with anything. */
- range.type = (range.type & ~ResAccMask) | ResAny | ResBios;
- if (checkConflict(&range,Acc,entityIndex,OPERATING,FALSE))
- switch (pAcc->res_type & ResPhysMask) {
- case ResMem:
- pEnt->entityProp |= NEED_MEM_SHARED;
- break;
- case ResIo:
- pEnt->entityProp |= NEED_IO_SHARED;
- break;
- }
- if (!(pAcc->res_type & ResOprMask)) {
- switch (pAcc->res_type & ResPhysMask) {
- case ResMem:
- pEnt->entityProp |= NEED_MEM;
- break;
- case ResIo:
- pEnt->entityProp |= NEED_IO;
- break;
- }
- }
- }
- pAcc = pAcc->next;
- }
-
- /*
- * After we have checked all resources of an entity agains any
- * other resource we know if the entity need this resource type
- * (ie. mem/io) at all. if not we can disable this type completely,
- * so no need to share it either.
- */
- if ((pEnt->entityProp & NEED_MEM_SHARED)
- && (!(pEnt->entityProp & NEED_MEM)))
- pEnt->entityProp &= ~(unsigned long)NEED_MEM_SHARED;
-
- if ((pEnt->entityProp & NEED_IO_SHARED)
- && (!(pEnt->entityProp & NEED_IO)))
- pEnt->entityProp &= ~(unsigned long)NEED_IO_SHARED;
-}
-
-void
-xf86PostPreInit()
-{
- if (doFramebufferMode) return;
-
- if (xf86NumScreens > 1)
- needRAC = TRUE;
-
- xf86MsgVerb(X_INFO, 3, "do I need RAC?");
-
- if (needRAC) {
- xf86ErrorFVerb(3, " Yes, I do.\n");
- } else {
- xf86ErrorFVerb(3, " No, I don't.\n");
- }
-
- xf86MsgVerb(X_INFO, 3, "resource ranges after preInit:\n");
- xf86PrintResList(3, Acc);
}
void
xf86PostScreenInit(void)
{
- int i,j;
- ScreenPtr pScreen;
- unsigned int flags;
- int nummem = 0, numio = 0;
-
+#ifdef HAVE_PCI_DEVICE_VGAARB_INIT
+ int vga_count;
+#endif
if (doFramebufferMode) {
SetSIGIOForState(OPERATING);
return;
}
-#ifdef DEBUG
- ErrorF("PostScreenInit generation: %i\n",serverGeneration);
-#endif
- if (serverGeneration == 1) {
- checkRoutingForScreens(OPERATING);
- for (i=0; i<xf86NumEntities; i++) {
- checkRequiredResources(i);
- }
-
- /*
- * after removing NEED_XXX_SHARED from entities that
- * don't need need XXX resources at all we might have
- * a single entity left that has NEED_XXX_SHARED set.
- * In this case we can delete that, too.
- */
- for (i = 0; i < xf86NumEntities; i++) {
- if (xf86Entities[i]->entityProp & NEED_MEM_SHARED)
- nummem++;
- if (xf86Entities[i]->entityProp & NEED_IO_SHARED)
- numio++;
- }
- for (i = 0; i < xf86NumEntities; i++) {
- if (nummem < 2)
- xf86Entities[i]->entityProp &= ~NEED_MEM_SHARED;
- if (numio < 2)
- xf86Entities[i]->entityProp &= ~NEED_IO_SHARED;
- }
- }
-
- if (xf86Screens && needRAC) {
- int needRACforVga = 0;
-
- for (i = 0; i < xf86NumScreens; i++) {
- for (j = 0; j < xf86Screens[i]->numEntities; j++) {
- if (xf86Entities[xf86Screens[i]->entityList[j]]->entityProp
- & NEED_VGA_ROUTED) {
- needRACforVga ++;
- break; /* only count each screen once */
- }
- }
- }
-
- for (i = 0; i < xf86NumScreens; i++) {
- Bool needRACforMem = FALSE, needRACforIo = FALSE;
-
- for (j = 0; j < xf86Screens[i]->numEntities; j++) {
- if (xf86Entities[xf86Screens[i]->entityList[j]]->entityProp
- & NEED_MEM_SHARED)
- needRACforMem = TRUE;
- if (xf86Entities[xf86Screens[i]->entityList[j]]->entityProp
- & NEED_IO_SHARED)
- needRACforIo = TRUE;
- /*
- * We may need RAC although we don't share any resources
- * as we need to route VGA to the correct bus. This can
- * only be done simultaniously for MEM and IO.
- */
- if (needRACforVga > 1) {
- if (xf86Entities[xf86Screens[i]->entityList[j]]->entityProp
- & NEED_VGA_MEM)
- needRACforMem = TRUE;
- if (xf86Entities[xf86Screens[i]->entityList[j]]->entityProp
- & NEED_VGA_IO)
- needRACforIo = TRUE;
- }
- }
-
- pScreen = xf86Screens[i]->pScreen;
- flags = 0;
- if (needRACforMem) {
- flags |= xf86Screens[i]->racMemFlags;
- xf86ErrorFVerb(3, "Screen %d is using RAC for mem\n", i);
- }
- if (needRACforIo) {
- flags |= xf86Screens[i]->racIoFlags;
- xf86ErrorFVerb(3, "Screen %d is using RAC for io\n", i);
- }
-
- xf86RACInit(pScreen,flags);
- }
- }
-
- xf86EnterServerState(OPERATING);
-
-}
-
-/*
- * Sets
- */
-
-
-static resPtr
-decomposeSparse(resRange range)
-{
- resRange new;
- resPtr ret = NULL;
- memType val = range.rBegin;
- int i = 0;
-
- new.type = (range.type & ~ResExtMask) | ResSparse;
-
- while (1) {
- if (val & 0x01) {
- new.rBase = (val << i);
- new.rMask = ~((1 << i) - 1);
- ret = xf86AddResToList(ret,&new,-1);
- val ++;
- }
- i++;
- val >>= 1;
- if ((((val + 1) << i) - 1) > range.rEnd)
- break;
- }
- i--;
- val <<= 1;
-
- while (1) {
- if((((val + 1) << i) - 1)> range.rEnd) {
- if (--i < 0) break;
- val <<= 1;
- } else {
- new.rBase = (val << i);
- new.rMask = ~((1 << i) - 1);
- val++;
- ret = xf86AddResToList(ret,&new,-1);
- }
- }
- return ret;
-}
-
-static Bool
-x_isSubsetOf(resRange range, resPtr list1, resPtr list2)
-{
- resRange range1, range2;
- memType m1_A_m2;
- Bool ret;
- resPtr list;
-
- if (list1) {
- list = list1;
- if ((range.type & ResTypeMask) == (list->res_type & ResTypeMask)) {
- switch (range.type & ResExtMask) {
- case ResBlock:
- if ((list->res_type & ResExtMask) == ResBlock) {
- if (range.rBegin >= list->block_begin
- && range.rEnd <= list->block_end)
- return TRUE;
- else if (range.rBegin < list->block_begin
- && range.rEnd > list->block_end) {
- RANGE(range1, range.rBegin, list->block_begin - 1,
- range.type);
- RANGE(range2, list->block_end + 1, range.rEnd,
- range.type);
- return (x_isSubsetOf(range1,list->next,list2) &&
- x_isSubsetOf(range2,list->next,list2));
- }
- else if (range.rBegin >= list->block_begin
- && range.rBegin <= list->block_end) {
- RANGE(range1, list->block_end + 1, range.rEnd,
- range.type);
- return (x_isSubsetOf(range1,list->next,list2));
- } else if (range.rEnd >= list->block_begin
- && range.rEnd <= list->block_end) {
- RANGE(range1,range.rBegin, list->block_begin - 1,
- range.type);
- return (x_isSubsetOf(range1,list->next,list2));
- }
- }
- break;
- case ResSparse:
- if ((list->res_type & ResExtMask) == ResSparse) {
- memType test;
- int i;
-
- m1_A_m2 = range.rMask & list->sparse_mask;
- if ((range.rBase ^ list->sparse_base) & m1_A_m2)
- break;
- /*
- * We use the following system:
- * let 0 ^= mask:1 base:0, 1 ^= mask:1 base:1,
- * X mask:0 ; S: set TSS: test set for subset
- * NTSS: new test set after test
- * S: 1 0 1 0 X X 0 1 X
- * TSS: 1 0 0 1 1 0 X X X
- * T: 0 0 1 1 0 0 0 0 0
- * NTSS: 1 0 0/X 1/X 1 0 1 0 X
- * R: 0 0 0 0 0 0 1 1 0
- * If R != 0 TSS and S are disjunct
- * If R == 0 TSS is subset of S
- * If R != 0 NTSS contains elements from TSS
- * which are not also members of S.
- * If a T is set one of the correspondig bits
- * in NTSS must be set to the specified value
- * all other are X
- */
- test = list->sparse_mask & ~range.rMask;
- if (test == 0)
- return TRUE;
- for (i = 0; i < sizeof(memType); i++) {
- if ((test >> i) & 0x1) {
- RANGE(range1, ((range.rBase & list->sparse_base)
- | (range.rBase & ~list->sparse_mask)
- | ((~list->sparse_base & list->sparse_mask)
- & ~range.rMask)) & range1.rMask,
- ((range.rMask | list->sparse_mask) & ~test)
- | (1 << i), range.type);
- return (x_isSubsetOf(range1,list->next,list2));
- }
- }
- }
- break;
- }
- }
- return (x_isSubsetOf(range,list->next,list2));
- } else if (list2) {
- resPtr tmpList = NULL;
- switch (range.type & ResExtMask) {
- case ResBlock:
- tmpList = decomposeSparse(range);
- while (tmpList) {
- if (!x_isSubsetOf(tmpList->val,list2,NULL)) {
- xf86FreeResList(tmpList);
- return FALSE;
- }
- tmpList = tmpList->next;
- }
- xf86FreeResList(tmpList);
- return TRUE;
- break;
- case ResSparse:
- while (list2) {
- tmpList = xf86JoinResLists(tmpList,decomposeSparse(list2->val));
- list2 = list2->next;
- }
- ret = x_isSubsetOf(range,tmpList,NULL);
- xf86FreeResList(tmpList);
- return ret;
- break;
- }
- } else
- return FALSE;
-
- return FALSE;
-}
-
-Bool
-xf86IsSubsetOf(resRange range, resPtr list)
-{
- resPtr dup = xf86DupResList(list);
- resPtr r_sp = NULL, r = NULL, tmp = NULL;
- Bool ret = FALSE;
-
- while (dup) {
- tmp = dup;
- dup = dup->next;
- switch (tmp->res_type & ResExtMask) {
- case ResBlock:
- tmp->next = r;
- r = tmp;
- break;
- case ResSparse:
- tmp->next = r_sp;
- r_sp = tmp;
- break;
- }
- }
-
- switch (range.type & ResExtMask) {
- case ResBlock:
- ret = x_isSubsetOf(range,r,r_sp);
- break;
- case ResSparse:
- ret = x_isSubsetOf(range,r_sp,r);
- break;
- }
- xf86FreeResList(r);
- xf86FreeResList(r_sp);
-
- return ret;
-}
-
-static resPtr
-findIntersect(resRange Range, resPtr list)
-{
- resRange range;
- resPtr new = NULL;
-
- while (list) {
- if ((Range.type & ResTypeMask) == (list->res_type & ResTypeMask)) {
- switch (Range.type & ResExtMask) {
- case ResBlock:
- switch (list->res_type & ResExtMask) {
- case ResBlock:
- if (Range.rBegin >= list->block_begin)
- range.rBegin = Range.rBegin;
- else
- range.rBegin = list->block_begin;
- if (Range.rEnd <= list->block_end)
- range.rEnd = Range.rEnd;
- else
- range.rEnd = list->block_end;
- if (range.rEnd > range.rBegin) {
- range.type = Range.type;
- new = xf86AddResToList(new,&range,-1);
- }
- break;
- case ResSparse:
- new = xf86JoinResLists(new,xf86FindIntersectOfLists(new,decomposeSparse(list->val)));
- break;
- }
- break;
- case ResSparse:
- switch (list->res_type & ResExtMask) {
- case ResSparse:
- if (!((~(range.rBase ^ list->sparse_base)
- & (range.rMask & list->sparse_mask)))) {
- RANGE(range, (range.rBase & list->sparse_base)
- | (~range.rMask & list->sparse_base)
- | (~list->sparse_mask & range.rBase),
- range.rMask | list->sparse_mask,
- Range.type);
- new = xf86AddResToList(new,&range,-1);
- }
- break;
- case ResBlock:
- new = xf86JoinResLists(new,xf86FindIntersectOfLists(
- decomposeSparse(range),list));
- break;
- }
- }
- }
- list = list->next;
- }
- return new;
-}
-
-resPtr
-xf86FindIntersectOfLists(resPtr l1, resPtr l2)
-{
- resPtr ret = NULL;
-
- while (l1) {
- ret = xf86JoinResLists(ret,findIntersect(l1->val,l2));
- l1 = l1->next;
- }
- return ret;
-}
-
-#if 0 /* Not used */
-static resPtr
-xf86FindComplement(resRange Range)
-{
- resRange range;
- memType tmp;
- resPtr new = NULL;
- int i;
-
- switch (Range.type & ResExtMask) {
- case ResBlock:
- if (Range.rBegin > 0) {
- RANGE(range, 0, Range.rBegin - 1, Range.type);
- new = xf86AddResToList(new,&range,-1);
- }
- if (Range.rEnd < (memType)~0) {
- RANGE(range,Range.rEnd + 1, (memType)~0, Range.type);
- new = xf86AddResToList(new,&range,-1);
- }
- break;
- case ResSparse:
- tmp = Range.rMask;
- for (i = 0; i < sizeof(memType); i++) {
- if (tmp & 0x1) {
- RANGE(range,(~Range.rMask & range.rMask),(1 << i), Range.type);
- new = xf86AddResToList(new,&range,-1);
- }
- }
- break;
- default:
- break;
+ /*
+ * we need to wrap the arbiter if we have more than
+ * one VGA card - hotplug cries.
+ */
+#ifdef HAVE_PCI_DEVICE_VGAARB_INIT
+ pci_device_vgaarb_get_info(NULL, &vga_count, NULL);
+ if (vga_count > 1 && xf86Screens) {
+ int i;
+ xf86Msg(X_INFO,"Number of VGA devices: %d: arbiter wrapping enabled\n", vga_count);
+ for (i = 0; i < xf86NumScreens; i++)
+ xf86VGAarbiterWrapFunctions(xf86Screens[i]->pScreen);
}
- return new;
-}
#endif
-
-resPtr
-xf86ExtractTypeFromList(resPtr list, unsigned long type)
-{
- resPtr ret = NULL;
+ DebugF("PostScreenInit generation: %i\n",serverGeneration);
+ xf86EnterServerState(OPERATING);
- while (list) {
- if ((list->res_type & ResTypeMask) == type)
- ret = xf86AddResToList(ret,&(list->val),list->entityIndex);
- list = list->next;
- }
- return ret;
}
/*
@@ -2370,7 +552,7 @@ xf86ExtractTypeFromList(resPtr list, unsigned long type)
* was active when the server was started.
*/
void
-xf86FindPrimaryDevice()
+xf86FindPrimaryDevice(void)
{
if (primaryBus.type != BUS_NONE) {
char *bus;
@@ -2398,81 +580,7 @@ xf86FindPrimaryDevice()
}
}
-Bool
-xf86NoSharedResources(int screenIndex,resType res)
-{
- int j;
-
- if (screenIndex > xf86NumScreens)
- return TRUE;
-
- for (j = 0; j < xf86Screens[screenIndex]->numEntities; j++) {
- switch (res) {
- case IO:
- if ( xf86Entities[xf86Screens[screenIndex]->entityList[j]]->entityProp
- & NEED_IO_SHARED)
- return FALSE;
- break;
- case MEM:
- if ( xf86Entities[xf86Screens[screenIndex]->entityList[j]]->entityProp
- & NEED_MEM_SHARED)
- return FALSE;
- break;
- case MEM_IO:
- if ( xf86Entities[xf86Screens[screenIndex]->entityList[j]]->entityProp
- & NEED_SHARED)
- return FALSE;
- break;
- case NONE:
- break;
- }
- }
- return TRUE;
-}
-
-_X_EXPORT void
-xf86RegisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func, pointer arg)
-{
- StateChangeNotificationPtr ptr =
- (StateChangeNotificationPtr)xnfalloc(sizeof(StateChangeNotificationRec));
-
- ptr->func = func;
- ptr->arg = arg;
- ptr->next = StateChangeNotificationList;
- StateChangeNotificationList = ptr;
-}
-
-_X_EXPORT Bool
-xf86DeregisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func)
-{
- StateChangeNotificationPtr *ptr = &StateChangeNotificationList;
- StateChangeNotificationPtr tmp;
-
- while (*ptr) {
- if ((*ptr)->func == func) {
- tmp = (*ptr);
- (*ptr) = (*ptr)->next;
- xfree(tmp);
- return TRUE;
- }
- ptr = &((*ptr)->next);
- }
- return FALSE;
-}
-
-static void
-notifyStateChange(xf86NotifyState state)
-{
- StateChangeNotificationPtr ptr = StateChangeNotificationList;
- while (ptr) {
- ptr->func(state,ptr->arg);
- ptr = ptr->next;
- }
-}
-
-/* Multihead accel sharing accessor functions and entity Private handling */
-
-_X_EXPORT int
+int
xf86GetLastScrnFlag(int entityIndex)
{
if(entityIndex < xf86NumEntities) {
@@ -2482,7 +590,7 @@ xf86GetLastScrnFlag(int entityIndex)
}
}
-_X_EXPORT void
+void
xf86SetLastScrnFlag(int entityIndex, int scrnIndex)
{
if(entityIndex < xf86NumEntities) {
@@ -2490,7 +598,7 @@ xf86SetLastScrnFlag(int entityIndex, int scrnIndex)
}
}
-_X_EXPORT Bool
+Bool
xf86IsEntityShared(int entityIndex)
{
if(entityIndex < xf86NumEntities) {
@@ -2501,7 +609,7 @@ xf86IsEntityShared(int entityIndex)
return FALSE;
}
-_X_EXPORT void
+void
xf86SetEntityShared(int entityIndex)
{
if(entityIndex < xf86NumEntities) {
@@ -2509,7 +617,7 @@ xf86SetEntityShared(int entityIndex)
}
}
-_X_EXPORT Bool
+Bool
xf86IsEntitySharable(int entityIndex)
{
if(entityIndex < xf86NumEntities) {
@@ -2520,7 +628,7 @@ xf86IsEntitySharable(int entityIndex)
return FALSE;
}
-_X_EXPORT void
+void
xf86SetEntitySharable(int entityIndex)
{
if(entityIndex < xf86NumEntities) {
@@ -2528,7 +636,7 @@ xf86SetEntitySharable(int entityIndex)
}
}
-_X_EXPORT Bool
+Bool
xf86IsPrimInitDone(int entityIndex)
{
if(entityIndex < xf86NumEntities) {
@@ -2539,7 +647,7 @@ xf86IsPrimInitDone(int entityIndex)
return FALSE;
}
-_X_EXPORT void
+void
xf86SetPrimInitDone(int entityIndex)
{
if(entityIndex < xf86NumEntities) {
@@ -2547,7 +655,7 @@ xf86SetPrimInitDone(int entityIndex)
}
}
-_X_EXPORT void
+void
xf86ClearPrimInitDone(int entityIndex)
{
if(entityIndex < xf86NumEntities) {
@@ -2560,7 +668,7 @@ xf86ClearPrimInitDone(int entityIndex)
* Allocate a private in the entities.
*/
-_X_EXPORT int
+int
xf86AllocateEntityPrivateIndex(void)
{
int idx, i;
@@ -2579,7 +687,7 @@ xf86AllocateEntityPrivateIndex(void)
return idx;
}
-_X_EXPORT DevUnion *
+DevUnion *
xf86GetEntityPrivate(int entityIndex, int privIndex)
{
if (entityIndex >= xf86NumEntities || privIndex >= xf86EntityPrivateCount)
diff --git a/xorg-server/hw/xfree86/common/xf86Bus.h b/xorg-server/hw/xfree86/common/xf86Bus.h
index c2d5bb7d4..b22e2e772 100644
--- a/xorg-server/hw/xfree86/common/xf86Bus.h
+++ b/xorg-server/hw/xfree86/common/xf86Bus.h
@@ -1,4 +1,3 @@
-
/*
* Copyright (c) 1997-2003 by The XFree86 Project, Inc.
*
@@ -44,14 +43,6 @@
#include "xf86sbusBus.h"
#endif
-typedef struct racInfo {
- xf86AccessPtr mem_new;
- xf86AccessPtr io_new;
- xf86AccessPtr io_mem_new;
- xf86SetAccessFuncPtr old;
-} AccessFuncRec, *AccessFuncPtr;
-
-
typedef struct {
DriverPtr driver;
int chipset;
@@ -60,12 +51,9 @@ typedef struct {
EntityProc entityEnter;
EntityProc entityLeave;
pointer private;
- resPtr resources;
Bool active;
Bool inUse;
BusRec bus;
- EntityAccessPtr access;
- AccessFuncPtr rac;
pointer busAcc;
int lastScrnFlag;
DevUnion * entityPrivates;
@@ -74,71 +62,15 @@ typedef struct {
IOADDRESS domainIO;
} EntityRec, *EntityPtr;
-#define NO_SEPARATE_IO_FROM_MEM 0x0001
-#define NO_SEPARATE_MEM_FROM_IO 0x0002
-#define NEED_VGA_ROUTED 0x0004
-#define NEED_VGA_ROUTED_SETUP 0x0008
-#define NEED_MEM 0x0010
-#define NEED_IO 0x0020
-#define NEED_MEM_SHARED 0x0040
-#define NEED_IO_SHARED 0x0080
-#define ACCEL_IS_SHARABLE 0x0100
-#define IS_SHARED_ACCEL 0x0200
-#define SA_PRIM_INIT_DONE 0x0400
-#define NEED_VGA_MEM 0x1000
-#define NEED_VGA_IO 0x2000
-
-#define NEED_SHARED (NEED_MEM_SHARED | NEED_IO_SHARED)
-
-#define busType bus.type
-#define isaBusId bus.id.isa
-#define sbusBusId bus.id.sbus
-
-struct x_BusAccRec;
-typedef void (*BusAccProcPtr)(struct x_BusAccRec *ptr);
-
-typedef struct x_BusAccRec {
- BusAccProcPtr set_f;
- BusAccProcPtr enable_f;
- BusAccProcPtr disable_f;
- BusAccProcPtr save_f;
- BusAccProcPtr restore_f;
- struct x_BusAccRec *current; /* pointer to bridge open on this bus */
- struct x_BusAccRec *primary; /* pointer to the bus connecting to this */
- struct x_BusAccRec *next; /* this links the different buses together */
- BusType type;
- BusType busdep_type;
- /* Bus-specific fields */
- union {
- struct {
- int bus;
- int primary_bus;
- struct pci_device * dev;
- pciBridgesSave save;
- } pci;
- } busdep;
-} BusAccRec, *BusAccPtr;
-
-/* state change notification callback */
-typedef struct _stateChange {
- xf86StateChangeNotificationCallbackFunc func;
- pointer arg;
- struct _stateChange *next;
-} StateChangeNotificationRec, *StateChangeNotificationPtr;
-
+#define ACCEL_IS_SHARABLE 0x100
+#define IS_SHARED_ACCEL 0x200
+#define SA_PRIM_INIT_DONE 0x400
extern EntityPtr *xf86Entities;
extern int xf86NumEntities;
-extern xf86AccessRec AccessNULL;
extern BusRec primaryBus;
-extern resPtr Acc;
-extern resPtr ResRange;
-extern BusAccPtr xf86BusAccInfo;
int xf86AllocateEntity(void);
BusType StringToBusType(const char* busID, const char **retID);
-Bool xf86IsSubsetOf(resRange range, resPtr list);
-resPtr xf86ExtractTypeFromList(resPtr list, unsigned long type);
-resPtr xf86FindIntersect(resRange Range, resPtr list);
#endif /* _XF86_BUS_H */
diff --git a/xorg-server/hw/xfree86/common/xf86Config.c b/xorg-server/hw/xfree86/common/xf86Config.c
index 93761193e..e81eb0f63 100644
--- a/xorg-server/hw/xfree86/common/xf86Config.c
+++ b/xorg-server/hw/xfree86/common/xf86Config.c
@@ -65,11 +65,7 @@
#include "xf86Xinput.h"
extern DeviceAssocRec mouse_assoc;
-#ifdef XKB
-#undef XKB_IN_SERVER
-#define XKB_IN_SERVER
-#include <xkbsrv.h>
-#endif
+#include "xkbsrv.h"
#ifdef RENDER
#include "picture.h"
@@ -112,12 +108,18 @@ extern DeviceAssocRec mouse_assoc;
static ModuleDefault ModuleDefaults[] = {
{.name = "extmod", .toLoad = TRUE, .load_opt=NULL},
+#ifdef DBE
{.name = "dbe", .toLoad = TRUE, .load_opt=NULL},
+#endif
+#ifdef GLXEXT
{.name = "glx", .toLoad = TRUE, .load_opt=NULL},
+#endif
#ifdef XRECORD
{.name = "record", .toLoad = TRUE, .load_opt=NULL},
#endif
+#ifdef XF86DRI
{.name = "dri", .toLoad = TRUE, .load_opt=NULL},
+#endif
#ifdef DRI2
{.name = "dri2", .toLoad = TRUE, .load_opt=NULL},
#endif
@@ -362,7 +364,7 @@ xf86ModulelistFromConfig(pointer **optlist)
char **
-xf86DriverlistFromConfig()
+xf86DriverlistFromConfig(void)
{
int count = 0;
int j;
@@ -434,7 +436,7 @@ xf86DriverlistFromConfig()
}
char **
-xf86InputDriverlistFromConfig()
+xf86InputDriverlistFromConfig(void)
{
int count = 0;
char **modulearray;
@@ -629,9 +631,9 @@ configFiles(XF86ConfFilesPtr fileconf)
}
}
/* xf86ValidateFontPath modifies its argument, but returns a copy of it. */
- temp_path = must_copy ? XNFstrdup(defaultFontPath) : defaultFontPath;
+ temp_path = must_copy ? xnfstrdup(defaultFontPath) : defaultFontPath;
defaultFontPath = xf86ValidateFontPath(temp_path);
- free(temp_path);
+ xfree(temp_path);
/* make fontpath more readable in the logfiles */
countDirs = 1;
@@ -657,14 +659,6 @@ configFiles(XF86ConfFilesPtr fileconf)
strcpy(temp_path, start);
xf86Msg(pathFrom, "FontPath set to:\n%s\n", log_buf);
xfree(log_buf);
-
-
- if (fileconf && fileconf->file_inputdevs) {
- xf86InputDeviceList = fileconf->file_inputdevs;
- xf86Msg(X_CONFIG, "Input device list set to \"%s\"\n",
- xf86InputDeviceList);
- }
-
/* ModulePath */
@@ -709,11 +703,8 @@ typedef enum {
FLAG_DONTZOOM,
FLAG_DISABLEVIDMODE,
FLAG_ALLOWNONLOCAL,
- FLAG_DISABLEMODINDEV,
- FLAG_MODINDEVALLOWNONLOCAL,
FLAG_ALLOWMOUSEOPENFAIL,
FLAG_VTSYSREQ,
- FLAG_XKBDISABLE,
FLAG_SAVER_BLANKTIME,
FLAG_DPMS_STANDBYTIME,
FLAG_DPMS_SUSPENDTIME,
@@ -724,7 +715,6 @@ typedef enum {
FLAG_XINERAMA,
FLAG_LOG,
FLAG_RENDER_COLORMAP_MODE,
- FLAG_HANDLE_SPECIAL_KEYS,
FLAG_RANDR,
FLAG_AIGLX,
FLAG_IGNORE_ABI,
@@ -749,16 +739,10 @@ static OptionInfoRec FlagOptions[] = {
{0}, FALSE },
{ FLAG_ALLOWNONLOCAL, "AllowNonLocalXvidtune", OPTV_BOOLEAN,
{0}, FALSE },
- { FLAG_DISABLEMODINDEV, "DisableModInDev", OPTV_BOOLEAN,
- {0}, FALSE },
- { FLAG_MODINDEVALLOWNONLOCAL, "AllowNonLocalModInDev", OPTV_BOOLEAN,
- {0}, FALSE },
{ FLAG_ALLOWMOUSEOPENFAIL, "AllowMouseOpenFail", OPTV_BOOLEAN,
{0}, FALSE },
{ FLAG_VTSYSREQ, "VTSysReq", OPTV_BOOLEAN,
{0}, FALSE },
- { FLAG_XKBDISABLE, "XkbDisable", OPTV_BOOLEAN,
- {0}, FALSE },
{ FLAG_SAVER_BLANKTIME, "BlankTime" , OPTV_INTEGER,
{0}, FALSE },
{ FLAG_DPMS_STANDBYTIME, "StandbyTime", OPTV_INTEGER,
@@ -779,8 +763,6 @@ static OptionInfoRec FlagOptions[] = {
{0}, FALSE },
{ FLAG_RENDER_COLORMAP_MODE, "RenderColormapMode", OPTV_STRING,
{0}, FALSE },
- { FLAG_HANDLE_SPECIAL_KEYS, "HandleSpecialKeys", OPTV_STRING,
- {0}, FALSE },
{ FLAG_RANDR, "RandR", OPTV_BOOLEAN,
{0}, FALSE },
{ FLAG_AIGLX, "AIGLX", OPTV_BOOLEAN,
@@ -831,9 +813,13 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
Bool value;
MessageType from;
const char *s;
-#ifdef XKB
- char *rules = "base";
-#endif
+ XkbRMLVOSet set;
+ /* Default options. */
+ set.rules = "base";
+ set.model = "pc105";
+ set.layout = "us";
+ set.variant = NULL;
+ set.options = NULL;
/*
* Merge the ServerLayout and ServerFlags options. The former have
@@ -909,16 +895,6 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
#endif
}
- if (xf86GetOptValBool(FlagOptions, FLAG_XKBDISABLE, &value)) {
-#ifdef XKB
- noXkbExtension = value;
- xf86Msg(X_CONFIG, "Xkb %s\n", value ? "disabled" : "enabled");
-#else
- if (!value)
- xf86Msg(X_WARNING, "Xserver doesn't support XKB\n");
-#endif
- }
-
xf86Info.pmFlag = TRUE;
if (xf86GetOptValBool(FlagOptions, FLAG_NOPM, &value))
xf86Info.pmFlag = !value;
@@ -953,22 +929,7 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
}
}
#endif
- {
- if ((s = xf86GetOptValString(FlagOptions, FLAG_HANDLE_SPECIAL_KEYS))) {
- if (!xf86NameCmp(s,"always")) {
- xf86Msg(X_CONFIG, "Always handling special keys in DDX\n");
- xf86Info.ddxSpecialKeys = SKAlways;
- } else if (!xf86NameCmp(s,"whenneeded")) {
- xf86Msg(X_CONFIG, "Special keys handled in DDX only if needed\n");
- xf86Info.ddxSpecialKeys = SKWhenNeeded;
- } else if (!xf86NameCmp(s,"never")) {
- xf86Msg(X_CONFIG, "Never handling special keys in DDX\n");
- xf86Info.ddxSpecialKeys = SKNever;
- } else {
- xf86Msg(X_WARNING,"Unknown HandleSpecialKeys option\n");
- }
- }
- }
+
#ifdef RANDR
xf86Info.disableRandR = FALSE;
xf86Info.randRFrom = X_DEFAULT;
@@ -1011,13 +972,11 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
xf86GetOptValBool(FlagOptions, FLAG_ALLOW_EMPTY_INPUT, &xf86Info.allowEmptyInput);
/* AEI on? Then we're not using kbd, so use the evdev rules set. */
-#ifdef XKB
#if defined(linux)
if (xf86Info.allowEmptyInput)
- rules = "evdev";
-#endif
- XkbSetRulesDflts(rules, "pc105", "us", NULL, NULL);
+ set.rules = "evdev";
#endif
+ XkbSetRulesDflts(&set);
xf86Info.useDefaultFontPath = TRUE;
xf86Info.useDefaultFontPathFrom = X_DEFAULT;
@@ -1041,21 +1000,21 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
i = -1;
xf86GetOptValInteger(FlagOptions, FLAG_DPMS_STANDBYTIME, &i);
if ((i >= 0) && (i < MAX_TIME_IN_MIN))
- DPMSStandbyTime = defaultDPMSStandbyTime = i * MILLI_PER_MIN;
+ DPMSStandbyTime = i * MILLI_PER_MIN;
else if (i != -1)
xf86ConfigError("StandbyTime value %d outside legal range of 0 - %d minutes",
i, MAX_TIME_IN_MIN);
i = -1;
xf86GetOptValInteger(FlagOptions, FLAG_DPMS_SUSPENDTIME, &i);
if ((i >= 0) && (i < MAX_TIME_IN_MIN))
- DPMSSuspendTime = defaultDPMSSuspendTime = i * MILLI_PER_MIN;
+ DPMSSuspendTime = i * MILLI_PER_MIN;
else if (i != -1)
xf86ConfigError("SuspendTime value %d outside legal range of 0 - %d minutes",
i, MAX_TIME_IN_MIN);
i = -1;
xf86GetOptValInteger(FlagOptions, FLAG_DPMS_OFFTIME, &i);
if ((i >= 0) && (i < MAX_TIME_IN_MIN))
- DPMSOffTime = defaultDPMSOffTime = i * MILLI_PER_MIN;
+ DPMSOffTime = i * MILLI_PER_MIN;
else if (i != -1)
xf86ConfigError("OffTime value %d outside legal range of 0 - %d minutes",
i, MAX_TIME_IN_MIN);
@@ -1137,8 +1096,8 @@ Bool xf86DRI2Enabled(void)
* 2. The "CorePointer" and "CoreKeyboard" InputDevices referred to by
* the active ServerLayout.
* 3. The first InputDevices marked as "CorePointer" and "CoreKeyboard".
- * 4. The first InputDevices that use the 'mouse' and 'keyboard' or 'kbd'
- * drivers.
+ * 4. The first InputDevices that use 'keyboard' or 'kbd' and a valid mouse
+ * driver (mouse, synaptics, evdev, vmmouse, void)
* 5. Default devices with an empty (default) configuration. These defaults
* will reference the 'mouse' and 'keyboard' drivers.
*/
@@ -1157,6 +1116,8 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
int count = 0;
MessageType from = X_DEFAULT;
int found = 0;
+ const char *mousedrivers[] = { "mouse", "synaptics", "evdev", "vmmouse",
+ "void", NULL };
/*
* First check if a core pointer or core keyboard have been specified
@@ -1266,13 +1227,15 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
}
}
- /* 4. First pointer with 'mouse' as the driver. */
+ /* 4. First pointer with an allowed mouse driver. */
if (!foundPointer && !xf86Info.allowEmptyInput) {
+ const char **driver = mousedrivers;
confInput = xf86findInput(CONF_IMPLICIT_POINTER,
xf86configptr->conf_input_lst);
- if (!confInput) {
- confInput = xf86findInputByDriver("mouse",
+ while (*driver && !confInput) {
+ confInput = xf86findInputByDriver(*driver,
xf86configptr->conf_input_lst);
+ driver++;
}
if (confInput) {
foundPointer = TRUE;
@@ -1327,9 +1290,13 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
* section ... deal.
*/
for (devs = servlayoutp->inputs; devs && *devs; devs++) {
- if (!strcmp((*devs)->driver, "void") || !strcmp((*devs)->driver, "mouse") ||
- !strcmp((*devs)->driver, "vmmouse") || !strcmp((*devs)->driver, "evdev")) {
- found = 1; break;
+ const char **driver = mousedrivers;
+ while(*driver) {
+ if (!strcmp((*devs)->driver, *driver)) {
+ found = 1;
+ break;
+ }
+ driver++;
}
}
if (!found && !xf86Info.allowEmptyInput) {
@@ -1564,10 +1531,8 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
adjp = (XF86ConfAdjacencyPtr)adjp->list.next;
}
-#ifdef DEBUG
- ErrorF("Found %d screens in the layout section %s",
+ DebugF("Found %d screens in the layout section %s",
count, conf_layout->lay_identifier);
-#endif
if (!count) /* alloc enough storage even if no screen is specified */
count = 1;
@@ -1724,10 +1689,8 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
count++;
idp = (XF86ConfInactivePtr)idp->list.next;
}
-#ifdef DEBUG
- ErrorF("Found %d inactive devices in the layout section %s",
+ DebugF("Found %d inactive devices in the layout section %s\n",
count, conf_layout->lay_identifier);
-#endif
gdp = xnfalloc((count + 1) * sizeof(GDevRec));
gdp[count].identifier = NULL;
idp = conf_layout->lay_inactive_lst;
@@ -1749,10 +1712,8 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
count++;
irp = (XF86ConfInputrefPtr)irp->list.next;
}
-#ifdef DEBUG
- ErrorF("Found %d input devices in the layout section %s",
+ DebugF("Found %d input devices in the layout section %s\n",
count, conf_layout->lay_identifier);
-#endif
indp = xnfcalloc((count + 1), sizeof(IDevPtr));
indp[count] = NULL;
irp = conf_layout->lay_input_lst;
@@ -1902,16 +1863,6 @@ configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum,
bzero(&defMon, sizeof(defMon));
defMon.mon_identifier = "<default monitor>";
- /*
- * TARGET_REFRESH_RATE may be defined to effectively limit the
- * default resolution to the largest that has a "good" refresh
- * rate.
- */
-#ifdef TARGET_REFRESH_RATE
- defMon.mon_option_lst = xf86ReplaceRealOption(defMon.mon_option_lst,
- "TargetRefresh",
- TARGET_REFRESH_RATE);
-#endif
if (!configMonitor(screenp->monitor, &defMon))
return FALSE;
defaultMonitor = TRUE;
diff --git a/xorg-server/hw/xfree86/common/xf86Config.h b/xorg-server/hw/xfree86/common/xf86Config.h
index a174e463b..de287041a 100644
--- a/xorg-server/hw/xfree86/common/xf86Config.h
+++ b/xorg-server/hw/xfree86/common/xf86Config.h
@@ -41,7 +41,7 @@
/*
* global structure that holds the result of parsing the config file
*/
-extern XF86ConfigPtr xf86configptr;
+extern _X_EXPORT XF86ConfigPtr xf86configptr;
#endif
typedef enum _ConfigStatus {
@@ -68,7 +68,5 @@ ConfigStatus xf86HandleConfigFile(Bool);
Bool xf86AutoConfig(void);
GDevPtr autoConfigDevice(GDevPtr preconf_device);
-char* chooseVideoDriver(void);
-int xchomp(char *line);
#endif /* _xf86_config_h */
diff --git a/xorg-server/hw/xfree86/common/xf86Configure.c b/xorg-server/hw/xfree86/common/xf86Configure.c
index 77326b6d4..bce5aae58 100644
--- a/xorg-server/hw/xfree86/common/xf86Configure.c
+++ b/xorg-server/hw/xfree86/common/xf86Configure.c
@@ -27,33 +27,17 @@
#include <xorg-config.h>
#endif
-#include <ctype.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include <pciaccess.h>
-#include "Pci.h"
-#include "os.h"
-#include "loaderProcs.h"
#include "xf86.h"
#include "xf86Config.h"
#include "xf86_OSlib.h"
#include "xf86Priv.h"
#define IN_XSERVER
-#include "xf86Parser.h"
-#include "xf86tokens.h"
#include "Configint.h"
-#include "vbe.h"
#include "xf86DDC.h"
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
#include "xf86Bus.h"
#include "xf86Sbus.h"
#endif
-#include "globals.h"
typedef struct _DevToConfig {
GDevRec GDev;
@@ -67,7 +51,7 @@ typedef struct _DevToConfig {
static DevToConfigPtr DevToConfig = NULL;
static int nDevToConfig = 0, CurrentDriver;
-_X_EXPORT xf86MonPtr ConfiguredMonitor;
+xf86MonPtr ConfiguredMonitor;
Bool xf86DoConfigurePass1 = TRUE;
static Bool foundMouse = FALSE;
@@ -87,24 +71,12 @@ static char *DFLT_MOUSE_DEV = "/dev/mouse";
static char *DFLT_MOUSE_PROTO = "auto";
#endif
-/*
- * This is called by the driver, either through xf86Match???Instances() or
- * directly. We allocate a GDevRec and fill it in as much as we can, letting
- * the caller fill in the rest and/or change it as it sees fit.
- */
-GDevPtr
-xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int chipset)
+static Bool
+bus_pci_configure(void *busData)
{
- int i, j;
+ int i;
struct pci_device * pVideo = NULL;
- Bool isPrimary = FALSE;
- if (xf86DoProbe || !xf86DoConfigure || !xf86DoConfigurePass1)
- return NULL;
-
- /* Check for duplicates */
- switch (bus) {
- case BUS_PCI:
pVideo = (struct pci_device *) busData;
for (i = 0; i < nDevToConfig; i++)
if (DevToConfig[i].pVideo &&
@@ -112,51 +84,37 @@ xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int
(DevToConfig[i].pVideo->bus == pVideo->bus) &&
(DevToConfig[i].pVideo->dev == pVideo->dev) &&
(DevToConfig[i].pVideo->func == pVideo->func))
- return NULL;
- isPrimary = xf86IsPrimaryPci(pVideo);
- break;
-#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
- case BUS_SBUS:
- for (i = 0; i < nDevToConfig; i++)
- if (DevToConfig[i].sVideo &&
- DevToConfig[i].sVideo->fbNum == ((sbusDevicePtr) busData)->fbNum)
- return NULL;
- break;
-#endif
- default:
- return NULL;
- }
+ return 0;
- /* Allocate new structure occurrence */
- i = nDevToConfig++;
- DevToConfig =
- xnfrealloc(DevToConfig, nDevToConfig * sizeof(DevToConfigRec));
-#if 1 /* Doesn't work when a driver detects more than one adapter */
- if ((i > 0) && isPrimary) {
- memmove(DevToConfig + 1,DevToConfig,
- (nDevToConfig - 1) * sizeof(DevToConfigRec));
- i = 0;
- }
-#endif
- memset(DevToConfig + i, 0, sizeof(DevToConfigRec));
-
-# define NewDevice DevToConfig[i]
+ return 1;
+}
- NewDevice.GDev.chipID = NewDevice.GDev.chipRev = NewDevice.GDev.irq = -1;
+static Bool
+bus_sbus_configure(void *busData)
+{
+#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
+ int i;
- NewDevice.iDriver = CurrentDriver;
+ for (i = 0; i < nDevToConfig; i++)
+ if (DevToConfig[i].sVideo &&
+ DevToConfig[i].sVideo->fbNum == ((sbusDevicePtr) busData)->fbNum)
+ return 0;
- /* Fill in what we know, converting the driver name to lower case */
- NewDevice.GDev.driver = xnfalloc(strlen(driver) + 1);
- for (j = 0; (NewDevice.GDev.driver[j] = tolower(driver[j])); j++);
+#endif
+ return 1;
+}
- switch (bus) {
- case BUS_PCI: {
+static void
+bus_pci_newdev_configure(void *busData, int i, int *chipset)
+{
const char *VendorName;
const char *CardName;
char busnum[8];
+ struct pci_device * pVideo = NULL;
+
+ pVideo = (struct pci_device *) busData;
- NewDevice.pVideo = pVideo;
+ DevToConfig[i].pVideo = pVideo;
VendorName = pci_device_get_vendor_name( pVideo );
CardName = pci_device_get_device_name( pVideo );
@@ -171,58 +129,113 @@ xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int
sprintf((char*)CardName, "Unknown Board");
}
- NewDevice.GDev.identifier =
+ DevToConfig[i].GDev.identifier =
xnfalloc(strlen(VendorName) + strlen(CardName) + 2);
- sprintf(NewDevice.GDev.identifier, "%s %s", VendorName, CardName);
+ sprintf(DevToConfig[i].GDev.identifier, "%s %s", VendorName, CardName);
- NewDevice.GDev.vendor = (char *)VendorName;
- NewDevice.GDev.board = (char *)CardName;
+ DevToConfig[i].GDev.vendor = (char *)VendorName;
+ DevToConfig[i].GDev.board = (char *)CardName;
- NewDevice.GDev.busID = xnfalloc(16);
+ DevToConfig[i].GDev.busID = xnfalloc(16);
xf86FormatPciBusNumber(pVideo->bus, busnum);
- sprintf(NewDevice.GDev.busID, "PCI:%s:%d:%d",
+ sprintf(DevToConfig[i].GDev.busID, "PCI:%s:%d:%d",
busnum, pVideo->dev, pVideo->func);
- NewDevice.GDev.chipID = pVideo->device_id;
- NewDevice.GDev.chipRev = pVideo->revision;
+ DevToConfig[i].GDev.chipID = pVideo->device_id;
+ DevToConfig[i].GDev.chipRev = pVideo->revision;
- if (chipset < 0)
- chipset = (pVideo->vendor_id << 16) | pVideo->device_id;
+ if (*chipset < 0) {
+ *chipset = (pVideo->vendor_id << 16) | pVideo->device_id;
}
- break;
+}
+
+static void
+bus_sbus_newdev_configure(void *busData, int i)
+{
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
- case BUS_SBUS: {
char *promPath = NULL;
- NewDevice.sVideo = (sbusDevicePtr) busData;
- NewDevice.GDev.identifier = NewDevice.sVideo->descr;
+ DevToConfig[i].sVideo = (sbusDevicePtr) busData;
+ DevToConfig[i].GDev.identifier = DevToConfig[i].sVideo->descr;
if (sparcPromInit() >= 0) {
- promPath = sparcPromNode2Pathname(&NewDevice.sVideo->node);
+ promPath = sparcPromNode2Pathname(&DevToConfig[i].sVideo->node);
sparcPromClose();
}
if (promPath) {
- NewDevice.GDev.busID = xnfalloc(strlen(promPath) + 6);
- sprintf(NewDevice.GDev.busID, "SBUS:%s", promPath);
+ DevToConfig[i].GDev.busID = xnfalloc(strlen(promPath) + 6);
+ sprintf(DevToConfig[i].GDev.busID, "SBUS:%s", promPath);
xfree(promPath);
} else {
- NewDevice.GDev.busID = xnfalloc(12);
- sprintf(NewDevice.GDev.busID, "SBUS:fb%d", NewDevice.sVideo->fbNum);
+ DevToConfig[i].GDev.busID = xnfalloc(12);
+ sprintf(DevToConfig[i].GDev.busID, "SBUS:fb%d",
+ DevToConfig[i].sVideo->fbNum);
}
- }
- break;
#endif
- default:
- break;
+}
+
+/*
+ * This is called by the driver, either through xf86Match???Instances() or
+ * directly. We allocate a GDevRec and fill it in as much as we can, letting
+ * the caller fill in the rest and/or change it as it sees fit.
+ */
+GDevPtr
+xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int chipset)
+{
+ int ret, i, j;
+
+ if (!xf86DoConfigure || !xf86DoConfigurePass1)
+ return NULL;
+
+ /* Check for duplicates */
+ switch (bus) {
+ case BUS_PCI:
+ ret = bus_pci_configure(busData);
+ break;
+ case BUS_SBUS:
+ ret = bus_sbus_configure(busData);
+ break;
+ default:
+ return NULL;
+ }
+
+ if (ret == 0)
+ goto out;
+
+ /* Allocate new structure occurrence */
+ i = nDevToConfig++;
+ DevToConfig =
+ xnfrealloc(DevToConfig, nDevToConfig * sizeof(DevToConfigRec));
+ memset(DevToConfig + i, 0, sizeof(DevToConfigRec));
+
+ DevToConfig[i].GDev.chipID =
+ DevToConfig[i].GDev.chipRev = DevToConfig[i].GDev.irq = -1;
+
+ DevToConfig[i].iDriver = CurrentDriver;
+
+ /* Fill in what we know, converting the driver name to lower case */
+ DevToConfig[i].GDev.driver = xnfalloc(strlen(driver) + 1);
+ for (j = 0; (DevToConfig[i].GDev.driver[j] = tolower(driver[j])); j++);
+
+ switch (bus) {
+ case BUS_PCI:
+ bus_pci_newdev_configure(busData, i, &chipset);
+ break;
+ case BUS_SBUS:
+ bus_sbus_newdev_configure(busData, i);
+ break;
+ default:
+ break;
}
/* Get driver's available options */
if (xf86DriverList[CurrentDriver]->AvailableOptions)
- NewDevice.GDev.options = (OptionInfoPtr)
+ DevToConfig[i].GDev.options = (OptionInfoPtr)
(*xf86DriverList[CurrentDriver]->AvailableOptions)(chipset,
bus);
- return &NewDevice.GDev;
+ return &DevToConfig[i].GDev;
-# undef NewDevice
+out:
+ return NULL;
}
static XF86ConfInputPtr
@@ -260,7 +273,7 @@ configureInputSection (void)
#endif
}
- mouse = xf86confcalloc(1, sizeof(XF86ConfInputRec));
+ mouse = calloc(1, sizeof(XF86ConfInputRec));
mouse->inp_identifier = "Mouse0";
mouse->inp_driver = "mouse";
mouse->inp_option_lst =
@@ -285,18 +298,18 @@ configureScreenSection (int screennum)
int depths[] = { 1, 4, 8, 15, 16, 24/*, 32*/ };
parsePrologue (XF86ConfScreenPtr, XF86ConfScreenRec)
- ptr->scrn_identifier = xf86confmalloc(18);
+ ptr->scrn_identifier = malloc(18);
sprintf(ptr->scrn_identifier, "Screen%d", screennum);
- ptr->scrn_monitor_str = xf86confmalloc(19);
+ ptr->scrn_monitor_str = malloc(19);
sprintf(ptr->scrn_monitor_str, "Monitor%d", screennum);
- ptr->scrn_device_str = xf86confmalloc(16);
+ ptr->scrn_device_str = malloc(16);
sprintf(ptr->scrn_device_str, "Card%d", screennum);
for (i=0; i<sizeof(depths)/sizeof(depths[0]); i++)
{
XF86ConfDisplayPtr display;
- display = xf86confcalloc(1, sizeof(XF86ConfDisplayRec));
+ display = calloc(1, sizeof(XF86ConfDisplayRec));
display->disp_depth = depths[i];
display->disp_black.red = display->disp_white.red = -1;
display->disp_black.green = display->disp_white.green = -1;
@@ -419,7 +432,7 @@ configureLayoutSection (void)
{
XF86ConfInputrefPtr iptr;
- iptr = xf86confmalloc (sizeof (XF86ConfInputrefRec));
+ iptr = malloc (sizeof (XF86ConfInputrefRec));
iptr->list.next = NULL;
iptr->iref_option_lst = NULL;
iptr->iref_inputdev_str = "Mouse0";
@@ -432,7 +445,7 @@ configureLayoutSection (void)
{
XF86ConfInputrefPtr iptr;
- iptr = xf86confmalloc (sizeof (XF86ConfInputrefRec));
+ iptr = malloc (sizeof (XF86ConfInputrefRec));
iptr->list.next = NULL;
iptr->iref_option_lst = NULL;
iptr->iref_inputdev_str = "Keyboard0";
@@ -445,7 +458,7 @@ configureLayoutSection (void)
for (scrnum = 0; scrnum < nDevToConfig; scrnum++) {
XF86ConfAdjacencyPtr aptr;
- aptr = xf86confmalloc (sizeof (XF86ConfAdjacencyRec));
+ aptr = malloc (sizeof (XF86ConfAdjacencyRec));
aptr->list.next = NULL;
aptr->adj_x = 0;
aptr->adj_y = 0;
@@ -481,12 +494,9 @@ static XF86ConfModulePtr
configureModuleSection (void)
{
char **elist, **el;
- /* Find the list of extension modules. */
+ /* Find the list of extension & font modules. */
const char *esubdirs[] = {
"extensions",
- NULL
- };
- const char *fsubdirs[] = {
"fonts",
NULL
};
@@ -497,7 +507,7 @@ configureModuleSection (void)
for (el = elist; *el; el++) {
XF86LoadPtr module;
- module = xf86confcalloc(1, sizeof(XF86LoadRec));
+ module = calloc(1, sizeof(XF86LoadRec));
module->load_name = *el;
ptr->mod_load_lst = (XF86LoadPtr)xf86addListItem(
(glp)ptr->mod_load_lst, (glp)module);
@@ -505,28 +515,6 @@ configureModuleSection (void)
xfree(elist);
}
- /* Process list of font backends separately to include only required ones */
- elist = LoaderListDirs(fsubdirs, NULL);
- if (elist) {
- for (el = elist; *el; el++) {
- XF86LoadPtr module;
-
- module = xf86confcalloc(1, sizeof(XF86LoadRec));
- module->load_name = *el;
-
- /* Add only those font backends which are referenced by fontpath */
- /* 'strstr(dFP,"/dir")' is meant as 'dFP =~ m(/dir\W)' */
- if (defaultFontPath && (
- (strcmp(*el, "freetype") == 0 &&
- strstr(defaultFontPath, "/TTF")) ||
- (strcmp(*el, "type1") == 0 &&
- strstr(defaultFontPath, "/Type1"))))
- ptr->mod_load_lst = (XF86LoadPtr)xf86addListItem(
- (glp)ptr->mod_load_lst, (glp)module);
- }
- xfree(elist);
- }
-
return ptr;
}
@@ -548,7 +536,7 @@ configureMonitorSection (int screennum)
{
parsePrologue (XF86ConfMonitorPtr, XF86ConfMonitorRec)
- ptr->mon_identifier = xf86confmalloc(19);
+ ptr->mon_identifier = malloc(19);
sprintf(ptr->mon_identifier, "Monitor%d", screennum);
ptr->mon_vendor = strdup("Monitor Vendor");
ptr->mon_modelname = strdup("Monitor Model");
@@ -567,10 +555,10 @@ configureDDCMonitorSection (int screennum)
parsePrologue (XF86ConfMonitorPtr, XF86ConfMonitorRec)
- ptr->mon_identifier = xf86confmalloc(19);
+ ptr->mon_identifier = malloc(19);
sprintf(ptr->mon_identifier, "Monitor%d", screennum);
ptr->mon_vendor = strdup(ConfiguredMonitor->vendor.name);
- ptr->mon_modelname = xf86confmalloc(12);
+ ptr->mon_modelname = malloc(12);
sprintf(ptr->mon_modelname, "%x", ConfiguredMonitor->vendor.prod_id);
/* features in centimetres, we want millimetres */
@@ -595,8 +583,7 @@ configureDDCMonitorSection (int screennum)
len = 0;
}
if ((ptr->mon_comment =
- xf86confrealloc(ptr->mon_comment,
- len+strlen(displaySize_string)))) {
+ realloc(ptr->mon_comment, len+strlen(displaySize_string)))) {
strcpy(ptr->mon_comment + len, displaySize_string);
}
}
@@ -606,7 +593,7 @@ configureDDCMonitorSection (int screennum)
for (i=0;i<4;i++) {
switch (ConfiguredMonitor->det_mon[i].type) {
case DS_NAME:
- ptr->mon_modelname = xf86confrealloc(ptr->mon_modelname,
+ ptr->mon_modelname = realloc(ptr->mon_modelname,
strlen((char*)(ConfiguredMonitor->det_mon[i].section.name))
+ 1);
strcpy(ptr->mon_modelname,
@@ -684,9 +671,6 @@ DoConfigure(void)
xorgHWAccess = FALSE;
}
- /* Disable PCI devices */
- xf86ResourceBrokerInit();
- xf86AccessInit();
xf86FindPrimaryDevice();
/* Create XF86Config file structure */
diff --git a/xorg-server/hw/xfree86/common/xf86Cursor.c b/xorg-server/hw/xfree86/common/xf86Cursor.c
index c6f603959..6740faf65 100644
--- a/xorg-server/hw/xfree86/common/xf86Cursor.c
+++ b/xorg-server/hw/xfree86/common/xf86Cursor.c
@@ -25,7 +25,6 @@
* authorization from the copyright holder(s) and author(s).
*/
-#define NEED_EVENTS
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
@@ -228,8 +227,6 @@ xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode)
if (IsPointerDevice(dev) && dev->spriteInfo->spriteOwner)
break;
}
- if (!dev)
- dev = inputInfo.pointer;
pCursorScreen = miPointerGetScreen(dev);
if (pScreen == pCursorScreen)
@@ -480,7 +477,7 @@ xf86WarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
}
-_X_EXPORT void *
+void *
xf86GetPointerScreenFuncs(void)
{
return (void *)&xf86PointerScreenFuncs;
diff --git a/xorg-server/hw/xfree86/common/xf86DGA.c b/xorg-server/hw/xfree86/common/xf86DGA.c
index a06f285f1..8328f5875 100644
--- a/xorg-server/hw/xfree86/common/xf86DGA.c
+++ b/xorg-server/hw/xfree86/common/xf86DGA.c
@@ -35,19 +35,19 @@
#include "xf86str.h"
#include "xf86Priv.h"
#include "dgaproc.h"
-#include <X11/extensions/xf86dgastr.h>
+#include <X11/extensions/xf86dgaproto.h>
#include "colormapst.h"
#include "pixmapstr.h"
#include "inputstr.h"
#include "globals.h"
#include "servermd.h"
#include "micmap.h"
-#ifdef XKB
-#include <xkbsrv.h>
-#endif
+#include "xkbsrv.h"
#include "xf86Xinput.h"
#include "exglobals.h"
#include "exevents.h"
+#include "eventstr.h"
+#include "eventconvert.h"
#include "mi.h"
@@ -59,8 +59,8 @@ static Bool DGACloseScreen(int i, ScreenPtr pScreen);
static void DGADestroyColormap(ColormapPtr pmap);
static void DGAInstallColormap(ColormapPtr pmap);
static void DGAUninstallColormap(ColormapPtr pmap);
-static void DGAHandleEvent(int screen_num, xEvent *event,
- DeviceIntPtr device, int nevents);
+static void DGAHandleEvent(int screen_num, InternalEvent *event,
+ DeviceIntPtr device);
static void
DGACopyModeInfo(
@@ -68,7 +68,7 @@ DGACopyModeInfo(
XDGAModePtr xmode
);
-_X_EXPORT int *XDGAEventBase = NULL;
+int *XDGAEventBase = NULL;
#define DGA_GET_SCREEN_PRIV(pScreen) ((DGAScreenPtr) \
dixLookupPrivate(&(pScreen)->devPrivates, DGAScreenKey))
@@ -101,7 +101,7 @@ typedef struct {
Bool grabKeyboard;
} DGAScreenRec, *DGAScreenPtr;
-_X_EXPORT Bool
+Bool
DGAInit(
ScreenPtr pScreen,
DGAFunctionPtr funcs,
@@ -164,7 +164,7 @@ DGAInit(
* the DGA mode list.
*/
-_X_EXPORT Bool
+Bool
DGAReInitModes(
ScreenPtr pScreen,
DGAModePtr modes,
@@ -247,11 +247,7 @@ DGACloseScreen(int i, ScreenPtr pScreen)
DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
if (XDGAEventBase) {
- mieqSetHandler(*XDGAEventBase + MotionNotify, NULL);
- mieqSetHandler(*XDGAEventBase + ButtonPress, NULL);
- mieqSetHandler(*XDGAEventBase + ButtonRelease, NULL);
- mieqSetHandler(*XDGAEventBase + KeyPress, NULL);
- mieqSetHandler(*XDGAEventBase + KeyRelease, NULL);
+ mieqSetHandler(ET_DGAEvent, NULL);
}
FreeMarkedVisuals(pScreen);
@@ -453,7 +449,7 @@ xf86SetDGAMode(
/*********** exported ones ***************/
-_X_EXPORT void
+void
DGASetInputMode(int index, Bool keyboard, Bool mouse)
{
ScreenPtr pScreen = screenInfo.screens[index];
@@ -465,17 +461,13 @@ DGASetInputMode(int index, Bool keyboard, Bool mouse)
pScreenPriv->grabKeyboard = keyboard;
if (!mieq_installed) {
- mieqSetHandler(*XDGAEventBase + MotionNotify, DGAHandleEvent);
- mieqSetHandler(*XDGAEventBase + ButtonPress, DGAHandleEvent);
- mieqSetHandler(*XDGAEventBase + ButtonRelease, DGAHandleEvent);
- mieqSetHandler(*XDGAEventBase + KeyPress, DGAHandleEvent);
- mieqSetHandler(*XDGAEventBase + KeyRelease, DGAHandleEvent);
+ mieqSetHandler(ET_DGAEvent, DGAHandleEvent);
mieq_installed = 1;
}
}
}
-_X_EXPORT Bool
+Bool
DGAChangePixmapMode(int index, int *x, int *y, int mode)
{
DGAScreenPtr pScreenPriv;
@@ -530,24 +522,19 @@ DGAChangePixmapMode(int index, int *x, int *y, int mode)
return TRUE;
}
-_X_EXPORT Bool
+Bool
DGAAvailable(int index)
{
if(DGAScreenKey == NULL)
return FALSE;
- if (!xf86NoSharedResources(((ScrnInfoPtr)dixLookupPrivate(
- &screenInfo.screens[index]->devPrivates,
- xf86ScreenKey))->scrnIndex, MEM))
- return FALSE;
-
if(DGA_GET_SCREEN_PRIV(screenInfo.screens[index]))
return TRUE;
return FALSE;
}
-_X_EXPORT Bool
+Bool
DGAActive(int index)
{
DGAScreenPtr pScreenPriv;
@@ -567,8 +554,8 @@ DGAActive(int index)
/* Called by the event code in case the server is abruptly terminated */
-void
-DGAShutdown()
+void
+DGAShutdown(void)
{
ScrnInfoPtr pScrn;
int i;
@@ -585,7 +572,7 @@ DGAShutdown()
/* Called by the extension to initialize a mode */
-_X_EXPORT int
+int
DGASetMode(
int index,
int num,
@@ -609,7 +596,7 @@ DGASetMode(
/* Called from the extension to let the DDX know which events are requested */
-_X_EXPORT void
+void
DGASelectInput(
int index,
ClientPtr client,
@@ -622,7 +609,7 @@ DGASelectInput(
pScreenPriv->input = mask;
}
-_X_EXPORT int
+int
DGAGetViewportStatus(int index)
{
DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
@@ -635,7 +622,7 @@ DGAGetViewportStatus(int index)
return (*pScreenPriv->funcs->GetViewport)(pScreenPriv->pScrn);
}
-_X_EXPORT int
+int
DGASetViewport(
int index,
int x, int y,
@@ -663,7 +650,7 @@ BitsClear(CARD32 data)
return bits;
}
-_X_EXPORT int
+int
DGACreateColormap(int index, ClientPtr client, int id, int mode, int alloc)
{
ScreenPtr pScreen = screenInfo.screens[index];
@@ -732,7 +719,7 @@ DGACreateColormap(int index, ClientPtr client, int id, int mode, int alloc)
/* Called by the extension to install a colormap on DGA active screens */
-_X_EXPORT void
+void
DGAInstallCmap(ColormapPtr cmap)
{
ScreenPtr pScreen = cmap->pScreen;
@@ -748,7 +735,7 @@ DGAInstallCmap(ColormapPtr cmap)
(*pScreen->InstallColormap)(cmap);
}
-_X_EXPORT int
+int
DGASync(int index)
{
DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
@@ -761,7 +748,7 @@ DGASync(int index)
return Success;
}
-_X_EXPORT int
+int
DGAFillRect(
int index,
int x, int y, int w, int h,
@@ -780,7 +767,7 @@ DGAFillRect(
return BadMatch;
}
-_X_EXPORT int
+int
DGABlitRect(
int index,
int srcx, int srcy,
@@ -801,7 +788,7 @@ DGABlitRect(
return BadMatch;
}
-_X_EXPORT int
+int
DGABlitTransRect(
int index,
int srcx, int srcy,
@@ -824,7 +811,7 @@ DGABlitTransRect(
}
-_X_EXPORT int
+int
DGAGetModes(int index)
{
DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
@@ -834,7 +821,7 @@ DGAGetModes(int index)
}
-_X_EXPORT int
+int
DGAGetModeInfo(
int index,
XDGAModePtr mode,
@@ -892,7 +879,7 @@ DGACopyModeInfo(
}
-Bool
+Bool
DGAVTSwitch(void)
{
ScreenPtr pScreen;
@@ -918,8 +905,8 @@ Bool
DGAStealKeyEvent(DeviceIntPtr dev, int index, int key_code, int is_down)
{
DGAScreenPtr pScreenPriv;
- dgaEvent de;
-
+ DGAEvent event;
+
if(DGAScreenKey == NULL) /* no DGA */
return FALSE;
@@ -931,10 +918,16 @@ DGAStealKeyEvent(DeviceIntPtr dev, int index, int key_code, int is_down)
if(!pScreenPriv || !pScreenPriv->grabKeyboard) /* no direct mode */
return FALSE;
- de.u.u.type = *XDGAEventBase + (is_down ? KeyPress : KeyRelease);
- de.u.u.detail = key_code;
- de.u.event.time = GetTimeInMillis();
- mieqEnqueue (dev, (xEvent *) &de);
+ memset(&event, 0, sizeof(event));
+ event.header = ET_Internal;
+ event.type = ET_DGAEvent;
+ event.length = sizeof(event);
+ event.time = GetTimeInMillis();
+ event.subtype = (is_down ? ET_KeyPress : ET_KeyRelease);
+ event.detail = key_code;
+ event.dx = 0;
+ event.dy = 0;
+ mieqEnqueue (dev, (InternalEvent*)&event);
return TRUE;
}
@@ -945,7 +938,7 @@ Bool
DGAStealMotionEvent(DeviceIntPtr dev, int index, int dx, int dy)
{
DGAScreenPtr pScreenPriv;
- dgaEvent de;
+ DGAEvent event;
if(DGAScreenKey == NULL) /* no DGA */
return FALSE;
@@ -965,14 +958,17 @@ DGAStealMotionEvent(DeviceIntPtr dev, int index, int dx, int dy)
DGAMouseY = 0;
else if (DGAMouseY > screenInfo.screens[index]->height)
DGAMouseY = screenInfo.screens[index]->height;
- de.u.u.type = *XDGAEventBase + MotionNotify;
- de.u.u.detail = 0;
- de.u.event.time = GetTimeInMillis();
- de.u.event.dx = dx;
- de.u.event.dy = dy;
- de.u.event.pad1 = DGAMouseX;
- de.u.event.pad2 = DGAMouseY;
- mieqEnqueue (dev, (xEvent *) &de);
+
+ memset(&event, 0, sizeof(event));
+ event.header = ET_Internal;
+ event.type = ET_DGAEvent;
+ event.length = sizeof(event);
+ event.time = GetTimeInMillis();
+ event.subtype = ET_Motion;
+ event.detail = 0;
+ event.dx = dx;
+ event.dy = dy;
+ mieqEnqueue (dev, (InternalEvent*)&event);
return TRUE;
}
@@ -980,7 +976,7 @@ Bool
DGAStealButtonEvent(DeviceIntPtr dev, int index, int button, int is_down)
{
DGAScreenPtr pScreenPriv;
- dgaEvent de;
+ DGAEvent event;
if (DGAScreenKey == NULL)
return FALSE;
@@ -990,14 +986,16 @@ DGAStealButtonEvent(DeviceIntPtr dev, int index, int button, int is_down)
if (!pScreenPriv || !pScreenPriv->grabMouse)
return FALSE;
- de.u.u.type = *XDGAEventBase + (is_down ? ButtonPress : ButtonRelease);
- de.u.u.detail = button;
- de.u.event.time = GetTimeInMillis();
- de.u.event.dx = 0;
- de.u.event.dy = 0;
- de.u.event.pad1 = DGAMouseX;
- de.u.event.pad2 = DGAMouseY;
- mieqEnqueue (dev, (xEvent *) &de);
+ memset(&event, 0, sizeof(event));
+ event.header = ET_Internal;
+ event.type = ET_DGAEvent;
+ event.length = sizeof(event);
+ event.time = GetTimeInMillis();
+ event.subtype = (is_down ? ET_ButtonPress : ET_ButtonRelease);
+ event.detail = button;
+ event.dx = 0;
+ event.dy = 0;
+ mieqEnqueue (dev, (InternalEvent*)&event);
return TRUE;
}
@@ -1029,82 +1027,94 @@ static Mask filters[] =
};
static void
-DGAProcessKeyboardEvent (ScreenPtr pScreen, dgaEvent *de, DeviceIntPtr keybd)
+DGAProcessKeyboardEvent (ScreenPtr pScreen, DGAEvent *event, DeviceIntPtr keybd)
{
- int coreEquiv;
- xEvent xi;
KeyClassPtr keyc = keybd->key;
DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
DeviceIntPtr pointer = GetPairedDevice(keybd);
+ DeviceEvent ev;
- coreEquiv = de->u.u.type - *XDGAEventBase;
-
- /*
- * Fill in remaining event state
- */
- de->u.event.dx = 0;
- de->u.event.dy = 0;
- de->u.event.screen = pScreen->myNum;
- de->u.event.state = keyc->state | pointer->button->state;
+ memset(&ev, 0, sizeof(ev));
+ ev.length = sizeof(ev);
+ ev.detail.key = event->detail;
+ ev.type = event->subtype;
+ ev.root_x = 0;
+ ev.root_y = 0;
+ ev.corestate = XkbStateFieldFromRec(&keyc->xkbInfo->state);
+ ev.corestate |= pointer->button->state;
- de->u.u.type = (IEventBase - 1) + coreEquiv; /* change to XI event */
- UpdateDeviceState(keybd, (xEvent*)de, 1);
- de->u.u.type = *XDGAEventBase + coreEquiv; /* change back */
+ UpdateDeviceState(keybd, &ev);
/*
* Deliver the DGA event
*/
if (pScreenPriv->client)
{
+ dgaEvent de;
+ de.u.u.type = *XDGAEventBase + GetCoreType((InternalEvent*)&ev);
+ de.u.u.detail = event->detail;
+ de.u.event.time = event->time;
+ de.u.event.dx = 0;
+ de.u.event.dy = 0;
+ de.u.event.screen = pScreen->myNum;
+ de.u.event.state = ev.corestate;
+
/* If the DGA client has selected input, then deliver based on the usual filter */
- TryClientEvents (pScreenPriv->client, keybd, (xEvent *) de, 1,
- filters[coreEquiv], pScreenPriv->input, 0);
+ TryClientEvents (pScreenPriv->client, keybd, (xEvent *)&de, 1,
+ filters[ev.type], pScreenPriv->input, 0);
}
else
{
/* If the keyboard is actively grabbed, deliver a grabbed core event */
if (keybd->deviceGrab.grab && !keybd->deviceGrab.fromPassiveGrab)
{
- xi.u.u.type = (IEventBase - 1) + coreEquiv;
- xi.u.u.detail = de->u.u.detail;
- xi.u.keyButtonPointer.time = de->u.event.time;
- xi.u.keyButtonPointer.eventX = de->u.event.dx;
- xi.u.keyButtonPointer.eventY = de->u.event.dy;
- xi.u.keyButtonPointer.rootX = de->u.event.dx;
- xi.u.keyButtonPointer.rootY = de->u.event.dy;
- xi.u.keyButtonPointer.state = de->u.event.state;
- ((deviceKeyButtonPointer*)&xi)->deviceid = keybd->id;
- DeliverGrabbedEvent (&xi, keybd, FALSE, 1);
+ ev.detail.key = event->detail;
+ ev.time = event->time;
+ ev.root_x = event->dx;
+ ev.root_y = event->dy;
+ ev.corestate = event->state;
+ ev.deviceid = keybd->id;
+ DeliverGrabbedEvent ((InternalEvent*)&ev, keybd, FALSE);
}
}
}
static void
-DGAProcessPointerEvent (ScreenPtr pScreen, dgaEvent *de, DeviceIntPtr mouse)
+DGAProcessPointerEvent (ScreenPtr pScreen, DGAEvent *event, DeviceIntPtr mouse)
{
ButtonClassPtr butc = mouse->button;
- int coreEquiv;
DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
- xEvent xi;
+ DeviceEvent ev;
- coreEquiv = de->u.u.type - *XDGAEventBase;
- /*
- * Fill in remaining event state
- */
- de->u.event.screen = pScreen->myNum;
- de->u.event.state = butc->state | GetPairedDevice(mouse)->key->state;
+ memset(&ev, 0, sizeof(ev));
+ ev.header = ET_Internal;
+ ev.length = sizeof(ev);
+ ev.type = event->subtype;
+ ev.corestate = butc->state;
+ ev.corestate |= XkbStateFieldFromRec(&GetPairedDevice(mouse)->key->xkbInfo->state);
- de->u.u.type = (IEventBase - 1) + coreEquiv; /* change to XI event */
- UpdateDeviceState(mouse, (xEvent*)de, 1);
- de->u.u.type = *XDGAEventBase + coreEquiv; /* change back */
+ UpdateDeviceState(mouse, &ev);
/*
* Deliver the DGA event
*/
if (pScreenPriv->client)
{
+ dgaEvent de;
+ int coreEquiv;
+
+ coreEquiv = GetCoreType((InternalEvent*)&ev);
+
+ de.u.u.type = *XDGAEventBase + coreEquiv;
+ de.u.u.detail = event->detail;
+ de.u.event.time = event->time;
+ de.u.event.dx = 0;
+ de.u.event.dy = 0;
+ de.u.event.screen = pScreen->myNum;
+ de.u.event.state = ev.corestate;
+
/* If the DGA client has selected input, then deliver based on the usual filter */
- TryClientEvents (pScreenPriv->client, mouse, (xEvent *) de, 1,
+ TryClientEvents (pScreenPriv->client, mouse, (xEvent *)&de, 1,
filters[coreEquiv], pScreenPriv->input, 0);
}
else
@@ -1112,20 +1122,17 @@ DGAProcessPointerEvent (ScreenPtr pScreen, dgaEvent *de, DeviceIntPtr mouse)
/* If the pointer is actively grabbed, deliver a grabbed core event */
if (mouse->deviceGrab.grab && !mouse->deviceGrab.fromPassiveGrab)
{
- xi.u.u.type = (IEventBase - 1 ) + coreEquiv;
- xi.u.u.detail = de->u.u.detail;
- xi.u.keyButtonPointer.time = de->u.event.time;
- xi.u.keyButtonPointer.eventX = de->u.event.dx;
- xi.u.keyButtonPointer.eventY = de->u.event.dy;
- xi.u.keyButtonPointer.rootX = de->u.event.dx;
- xi.u.keyButtonPointer.rootY = de->u.event.dy;
- xi.u.keyButtonPointer.state = de->u.event.state;
- DeliverGrabbedEvent (&xi, mouse, FALSE, 1);
+ ev.detail.button = event->detail;
+ ev.time = event->time;
+ ev.root_x = event->dx;
+ ev.root_y = event->dy;
+ ev.corestate = event->state;
+ DeliverGrabbedEvent ((InternalEvent*)&ev, mouse, FALSE);
}
}
}
-_X_EXPORT Bool
+Bool
DGAOpenFramebuffer(
int index,
char **name,
@@ -1142,7 +1149,7 @@ DGAOpenFramebuffer(
name, mem, size, offset, flags);
}
-_X_EXPORT void
+void
DGACloseFramebuffer(int index)
{
DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
@@ -1154,7 +1161,7 @@ DGACloseFramebuffer(int index)
/* For DGA 1.0 backwards compatibility only */
-_X_EXPORT int
+int
DGAGetOldDGAMode(int index)
{
DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
@@ -1166,7 +1173,7 @@ DGAGetOldDGAMode(int index)
w = pScrn->currentMode->HDisplay;
h = pScrn->currentMode->VDisplay;
- p = ((pScrn->displayWidth * (pScrn->bitsPerPixel >> 3)) + 3) & ~3L;
+ p = pad_to_int32(pScrn->displayWidth * bits_to_bytes(pScrn->bitsPerPixel));
for(i = 0; i < pScreenPriv->numModes; i++) {
mode = &(pScreenPriv->modes[i]);
@@ -1184,34 +1191,32 @@ DGAGetOldDGAMode(int index)
}
static void
-DGAHandleEvent(int screen_num, xEvent *event, DeviceIntPtr device, int nevents)
+DGAHandleEvent(int screen_num, InternalEvent *ev, DeviceIntPtr device)
{
- dgaEvent *de = (dgaEvent *) event;
+ DGAEvent *event= (DGAEvent*)ev;
ScreenPtr pScreen = screenInfo.screens[screen_num];
DGAScreenPtr pScreenPriv;
- int coreEquiv;
/* no DGA */
if (DGAScreenKey == NULL || XDGAEventBase == 0)
return;
pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
-
+
/* DGA not initialized on this screen */
if (!pScreenPriv)
return;
-
- coreEquiv = de->u.u.type - *XDGAEventBase;
- /* Not a DGA event; shouldn't happen, but you never know. */
- if (coreEquiv < KeyPress || coreEquiv > MotionNotify)
- return;
-
- switch (coreEquiv) {
+
+ switch (event->subtype) {
case KeyPress:
case KeyRelease:
- DGAProcessKeyboardEvent (pScreen, de, device);
+ DGAProcessKeyboardEvent (pScreen, event, device);
break;
+ case MotionNotify:
+ case ButtonPress:
+ case ButtonRelease:
+ DGAProcessPointerEvent (pScreen, event, device);
+ break;
default:
- DGAProcessPointerEvent (pScreen, de, device);
break;
}
}
diff --git a/xorg-server/hw/xfree86/common/xf86DPMS.c b/xorg-server/hw/xfree86/common/xf86DPMS.c
index 5ee5e2451..22174c74e 100644
--- a/xorg-server/hw/xfree86/common/xf86DPMS.c
+++ b/xorg-server/hw/xfree86/common/xf86DPMS.c
@@ -1,4 +1,3 @@
-
/*
* Copyright (c) 1997-2003 by The XFree86 Project, Inc.
*
@@ -40,10 +39,10 @@
#include "xf86.h"
#include "xf86Priv.h"
#ifdef DPMSExtension
-#define DPMS_SERVER
-#include <X11/extensions/dpms.h>
+#include <X11/extensions/dpmsconst.h>
#include "dpmsproc.h"
#endif
+#include "xf86VGAarbiter.h"
#ifdef DPMSExtension
@@ -54,44 +53,41 @@ static int DPMSCount = 0;
#endif
-_X_EXPORT Bool
+Bool
xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags)
{
#ifdef DPMSExtension
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
DPMSPtr pDPMS;
pointer DPMSOpt;
- MessageType enabled_from = X_INFO;
+ MessageType enabled_from;
DPMSKey = &DPMSKeyIndex;
- if (DPMSDisabledSwitch)
- DPMSEnabled = FALSE;
if (!dixSetPrivate(&pScreen->devPrivates, DPMSKey,
xcalloc(sizeof(DPMSRec), 1)))
return FALSE;
- pDPMS = (DPMSPtr)dixLookupPrivate(&pScreen->devPrivates, DPMSKey);
+ pDPMS = dixLookupPrivate(&pScreen->devPrivates, DPMSKey);
pScrn->DPMSSet = set;
pDPMS->Flags = flags;
DPMSOpt = xf86FindOption(pScrn->options, "dpms");
- if (DPMSOpt) {
- if ((pDPMS->Enabled
- = xf86SetBoolOption(pScrn->options, "dpms", FALSE))
- && !DPMSDisabledSwitch)
- DPMSEnabled = TRUE;
- enabled_from = X_CONFIG;
+ if (DPMSDisabledSwitch) {
+ enabled_from = X_CMDLINE;
+ DPMSEnabled = FALSE;
+ }
+ else if (DPMSOpt) {
+ enabled_from = X_CONFIG;
+ DPMSEnabled = xf86CheckBoolOption(pScrn->options, "dpms", FALSE);
xf86MarkOptionUsed(DPMSOpt);
- } else if (DPMSEnabledSwitch) {
- if (!DPMSDisabledSwitch)
- DPMSEnabled = TRUE;
- pDPMS->Enabled = TRUE;
- }
+ }
else {
- pDPMS->Enabled = defaultDPMSEnabled;
+ enabled_from = X_DEFAULT;
+ DPMSEnabled = TRUE;
}
- if (pDPMS->Enabled)
+ if (DPMSEnabled)
xf86DrvMsg(pScreen->myNum, enabled_from, "DPMS enabled\n");
+ pDPMS->Enabled = DPMSEnabled;
pDPMS->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = DPMSClose;
DPMSCount++;
@@ -113,7 +109,7 @@ DPMSClose(int i, ScreenPtr pScreen)
if (DPMSKey == NULL)
return FALSE;
- pDPMS = (DPMSPtr)dixLookupPrivate(&pScreen->devPrivates, DPMSKey);
+ pDPMS = dixLookupPrivate(&pScreen->devPrivates, DPMSKey);
/* This shouldn't happen */
if (!pDPMS)
@@ -131,7 +127,7 @@ DPMSClose(int i, ScreenPtr pScreen)
xf86Screens[i]->DPMSSet(xf86Screens[i],DPMSModeOn,0);
}
- xfree((pointer)pDPMS);
+ xfree(pDPMS);
dixSetPrivate(&pScreen->devPrivates, DPMSKey, NULL);
if (--DPMSCount == 0)
DPMSKey = NULL;
@@ -144,7 +140,7 @@ DPMSClose(int i, ScreenPtr pScreen)
* Device dependent DPMS mode setting hook. This is called whenever
* the DPMS mode is to be changed.
*/
-_X_EXPORT int
+int
DPMSSet(ClientPtr client, int level)
{
int rc, i;
@@ -165,11 +161,11 @@ DPMSSet(ClientPtr client, int level)
/* For each screen, set the DPMS level */
for (i = 0; i < xf86NumScreens; i++) {
pScrn = xf86Screens[i];
- pDPMS = (DPMSPtr)dixLookupPrivate(&screenInfo.screens[i]->devPrivates,
- DPMSKey);
+ pDPMS = dixLookupPrivate(&screenInfo.screens[i]->devPrivates, DPMSKey);
if (pDPMS && pScrn->DPMSSet && pDPMS->Enabled && pScrn->vtSema) {
- xf86EnableAccess(pScrn);
+ xf86VGAarbiterLock(pScrn);
pScrn->DPMSSet(pScrn, level, 0);
+ xf86VGAarbiterUnlock(pScrn);
}
}
return Success;
@@ -180,7 +176,7 @@ DPMSSet(ClientPtr client, int level)
* DPMSSupported --
* Return TRUE if any screen supports DPMS.
*/
-_X_EXPORT Bool
+Bool
DPMSSupported(void)
{
int i;
@@ -194,33 +190,11 @@ DPMSSupported(void)
/* For each screen, check if DPMS is supported */
for (i = 0; i < xf86NumScreens; i++) {
pScrn = xf86Screens[i];
- pDPMS = (DPMSPtr)dixLookupPrivate(&screenInfo.screens[i]->devPrivates,
- DPMSKey);
+ pDPMS = dixLookupPrivate(&screenInfo.screens[i]->devPrivates, DPMSKey);
if (pDPMS && pScrn->DPMSSet)
return TRUE;
}
return FALSE;
}
-
-/*
- * DPMSGet --
- * Device dependent DPMS mode getting hook. This returns the current
- * DPMS mode, or -1 if DPMS is not supported.
- *
- * This should hook in to the appropriate driver-level function, which
- * will be added to the ScrnInfoRec.
- *
- * NOTES:
- * 1. the calling interface should be changed to specify which
- * screen to check.
- * 2. It isn't clear that this function is ever used or what it should
- * return.
- */
-_X_EXPORT int
-DPMSGet(int *level)
-{
- return DPMSPowerLevel;
-}
-
#endif /* DPMSExtension */
diff --git a/xorg-server/hw/xfree86/common/xf86Events.c b/xorg-server/hw/xfree86/common/xf86Events.c
index d6ef93a1b..9487fe7b2 100644
--- a/xorg-server/hw/xfree86/common/xf86Events.c
+++ b/xorg-server/hw/xfree86/common/xf86Events.c
@@ -76,24 +76,15 @@
#include "mi.h"
#include "mipointer.h"
-#ifdef XF86BIGFONT
-#define _XF86BIGFONT_SERVER_
-#include <X11/extensions/xf86bigfont.h>
-#endif
+#include "xkbsrv.h"
+#include "xkbstr.h"
#ifdef DPMSExtension
-#define DPMS_SERVER
-#include <X11/extensions/dpms.h>
+#include <X11/extensions/dpmsconst.h>
#include "dpmsproc.h"
#endif
/*
- * The first of many hacks to get VT switching to work under
- * Solaris 2.1 for x86. The basic problem is that Solaris is supposed
- * to be SVR4. It is for the most part, except where the video interface
- * is concerned. These hacks work around those problems.
- * See the comments for Linux, and SCO.
- *
* This is a toggling variable:
* FALSE = No VT switching keys have been pressed last time around
* TRUE = Possible VT switch Pending
@@ -102,7 +93,7 @@
* This has been generalised to work with Linux and *BSD+syscons (DHD)
*/
-_X_EXPORT Bool VTSwitchEnabled = TRUE; /* Allows run-time disabling for
+Bool VTSwitchEnabled = TRUE; /* Allows run-time disabling for
*BSD and for avoiding VT
switches when using the DRI
automatic full screen mode.*/
@@ -142,7 +133,7 @@ LegalModifier(unsigned int key, DeviceIntPtr pDev)
* time in milliseconds since there last was any input.
*/
int
-TimeSinceLastInputEvent()
+TimeSinceLastInputEvent(void)
{
if (xf86Info.lastEventTime == 0) {
xf86Info.lastEventTime = GetTimeInMillis();
@@ -154,8 +145,8 @@ TimeSinceLastInputEvent()
* SetTimeSinceLastInputEvent --
* Set the lastEventTime to now.
*/
-_X_EXPORT void
-SetTimeSinceLastInputEvent()
+void
+SetTimeSinceLastInputEvent(void)
{
xf86Info.lastEventTime = GetTimeInMillis();
}
@@ -167,7 +158,7 @@ SetTimeSinceLastInputEvent()
* and keyboard.
*/
void
-ProcessInputEvents ()
+ProcessInputEvents (void)
{
int x, y;
@@ -185,9 +176,7 @@ ProcessInputEvents ()
void
xf86ProcessActionEvent(ActionEvent action, void *arg)
{
-#ifdef DEBUG
- ErrorF("ProcessActionEvent(%d,%x)\n", (int) action, arg);
-#endif
+ DebugF("ProcessActionEvent(%d,%x)\n", (int) action, arg);
switch (action) {
case ACTION_TERMINATE:
if (!xf86Info.dontZap) {
@@ -205,21 +194,27 @@ xf86ProcessActionEvent(ActionEvent action, void *arg)
if (!xf86Info.dontZoom)
xf86ZoomViewport(xf86Info.currentScreen, -1);
break;
-#if !defined(__SOL8__) && \
- (!defined(sun) || defined(__i386__)) && defined(VT_ACTIVATE)
+#if defined(VT_ACTIVATE)
case ACTION_SWITCHSCREEN:
if (VTSwitchEnabled && !xf86Info.dontVTSwitch && arg) {
int vtno = *((int *) arg);
#if defined(__SCO__) || defined(__UNIXWARE__)
vtno--;
#endif
+#if defined(sun)
+ if (vtno == xf86Info.vtno)
+ break;
+
+ xf86Info.vtRequestsPending = TRUE;
+ xf86Info.vtPendingNum = vtno;
+#else
if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, vtno) < 0)
ErrorF("Failed to switch consoles (%s)\n", strerror(errno));
+#endif
}
break;
case ACTION_SWITCHSCREEN_NEXT:
if (VTSwitchEnabled && !xf86Info.dontVTSwitch) {
-/* Shouldn't this be true for (sun) && (i386) && (SVR4) ? */
#if defined(__SCO__) || defined(__UNIXWARE__)
if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) < 0)
#else
@@ -301,16 +296,13 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask)
* signal handler for the SIGIO signal.
*/
static void
-xf86SigioReadInput(int fd,
- void *closure)
+xf86SigioReadInput(int fd, void *closure)
{
int errno_save = errno;
- int sigstate = xf86BlockSIGIO();
- InputInfoPtr pInfo = (InputInfoPtr) closure;
+ InputInfoPtr pInfo = closure;
pInfo->read_input(pInfo);
- xf86UnblockSIGIO(sigstate);
errno = errno_save;
}
@@ -318,7 +310,7 @@ xf86SigioReadInput(int fd,
* xf86AddEnabledDevice --
*
*/
-_X_EXPORT void
+void
xf86AddEnabledDevice(InputInfoPtr pInfo)
{
if (!xf86InstallSIGIOHandler (pInfo->fd, xf86SigioReadInput, pInfo)) {
@@ -330,7 +322,7 @@ xf86AddEnabledDevice(InputInfoPtr pInfo)
* xf86RemoveEnabledDevice --
*
*/
-_X_EXPORT void
+void
xf86RemoveEnabledDevice(InputInfoPtr pInfo)
{
if (!xf86RemoveSIGIOHandler (pInfo->fd)) {
@@ -340,7 +332,7 @@ xf86RemoveEnabledDevice(InputInfoPtr pInfo)
static int *xf86SignalIntercept = NULL;
-_X_EXPORT void
+void
xf86InterceptSignals(int *signo)
{
if ((xf86SignalIntercept = signo))
@@ -349,70 +341,55 @@ xf86InterceptSignals(int *signo)
static void (*xf86SigIllHandler)(void) = NULL;
-_X_EXPORT void
+void
xf86InterceptSigIll(void (*sigillhandler)(void))
{
xf86SigIllHandler = sigillhandler;
}
/*
- * xf86SigHandler --
+ * xf86SigWrapper --
* Catch unexpected signals and exit or continue cleanly.
*/
-void
-xf86SigHandler(int signo)
+int
+xf86SigWrapper(int signo)
{
if ((signo == SIGILL) && xf86SigIllHandler) {
(*xf86SigIllHandler)();
- /* Re-arm handler just in case we unexpectedly return here */
- (void) signal(signo, xf86SigHandler);
- return;
+ return 0; /* continue */
}
if (xf86SignalIntercept && (*xf86SignalIntercept < 0)) {
*xf86SignalIntercept = signo;
- /* Re-arm handler just in case */
- (void) signal(signo, xf86SigHandler);
- return;
+ return 0; /* continue */
}
- signal(signo,SIG_IGN);
xf86Info.caughtSignal = TRUE;
-#ifdef XF86BIGFONT
- XF86BigfontCleanup();
-#endif
-
- xorg_backtrace();
-
- FatalError("Caught signal %d. Server aborting\n", signo);
+ return 1; /* abort */
}
/*
* xf86PrintBacktrace --
* Print a stack backtrace for debugging purposes.
*/
-_X_EXPORT void
+void
xf86PrintBacktrace(void)
{
xorg_backtrace();
}
#define KeyPressed(k) (keyc->postdown[k >> 3] & (1 << (k & 7)))
-#define ModifierDown(k) ((keyc->state & (k)) == (k))
static void
xf86ReleaseKeys(DeviceIntPtr pDev)
{
- KeyClassPtr keyc = NULL;
- KeySym *map = NULL;
- xEvent ke;
- int i = 0, j = 0, nevents = 0;
+ KeyClassPtr keyc;
+ int i, j, nevents, sigstate;
if (!pDev || !pDev->key)
return;
keyc = pDev->key;
- map = keyc->curKeySyms.map;
/*
* Hmm... here is the biggest hack of every time !
@@ -425,36 +402,15 @@ xf86ReleaseKeys(DeviceIntPtr pDev)
* are reenabled.
*/
- for (i = keyc->curKeySyms.minKeyCode, map = keyc->curKeySyms.map;
- i < keyc->curKeySyms.maxKeyCode;
- i++, map += keyc->curKeySyms.mapWidth) {
+ for (i = keyc->xkbInfo->desc->min_key_code;
+ i < keyc->xkbInfo->desc->max_key_code;
+ i++) {
if (KeyPressed(i)) {
- switch (*map) {
- /* Don't release the lock keys */
- case XK_Caps_Lock:
- case XK_Shift_Lock:
- case XK_Num_Lock:
- case XK_Scroll_Lock:
- case XK_Kana_Lock:
- break;
- default:
- if (pDev == inputInfo.keyboard) {
- ke.u.keyButtonPointer.time = GetTimeInMillis();
- ke.u.keyButtonPointer.rootX = 0;
- ke.u.keyButtonPointer.rootY = 0;
- ke.u.u.type = KeyRelease;
- ke.u.u.detail = i;
- (*pDev->public.processInputProc) (&ke, pDev, 1);
- }
- else {
- int sigstate = xf86BlockSIGIO ();
- nevents = GetKeyboardEvents(xf86Events, pDev, KeyRelease, i);
- for (j = 0; j < nevents; j++)
- mieqEnqueue(pDev, (xf86Events + j)->event);
- xf86UnblockSIGIO(sigstate);
- }
- break;
- }
+ sigstate = xf86BlockSIGIO ();
+ nevents = GetKeyboardEvents(xf86Events, pDev, KeyRelease, i);
+ for (j = 0; j < nevents; j++)
+ mieqEnqueue(pDev, (InternalEvent*)(xf86Events + j)->event);
+ xf86UnblockSIGIO(sigstate);
}
}
}
@@ -464,15 +420,13 @@ xf86ReleaseKeys(DeviceIntPtr pDev)
* Handle requests for switching the vt.
*/
static void
-xf86VTSwitch()
+xf86VTSwitch(void)
{
int i, prevSIGIO;
InputInfoPtr pInfo;
IHPtr ih;
-#ifdef DEBUG
- ErrorF("xf86VTSwitch()\n");
-#endif
+ DebugF("xf86VTSwitch()\n");
#ifdef XFreeXDGA
if(!DGAVTSwitch())
@@ -485,10 +439,8 @@ xf86VTSwitch()
*/
if (xf86Screens[0]->vtSema) {
-#ifdef DEBUG
- ErrorF("xf86VTSwitch: Leaving, xf86Exiting is %s\n",
+ DebugF("xf86VTSwitch: Leaving, xf86Exiting is %s\n",
BOOLTOSTRING((dispatchException & DE_TERMINATE) ? TRUE : FALSE));
-#endif
#ifdef DPMSExtension
if (DPMSPowerLevel != DPMSModeOn)
DPMSSet(serverClient, DPMSModeOn);
@@ -503,29 +455,27 @@ xf86VTSwitch()
* Keep the order: Disable Device > LeaveVT
* EnterVT > EnableDevice
*/
- pInfo = xf86InputDevs;
- while (pInfo) {
- if (pInfo->dev)
- DisableDevice(pInfo->dev);
- pInfo = pInfo->next;
+ for (ih = InputHandlers; ih; ih = ih->next)
+ xf86DisableInputHandler(ih);
+ for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next) {
+ if (pInfo->dev) {
+ xf86ReleaseKeys(pInfo->dev);
+ ProcessInputEvents();
+ DisableDevice(pInfo->dev, TRUE);
+ }
}
xf86EnterServerState(SETUP);
for (i = 0; i < xf86NumScreens; i++)
xf86Screens[i]->LeaveVT(i, 0);
- for (ih = InputHandlers; ih; ih = ih->next)
- xf86DisableInputHandler(ih);
xf86AccessLeave(); /* We need this here, otherwise */
- xf86AccessLeaveState(); /* console won't be restored */
if (!xf86VTSwitchAway()) {
/*
* switch failed
*/
-#ifdef DEBUG
- ErrorF("xf86VTSwitch: Leave failed\n");
-#endif
+ DebugF("xf86VTSwitch: Leave failed\n");
prevSIGIO = xf86BlockSIGIO();
xf86AccessEnter();
xf86EnterServerState(SETUP);
@@ -544,14 +494,10 @@ xf86VTSwitch()
pInfo = xf86InputDevs;
while (pInfo) {
- if (pInfo->dev) {
- xf86ReleaseKeys(pInfo->dev);
- EnableDevice(pInfo->dev);
- }
+ if (pInfo->dev)
+ EnableDevice(pInfo->dev, TRUE);
pInfo = pInfo->next;
}
- /* XXX HACK */
- xf86ReleaseKeys(inputInfo.keyboard);
for (ih = InputHandlers; ih; ih = ih->next)
xf86EnableInputHandler(ih);
@@ -570,17 +516,13 @@ xf86VTSwitch()
* trap calls when switched away.
*/
xf86Screens[i]->vtSema = FALSE;
- xf86Screens[i]->access = NULL;
- xf86Screens[i]->busAccess = NULL;
}
if (xorgHWAccess)
xf86DisableIO();
}
} else {
-#ifdef DEBUG
- ErrorF("xf86VTSwitch: Entering\n");
-#endif
+ DebugF("xf86VTSwitch: Entering\n");
if (!xf86VTSwitchTo()) return;
prevSIGIO = xf86BlockSIGIO();
@@ -608,14 +550,10 @@ xf86VTSwitch()
pInfo = xf86InputDevs;
while (pInfo) {
- if (pInfo->dev) {
- xf86ReleaseKeys(pInfo->dev);
- EnableDevice(pInfo->dev);
- }
+ if (pInfo->dev)
+ EnableDevice(pInfo->dev, TRUE);
pInfo = pInfo->next;
}
- /* XXX HACK */
- xf86ReleaseKeys(inputInfo.keyboard);
for (ih = InputHandlers; ih; ih = ih->next)
xf86EnableInputHandler(ih);
@@ -650,7 +588,7 @@ addInputHandler(int fd, InputHandlerProc proc, pointer data)
return ih;
}
-_X_EXPORT pointer
+pointer
xf86AddInputHandler(int fd, InputHandlerProc proc, pointer data)
{
IHPtr ih = addInputHandler(fd, proc, data);
@@ -660,7 +598,7 @@ xf86AddInputHandler(int fd, InputHandlerProc proc, pointer data)
return ih;
}
-_X_EXPORT pointer
+pointer
xf86AddGeneralHandler(int fd, InputHandlerProc proc, pointer data)
{
IHPtr ih = addInputHandler(fd, proc, data);
@@ -687,7 +625,7 @@ removeInputHandler(IHPtr ih)
xfree(ih);
}
-_X_EXPORT int
+int
xf86RemoveInputHandler(pointer handler)
{
IHPtr ih;
@@ -706,7 +644,7 @@ xf86RemoveInputHandler(pointer handler)
return fd;
}
-_X_EXPORT int
+int
xf86RemoveGeneralHandler(pointer handler)
{
IHPtr ih;
@@ -725,7 +663,7 @@ xf86RemoveGeneralHandler(pointer handler)
return fd;
}
-_X_EXPORT void
+void
xf86DisableInputHandler(pointer handler)
{
IHPtr ih;
@@ -739,7 +677,7 @@ xf86DisableInputHandler(pointer handler)
RemoveEnabledDevice(ih->fd);
}
-_X_EXPORT void
+void
xf86DisableGeneralHandler(pointer handler)
{
IHPtr ih;
@@ -753,7 +691,7 @@ xf86DisableGeneralHandler(pointer handler)
RemoveGeneralSocket(ih->fd);
}
-_X_EXPORT void
+void
xf86EnableInputHandler(pointer handler)
{
IHPtr ih;
@@ -767,7 +705,7 @@ xf86EnableInputHandler(pointer handler)
AddEnabledDevice(ih->fd);
}
-_X_EXPORT void
+void
xf86EnableGeneralHandler(pointer handler)
{
IHPtr ih;
@@ -784,7 +722,7 @@ xf86EnableGeneralHandler(pointer handler)
/*
* As used currently by the DRI, the return value is ignored.
*/
-_X_EXPORT Bool
+Bool
xf86EnableVTSwitch(Bool new)
{
static Bool def = TRUE;
@@ -803,23 +741,6 @@ xf86EnableVTSwitch(Bool new)
}
void
-xf86ReloadInputDevs(int sig)
-{
- InputInfoPtr pInfo;
-
- signal(sig, (void(*)(int))xf86ReloadInputDevs);
-
- pInfo = xf86InputDevs;
- while (pInfo) {
- DisableDevice(pInfo->dev);
- EnableDevice(pInfo->dev);
- pInfo = pInfo->next;
- }
-
- return;
-}
-
-_X_EXPORT void
DDXRingBell(int volume, int pitch, int duration) {
xf86OSRingBell(volume, pitch, duration);
}
diff --git a/xorg-server/hw/xfree86/common/xf86Globals.c b/xorg-server/hw/xfree86/common/xf86Globals.c
index 04a96cbdc..d8f7f7f27 100644
--- a/xorg-server/hw/xfree86/common/xf86Globals.c
+++ b/xorg-server/hw/xfree86/common/xf86Globals.c
@@ -43,6 +43,7 @@
#include "xf86Parser.h"
#include "xf86Xinput.h"
#include "xf86InPriv.h"
+#include "xf86Config.h"
/* Globals that video drivers may access */
@@ -51,11 +52,11 @@ static int xf86CreateRootWindowKeyIndex;
DevPrivateKey xf86CreateRootWindowKey = &xf86CreateRootWindowKeyIndex;
/* Index of ScrnInfo in pScreen.devPrivates */
static int xf86ScreenKeyIndex;
-_X_EXPORT DevPrivateKey xf86ScreenKey = &xf86ScreenKeyIndex;
+DevPrivateKey xf86ScreenKey = &xf86ScreenKeyIndex;
static int xf86PixmapKeyIndex;
-_X_EXPORT DevPrivateKey xf86PixmapKey = &xf86PixmapKeyIndex;
-_X_EXPORT ScrnInfoPtr *xf86Screens = NULL; /* List of ScrnInfos */
-_X_EXPORT const unsigned char byte_reversed[256] =
+DevPrivateKey xf86PixmapKey = &xf86PixmapKeyIndex;
+ScrnInfoPtr *xf86Screens = NULL; /* List of ScrnInfos */
+const unsigned char byte_reversed[256] =
{
0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
@@ -101,9 +102,11 @@ xf86InfoRec xf86Info = {
.consoleFd = -1,
.vtno = -1,
.vtSysreq = FALSE,
- .ddxSpecialKeys = SKWhenNeeded,
.lastEventTime = -1,
.vtRequestsPending = FALSE,
+#ifdef sun
+ .vtPendingNum = -1,
+#endif
.dontVTSwitch = FALSE,
.dontZap = FALSE,
.dontZoom = FALSE,
@@ -140,21 +143,18 @@ xf86InfoRec xf86Info = {
#endif
};
const char *xf86ConfigFile = NULL;
-const char *xf86InputDeviceList = NULL;
const char *xf86ModulePath = DEFAULT_MODULE_PATH;
MessageType xf86ModPathFrom = X_DEFAULT;
const char *xf86LogFile = DEFAULT_LOGPREFIX;
MessageType xf86LogFileFrom = X_DEFAULT;
Bool xf86LogFileWasOpened = FALSE;
serverLayoutRec xf86ConfigLayout = {NULL, };
-_X_EXPORT confDRIRec xf86ConfigDRI = {0, };
+confDRIRec xf86ConfigDRI = {0, };
XF86ConfigPtr xf86configptr = NULL;
Bool xf86Resetting = FALSE;
Bool xf86Initialising = FALSE;
-Bool xf86DoProbe = FALSE;
Bool xf86DoConfigure = FALSE;
Bool xf86DoShowOptions = FALSE;
-Bool xf86DoModalias = FALSE;
DriverPtr *xf86DriverList = NULL;
int xf86NumDrivers = 0;
InputDriverPtr *xf86InputDriverList = NULL;
@@ -185,7 +185,6 @@ char *xf86LayoutName = NULL;
char *xf86ScreenName = NULL;
char *xf86PointerName = NULL;
char *xf86KeyboardName = NULL;
-Bool xf86ProbeOnly = FALSE;
int xf86Verbose = DEFAULT_VERBOSE;
int xf86LogVerbose = DEFAULT_LOG_VERBOSE;
int xf86FbBpp = -1;
@@ -200,7 +199,7 @@ Bool xf86VidModeDisabled = FALSE;
Bool xf86VidModeAllowNonLocal = FALSE;
#endif
RootWinPropPtr *xf86RegisteredPropertiesTable = NULL;
-_X_EXPORT Bool xf86inSuspend = FALSE;
+Bool xf86inSuspend = FALSE;
Bool xorgHWAccess = FALSE;
struct pci_slot_match xf86IsolateDevice = {
diff --git a/xorg-server/hw/xfree86/common/xf86Helper.c b/xorg-server/hw/xfree86/common/xf86Helper.c
index 00df10574..9a2468dd3 100644
--- a/xorg-server/hw/xfree86/common/xf86Helper.c
+++ b/xorg-server/hw/xfree86/common/xf86Helper.c
@@ -53,13 +53,12 @@
#include "xf86Priv.h"
#include "xf86_OSlib.h"
#include "micmap.h"
-#include "xf86PciInfo.h"
#include "xf86DDC.h"
#include "xf86Xinput.h"
#include "xf86InPriv.h"
#include "mivalidate.h"
-#include "xf86RAC.h"
#include "xf86Bus.h"
+#include "xf86Crtc.h"
/* For xf86GetClocks */
#if defined(CSRG_BASED) || defined(__GNU__)
@@ -72,7 +71,7 @@ static int xf86ScrnInfoPrivateCount = 0;
/* Add a pointer to a new DriverRec to xf86DriverList */
-_X_EXPORT void
+void
xf86AddDriver(DriverPtr driver, pointer module, int flags)
{
/* Don't add null entries */
@@ -99,7 +98,7 @@ xf86AddDriver(DriverPtr driver, pointer module, int flags)
xf86DriverList[xf86NumDrivers - 1]->refCount = 0;
}
-_X_EXPORT void
+void
xf86DeleteDriver(int drvIndex)
{
if (xf86DriverList[drvIndex]
@@ -113,7 +112,7 @@ xf86DeleteDriver(int drvIndex)
/* Add a pointer to a new InputDriverRec to xf86InputDriverList */
-_X_EXPORT void
+void
xf86AddInputDriver(InputDriverPtr driver, pointer module, int flags)
{
/* Don't add null entries */
@@ -168,20 +167,9 @@ xf86LookupInput(const char *name)
return NULL;
}
-/* ABI stubs of despair */
-_X_EXPORT void
-xf86AddModuleInfo(pointer info, pointer module)
-{
-}
-
-_X_EXPORT void
-xf86DeleteModuleInfo(int idx)
-{
-}
-
/* Allocate a new ScrnInfoRec in xf86Screens */
-_X_EXPORT ScrnInfoPtr
+ScrnInfoPtr
xf86AllocateScreen(DriverPtr drv, int flags)
{
int i;
@@ -204,22 +192,6 @@ xf86AllocateScreen(DriverPtr drv, int flags)
xf86Screens[i]->drv = drv;
drv->refCount++;
xf86Screens[i]->module = DuplicateModule(drv->module, NULL);
- /*
- * set the initial access state. This will be modified after PreInit.
- * XXX Or should we do it some other place?
- */
- xf86Screens[i]->CurrentAccess = &xf86CurrentAccess;
- xf86Screens[i]->resourceType = MEM_IO;
-
-#ifdef DEBUG
- /* OOps -- What's this ? */
- ErrorF("xf86AllocateScreen - xf86Screens[%d]->pScreen = %p\n",
- i, xf86Screens[i]->pScreen );
- if ( NULL != xf86Screens[i]->pScreen ) {
- ErrorF("xf86Screens[%d]->pScreen->CreateWindow = %p\n",
- i, xf86Screens[i]->pScreen->CreateWindow );
- }
-#endif
xf86Screens[i]->DriverFunc = drv->driverFunc;
@@ -232,7 +204,7 @@ xf86AllocateScreen(DriverPtr drv, int flags)
* data. To do this properly may require a driver hook.
*/
-_X_EXPORT void
+void
xf86DeleteScreen(int scrnIndex, int flags)
{
ScrnInfoPtr pScrn;
@@ -288,7 +260,7 @@ xf86DeleteScreen(int scrnIndex, int flags)
* Allocate a private in ScrnInfoRec.
*/
-_X_EXPORT int
+int
xf86AllocateScrnInfoPrivateIndex(void)
{
int idx, i;
@@ -308,7 +280,7 @@ xf86AllocateScrnInfoPrivateIndex(void)
}
/* Allocate a new InputInfoRec and append it to the tail of xf86InputDevs. */
-_X_EXPORT InputInfoPtr
+InputInfoPtr
xf86AllocateInput(InputDriverPtr drv, int flags)
{
InputInfoPtr new, *prev = NULL;
@@ -335,7 +307,7 @@ xf86AllocateInput(InputDriverPtr drv, int flags)
* data. To do this properly may require a driver hook.
*/
-_X_EXPORT void
+void
xf86DeleteInput(InputInfoPtr pInp, int flags)
{
InputInfoPtr p;
@@ -376,7 +348,7 @@ xf86DeleteInput(InputInfoPtr pInp, int flags)
xfree(pInp);
}
-_X_EXPORT Bool
+Bool
xf86AddPixFormat(ScrnInfoPtr pScrn, int depth, int bpp, int pad)
{
int i;
@@ -447,7 +419,7 @@ xf86AddPixFormat(ScrnInfoPtr pScrn, int depth, int bpp, int pad)
#define GLOBAL_DEFAULT_DEPTH 24
#endif
-_X_EXPORT Bool
+Bool
xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int dummy, int fbbpp,
int depth24flags)
{
@@ -764,7 +736,7 @@ xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int dummy, int fbbpp,
/*
* Print out the selected depth and bpp.
*/
-_X_EXPORT void
+void
xf86PrintDepthBpp(ScrnInfoPtr scrp)
{
xf86DrvMsg(scrp->scrnIndex, scrp->depthFrom, "Depth %d, ", scrp->depth);
@@ -775,7 +747,7 @@ xf86PrintDepthBpp(ScrnInfoPtr scrp)
* xf86SetWeight sets scrp->weight, scrp->mask, scrp->offset, and for depths
* greater than MAX_PSEUDO_DEPTH also scrp->rgbBits.
*/
-_X_EXPORT Bool
+Bool
xf86SetWeight(ScrnInfoPtr scrp, rgb weight, rgb mask)
{
MessageType weightFrom = X_DEFAULT;
@@ -867,7 +839,7 @@ xf86SetWeight(ScrnInfoPtr scrp, rgb weight, rgb mask)
return TRUE;
}
-_X_EXPORT Bool
+Bool
xf86SetDefaultVisual(ScrnInfoPtr scrp, int visual)
{
MessageType visualFrom = X_DEFAULT;
@@ -914,7 +886,7 @@ xf86SetDefaultVisual(ScrnInfoPtr scrp, int visual)
#define SET_GAMMA(g) \
(g) > GAMMA_ZERO ? (g) : 1.0
-_X_EXPORT Bool
+Bool
xf86SetGamma(ScrnInfoPtr scrp, Gamma gamma)
{
MessageType from = X_DEFAULT;
@@ -949,6 +921,11 @@ xf86SetGamma(ScrnInfoPtr scrp, Gamma gamma)
scrp->gamma.green = 1.0;
scrp->gamma.blue = 1.0;
}
+ /* Pretend we succeeded if we support better a gamma system.
+ * This avoids a confusing message.
+ */
+ if (xf86_crtc_supports_gamma(scrp))
+ return TRUE;
xf86DrvMsg(scrp->scrnIndex, from,
"Using gamma correction (%.1f, %.1f, %.1f)\n",
scrp->gamma.red, scrp->gamma.green, scrp->gamma.blue);
@@ -968,7 +945,7 @@ xf86SetGamma(ScrnInfoPtr scrp, Gamma gamma)
#undef MMPERINCH
#define MMPERINCH 25.4
-_X_EXPORT void
+void
xf86SetDpi(ScrnInfoPtr pScrn, int x, int y)
{
MessageType from = X_DEFAULT;
@@ -1065,7 +1042,7 @@ xf86SetDpi(ScrnInfoPtr pScrn, int x, int y)
#undef MMPERINCH
-_X_EXPORT void
+void
xf86SetBlackWhitePixels(ScreenPtr pScreen)
{
if (xf86FlipPixels) {
@@ -1196,7 +1173,7 @@ xf86SetRootClip (ScreenPtr pScreen, Bool enable)
* whether they are switched in or out by keeping track of the root pixmap's
* private data, and therefore don't need to access pScrnInfo->vtSema.
*/
-_X_EXPORT void
+void
xf86EnableDisableFBAccess(int scrnIndex, Bool enable)
{
ScrnInfoPtr pScrnInfo = xf86Screens[scrnIndex];
@@ -1238,7 +1215,7 @@ xf86EnableDisableFBAccess(int scrnIndex, Bool enable)
#undef PREFIX_SIZE
#define PREFIX_SIZE 14
-_X_EXPORT void
+void
xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format,
va_list args)
{
@@ -1265,7 +1242,7 @@ xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format,
#undef PREFIX_SIZE
/* Print driver messages, with verbose level specified directly */
-_X_EXPORT void
+void
xf86DrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format,
...)
{
@@ -1277,7 +1254,7 @@ xf86DrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format,
}
/* Print driver messages, with verbose level of 1 (default) */
-_X_EXPORT void
+void
xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...)
{
va_list ap;
@@ -1288,7 +1265,7 @@ xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...)
}
/* Print non-driver messages with verbose level specified directly */
-_X_EXPORT void
+void
xf86MsgVerb(MessageType type, int verb, const char *format, ...)
{
va_list ap;
@@ -1299,7 +1276,7 @@ xf86MsgVerb(MessageType type, int verb, const char *format, ...)
}
/* Print non-driver messages with verbose level of 1 (default) */
-_X_EXPORT void
+void
xf86Msg(MessageType type, const char *format, ...)
{
va_list ap;
@@ -1310,7 +1287,7 @@ xf86Msg(MessageType type, const char *format, ...)
}
/* Just like ErrorF, but with the verbose level checked */
-_X_EXPORT void
+void
xf86ErrorFVerb(int verb, const char *format, ...)
{
va_list ap;
@@ -1322,7 +1299,7 @@ xf86ErrorFVerb(int verb, const char *format, ...)
}
/* Like xf86ErrorFVerb, but with an implied verbose level of 1 */
-_X_EXPORT void
+void
xf86ErrorF(const char *format, ...)
{
va_list ap;
@@ -1335,7 +1312,7 @@ xf86ErrorF(const char *format, ...)
void
-xf86LogInit()
+xf86LogInit(void)
{
char *lf = NULL;
@@ -1366,7 +1343,7 @@ xf86LogInit()
}
void
-xf86CloseLog()
+xf86CloseLog(void)
{
LogClose();
}
@@ -1376,7 +1353,7 @@ xf86CloseLog()
* Drivers can use these for using their own SymTabRecs.
*/
-_X_EXPORT const char *
+const char *
xf86TokenToString(SymTabPtr table, int token)
{
int i;
@@ -1390,7 +1367,7 @@ xf86TokenToString(SymTabPtr table, int token)
return(table[i].name);
}
-_X_EXPORT int
+int
xf86StringToToken(SymTabPtr table, const char *string)
{
int i;
@@ -1407,7 +1384,7 @@ xf86StringToToken(SymTabPtr table, const char *string)
/*
* helper to display the clocks found on a card
*/
-_X_EXPORT void
+void
xf86ShowClocks(ScrnInfoPtr scrp, MessageType from)
{
int j;
@@ -1431,7 +1408,7 @@ xf86ShowClocks(ScrnInfoPtr scrp, MessageType from)
* XXX This makes assumptions about the line width, etc. Maybe we could
* use a more general "pretty print" function for messages.
*/
-_X_EXPORT void
+void
xf86PrintChipsets(const char *drvname, const char *drvmsg, SymTabPtr chips)
{
int len, i;
@@ -1457,7 +1434,7 @@ xf86PrintChipsets(const char *drvname, const char *drvmsg, SymTabPtr chips)
}
-_X_EXPORT int
+int
xf86MatchDevice(const char *drivername, GDevPtr **sectlist)
{
GDevPtr gdp, *pgdp = NULL;
@@ -1467,10 +1444,6 @@ xf86MatchDevice(const char *drivername, GDevPtr **sectlist)
if (sectlist)
*sectlist = NULL;
- if (xf86DoModalias) return 0;
-
- if (xf86DoProbe) return 1;
-
if (xf86DoConfigure && xf86DoConfigurePass1) return 1;
/*
@@ -1590,7 +1563,7 @@ struct Inst {
* \c DriverRec::driverName. In a future version of this function, remove
* that parameter.
*/
-_X_EXPORT int
+int
xf86MatchPciInstances(const char *driverName, int vendorID,
SymTabPtr chipsets, PciChipsets *PCIchipsets,
GDevPtr *devList, int numDevs, DriverPtr drvp,
@@ -1616,7 +1589,7 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
* Do this calculation and memory allocation once now to eliminate the
* need for realloc calls inside the loop.
*/
- if ( !xf86DoProbe && !(xf86DoConfigure && xf86DoConfigurePass1) ) {
+ if (!(xf86DoConfigure && xf86DoConfigurePass1)) {
unsigned max_entries = numDevs;
iter = pci_slot_match_iterator_create(NULL);
@@ -1729,9 +1702,7 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
}
-#ifdef DEBUG
- ErrorF("%s instances found: %d\n", driverName, allocatedInstances);
-#endif
+ DebugF("%s instances found: %d\n", driverName, allocatedInstances);
/*
* Check for devices that need duplicated instances. This is required
@@ -1814,9 +1785,7 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
instances[i].dev = dev;
}
}
-#ifdef DEBUG
- ErrorF("%s instances found: %d\n", driverName, numClaimedInstances);
-#endif
+ DebugF("%s instances found: %d\n", driverName, numClaimedInstances);
/*
* Now check that a chipset or chipID override in the device section
* is valid. Chipset has precedence over chipID.
@@ -1920,11 +1889,9 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
if (instances[i].screen == 0 && !xf86CheckPciSlot( pPci ))
continue;
-#ifdef DEBUG
- ErrorF("%s: card at %d:%d:%d is claimed by a Device section\n",
+ DebugF("%s: card at %d:%d:%d is claimed by a Device section\n",
driverName, pPci->bus, pPci->dev, pPci->func);
-#endif
-
+
/* Allocate an entry in the lists to be returned */
numFound++;
retEntities = xnfrealloc(retEntities, numFound * sizeof(int));
@@ -1956,7 +1923,7 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
/*
* xf86GetClocks -- get the dot-clocks via a BIG BAD hack ...
*/
-_X_EXPORT void
+void
xf86GetClocks(ScrnInfoPtr pScrn, int num, Bool (*ClockFunc)(ScrnInfoPtr, int),
void (*ProtectRegs)(ScrnInfoPtr, Bool),
void (*BlankScreen)(ScrnInfoPtr, Bool), IOADDRESS vertsyncreg,
@@ -1968,8 +1935,6 @@ xf86GetClocks(ScrnInfoPtr pScrn, int num, Bool (*ClockFunc)(ScrnInfoPtr, int),
/* First save registers that get written on */
(*ClockFunc)(pScrn, CLK_REG_SAVE);
- xf86SetPriority(TRUE);
-
if (num > MAXCLOCKS)
num = MAXCLOCKS;
@@ -2017,8 +1982,6 @@ finish:
(*BlankScreen)(pScrn, TRUE);
}
- xf86SetPriority(FALSE);
-
for (i = 0; i < num; i++)
{
if (i != knownclkindex)
@@ -2047,31 +2010,7 @@ finish:
(*ClockFunc)(pScrn, CLK_REG_RESTORE);
}
-_X_EXPORT void
-xf86SetPriority(Bool up)
-{
- static int saved_nice;
-
- if (up) {
-#ifdef HAS_SETPRIORITY
- saved_nice = getpriority(PRIO_PROCESS, 0);
- setpriority(PRIO_PROCESS, 0, -20);
-#endif
-#if defined(SYSV) || defined(SVR4) || defined(linux)
- saved_nice = nice(0);
- nice(-20 - saved_nice);
-#endif
- } else {
-#ifdef HAS_SETPRIORITY
- setpriority(PRIO_PROCESS, 0, saved_nice);
-#endif
-#if defined(SYSV) || defined(SVR4) || defined(linux)
- nice(20 + saved_nice);
-#endif
- }
-}
-
-_X_EXPORT const char *
+const char *
xf86GetVisualName(int visual)
{
if (visual < 0 || visual > DirectColor)
@@ -2081,132 +2020,125 @@ xf86GetVisualName(int visual)
}
-_X_EXPORT int
-xf86GetVerbosity()
+int
+xf86GetVerbosity(void)
{
return max(xf86Verbose, xf86LogVerbose);
}
-_X_EXPORT Pix24Flags
-xf86GetPix24()
+Pix24Flags
+xf86GetPix24(void)
{
return xf86Info.pixmap24;
}
-_X_EXPORT int
-xf86GetDepth()
+int
+xf86GetDepth(void)
{
return xf86Depth;
}
-_X_EXPORT rgb
-xf86GetWeight()
+rgb
+xf86GetWeight(void)
{
return xf86Weight;
}
-_X_EXPORT Gamma
-xf86GetGamma()
+Gamma
+xf86GetGamma(void)
{
return xf86Gamma;
}
-_X_EXPORT Bool
-xf86GetFlipPixels()
+Bool
+xf86GetFlipPixels(void)
{
return xf86FlipPixels;
}
-_X_EXPORT const char *
-xf86GetServerName()
+const char *
+xf86GetServerName(void)
{
return xf86ServerName;
}
-_X_EXPORT Bool
-xf86ServerIsExiting()
+Bool
+xf86ServerIsExiting(void)
{
return (dispatchException & DE_TERMINATE) == DE_TERMINATE;
}
-_X_EXPORT Bool
-xf86ServerIsResetting()
+Bool
+xf86ServerIsResetting(void)
{
return xf86Resetting;
}
Bool
-xf86ServerIsInitialising()
+xf86ServerIsInitialising(void)
{
return xf86Initialising;
}
-_X_EXPORT Bool
+Bool
xf86ServerIsOnlyDetecting(void)
{
- return xf86DoProbe || xf86DoConfigure;
-}
-
-
-_X_EXPORT Bool
-xf86ServerIsOnlyProbing(void)
-{
- return xf86ProbeOnly;
+ return xf86DoConfigure;
}
-_X_EXPORT Bool
-xf86CaughtSignal()
+Bool
+xf86CaughtSignal(void)
{
return xf86Info.caughtSignal;
}
-_X_EXPORT Bool
-xf86GetVidModeAllowNonLocal()
+Bool
+xf86GetVidModeAllowNonLocal(void)
{
return xf86Info.vidModeAllowNonLocal;
}
-_X_EXPORT Bool
-xf86GetVidModeEnabled()
+Bool
+xf86GetVidModeEnabled(void)
{
return xf86Info.vidModeEnabled;
}
-_X_EXPORT Bool
-xf86GetModInDevAllowNonLocal()
+Bool
+xf86GetModInDevAllowNonLocal(void)
{
return xf86Info.miscModInDevAllowNonLocal;
}
-_X_EXPORT Bool
-xf86GetModInDevEnabled()
+Bool
+xf86GetModInDevEnabled(void)
{
return xf86Info.miscModInDevEnabled;
}
-_X_EXPORT Bool
-xf86GetAllowMouseOpenFail()
+Bool
+xf86GetAllowMouseOpenFail(void)
{
return xf86Info.allowMouseOpenFail;
}
-_X_EXPORT Bool
-xf86IsPc98()
+Bool
+xf86IsPc98(void)
{
#ifdef __i386__
return xf86Info.pc98;
@@ -2215,20 +2147,20 @@ xf86IsPc98()
#endif
}
-_X_EXPORT void
-xf86DisableRandR()
+void
+xf86DisableRandR(void)
{
xf86Info.disableRandR = TRUE;
xf86Info.randRFrom = X_PROBED;
}
-_X_EXPORT CARD32
+CARD32
xf86GetModuleVersion(pointer module)
{
return (CARD32)LoaderGetModuleVersion(module);
}
-_X_EXPORT pointer
+pointer
xf86LoadDrvSubModule(DriverPtr drv, const char *name)
{
pointer ret;
@@ -2241,7 +2173,7 @@ xf86LoadDrvSubModule(DriverPtr drv, const char *name)
return ret;
}
-_X_EXPORT pointer
+pointer
xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name)
{
pointer ret;
@@ -2257,7 +2189,7 @@ xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name)
/*
* xf86LoadOneModule loads a single module.
*/
-_X_EXPORT pointer
+pointer
xf86LoadOneModule(char *name, pointer opt)
{
int errmaj, errmin;
@@ -2285,7 +2217,7 @@ xf86LoadOneModule(char *name, pointer opt)
return mod;
}
-_X_EXPORT void
+void
xf86UnloadSubModule(pointer mod)
{
/*
@@ -2297,34 +2229,12 @@ xf86UnloadSubModule(pointer mod)
#endif
}
-_X_EXPORT Bool
+Bool
xf86LoaderCheckSymbol(const char *name)
{
return LoaderSymbol(name) != NULL;
}
-/* These two are just ABI stubs, they don't do anything in dlloader world */
-_X_EXPORT void
-xf86LoaderReqSymLists(const char **list0, ...)
-{
-}
-
-_X_EXPORT void
-xf86LoaderReqSymbols(const char *sym0, ...)
-{
-}
-
-_X_EXPORT void
-xf86LoaderRefSymLists(const char **list0, ...)
-{
-}
-
-_X_EXPORT void
-xf86LoaderRefSymbols(const char *sym0, ...)
-{
-}
-
-
typedef enum {
OPTION_BACKING_STORE
} BSOpts;
@@ -2334,7 +2244,7 @@ static const OptionInfoRec BSOptions[] = {
{ -1, NULL, OPTV_NONE, {0}, FALSE }
};
-_X_EXPORT void
+void
xf86SetBackingStore(ScreenPtr pScreen)
{
Bool useBS = FALSE;
@@ -2374,7 +2284,7 @@ static const OptionInfoRec SMOptions[] = {
{ -1, NULL, OPTV_NONE, {0}, FALSE }
};
-_X_EXPORT void
+void
xf86SetSilkenMouse (ScreenPtr pScreen)
{
Bool useSM = TRUE;
@@ -2388,13 +2298,8 @@ xf86SetSilkenMouse (ScreenPtr pScreen)
/* check for commandline option here */
/* disable if screen shares resources */
- if (((pScrn->racMemFlags & RAC_CURSOR) &&
- !xf86NoSharedResources(pScrn->scrnIndex,MEM)) ||
- ((pScrn->racIoFlags & RAC_CURSOR) &&
- !xf86NoSharedResources(pScrn->scrnIndex,IO))) {
- useSM = FALSE;
- from = X_PROBED;
- } else if (xf86silkenMouseDisableFlag) {
+ /* TODO VGA arb disable silken mouse */
+ if (xf86silkenMouseDisableFlag) {
from = X_CMDLINE;
useSM = FALSE;
} else {
@@ -2415,7 +2320,7 @@ xf86SetSilkenMouse (ScreenPtr pScreen)
/* Wrote this function for the PM2 Xv driver, preliminary. */
-_X_EXPORT pointer
+pointer
xf86FindXvOptions(int scrnIndex, int adaptor_index, char *port_name,
char **adaptor_name, pointer *adaptor_options)
{
@@ -2445,13 +2350,43 @@ xf86FindXvOptions(int scrnIndex, int adaptor_index, char *port_name,
#include "loader/os.c"
/* new RAC */
+/*
+ * xf86ConfigPciEntityInactive() -- This function can be used
+ * to configure an inactive entity as well as to reconfigure an
+ * previously active entity inactive. If the entity has been
+ * assigned to a screen before it will be removed. If p_chip is
+ * non-NULL all static resources listed there will be registered.
+ */
+static void
+xf86ConfigPciEntityInactive(EntityInfoPtr pEnt, PciChipsets *p_chip,
+ EntityProc init, EntityProc enter,
+ EntityProc leave, pointer private)
+{
+ ScrnInfoPtr pScrn;
+
+ if ((pScrn = xf86FindScreenForEntity(pEnt->index)))
+ xf86RemoveEntityFromScreen(pScrn,pEnt->index);
-_X_EXPORT ScrnInfoPtr
+ /* shared resources are only needed when entity is active: remove */
+ xf86SetEntityFuncs(pEnt->index,init,enter,leave,private);
+}
+
+static void
+xf86ConfigFbEntityInactive(EntityInfoPtr pEnt, EntityProc init,
+ EntityProc enter, EntityProc leave, pointer private)
+{
+ ScrnInfoPtr pScrn;
+
+ if ((pScrn = xf86FindScreenForEntity(pEnt->index)))
+ xf86RemoveEntityFromScreen(pScrn,pEnt->index);
+ xf86SetEntityFuncs(pEnt->index,init,enter,leave,private);
+}
+
+ScrnInfoPtr
xf86ConfigPciEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
- PciChipsets *p_chip, resList res, EntityProc init,
+ PciChipsets *p_chip, void *dummy, EntityProc init,
EntityProc enter, EntityProc leave, pointer private)
{
- PciChipsets *p_id;
EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex);
if (!pEnt) return pScrn;
@@ -2461,7 +2396,7 @@ xf86ConfigPciEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
return pScrn;
}
if (!pEnt->active) {
- xf86ConfigPciEntityInactive(pEnt, p_chip, res, init, enter,
+ xf86ConfigPciEntityInactive(pEnt, p_chip, init, enter,
leave, private);
xfree(pEnt);
return pScrn;
@@ -2476,21 +2411,14 @@ xf86ConfigPciEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
if (xf86IsEntityShared(entityIndex)) {
return pScrn;
}
- if (p_chip) {
- for (p_id = p_chip; p_id->numChipset != -1; p_id++) {
- if (pEnt->chipset == p_id->numChipset) break;
- }
- xf86ClaimFixedResources(p_id->resList,entityIndex);
- }
xfree(pEnt);
- xf86ClaimFixedResources(res,entityIndex);
xf86SetEntityFuncs(entityIndex,init,enter,leave,private);
return pScrn;
}
-_X_EXPORT ScrnInfoPtr
+ScrnInfoPtr
xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
EntityProc init, EntityProc enter, EntityProc leave,
pointer private)
@@ -2520,16 +2448,15 @@ xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
/*
*
- * OBSOLETE ! xf86ConfigActivePciEntity() is an obsolete functions.
- * They the are likely to be removed. Don't use!
+ * OBSOLETE ! xf86ConfigActivePciEntity() is an obsolete function.
+ * It is likely to be removed. Don't use!
*/
-_X_EXPORT Bool
+Bool
xf86ConfigActivePciEntity(ScrnInfoPtr pScrn, int entityIndex,
- PciChipsets *p_chip, resList res, EntityProc init,
+ PciChipsets *p_chip, void *dummy, EntityProc init,
EntityProc enter, EntityProc leave, pointer private)
{
- PciChipsets *p_id;
EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex);
if (!pEnt) return FALSE;
@@ -2539,62 +2466,14 @@ xf86ConfigActivePciEntity(ScrnInfoPtr pScrn, int entityIndex,
}
xf86AddEntityToScreen(pScrn,entityIndex);
- if (p_chip) {
- for (p_id = p_chip; p_id->numChipset != -1; p_id++) {
- if (pEnt->chipset == p_id->numChipset) break;
- }
- xf86ClaimFixedResources(p_id->resList,entityIndex);
- }
xfree(pEnt);
-
- xf86ClaimFixedResources(res,entityIndex);
if (!xf86SetEntityFuncs(entityIndex,init,enter,leave,private))
return FALSE;
return TRUE;
}
-/*
- * xf86ConfigPciEntityInactive() -- This functions can be used
- * to configure an inactive entity as well as to reconfigure an
- * previously active entity inactive. If the entity has been
- * assigned to a screen before it will be removed. If p_pci is
- * non-NULL all static resources listed there will be registered.
- */
-_X_EXPORT void
-xf86ConfigPciEntityInactive(EntityInfoPtr pEnt, PciChipsets *p_chip,
- resList res, EntityProc init, EntityProc enter,
- EntityProc leave, pointer private)
-{
- PciChipsets *p_id;
- ScrnInfoPtr pScrn;
-
- if ((pScrn = xf86FindScreenForEntity(pEnt->index)))
- xf86RemoveEntityFromScreen(pScrn,pEnt->index);
- else if (p_chip) {
- for (p_id = p_chip; p_id->numChipset != -1; p_id++) {
- if (pEnt->chipset == p_id->numChipset) break;
- }
- xf86ClaimFixedResources(p_id->resList,pEnt->index);
- }
- xf86ClaimFixedResources(res,pEnt->index);
- /* shared resources are only needed when entity is active: remove */
- xf86DeallocateResourcesForEntity(pEnt->index, ResShared);
- xf86SetEntityFuncs(pEnt->index,init,enter,leave,private);
-}
-
-void
-xf86ConfigFbEntityInactive(EntityInfoPtr pEnt, EntityProc init,
- EntityProc enter, EntityProc leave, pointer private)
-{
- ScrnInfoPtr pScrn;
-
- if ((pScrn = xf86FindScreenForEntity(pEnt->index)))
- xf86RemoveEntityFromScreen(pScrn,pEnt->index);
- xf86SetEntityFuncs(pEnt->index,init,enter,leave,private);
-}
-
-_X_EXPORT Bool
+Bool
xf86IsScreenPrimary(int scrnIndex)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
@@ -2607,7 +2486,7 @@ xf86IsScreenPrimary(int scrnIndex)
return FALSE;
}
-_X_EXPORT int
+int
xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type,
int format, unsigned long len, pointer value )
{
@@ -2615,10 +2494,8 @@ xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type,
int i;
Bool existing = FALSE;
-#ifdef DEBUG
- ErrorF("xf86RegisterRootWindowProperty(%d, %ld, %ld, %d, %ld, %p)\n",
+ DebugF("xf86RegisterRootWindowProperty(%d, %ld, %ld, %d, %ld, %p)\n",
ScrnIndex, property, type, format, len, value);
-#endif
if (ScrnIndex<0 || ScrnIndex>=xf86NumScreens) {
return(BadMatch);
@@ -2654,15 +2531,11 @@ xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type,
pNewProp->size = len;
pNewProp->data = value;
-#ifdef DEBUG
- ErrorF("new property filled\n");
-#endif
+ DebugF("new property filled\n");
if (NULL==xf86RegisteredPropertiesTable) {
-#ifdef DEBUG
- ErrorF("creating xf86RegisteredPropertiesTable[] size %d\n",
+ DebugF("creating xf86RegisteredPropertiesTable[] size %d\n",
xf86NumScreens);
-#endif
if ( NULL==(xf86RegisteredPropertiesTable=(RootWinPropPtr*)xnfcalloc(sizeof(RootWinProp),xf86NumScreens) )) {
return(BadAlloc);
}
@@ -2671,12 +2544,10 @@ xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type,
}
}
-#ifdef DEBUG
- ErrorF("xf86RegisteredPropertiesTable %p\n",
+ DebugF("xf86RegisteredPropertiesTable %p\n",
(void *)xf86RegisteredPropertiesTable);
- ErrorF("xf86RegisteredPropertiesTable[%d] %p\n",
+ DebugF("xf86RegisteredPropertiesTable[%d] %p\n",
ScrnIndex, (void *)xf86RegisteredPropertiesTable[ScrnIndex]);
-#endif
if (!existing) {
if ( xf86RegisteredPropertiesTable[ScrnIndex] == NULL) {
@@ -2684,21 +2555,17 @@ xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type,
} else {
pRegProp = xf86RegisteredPropertiesTable[ScrnIndex];
while (pRegProp->next != NULL) {
-#ifdef DEBUG
- ErrorF("- next %p\n", (void *)pRegProp);
-#endif
+ DebugF("- next %p\n", (void *)pRegProp);
pRegProp = pRegProp->next;
}
pRegProp->next = pNewProp;
}
}
-#ifdef DEBUG
- ErrorF("xf86RegisterRootWindowProperty succeeded\n");
-#endif
+ DebugF("xf86RegisterRootWindowProperty succeeded\n");
return(Success);
}
-_X_EXPORT Bool
+Bool
xf86IsUnblank(int mode)
{
switch(mode) {
@@ -2714,15 +2581,8 @@ xf86IsUnblank(int mode)
}
}
-_X_EXPORT void
+void
xf86MotionHistoryAllocate(LocalDevicePtr local)
{
AllocateMotionHistory(local->dev);
}
-
-_X_EXPORT int
-xf86GetMotionEvents(DeviceIntPtr pDev, xTimecoord *buff, unsigned long start,
- unsigned long stop, ScreenPtr pScreen, BOOL core)
-{
- return GetMotionHistory(pDev, buff, start, stop, pScreen, core);
-}
diff --git a/xorg-server/hw/xfree86/common/xf86Init.c b/xorg-server/hw/xfree86/common/xf86Init.c
index f029915c6..f9224b1a6 100644
--- a/xorg-server/hw/xfree86/common/xf86Init.c
+++ b/xorg-server/hw/xfree86/common/xf86Init.c
@@ -43,7 +43,6 @@
#include <sys/utsname.h>
#endif
-#define NEED_EVENTS
#include <X11/X.h>
#include <X11/Xmd.h>
#include <X11/Xproto.h>
@@ -68,7 +67,6 @@
#include "xf86Config.h"
#include "xf86_OSlib.h"
#include "xorgVersion.h"
-#include "xf86Date.h"
#include "xf86Build.h"
#include "mipointer.h"
#include <X11/extensions/XI.h>
@@ -80,11 +78,11 @@
#include "picturestr.h"
#endif
+#include "xf86VGAarbiter.h"
#include "globals.h"
#ifdef DPMSExtension
-#define DPMS_SERVER
-#include <X11/extensions/dpms.h>
+#include <X11/extensions/dpmsconst.h>
#include "dpmsproc.h"
#endif
@@ -95,7 +93,6 @@
/* forward declarations */
static Bool probe_devices_from_device_sections(DriverPtr drvp);
static Bool add_matching_devices_to_configure_list(DriverPtr drvp);
-static Bool check_for_matching_devices(DriverPtr drvp);
#ifdef XF86PM
void (*xf86OSPMClose)(void) = NULL;
@@ -175,7 +172,7 @@ xf86PrintBanner(void)
ErrorF(" (%s)", XORG_CUSTOM_VERSION);
#endif
#ifndef XORG_DATE
-#define XORG_DATE XF86_DATE
+# define XORG_DATE "Unknown"
#endif
ErrorF("\nRelease Date: %s\n", XORG_DATE);
ErrorF("X Protocol Version %d, Revision %d\n",
@@ -192,6 +189,21 @@ xf86PrintBanner(void)
if (uname(&name) >= 0) {
ErrorF("Current Operating System: %s %s %s %s %s\n",
name.sysname, name.nodename, name.release, name.version, name.machine);
+#ifdef linux
+ do {
+ char buf[80];
+ int fd = open("/proc/cmdline", O_RDONLY);
+ if (fd != -1) {
+ ErrorF("Kernel command line: ");
+ memset(buf, 0, 80);
+ while (read(fd, buf, 80) > 0) {
+ ErrorF("%.80s", buf);
+ memset(buf, 0, 80);
+ }
+ close(fd);
+ }
+ } while (0);
+#endif
}
}
#endif
@@ -217,23 +229,10 @@ xf86PrintBanner(void)
#endif
}
#endif
-#if defined(CLOG_DATE) && (CLOG_DATE > 19000000)
- {
- struct tm t;
- char buf[100];
-
- bzero(&t, sizeof(t));
- bzero(buf, sizeof(buf));
- t.tm_mday = CLOG_DATE % 100;
- t.tm_mon = (CLOG_DATE / 100) % 100 - 1;
- t.tm_year = CLOG_DATE / 10000 - 1900;
- if (strftime(buf, sizeof(buf), "%d %B %Y", &t))
- ErrorF("Changelog Date: %s\n", buf);
- }
-#endif
#if defined(BUILDERSTRING)
ErrorF("%s \n",BUILDERSTRING);
#endif
+ ErrorF("Current version of pixman: %s\n", pixman_version_string());
ErrorF("\tBefore reporting problems, check "__VENDORDWEBSUPPORT__"\n"
"\tto make sure that you have the latest version.\n");
}
@@ -244,84 +243,6 @@ xf86PrintMarkers(void)
LogPrintMarkers();
}
-static void
-DoModalias(void)
-{
- int i = -1;
- char **vlist;
-
- /* Get all the drivers */
- vlist = xf86DriverlistFromCompile();
- if (!vlist) {
- ErrorF("Missing output drivers. PCI Access dump failed.\n");
- goto bail;
- }
-
- /* Load all the drivers that were found. */
- xf86LoadModules(vlist, NULL);
-
- xfree(vlist);
-
- /* Iterate through each driver */
- for (i = 0; i < xf86NumDrivers; i++) {
- struct pci_id_match *match;
-
- /* Iterate through each pci id match data, dumping it to the screen */
- for (match = (struct pci_id_match *) xf86DriverList[i]->supported_devices ;
- match && !(!match->vendor_id && !match->device_id) ; match++) {
- /* Prefix */
- ErrorF("alias pci:");
-
- /* Vendor */
- if (match->vendor_id == ~0)
- ErrorF("v*");
- else
- ErrorF("v%08X", match->vendor_id);
-
- /* Device */
- if (match->device_id == ~0)
- ErrorF("d*");
- else
- ErrorF("d%08X", match->device_id);
-
- /* Subvendor */
- if (match->subvendor_id == ~0)
- ErrorF("sv*");
- else
- ErrorF("sv%08X", match->subvendor_id);
-
- /* Subdevice */
- if (match->subdevice_id == ~0)
- ErrorF("sd*");
- else
- ErrorF("sd%08X", match->subdevice_id);
-
- /* Class */
- if ((match->device_class_mask >> 16 & 0xFF) == 0xFF)
- ErrorF("bc%02X", match->device_class >> 16 & 0xFF);
- else
- ErrorF("bc*");
- if ((match->device_class_mask >> 8 & 0xFF) == 0xFF)
- ErrorF("sc%02X", match->device_class >> 8 & 0xFF);
- else
- ErrorF("sc*");
- if ((match->device_class_mask & 0xFF) == 0xFF)
- ErrorF("i%02X*", match->device_class & 0xFF);
- else
- ErrorF("i*");
-
- /* Suffix (driver) */
- ErrorF(" %s\n", xf86DriverList[i]->driverName);
- }
- }
-
-bail:
- OsCleanup(TRUE);
- AbortDDX();
- fflush(stderr);
- exit(0);
-}
-
static Bool
xf86CreateRootWindow(WindowPtr pWin)
{
@@ -332,9 +253,7 @@ xf86CreateRootWindow(WindowPtr pWin)
CreateWindowProcPtr CreateWindow = (CreateWindowProcPtr)
dixLookupPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey);
-#ifdef DEBUG
- ErrorF("xf86CreateRootWindow(%p)\n", pWin);
-#endif
+ DebugF("xf86CreateRootWindow(%p)\n", pWin);
if ( pScreen->CreateWindow != xf86CreateRootWindow ) {
/* Can't find hook we are hung on */
@@ -381,9 +300,7 @@ xf86CreateRootWindow(WindowPtr pWin)
}
}
-#ifdef DEBUG
- ErrorF("xf86CreateRootWindow() returns %d\n", ret);
-#endif
+ DebugF("xf86CreateRootWindow() returns %d\n", ret);
return (ret);
}
@@ -396,23 +313,25 @@ InstallSignalHandlers(void)
*/
xf86Info.caughtSignal=FALSE;
if (!xf86Info.notrapSignals) {
- signal(SIGSEGV,xf86SigHandler);
- signal(SIGILL,xf86SigHandler);
+ OsRegisterSigWrapper(xf86SigWrapper);
+ } else {
+ signal(SIGSEGV, SIG_DFL);
+ signal(SIGILL, SIG_DFL);
#ifdef SIGEMT
- signal(SIGEMT,xf86SigHandler);
+ signal(SIGEMT, SIG_DFL);
#endif
- signal(SIGFPE,xf86SigHandler);
+ signal(SIGFPE, SIG_DFL);
#ifdef SIGBUS
- signal(SIGBUS,xf86SigHandler);
+ signal(SIGBUS, SIG_DFL);
#endif
#ifdef SIGSYS
- signal(SIGSYS,xf86SigHandler);
+ signal(SIGSYS, SIG_DFL);
#endif
#ifdef SIGXCPU
- signal(SIGXCPU,xf86SigHandler);
+ signal(SIGXCPU, SIG_DFL);
#endif
#ifdef SIGXFSZ
- signal(SIGXFSZ,xf86SigHandler);
+ signal(SIGXFSZ, SIG_DFL);
#endif
}
}
@@ -485,10 +404,8 @@ probe_devices_from_device_sections(DriverPtr drvp)
if ( (devList[i]->screen == 0) && !xf86CheckPciSlot( pPci ) )
continue;
-#ifdef DEBUG
- ErrorF("%s: card at %d:%d:%d is claimed by a Device section\n",
+ DebugF("%s: card at %d:%d:%d is claimed by a Device section\n",
drvp->driverName, pPci->bus, pPci->dev, pPci->func);
-#endif
/* Allocate an entry in the lists to be returned */
entry = xf86ClaimPciSlot(pPci, drvp, device_id,
@@ -499,7 +416,7 @@ probe_devices_from_device_sections(DriverPtr drvp)
for ( k = 0; k < xf86NumEntities; k++ ) {
EntityPtr pEnt = xf86Entities[k];
- if (pEnt->busType != BUS_PCI)
+ if (pEnt->bus.type != BUS_PCI)
continue;
if (pEnt->bus.id.pci == pPci) {
@@ -514,7 +431,8 @@ probe_devices_from_device_sections(DriverPtr drvp)
if ((*drvp->PciProbe)(drvp, entry, pPci,
devices[j].match_data)) {
foundScreen = TRUE;
- }
+ } else
+ xf86UnclaimPciSlot(pPci);
}
break;
@@ -572,32 +490,6 @@ add_matching_devices_to_configure_list(DriverPtr drvp)
return (numFound != 0);
}
-
-Bool
-check_for_matching_devices(DriverPtr drvp)
-{
- const struct pci_id_match * const devices = drvp->supported_devices;
- int j;
-
-
- for (j = 0; ! END_OF_MATCHES(devices[j]); j++) {
- struct pci_device_iterator *iter;
- struct pci_device *dev;
-
- iter = pci_id_match_iterator_create(& devices[j]);
- dev = pci_device_next(iter);
- pci_iterator_destroy(iter);
-
- if (dev != NULL) {
- return TRUE;
- }
- }
-
-
- return FALSE;
-}
-
-
/**
* Call the driver's correct probe function.
*
@@ -619,11 +511,7 @@ xf86CallDriverProbe( DriverPtr drv, Bool detect_only )
Bool foundScreen = FALSE;
if ( drv->PciProbe != NULL ) {
- if ( xf86DoProbe ) {
- assert( detect_only );
- foundScreen = check_for_matching_devices( drv );
- }
- else if ( xf86DoConfigure && xf86DoConfigurePass1 ) {
+ if ( xf86DoConfigure && xf86DoConfigurePass1 ) {
assert( detect_only );
foundScreen = add_matching_devices_to_configure_list( drv );
}
@@ -643,76 +531,6 @@ xf86CallDriverProbe( DriverPtr drv, Bool detect_only )
return foundScreen;
}
-static void
-DoProbe(void)
-{
- int i;
- Bool probeResult;
- Bool ioEnableFailed = FALSE;
-
- /* Find the list of video driver modules. */
- char **list = xf86DriverlistFromCompile();
- char **l;
-
- if (list) {
- ErrorF("List of video driver modules:\n");
- for (l = list; *l; l++)
- ErrorF("\t%s\n", *l);
- } else {
- ErrorF("No video driver modules found\n");
- }
-
- /* Load all the drivers that were found. */
- xf86LoadModules(list, NULL);
-
- /* Disable PCI devices */
- xf86AccessInit();
-
- /* Call all of the probe functions, reporting the results. */
- for (i = 0; i < xf86NumDrivers; i++) {
- DriverRec * const drv = xf86DriverList[i];
-
- if (!xorgHWAccess) {
- xorgHWFlags flags;
- if (!drv->driverFunc
- || !drv->driverFunc( NULL, GET_REQUIRED_HW_INTERFACES, &flags )
- || NEED_IO_ENABLED(flags)) {
- if (ioEnableFailed)
- continue;
- if (!xf86EnableIO()) {
- ioEnableFailed = TRUE;
- continue;
- }
- xorgHWAccess = TRUE;
- }
- }
-
-
- xf86MsgVerb(X_INFO, 3, "Probing in driver %s\n", drv->driverName);
-
- probeResult = xf86CallDriverProbe( drv, TRUE );
- if (!probeResult) {
- xf86ErrorF("Probe in driver `%s' returns FALSE\n",
- drv->driverName);
- } else {
- xf86ErrorF("Probe in driver `%s' returns TRUE\n",
- drv->driverName);
-
- /* If we have a result, then call driver's Identify function */
- if (drv->Identify != NULL) {
- const int verbose = xf86SetVerbosity(1);
- (*drv->Identify)(0);
- xf86SetVerbosity(verbose);
- }
- }
- }
-
- OsCleanup(TRUE);
- AbortDDX();
- fflush(stderr);
- exit(0);
-}
-
/*
* InitOutput --
* Initialize screenInfo for all actually accessible framebuffers.
@@ -743,7 +561,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
else
xf86ServerName = argv[0];
- if (!xf86DoModalias) {
xf86PrintBanner();
xf86PrintMarkers();
if (xf86LogFile) {
@@ -754,10 +571,9 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
xf86MsgVerb(xf86LogFileFrom, 0, "Log file: \"%s\", Time: %s",
xf86LogFile, ct);
}
- }
/* Read and parse the config file */
- if (!xf86DoProbe && !xf86DoConfigure && !xf86DoModalias && !xf86DoShowOptions) {
+ if (!xf86DoConfigure && !xf86DoShowOptions) {
switch (xf86HandleConfigFile(FALSE)) {
case CONFIG_OK:
break;
@@ -790,16 +606,9 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
/* Do a general bus probe. This will be a PCI probe for x86 platforms */
xf86BusProbe();
- if (xf86DoProbe)
- DoProbe();
-
if (xf86DoConfigure)
DoConfigure();
- /* Do the PCI Access dump */
- if (xf86DoModalias)
- DoModalias();
-
if (autoconfig) {
if (!xf86AutoConfig()) {
xf86Msg(X_ERROR, "Auto configuration failed\n");
@@ -811,9 +620,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
xf86OSPMClose = xf86OSPMOpen();
#endif
- /* Initialise the resource broker */
- xf86ResourceBrokerInit();
-
/* Load all modules specified explicitly in the config file */
if ((modulelist = xf86ModulelistFromConfig(&optionlist))) {
xf86LoadModules(modulelist, optionlist);
@@ -924,6 +730,8 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
return;
}
+ xf86VGAarbiterInit();
+
/*
* Match up the screens found by the probes against those specified
* in the config file. Remove the ones that won't be used. Sort
@@ -1004,10 +812,12 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
*/
for (i = 0; i < xf86NumScreens; i++) {
- xf86EnableAccess(xf86Screens[i]);
+ xf86VGAarbiterScrnInit(xf86Screens[i]);
+ xf86VGAarbiterLock(xf86Screens[i]);
if (xf86Screens[i]->PreInit &&
xf86Screens[i]->PreInit(xf86Screens[i], 0))
xf86Screens[i]->configured = TRUE;
+ xf86VGAarbiterUnlock(xf86Screens[i]);
}
for (i = 0; i < xf86NumScreens; i++)
if (!xf86Screens[i]->configured)
@@ -1033,15 +843,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
}
}
- /* XXX Should this be before or after loading dependent modules? */
- if (xf86ProbeOnly)
- {
- OsCleanup(TRUE);
- AbortDDX();
- fflush(stderr);
- exit(0);
- }
-
/* Remove (unload) drivers that are not required */
for (i = 0; i < xf86NumDrivers; i++)
if (xf86DriverList[i] && xf86DriverList[i]->refCount <= 0)
@@ -1057,7 +858,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
/*
* Collect all pixmap formats and check for conflicts at the display
* level. Should we die here? Or just delete the offending screens?
- * Also, should this be done for -probeonly?
*/
screenpix24 = Pix24DontCare;
for (i = 0; i < xf86NumScreens; i++) {
@@ -1162,10 +962,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
break;
}
}
-
- /* set up the proper access funcs */
- xf86PostPreInit();
-
} else {
/*
* serverGeneration != 1; some OSs have to do things here, too.
@@ -1230,19 +1026,22 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
#endif /* SCO325 */
for (i = 0; i < xf86NumScreens; i++) {
- xf86EnableAccess(xf86Screens[i]);
+ xf86VGAarbiterLock(xf86Screens[i]);
/*
* Almost everything uses these defaults, and many of those that
* don't, will wrap them.
*/
xf86Screens[i]->EnableDisableFBAccess = xf86EnableDisableFBAccess;
+#ifdef XFreeXDGA
xf86Screens[i]->SetDGAMode = xf86SetDGAMode;
+#endif
xf86Screens[i]->DPMSSet = NULL;
xf86Screens[i]->LoadPalette = NULL;
xf86Screens[i]->SetOverscan = NULL;
xf86Screens[i]->DriverFunc = NULL;
xf86Screens[i]->pScreen = NULL;
scr_index = AddScreen(xf86Screens[i]->ScreenInit, argc, argv);
+ xf86VGAarbiterUnlock(xf86Screens[i]);
if (scr_index == i) {
/*
* Hook in our ScrnInfoRec, and initialise some other pScreen
@@ -1258,12 +1057,10 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
FatalError("AddScreen/ScreenInit failed for driver %d\n", i);
}
-#ifdef DEBUG
- ErrorF("InitOutput - xf86Screens[%d]->pScreen = %p\n",
+ DebugF("InitOutput - xf86Screens[%d]->pScreen = %p\n",
i, xf86Screens[i]->pScreen );
- ErrorF("xf86Screens[%d]->pScreen->CreateWindow = %p\n",
+ DebugF("xf86Screens[%d]->pScreen->CreateWindow = %p\n",
i, xf86Screens[i]->pScreen->CreateWindow );
-#endif
dixSetPrivate(&screenInfo.screens[scr_index]->devPrivates,
xf86CreateRootWindowKey,
@@ -1306,9 +1103,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
*/
void
-InitInput(argc, argv)
- int argc;
- char **argv;
+InitInput(int argc, char **argv)
{
IDevPtr* pDev;
DeviceIntPtr dev;
@@ -1337,7 +1132,7 @@ InitInput(argc, argv)
*/
void
-OsVendorInit()
+OsVendorInit(void)
{
static Bool beenHere = FALSE;
@@ -1382,7 +1177,7 @@ OsVendorInit()
*/
void
-ddxGiveUp()
+ddxGiveUp(void)
{
int i;
@@ -1392,16 +1187,12 @@ ddxGiveUp()
xf86OSPMClose = NULL;
#endif
- xf86AccessLeaveState();
-
for (i = 0; i < xf86NumScreens; i++) {
/*
* zero all access functions to
* trap calls when switched away.
*/
xf86Screens[i]->vtSema = FALSE;
- xf86Screens[i]->access = NULL;
- xf86Screens[i]->busAccess = NULL;
}
#ifdef XFreeXDGA
@@ -1427,7 +1218,7 @@ ddxGiveUp()
*/
void
-AbortDDX()
+AbortDDX(void)
{
int i;
@@ -1448,7 +1239,6 @@ AbortDDX()
* we might not have been wrapped yet. Therefore enable
* screen explicitely.
*/
- xf86EnableAccess(xf86Screens[i]);
(xf86Screens[i]->LeaveVT)(i, 0);
}
}
@@ -1463,7 +1253,7 @@ AbortDDX()
}
void
-OsVendorFatalError()
+OsVendorFatalError(void)
{
#ifdef VENDORSUPPORT
ErrorF("\nPlease refer to your Operating System Vendor support pages\n"
@@ -1535,9 +1325,11 @@ ddxProcessArgument(int argc, char **argv, int i)
}
/* First the options that are only allowed for root */
- if (getuid() == 0 || geteuid() != 0)
- {
- if (!strcmp(argv[i], "-modulepath"))
+ if (!strcmp(argv[i], "-modulepath") || !strcmp(argv[i], "-logfile")) {
+ if ( (geteuid() == 0) && (getuid() != 0) ) {
+ FatalError("The '%s' option can only be used by root.\n", argv[i]);
+ }
+ else if (!strcmp(argv[i], "-modulepath"))
{
char *mp;
CHECK_FOR_REQUIRED_ARGUMENT();
@@ -1561,8 +1353,6 @@ ddxProcessArgument(int argc, char **argv, int i)
xf86LogFileFrom = X_CMDLINE;
return 2;
}
- } else if (!strcmp(argv[i], "-modulepath") || !strcmp(argv[i], "-logfile")) {
- FatalError("The '%s' option can only be used by root.\n", argv[i]);
}
if (!strcmp(argv[i], "-config") || !strcmp(argv[i], "-xf86config"))
{
@@ -1577,11 +1367,6 @@ ddxProcessArgument(int argc, char **argv, int i)
xf86ConfigFile = argv[i + 1];
return 2;
}
- if (!strcmp(argv[i],"-probeonly"))
- {
- xf86ProbeOnly = TRUE;
- return 1;
- }
if (!strcmp(argv[i],"-flipPixels"))
{
xf86FlipPixels = TRUE;
@@ -1797,11 +1582,6 @@ ddxProcessArgument(int argc, char **argv, int i)
return 1;
}
#endif
- if (!strcmp(argv[i], "-probe"))
- {
- xf86DoProbe = TRUE;
- return 1;
- }
if (!strcmp(argv[i], "-configure"))
{
if (getuid() != 0 && geteuid() == 0) {
@@ -1812,12 +1592,6 @@ ddxProcessArgument(int argc, char **argv, int i)
xf86AllowMouseOpenFail = TRUE;
return 1;
}
- if (!strcmp(argv[i], "-modalias"))
- {
- xf86DoModalias = TRUE;
- xf86AllowMouseOpenFail = TRUE;
- return 1;
- }
if (!strcmp(argv[i], "-showopts"))
{
if (getuid() != 0 && geteuid() == 0) {
@@ -1862,7 +1636,7 @@ ddxProcessArgument(int argc, char **argv, int i)
*/
void
-ddxUseMsg()
+ddxUseMsg(void)
{
ErrorF("\n");
ErrorF("\n");
@@ -1874,10 +1648,8 @@ ddxUseMsg()
ErrorF("-configure probe for devices and write an "__XCONFIGFILE__"\n");
ErrorF("-showopts print available options for all installed drivers\n");
}
- ErrorF("-modalias output a modalias-style filter for each driver installed\n");
ErrorF("-config file specify a configuration file, relative to the\n");
ErrorF(" "__XCONFIGFILE__" search path, only root can use absolute\n");
- ErrorF("-probeonly probe for devices, then exit\n");
ErrorF("-verbose [n] verbose startup messages\n");
ErrorF("-logverbose [n] verbose log messages\n");
ErrorF("-quiet minimal startup messages\n");
@@ -1957,7 +1729,7 @@ xf86LoadModules(char **list, pointer *optlist)
/* Pixmap format stuff */
-_X_EXPORT PixmapFormatPtr
+PixmapFormatPtr
xf86GetPixFormat(ScrnInfoPtr pScrn, int depth)
{
int i;
@@ -2002,7 +1774,7 @@ xf86GetPixFormat(ScrnInfoPtr pScrn, int depth)
return NULL;
}
-_X_EXPORT int
+int
xf86GetBppFromDepth(ScrnInfoPtr pScrn, int depth)
{
PixmapFormatPtr format;
diff --git a/xorg-server/hw/xfree86/common/xf86Mode.c b/xorg-server/hw/xfree86/common/xf86Mode.c
index 24a431dc5..0e43946c5 100644
--- a/xorg-server/hw/xfree86/common/xf86Mode.c
+++ b/xorg-server/hw/xfree86/common/xf86Mode.c
@@ -71,7 +71,7 @@ printModeRejectMessage(int index, DisplayModePtr p, int status)
* Find closest clock to given frequency (in kHz). This assumes the
* number of clocks is greater than zero.
*/
-_X_EXPORT int
+int
xf86GetNearestClock(ScrnInfoPtr scrp, int freq, Bool allowDiv2,
int DivFactor, int MulFactor, int *divider)
{
@@ -110,7 +110,7 @@ xf86GetNearestClock(ScrnInfoPtr scrp, int freq, Bool allowDiv2,
* Convert a ModeStatus value to a printable message
*/
-_X_EXPORT const char *
+const char *
xf86ModeStatusToString(ModeStatus status)
{
switch (status) {
@@ -199,7 +199,7 @@ xf86ModeStatusToString(ModeStatus status)
* xf86ShowClockRanges() -- Print the clock ranges allowed
* and the clock values scaled by ClockMulFactor and ClockDivFactor
*/
-_X_EXPORT void
+void
xf86ShowClockRanges(ScrnInfoPtr scrp, ClockRangePtr clockRanges)
{
ClockRangePtr cp;
@@ -399,7 +399,7 @@ xf86HandleBuiltinMode(ScrnInfoPtr scrp,
* reason.
*/
-_X_EXPORT ModeStatus
+ModeStatus
xf86LookupMode(ScrnInfoPtr scrp, DisplayModePtr modep,
ClockRangePtr clockRanges, LookupModeFlags strategy)
{
@@ -643,7 +643,7 @@ xf86LookupMode(ScrnInfoPtr scrp, DisplayModePtr modep,
* This function takes a mode and monitor description, and determines
* if the mode is valid for the monitor.
*/
-_X_EXPORT ModeStatus
+ModeStatus
xf86CheckModeForMonitor(DisplayModePtr mode, MonPtr monitor)
{
int i;
@@ -654,10 +654,8 @@ xf86CheckModeForMonitor(DisplayModePtr mode, MonPtr monitor)
return MODE_ERROR;
}
-#ifdef DEBUG
- ErrorF("xf86CheckModeForMonitor(%p %s, %p %s)\n",
+ DebugF("xf86CheckModeForMonitor(%p %s, %p %s)\n",
mode, mode->name, monitor, monitor->id);
-#endif
/* Some basic mode validity checks */
if (0 >= mode->HDisplay || mode->HDisplay > mode->HSyncStart ||
@@ -790,7 +788,7 @@ xf86CheckModeSize(ScrnInfoPtr scrp, int w, int x, int y)
* maxVValue maximum vertical timing value
*/
-_X_EXPORT ModeStatus
+ModeStatus
xf86InitialCheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode,
ClockRangePtr clockRanges,
LookupModeFlags strategy,
@@ -808,10 +806,8 @@ xf86InitialCheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode,
return MODE_ERROR;
}
-#ifdef DEBUG
- ErrorF("xf86InitialCheckModeForDriver(%p, %p %s, %p, 0x%x, %d, %d, %d)\n",
+ DebugF("xf86InitialCheckModeForDriver(%p, %p %s, %p, 0x%x, %d, %d, %d)\n",
scrp, mode, mode->name , clockRanges, strategy, maxPitch, virtualX, virtualY);
-#endif
/* Some basic mode validity checks */
if (0 >= mode->HDisplay || mode->HDisplay > mode->HSyncStart ||
@@ -938,7 +934,7 @@ xf86InitialCheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode,
* clockRanges allowable clock ranges
*/
-_X_EXPORT ModeStatus
+ModeStatus
xf86CheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode, int flags)
{
ClockRangesPtr cp;
@@ -1185,7 +1181,7 @@ found:
* if an unrecoverable error was encountered.
*/
-_X_EXPORT int
+int
xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
char **modeNames, ClockRangePtr clockRanges,
int *linePitches, int minPitch, int maxPitch, int pitchInc,
@@ -1204,20 +1200,17 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
PixmapFormatRec *BankFormat;
ClockRangePtr cp;
ClockRangesPtr storeClockRanges;
- double targetRefresh = 0.0;
int numTimings = 0;
range hsync[MAX_HSYNC];
range vrefresh[MAX_VREFRESH];
Bool inferred_virtual = FALSE;
-#ifdef DEBUG
- ErrorF("xf86ValidateModes(%p, %p, %p, %p,\n\t\t %p, %d, %d, %d, %d, %d, %d, %d, %d, 0x%x)\n",
+ DebugF("xf86ValidateModes(%p, %p, %p, %p,\n\t\t %p, %d, %d, %d, %d, %d, %d, %d, %d, 0x%x)\n",
scrp, availModes, modeNames, clockRanges,
linePitches, minPitch, maxPitch, pitchInc,
minHeight, maxHeight, virtualX, virtualY,
apertureSize, strategy
);
-#endif
/* Some sanity checking */
if (scrp == NULL || scrp->name == NULL || !scrp->monitor ||
@@ -1466,26 +1459,6 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
}
/*
- * Go through the mode pool and see if any modes match the target
- * refresh rate, (if specified). If no modes match, abandon the target.
- */
- targetRefresh = xf86SetRealOption(scrp->options,
- "TargetRefresh", 0.0);
- if (targetRefresh > 0.0) {
- for (p = scrp->modePool; p != NULL; p = p->next) {
- if (xf86ModeVRefresh(p) > targetRefresh * (1.0 - SYNC_TOLERANCE))
- break;
- }
- if (!p)
- targetRefresh = 0.0;
- }
-
- if (targetRefresh > 0.0) {
- xf86DrvMsg(scrp->scrnIndex, X_CONFIG,
- "Target refresh rate is %.1f Hz\n", targetRefresh);
- }
-
- /*
* Allocate one entry in scrp->modes for each named mode.
*/
while (scrp->modes)
@@ -1558,14 +1531,6 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
((double)q->HTotal / (double)q->HDisplay) < 1.15)
continue;
- /*
- * If there is a target refresh rate, skip modes that
- * don't match up.
- */
- if (xf86ModeVRefresh(q) <
- (1.0 - SYNC_TOLERANCE) * targetRefresh)
- continue;
-
if (modeSize < (q->HDisplay * q->VDisplay)) {
r = q;
modeSize = q->HDisplay * q->VDisplay;
@@ -1771,7 +1736,7 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
*
*/
-_X_EXPORT void
+void
xf86DeleteMode(DisplayModePtr *modeList, DisplayModePtr mode)
{
/* Catch the easy/insane cases */
@@ -1803,7 +1768,7 @@ xf86DeleteMode(DisplayModePtr *modeList, DisplayModePtr mode)
* invalid.
*/
-_X_EXPORT void
+void
xf86PruneDriverModes(ScrnInfoPtr scrp)
{
DisplayModePtr first, p, n;
@@ -1843,7 +1808,7 @@ xf86PruneDriverModes(ScrnInfoPtr scrp)
* parameters for each mode. The initialisation includes adjustments
* for interlaced and double scan modes.
*/
-_X_EXPORT void
+void
xf86SetCrtcForModes(ScrnInfoPtr scrp, int adjustFlags)
{
DisplayModePtr p;
@@ -1860,67 +1825,18 @@ xf86SetCrtcForModes(ScrnInfoPtr scrp, int adjustFlags)
do {
xf86SetModeCrtc(p, adjustFlags);
-#ifdef DEBUG
- ErrorF("%sMode %s: %d (%d) %d %d (%d) %d %d (%d) %d %d (%d) %d\n",
+ DebugF("%sMode %s: %d (%d) %d %d (%d) %d %d (%d) %d %d (%d) %d\n",
(p->type & M_T_DEFAULT) ? "Default " : "",
p->name, p->CrtcHDisplay, p->CrtcHBlankStart,
p->CrtcHSyncStart, p->CrtcHSyncEnd, p->CrtcHBlankEnd,
p->CrtcHTotal, p->CrtcVDisplay, p->CrtcVBlankStart,
p->CrtcVSyncStart, p->CrtcVSyncEnd, p->CrtcVBlankEnd,
p->CrtcVTotal);
-#endif
p = p->next;
} while (p != NULL && p != scrp->modes);
}
-
-#if 0
-static void
-add(char **p, char *new)
-{
- *p = xnfrealloc(*p, strlen(*p) + strlen(new) + 2);
- strcat(*p, " ");
- strcat(*p, new);
-}
-
-_X_EXPORT void
-xf86PrintModeline(int scrnIndex,DisplayModePtr mode)
-{
- char tmp[256];
- char *flags = xnfcalloc(1, 1);
-
- if (mode->HSkew) {
- snprintf(tmp, 256, "hskew %i", mode->HSkew);
- add(&flags, tmp);
- }
- if (mode->VScan) {
- snprintf(tmp, 256, "vscan %i", mode->VScan);
- add(&flags, tmp);
- }
- if (mode->Flags & V_INTERLACE) add(&flags, "interlace");
- if (mode->Flags & V_CSYNC) add(&flags, "composite");
- if (mode->Flags & V_DBLSCAN) add(&flags, "doublescan");
- if (mode->Flags & V_BCAST) add(&flags, "bcast");
- if (mode->Flags & V_PHSYNC) add(&flags, "+hsync");
- if (mode->Flags & V_NHSYNC) add(&flags, "-hsync");
- if (mode->Flags & V_PVSYNC) add(&flags, "+vsync");
- if (mode->Flags & V_NVSYNC) add(&flags, "-vsync");
- if (mode->Flags & V_PCSYNC) add(&flags, "+csync");
- if (mode->Flags & V_NCSYNC) add(&flags, "-csync");
-#if 0
- if (mode->Flags & V_CLKDIV2) add(&flags, "vclk/2");
-#endif
- xf86DrvMsgVerb(scrnIndex, X_INFO, 3,
- "Modeline \"%s\" %6.2f %i %i %i %i %i %i %i %i%s\n",
- mode->name, mode->Clock/1000., mode->HDisplay,
- mode->HSyncStart, mode->HSyncEnd, mode->HTotal,
- mode->VDisplay, mode->VSyncStart, mode->VSyncEnd,
- mode->VTotal, flags);
- xfree(flags);
-}
-#endif
-
-_X_EXPORT void
+void
xf86PrintModes(ScrnInfoPtr scrp)
{
DisplayModePtr p;
@@ -1988,29 +1904,3 @@ xf86PrintModes(ScrnInfoPtr scrp)
p = p->next;
} while (p != NULL && p != scrp->modes);
}
-
-#if 0
-/**
- * Adds the new mode into the mode list, and returns the new list
- *
- * \param modes doubly-linked mode list.
- */
-_X_EXPORT DisplayModePtr
-xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new)
-{
- if (modes == NULL)
- return new;
-
- if (new) {
- DisplayModePtr mode = modes;
-
- while (mode->next)
- mode = mode->next;
-
- mode->next = new;
- new->prev = mode;
- }
-
- return modes;
-}
-#endif
diff --git a/xorg-server/hw/xfree86/common/xf86Module.h b/xorg-server/hw/xfree86/common/xf86Module.h
index 81011e163..28da22b40 100644
--- a/xorg-server/hw/xfree86/common/xf86Module.h
+++ b/xorg-server/hw/xfree86/common/xf86Module.h
@@ -82,8 +82,8 @@ typedef enum {
* mask is 0xFFFF0000.
*/
#define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 4)
-#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(5, 0)
-#define ABI_XINPUT_VERSION SET_ABI_VERSION(4, 0)
+#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(6, 0)
+#define ABI_XINPUT_VERSION SET_ABI_VERSION(7, 0)
#define ABI_EXTENSION_VERSION SET_ABI_VERSION(2, 0)
#define ABI_FONT_VERSION SET_ABI_VERSION(0, 6)
@@ -181,34 +181,22 @@ typedef struct {
const char ** initDependencies;
} ExtensionModule;
-extern ExtensionModule *ExtensionModuleList;
+extern _X_EXPORT ExtensionModule *ExtensionModuleList;
/* Prototypes for Loader functions that are exported to modules */
-#ifndef IN_LOADER
-/* Prototypes with opaque pointers for use by modules */
-pointer LoadSubModule(pointer, const char *, const char **,
+extern _X_EXPORT pointer LoadSubModule(pointer, const char *, const char **,
const char **, pointer, const XF86ModReqInfo *,
int *, int *);
-pointer LoadSubModuleLocal(pointer, const char *, const char **,
- const char **, pointer, const XF86ModReqInfo *,
- int *, int *);
-void UnloadSubModule(pointer);
-void UnloadModule (pointer);
-#endif
-pointer LoaderSymbol(const char *);
-pointer LoaderSymbolLocal(pointer module, const char *);
-char **LoaderListDirs(const char **, const char **);
-void LoaderFreeDirList(char **);
-void LoaderErrorMsg(const char *, const char *, int, int);
-void LoadExtension(ExtensionModule *, Bool);
-void LoaderRefSymLists(const char **, ...);
-void LoaderRefSymbols(const char *, ...);
-void LoaderReqSymLists(const char **, ...);
-void LoaderReqSymbols(const char *, ...);
-int LoaderCheckUnresolved(int);
-void LoaderGetOS(const char **name, int *major, int *minor, int *teeny);
-Bool LoaderShouldIgnoreABI(void);
-int LoaderGetABIVersion(const char *abiclass);
+extern _X_EXPORT void UnloadSubModule(pointer);
+extern _X_EXPORT void UnloadModule (pointer);
+extern _X_EXPORT pointer LoaderSymbol(const char *);
+extern _X_EXPORT char **LoaderListDirs(const char **, const char **);
+extern _X_EXPORT void LoaderFreeDirList(char **);
+extern _X_EXPORT void LoaderErrorMsg(const char *, const char *, int, int);
+extern _X_EXPORT void LoadExtension(ExtensionModule *, Bool);
+extern _X_EXPORT void LoaderGetOS(const char **name, int *major, int *minor, int *teeny);
+extern _X_EXPORT Bool LoaderShouldIgnoreABI(void);
+extern _X_EXPORT int LoaderGetABIVersion(const char *abiclass);
typedef pointer (*ModuleSetupProc)(pointer, pointer, int *, int *);
typedef void (*ModuleTearDownProc)(pointer);
diff --git a/xorg-server/hw/xfree86/common/xf86Opt.h b/xorg-server/hw/xfree86/common/xf86Opt.h
index dbb98da03..ce3d76724 100644
--- a/xorg-server/hw/xfree86/common/xf86Opt.h
+++ b/xorg-server/hw/xfree86/common/xf86Opt.h
@@ -68,46 +68,46 @@ typedef struct {
Bool found;
} OptionInfoRec, *OptionInfoPtr;
-int xf86SetIntOption(pointer optlist, const char *name, int deflt);
-double xf86SetRealOption(pointer optlist, const char *name, double deflt);
-char *xf86SetStrOption(pointer optlist, const char *name, char *deflt);
-int xf86SetBoolOption(pointer list, const char *name, int deflt );
-int xf86CheckIntOption(pointer optlist, const char *name, int deflt);
-double xf86CheckRealOption(pointer optlist, const char *name, double deflt);
-char *xf86CheckStrOption(pointer optlist, const char *name, char *deflt);
-int xf86CheckBoolOption(pointer list, const char *name, int deflt );
-pointer xf86AddNewOption(pointer head, const char *name, const char *val );
-pointer xf86NewOption(char *name, char *value );
-pointer xf86NextOption(pointer list );
-pointer xf86OptionListCreate(const char **options, int count, int used);
-pointer xf86OptionListMerge(pointer head, pointer tail);
-void xf86OptionListFree(pointer opt);
-char *xf86OptionName(pointer opt);
-char *xf86OptionValue(pointer opt);
-void xf86OptionListReport(pointer parm);
-pointer xf86FindOption(pointer options, const char *name);
-char *xf86FindOptionValue(pointer options, const char *name);
-void xf86MarkOptionUsed(pointer option);
-void xf86MarkOptionUsedByName(pointer options, const char *name);
-Bool xf86CheckIfOptionUsed(pointer option);
-Bool xf86CheckIfOptionUsedByName(pointer options, const char *name);
-void xf86ShowUnusedOptions(int scrnIndex, pointer options);
-void xf86ProcessOptions(int scrnIndex, pointer options, OptionInfoPtr optinfo);
-OptionInfoPtr xf86TokenToOptinfo(const OptionInfoRec *table, int token);
-const char *xf86TokenToOptName(const OptionInfoRec *table, int token);
-Bool xf86IsOptionSet(const OptionInfoRec *table, int token);
-char *xf86GetOptValString(const OptionInfoRec *table, int token);
-Bool xf86GetOptValInteger(const OptionInfoRec *table, int token, int *value);
-Bool xf86GetOptValULong(const OptionInfoRec *table, int token, unsigned long *value);
-Bool xf86GetOptValReal(const OptionInfoRec *table, int token, double *value);
-Bool xf86GetOptValFreq(const OptionInfoRec *table, int token,
+extern _X_EXPORT int xf86SetIntOption(pointer optlist, const char *name, int deflt);
+extern _X_EXPORT double xf86SetRealOption(pointer optlist, const char *name, double deflt);
+extern _X_EXPORT char *xf86SetStrOption(pointer optlist, const char *name, char *deflt);
+extern _X_EXPORT int xf86SetBoolOption(pointer list, const char *name, int deflt );
+extern _X_EXPORT int xf86CheckIntOption(pointer optlist, const char *name, int deflt);
+extern _X_EXPORT double xf86CheckRealOption(pointer optlist, const char *name, double deflt);
+extern _X_EXPORT char *xf86CheckStrOption(pointer optlist, const char *name, char *deflt);
+extern _X_EXPORT int xf86CheckBoolOption(pointer list, const char *name, int deflt );
+extern _X_EXPORT pointer xf86AddNewOption(pointer head, const char *name, const char *val );
+extern _X_EXPORT pointer xf86NewOption(char *name, char *value );
+extern _X_EXPORT pointer xf86NextOption(pointer list );
+extern _X_EXPORT pointer xf86OptionListCreate(const char **options, int count, int used);
+extern _X_EXPORT pointer xf86OptionListMerge(pointer head, pointer tail);
+extern _X_EXPORT void xf86OptionListFree(pointer opt);
+extern _X_EXPORT char *xf86OptionName(pointer opt);
+extern _X_EXPORT char *xf86OptionValue(pointer opt);
+extern _X_EXPORT void xf86OptionListReport(pointer parm);
+extern _X_EXPORT pointer xf86FindOption(pointer options, const char *name);
+extern _X_EXPORT char *xf86FindOptionValue(pointer options, const char *name);
+extern _X_EXPORT void xf86MarkOptionUsed(pointer option);
+extern _X_EXPORT void xf86MarkOptionUsedByName(pointer options, const char *name);
+extern _X_EXPORT Bool xf86CheckIfOptionUsed(pointer option);
+extern _X_EXPORT Bool xf86CheckIfOptionUsedByName(pointer options, const char *name);
+extern _X_EXPORT void xf86ShowUnusedOptions(int scrnIndex, pointer options);
+extern _X_EXPORT void xf86ProcessOptions(int scrnIndex, pointer options, OptionInfoPtr optinfo);
+extern _X_EXPORT OptionInfoPtr xf86TokenToOptinfo(const OptionInfoRec *table, int token);
+extern _X_EXPORT const char *xf86TokenToOptName(const OptionInfoRec *table, int token);
+extern _X_EXPORT Bool xf86IsOptionSet(const OptionInfoRec *table, int token);
+extern _X_EXPORT char *xf86GetOptValString(const OptionInfoRec *table, int token);
+extern _X_EXPORT Bool xf86GetOptValInteger(const OptionInfoRec *table, int token, int *value);
+extern _X_EXPORT Bool xf86GetOptValULong(const OptionInfoRec *table, int token, unsigned long *value);
+extern _X_EXPORT Bool xf86GetOptValReal(const OptionInfoRec *table, int token, double *value);
+extern _X_EXPORT Bool xf86GetOptValFreq(const OptionInfoRec *table, int token,
OptFreqUnits expectedUnits, double *value);
-Bool xf86GetOptValBool(const OptionInfoRec *table, int token, Bool *value);
-Bool xf86ReturnOptValBool(const OptionInfoRec *table, int token, Bool def);
-int xf86NameCmp(const char *s1, const char *s2);
-char *xf86NormalizeName(const char *s);
-pointer xf86ReplaceIntOption(pointer optlist, const char *name, const int val);
-pointer xf86ReplaceRealOption(pointer optlist, const char *name, const double val);
-pointer xf86ReplaceBoolOption(pointer optlist, const char *name, const Bool val);
-pointer xf86ReplaceStrOption(pointer optlist, const char *name, const char* val);
+extern _X_EXPORT Bool xf86GetOptValBool(const OptionInfoRec *table, int token, Bool *value);
+extern _X_EXPORT Bool xf86ReturnOptValBool(const OptionInfoRec *table, int token, Bool def);
+extern _X_EXPORT int xf86NameCmp(const char *s1, const char *s2);
+extern _X_EXPORT char *xf86NormalizeName(const char *s);
+extern _X_EXPORT pointer xf86ReplaceIntOption(pointer optlist, const char *name, const int val);
+extern _X_EXPORT pointer xf86ReplaceRealOption(pointer optlist, const char *name, const double val);
+extern _X_EXPORT pointer xf86ReplaceBoolOption(pointer optlist, const char *name, const Bool val);
+extern _X_EXPORT pointer xf86ReplaceStrOption(pointer optlist, const char *name, const char* val);
#endif
diff --git a/xorg-server/hw/xfree86/common/xf86Option.c b/xorg-server/hw/xfree86/common/xf86Option.c
index 50a7d9cb9..ad8d1c426 100644
--- a/xorg-server/hw/xfree86/common/xf86Option.c
+++ b/xorg-server/hw/xfree86/common/xf86Option.c
@@ -64,7 +64,7 @@ static Bool ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p,
* extraOpts, display, confScreen, monitor, device
*/
-_X_EXPORT void
+void
xf86CollectOptions(ScrnInfoPtr pScrn, pointer extraOpts)
{
XF86OptionPtr tmp;
@@ -131,7 +131,7 @@ xf86CollectOptions(ScrnInfoPtr pScrn, pointer extraOpts)
* pInfo->conf_idev->commonOptions, defaultOpts
*/
-_X_EXPORT void
+void
xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts,
pointer extraOpts)
{
@@ -224,28 +224,28 @@ LookupBoolOption(pointer optlist, const char *name, int deflt, Bool markUsed)
/* These xf86Set* functions are intended for use by non-screen specific code */
-_X_EXPORT int
+int
xf86SetIntOption(pointer optlist, const char *name, int deflt)
{
return LookupIntOption(optlist, name, deflt, TRUE);
}
-_X_EXPORT double
+double
xf86SetRealOption(pointer optlist, const char *name, double deflt)
{
return LookupRealOption(optlist, name, deflt, TRUE);
}
-_X_EXPORT char *
+char *
xf86SetStrOption(pointer optlist, const char *name, char *deflt)
{
return LookupStrOption(optlist, name, deflt, TRUE);
}
-_X_EXPORT int
+int
xf86SetBoolOption(pointer optlist, const char *name, int deflt)
{
return LookupBoolOption(optlist, name, deflt, TRUE);
@@ -255,28 +255,28 @@ xf86SetBoolOption(pointer optlist, const char *name, int deflt)
* These are like the Set*Option functions, but they don't mark the options
* as used.
*/
-_X_EXPORT int
+int
xf86CheckIntOption(pointer optlist, const char *name, int deflt)
{
return LookupIntOption(optlist, name, deflt, FALSE);
}
-_X_EXPORT double
+double
xf86CheckRealOption(pointer optlist, const char *name, double deflt)
{
return LookupRealOption(optlist, name, deflt, FALSE);
}
-_X_EXPORT char *
+char *
xf86CheckStrOption(pointer optlist, const char *name, char *deflt)
{
return LookupStrOption(optlist, name, deflt, FALSE);
}
-_X_EXPORT int
+int
xf86CheckBoolOption(pointer optlist, const char *name, int deflt)
{
return LookupBoolOption(optlist, name, deflt, FALSE);
@@ -286,7 +286,7 @@ xf86CheckBoolOption(pointer optlist, const char *name, int deflt)
* addNewOption() has the required property of replacing the option value
* if the option is already present.
*/
-_X_EXPORT pointer
+pointer
xf86ReplaceIntOption(pointer optlist, const char *name, const int val)
{
char tmp[16];
@@ -294,7 +294,7 @@ xf86ReplaceIntOption(pointer optlist, const char *name, const int val)
return xf86AddNewOption(optlist,name,tmp);
}
-_X_EXPORT pointer
+pointer
xf86ReplaceRealOption(pointer optlist, const char *name, const double val)
{
char tmp[32];
@@ -302,19 +302,19 @@ xf86ReplaceRealOption(pointer optlist, const char *name, const double val)
return xf86AddNewOption(optlist,name,tmp);
}
-_X_EXPORT pointer
+pointer
xf86ReplaceBoolOption(pointer optlist, const char *name, const Bool val)
{
return xf86AddNewOption(optlist,name,val?"True":"False");
}
-_X_EXPORT pointer
+pointer
xf86ReplaceStrOption(pointer optlist, const char *name, const char* val)
{
return xf86AddNewOption(optlist,name,val);
}
-_X_EXPORT pointer
+pointer
xf86AddNewOption(pointer head, const char *name, const char *val)
{
/* XXX These should actually be allocated in the parser library. */
@@ -325,50 +325,50 @@ xf86AddNewOption(pointer head, const char *name, const char *val)
}
-_X_EXPORT pointer
+pointer
xf86NewOption(char *name, char *value)
{
return xf86newOption(name, value);
}
-_X_EXPORT pointer
+pointer
xf86NextOption(pointer list)
{
return xf86nextOption(list);
}
-_X_EXPORT pointer
+pointer
xf86OptionListCreate(const char **options, int count, int used)
{
return xf86optionListCreate(options, count, used);
}
-_X_EXPORT pointer
+pointer
xf86OptionListMerge(pointer head, pointer tail)
{
return xf86optionListMerge(head, tail);
}
-_X_EXPORT void
+void
xf86OptionListFree(pointer opt)
{
xf86optionListFree(opt);
}
-_X_EXPORT char *
+char *
xf86OptionName(pointer opt)
{
return xf86optionName(opt);
}
-_X_EXPORT char *
+char *
xf86OptionValue(pointer opt)
{
return xf86optionValue(opt);
}
-_X_EXPORT void
+void
xf86OptionListReport(pointer parm)
{
XF86OptionPtr opts = parm;
@@ -385,21 +385,21 @@ xf86OptionListReport(pointer parm)
/* End of XInput-caused section */
-_X_EXPORT pointer
+pointer
xf86FindOption(pointer options, const char *name)
{
return xf86findOption(options, name);
}
-_X_EXPORT char *
+char *
xf86FindOptionValue(pointer options, const char *name)
{
return xf86findOptionValue(options, name);
}
-_X_EXPORT void
+void
xf86MarkOptionUsed(pointer option)
{
if (option != NULL)
@@ -407,7 +407,7 @@ xf86MarkOptionUsed(pointer option)
}
-_X_EXPORT void
+void
xf86MarkOptionUsedByName(pointer options, const char *name)
{
XF86OptionPtr opt;
@@ -417,7 +417,7 @@ xf86MarkOptionUsedByName(pointer options, const char *name)
opt->opt_used = TRUE;
}
-_X_EXPORT Bool
+Bool
xf86CheckIfOptionUsed(pointer option)
{
if (option != NULL)
@@ -426,7 +426,7 @@ xf86CheckIfOptionUsed(pointer option)
return FALSE;
}
-_X_EXPORT Bool
+Bool
xf86CheckIfOptionUsedByName(pointer options, const char *name)
{
XF86OptionPtr opt;
@@ -438,7 +438,7 @@ xf86CheckIfOptionUsedByName(pointer options, const char *name)
return FALSE;
}
-_X_EXPORT void
+void
xf86ShowUnusedOptions(int scrnIndex, pointer options)
{
XF86OptionPtr opt = options;
@@ -661,7 +661,7 @@ ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p,
}
-_X_EXPORT void
+void
xf86ProcessOptions(int scrnIndex, pointer options, OptionInfoPtr optinfo)
{
OptionInfoPtr p;
@@ -672,7 +672,7 @@ xf86ProcessOptions(int scrnIndex, pointer options, OptionInfoPtr optinfo)
}
-_X_EXPORT OptionInfoPtr
+OptionInfoPtr
xf86TokenToOptinfo(const OptionInfoRec *table, int token)
{
const OptionInfoRec *p, *match = NULL, *set = NULL;
@@ -699,7 +699,7 @@ xf86TokenToOptinfo(const OptionInfoRec *table, int token)
}
-_X_EXPORT const char *
+const char *
xf86TokenToOptName(const OptionInfoRec *table, int token)
{
const OptionInfoRec *p;
@@ -709,7 +709,7 @@ xf86TokenToOptName(const OptionInfoRec *table, int token)
}
-_X_EXPORT Bool
+Bool
xf86IsOptionSet(const OptionInfoRec *table, int token)
{
OptionInfoPtr p;
@@ -719,7 +719,7 @@ xf86IsOptionSet(const OptionInfoRec *table, int token)
}
-_X_EXPORT char *
+char *
xf86GetOptValString(const OptionInfoRec *table, int token)
{
OptionInfoPtr p;
@@ -732,7 +732,7 @@ xf86GetOptValString(const OptionInfoRec *table, int token)
}
-_X_EXPORT Bool
+Bool
xf86GetOptValInteger(const OptionInfoRec *table, int token, int *value)
{
OptionInfoPtr p;
@@ -746,7 +746,7 @@ xf86GetOptValInteger(const OptionInfoRec *table, int token, int *value)
}
-_X_EXPORT Bool
+Bool
xf86GetOptValULong(const OptionInfoRec *table, int token, unsigned long *value)
{
OptionInfoPtr p;
@@ -760,7 +760,7 @@ xf86GetOptValULong(const OptionInfoRec *table, int token, unsigned long *value)
}
-_X_EXPORT Bool
+Bool
xf86GetOptValReal(const OptionInfoRec *table, int token, double *value)
{
OptionInfoPtr p;
@@ -774,7 +774,7 @@ xf86GetOptValReal(const OptionInfoRec *table, int token, double *value)
}
-_X_EXPORT Bool
+Bool
xf86GetOptValFreq(const OptionInfoRec *table, int token,
OptFreqUnits expectedUnits, double *value)
{
@@ -822,7 +822,7 @@ xf86GetOptValFreq(const OptionInfoRec *table, int token,
}
-_X_EXPORT Bool
+Bool
xf86GetOptValBool(const OptionInfoRec *table, int token, Bool *value)
{
OptionInfoPtr p;
@@ -836,7 +836,7 @@ xf86GetOptValBool(const OptionInfoRec *table, int token, Bool *value)
}
-_X_EXPORT Bool
+Bool
xf86ReturnOptValBool(const OptionInfoRec *table, int token, Bool def)
{
OptionInfoPtr p;
@@ -849,7 +849,7 @@ xf86ReturnOptValBool(const OptionInfoRec *table, int token, Bool def)
}
-_X_EXPORT int
+int
xf86NameCmp(const char *s1, const char *s2)
{
return xf86nameCompare(s1, s2);
diff --git a/xorg-server/hw/xfree86/common/xf86PM.c b/xorg-server/hw/xfree86/common/xf86PM.c
index 7c8320dee..7af89b5b4 100644
--- a/xorg-server/hw/xfree86/common/xf86PM.c
+++ b/xorg-server/hw/xfree86/common/xf86PM.c
@@ -70,18 +70,16 @@ suspend (pmEvent event, Bool undo)
xf86inSuspend = TRUE;
for (i = 0; i < xf86NumScreens; i++) {
- xf86EnableAccess(xf86Screens[i]);
if (xf86Screens[i]->EnableDisableFBAccess)
(*xf86Screens[i]->EnableDisableFBAccess) (i, FALSE);
}
pInfo = xf86InputDevs;
while (pInfo) {
- DisableDevice(pInfo->dev);
+ DisableDevice(pInfo->dev, TRUE);
pInfo = pInfo->next;
}
xf86EnterServerState(SETUP);
for (i = 0; i < xf86NumScreens; i++) {
- xf86EnableAccess(xf86Screens[i]);
if (xf86Screens[i]->PMEvent)
xf86Screens[i]->PMEvent(i,event,undo);
else {
@@ -90,7 +88,7 @@ suspend (pmEvent event, Bool undo)
}
}
xf86AccessLeave();
- xf86AccessLeaveState();
+
}
static void
@@ -102,7 +100,6 @@ resume(pmEvent event, Bool undo)
xf86AccessEnter();
xf86EnterServerState(SETUP);
for (i = 0; i < xf86NumScreens; i++) {
- xf86EnableAccess(xf86Screens[i]);
if (xf86Screens[i]->PMEvent)
xf86Screens[i]->PMEvent(i,event,undo);
else {
@@ -112,14 +109,13 @@ resume(pmEvent event, Bool undo)
}
xf86EnterServerState(OPERATING);
for (i = 0; i < xf86NumScreens; i++) {
- xf86EnableAccess(xf86Screens[i]);
if (xf86Screens[i]->EnableDisableFBAccess)
(*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE);
}
dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
pInfo = xf86InputDevs;
while (pInfo) {
- EnableDevice(pInfo->dev);
+ EnableDevice(pInfo->dev, TRUE);
pInfo = pInfo->next;
}
xf86inSuspend = FALSE;
@@ -167,7 +163,6 @@ DoApmEvent(pmEvent event, Bool undo)
if (xf86Screens[i]->PMEvent) {
if (!setup) xf86EnterServerState(SETUP);
setup = 1;
- xf86EnableAccess(xf86Screens[i]);
xf86Screens[i]->PMEvent(i,event,undo);
}
}
diff --git a/xorg-server/hw/xfree86/common/xf86Priv.h b/xorg-server/hw/xfree86/common/xf86Priv.h
index 41ca8f531..3bb15718c 100644
--- a/xorg-server/hw/xfree86/common/xf86Priv.h
+++ b/xorg-server/hw/xfree86/common/xf86Priv.h
@@ -45,65 +45,55 @@
* Parameters set ONLY from the command line options
* The global state of these things is held in xf86InfoRec (when appropriate).
*/
-extern const char *xf86ConfigFile;
-extern Bool xf86AllowMouseOpenFail;
+extern _X_EXPORT const char *xf86ConfigFile;
+extern _X_EXPORT Bool xf86AllowMouseOpenFail;
#ifdef XF86VIDMODE
-extern Bool xf86VidModeDisabled;
-extern Bool xf86VidModeAllowNonLocal;
+extern _X_EXPORT Bool xf86VidModeDisabled;
+extern _X_EXPORT Bool xf86VidModeAllowNonLocal;
#endif
-extern Bool xf86fpFlag;
-extern Bool xf86sFlag;
-extern Bool xf86bsEnableFlag;
-extern Bool xf86bsDisableFlag;
-extern Bool xf86silkenMouseDisableFlag;
-extern Bool xf86xkbdirFlag;
-extern Bool xf86acpiDisableFlag;
-extern char *xf86LayoutName;
-extern char *xf86ScreenName;
-extern char *xf86PointerName;
-extern char *xf86KeyboardName;
-#ifdef KEEPBPP
-extern int xf86Bpp;
+extern _X_EXPORT Bool xf86fpFlag;
+extern _X_EXPORT Bool xf86sFlag;
+extern _X_EXPORT Bool xf86bsEnableFlag;
+extern _X_EXPORT Bool xf86bsDisableFlag;
+extern _X_EXPORT Bool xf86silkenMouseDisableFlag;
+extern _X_EXPORT Bool xf86xkbdirFlag;
+#ifdef HAVE_ACPI
+extern _X_EXPORT Bool xf86acpiDisableFlag;
#endif
-extern int xf86FbBpp;
-extern int xf86Depth;
-extern Pix24Flags xf86Pix24;
-extern rgb xf86Weight;
-extern Bool xf86FlipPixels;
-extern Gamma xf86Gamma;
-extern char *xf86ServerName;
-extern struct pci_slot_match xf86IsolateDevice;
+extern _X_EXPORT char *xf86LayoutName;
+extern _X_EXPORT char *xf86ScreenName;
+extern _X_EXPORT char *xf86PointerName;
+extern _X_EXPORT char *xf86KeyboardName;
+extern _X_EXPORT int xf86FbBpp;
+extern _X_EXPORT int xf86Depth;
+extern _X_EXPORT Pix24Flags xf86Pix24;
+extern _X_EXPORT rgb xf86Weight;
+extern _X_EXPORT Bool xf86FlipPixels;
+extern _X_EXPORT Gamma xf86Gamma;
+extern _X_EXPORT char *xf86ServerName;
+extern _X_EXPORT struct pci_slot_match xf86IsolateDevice;
/* Other parameters */
-extern xf86InfoRec xf86Info;
-extern const char *xf86InputDeviceList;
-extern const char *xf86ModulePath;
-extern MessageType xf86ModPathFrom;
-extern const char *xf86LogFile;
-extern MessageType xf86LogFileFrom;
-extern Bool xf86LogFileWasOpened;
-extern serverLayoutRec xf86ConfigLayout;
-extern Pix24Flags xf86ConfigPix24;
-
-extern unsigned short xf86MouseCflags[];
-extern Bool xf86SupportedMouseTypes[];
-extern int xf86NumMouseTypes;
-
-extern DriverPtr *xf86DriverList;
-extern int xf86NumDrivers;
-extern Bool xf86Resetting;
-extern Bool xf86Initialising;
-extern int xf86NumScreens;
-extern xf86CurrentAccessRec xf86CurrentAccess;
-extern const char *xf86VisualNames[];
-extern int xf86Verbose; /* verbosity level */
-extern int xf86LogVerbose; /* log file verbosity level */
-extern Bool xf86ProbeOnly;
-extern Bool xf86DoProbe;
-extern Bool xorgHWAccess;
-
-extern RootWinPropPtr *xf86RegisteredPropertiesTable;
+extern _X_EXPORT xf86InfoRec xf86Info;
+extern _X_EXPORT const char *xf86ModulePath;
+extern _X_EXPORT MessageType xf86ModPathFrom;
+extern _X_EXPORT const char *xf86LogFile;
+extern _X_EXPORT MessageType xf86LogFileFrom;
+extern _X_EXPORT Bool xf86LogFileWasOpened;
+extern _X_EXPORT serverLayoutRec xf86ConfigLayout;
+
+extern _X_EXPORT DriverPtr *xf86DriverList;
+extern _X_EXPORT int xf86NumDrivers;
+extern _X_EXPORT Bool xf86Resetting;
+extern _X_EXPORT Bool xf86Initialising;
+extern _X_EXPORT int xf86NumScreens;
+extern _X_EXPORT const char *xf86VisualNames[];
+extern _X_EXPORT int xf86Verbose; /* verbosity level */
+extern _X_EXPORT int xf86LogVerbose; /* log file verbosity level */
+extern _X_EXPORT Bool xorgHWAccess;
+
+extern _X_EXPORT RootWinPropPtr *xf86RegisteredPropertiesTable;
#ifndef DEFAULT_VERBOSE
#define DEFAULT_VERBOSE 0
@@ -115,68 +105,59 @@ extern RootWinPropPtr *xf86RegisteredPropertiesTable;
#define DEFAULT_DPI 96
#endif
-#define DEFAULT_UNRESOLVED TRUE
-#define DEFAULT_BEST_REFRESH FALSE
-
/* Function Prototypes */
#ifndef _NO_XF86_PROTOTYPES
/* xf86Bus.c */
-void xf86BusProbe(void);
-void xf86ChangeBusIndex(int oldIndex, int newIndex);
-void xf86AccessInit(void);
-void xf86AccessEnter(void);
-void xf86AccessLeave(void);
-void xf86EntityInit(void);
-void xf86EntityEnter(void);
-void xf86EntityLeave(void);
-void xf86AccessLeaveState(void);
-
-void xf86FindPrimaryDevice(void);
+extern _X_EXPORT void xf86BusProbe(void);
+extern _X_EXPORT void xf86AccessInit(void);
+extern _X_EXPORT void xf86AccessEnter(void);
+extern _X_EXPORT void xf86AccessLeave(void);
+extern _X_EXPORT void xf86EntityInit(void);
+
+extern _X_EXPORT void xf86FindPrimaryDevice(void);
/* new RAC */
-void xf86ResourceBrokerInit(void);
-void xf86PostProbe(void);
-void xf86ClearEntityListForScreen(int scrnIndex);
-void xf86AddDevToEntity(int entityIndex, GDevPtr dev);
-extern void xf86PostPreInit(void);
-extern void xf86PostScreenInit(void);
+extern _X_EXPORT void xf86PostProbe(void);
+extern _X_EXPORT void xf86ClearEntityListForScreen(int scrnIndex);
+extern _X_EXPORT void xf86AddDevToEntity(int entityIndex, GDevPtr dev);
+extern _X_EXPORT void xf86PostScreenInit(void);
/* xf86Config.c */
-Bool xf86PathIsSafe(const char *path);
+extern _X_EXPORT Bool xf86PathIsSafe(const char *path);
/* xf86DefaultModes */
-extern const DisplayModeRec xf86DefaultModes[];
-extern const int xf86NumDefaultModes;
+extern _X_EXPORT const DisplayModeRec xf86DefaultModes[];
+extern _X_EXPORT const int xf86NumDefaultModes;
/* xf86Configure.c */
-void DoConfigure(void);
+extern _X_EXPORT void DoConfigure(void);
/* xf86ShowOpts.c */
-void DoShowOptions(void);
+extern _X_EXPORT void DoShowOptions(void);
/* xf86Events.c */
-void xf86Wakeup(pointer blockData, int err, pointer pReadmask);
-void xf86SigHandler(int signo);
-void xf86HandlePMEvents(int fd, pointer data);
-extern int (*xf86PMGetEventFromOs)(int fd,pmEvent *events,int num);
-extern pmWait (*xf86PMConfirmEventToOs)(int fd,pmEvent event);
+extern _X_EXPORT void xf86Wakeup(pointer blockData, int err, pointer pReadmask);
+extern _X_HIDDEN int xf86SigWrapper(int signo);
+extern _X_EXPORT void xf86HandlePMEvents(int fd, pointer data);
+extern _X_EXPORT int (*xf86PMGetEventFromOs)(int fd,pmEvent *events,int num);
+extern _X_EXPORT pmWait (*xf86PMConfirmEventToOs)(int fd,pmEvent event);
/* xf86Helper.c */
-void xf86LogInit(void);
-void xf86CloseLog(void);
+extern _X_EXPORT void xf86LogInit(void);
+extern _X_EXPORT void xf86CloseLog(void);
/* xf86Init.c */
-Bool xf86LoadModules(char **list, pointer *optlist);
-int xf86SetVerbosity(int verb);
-int xf86SetLogVerbosity(int verb);
-Bool xf86CallDriverProbe( struct _DriverRec * drv, Bool detect_only );
+extern _X_EXPORT Bool xf86LoadModules(char **list, pointer *optlist);
+extern _X_EXPORT int xf86SetVerbosity(int verb);
+extern _X_EXPORT int xf86SetLogVerbosity(int verb);
+extern _X_EXPORT Bool xf86CallDriverProbe( struct _DriverRec * drv, Bool detect_only );
/* xf86Xinput.c */
-extern EventList *xf86Events;
+extern _X_EXPORT EventList *xf86Events;
#endif /* _NO_XF86_PROTOTYPES */
diff --git a/xorg-server/hw/xfree86/common/xf86Privstr.h b/xorg-server/hw/xfree86/common/xf86Privstr.h
index 6a7a6dc86..26f822dc4 100644
--- a/xorg-server/hw/xfree86/common/xf86Privstr.h
+++ b/xorg-server/hw/xfree86/common/xf86Privstr.h
@@ -34,7 +34,6 @@
#ifndef _XF86PRIVSTR_H
#define _XF86PRIVSTR_H
-#include "xf86Pci.h"
#include "xf86str.h"
typedef enum {
@@ -44,12 +43,6 @@ typedef enum {
} Log;
typedef enum {
- SKNever,
- SKWhenNeeded,
- SKAlways
-} SpecialKeysInDDX;
-
-typedef enum {
XF86_GlxVisualsMinimal,
XF86_GlxVisualsTypical,
XF86_GlxVisualsAll,
@@ -65,11 +58,13 @@ typedef struct {
int consoleFd;
int vtno;
Bool vtSysreq;
- SpecialKeysInDDX ddxSpecialKeys;
/* event handler part */
int lastEventTime;
Bool vtRequestsPending;
+#ifdef sun
+ int vtPendingNum;
+#endif
Bool dontVTSwitch;
Bool dontZap;
Bool dontZoom;
diff --git a/xorg-server/hw/xfree86/common/xf86RandR.c b/xorg-server/hw/xfree86/common/xf86RandR.c
index de2f78c5f..02dcc34b4 100644
--- a/xorg-server/hw/xfree86/common/xf86RandR.c
+++ b/xorg-server/hw/xfree86/common/xf86RandR.c
@@ -30,6 +30,7 @@
#include "mibank.h"
#include "globals.h"
#include "xf86.h"
+#include "xf86str.h"
#include "xf86Priv.h"
#include "xf86DDC.h"
#include "mipointer.h"
@@ -364,7 +365,7 @@ xf86RandRCloseScreen (int index, ScreenPtr pScreen)
return (*pScreen->CloseScreen) (index, pScreen);
}
-_X_EXPORT Rotation
+Rotation
xf86GetRotation(ScreenPtr pScreen)
{
if (xf86RandRKey == NULL)
@@ -374,7 +375,7 @@ xf86GetRotation(ScreenPtr pScreen)
}
/* Function to change RandR's idea of the virtual screen size */
-_X_EXPORT Bool
+Bool
xf86RandRSetNewVirtualAndDimensions(ScreenPtr pScreen,
int newvirtX, int newvirtY, int newmmWidth, int newmmHeight,
Bool resetMode)
diff --git a/xorg-server/hw/xfree86/common/xf86ShowOpts.c b/xorg-server/hw/xfree86/common/xf86ShowOpts.c
index b8efa73c2..04a9a8b1c 100644
--- a/xorg-server/hw/xfree86/common/xf86ShowOpts.c
+++ b/xorg-server/hw/xfree86/common/xf86ShowOpts.c
@@ -45,7 +45,6 @@
#include "xf86Parser.h"
#include "xf86tokens.h"
#include "Configint.h"
-#include "vbe.h"
#include "xf86DDC.h"
#if defined(__sparc__) && !defined(__OpenBSD__)
#include "xf86Bus.h"
@@ -104,10 +103,10 @@ void DoShowOptions (void) {
initData = LoaderSymbol (pSymbol);
if (initData) {
XF86ModuleVersionInfo *vers = initData->vers;
+ OptionInfoPtr p;
ErrorF ("Driver[%d]:%s[%s] {\n",
i,xf86DriverList[i]->driverName,vers->vendor
);
- OptionInfoPtr p;
for (p = pOption; p->name != NULL; p++) {
const char *opttype = optionTypeToSting(p->type);
char *optname = xalloc(strlen(p->name) + 2 + 1);
diff --git a/xorg-server/hw/xfree86/common/xf86VGAarbiter.c b/xorg-server/hw/xfree86/common/xf86VGAarbiter.c
new file mode 100644
index 000000000..c38973933
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86VGAarbiter.c
@@ -0,0 +1,1157 @@
+/*
+ * This code was stolen from RAC and adapted to control the legacy vga
+ * interface.
+ *
+ *
+ * Copyright (c) 2007 Paulo R. Zanoni, Tiago Vignatti
+ *
+ * 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 AUTHORS OR COPYRIGHT
+ * HOLDERS 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.
+ *
+ */
+
+#include "xorg-config.h"
+
+#include "xf86VGAarbiter.h"
+
+#ifdef HAVE_PCI_DEVICE_VGAARB_INIT
+#include "xf86VGAarbiterPriv.h"
+#include "xf86Bus.h"
+#include "pciaccess.h"
+
+#ifdef DEBUG
+#error "no, really, you dont want to do this"
+#define DPRINT_S(x,y) ErrorF(x ": %i\n",y);
+#define DPRINT(x) ErrorF(x "\n");
+#else
+#define DPRINT_S(x,y)
+#define DPRINT(x)
+#endif
+
+static GCFuncs VGAarbiterGCFuncs = {
+ VGAarbiterValidateGC, VGAarbiterChangeGC, VGAarbiterCopyGC,
+ VGAarbiterDestroyGC, VGAarbiterChangeClip, VGAarbiterDestroyClip,
+ VGAarbiterCopyClip
+};
+
+static GCOps VGAarbiterGCOps = {
+ VGAarbiterFillSpans, VGAarbiterSetSpans, VGAarbiterPutImage,
+ VGAarbiterCopyArea, VGAarbiterCopyPlane, VGAarbiterPolyPoint,
+ VGAarbiterPolylines, VGAarbiterPolySegment, VGAarbiterPolyRectangle,
+ VGAarbiterPolyArc, VGAarbiterFillPolygon, VGAarbiterPolyFillRect,
+ VGAarbiterPolyFillArc, VGAarbiterPolyText8, VGAarbiterPolyText16,
+ VGAarbiterImageText8, VGAarbiterImageText16, VGAarbiterImageGlyphBlt,
+ VGAarbiterPolyGlyphBlt, VGAarbiterPushPixels,
+ {NULL} /* devPrivate */
+};
+
+static miPointerSpriteFuncRec VGAarbiterSpriteFuncs = {
+ VGAarbiterSpriteRealizeCursor, VGAarbiterSpriteUnrealizeCursor,
+ VGAarbiterSpriteSetCursor, VGAarbiterSpriteMoveCursor,
+ VGAarbiterDeviceCursorInitialize, VGAarbiterDeviceCursorCleanup
+};
+
+static int VGAarbiterKeyIndex;
+static DevPrivateKey VGAarbiterScreenKey = &VGAarbiterKeyIndex;
+static int VGAarbiterGCIndex;
+static DevPrivateKey VGAarbiterGCKey = &VGAarbiterGCIndex;
+
+static int vga_no_arb = 0;
+void
+xf86VGAarbiterInit(void)
+{
+ if (pci_device_vgaarb_init() != 0) {
+ vga_no_arb = 1;
+ xf86Msg(X_WARNING, "VGA arbiter: cannot open kernel arbiter, no multi-card support\n");
+ }
+}
+
+void
+xf86VGAarbiterFini(void)
+{
+ if (vga_no_arb)
+ return;
+ pci_device_vgaarb_fini();
+}
+
+void
+xf86VGAarbiterLock(ScrnInfoPtr pScrn)
+{
+ if (vga_no_arb)
+ return;
+ pci_device_vgaarb_set_target(pScrn->vgaDev);
+ pci_device_vgaarb_lock();
+}
+
+void
+xf86VGAarbiterUnlock(ScrnInfoPtr pScrn)
+{
+ if (vga_no_arb)
+ return;
+ pci_device_vgaarb_unlock();
+}
+
+Bool xf86VGAarbiterAllowDRI(ScreenPtr pScreen)
+{
+ int vga_count;
+ int rsrc_decodes;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+
+ if (vga_no_arb)
+ return TRUE;
+
+ pci_device_vgaarb_get_info(pScrn->vgaDev, &vga_count, &rsrc_decodes);
+ if (vga_count > 1) {
+ if (rsrc_decodes) {
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+void
+xf86VGAarbiterScrnInit(ScrnInfoPtr pScrn)
+{
+ struct pci_device *dev;
+ EntityPtr pEnt;
+
+ if (vga_no_arb)
+ return;
+
+ pEnt = xf86Entities[pScrn->entityList[0]];
+ if (pEnt->bus.type != BUS_PCI)
+ return;
+
+ dev = pEnt->bus.id.pci;
+ pScrn->vgaDev = dev;
+}
+
+void
+xf86VGAarbiterDeviceDecodes(ScrnInfoPtr pScrn)
+{
+ if (vga_no_arb)
+ return;
+ pci_device_vgaarb_decodes(VGA_ARB_RSRC_LEGACY_MEM | VGA_ARB_RSRC_LEGACY_IO);
+}
+
+Bool
+xf86VGAarbiterWrapFunctions(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn;
+ VGAarbiterScreenPtr pScreenPriv;
+ miPointerScreenPtr PointPriv;
+#ifdef RENDER
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+#endif
+
+ if (vga_no_arb)
+ return FALSE;
+
+ pScrn = xf86Screens[pScreen->myNum];
+ PointPriv = dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);
+
+ DPRINT_S("VGAarbiterWrapFunctions",pScreen->myNum);
+
+ if (!dixRequestPrivate(VGAarbiterGCKey, sizeof(VGAarbiterGCRec)))
+ return FALSE;
+
+ if (!(pScreenPriv = xalloc(sizeof(VGAarbiterScreenRec))))
+ return FALSE;
+
+ dixSetPrivate(&pScreen->devPrivates, VGAarbiterScreenKey, pScreenPriv);
+
+ WRAP_SCREEN(CloseScreen, VGAarbiterCloseScreen);
+ WRAP_SCREEN(SaveScreen, VGAarbiterSaveScreen);
+ WRAP_SCREEN(WakeupHandler, VGAarbiterWakeupHandler);
+ WRAP_SCREEN(BlockHandler, VGAarbiterBlockHandler);
+ WRAP_SCREEN(CreateGC, VGAarbiterCreateGC);
+ WRAP_SCREEN(GetImage, VGAarbiterGetImage);
+ WRAP_SCREEN(GetSpans, VGAarbiterGetSpans);
+ WRAP_SCREEN(SourceValidate, VGAarbiterSourceValidate);
+ WRAP_SCREEN(CopyWindow, VGAarbiterCopyWindow);
+ WRAP_SCREEN(ClearToBackground, VGAarbiterClearToBackground);
+ WRAP_SCREEN(CreatePixmap, VGAarbiterCreatePixmap);
+ WRAP_SCREEN(StoreColors, VGAarbiterStoreColors);
+ WRAP_SCREEN(DisplayCursor, VGAarbiterDisplayCursor);
+ WRAP_SCREEN(RealizeCursor, VGAarbiterRealizeCursor);
+ WRAP_SCREEN(UnrealizeCursor, VGAarbiterUnrealizeCursor);
+ WRAP_SCREEN(RecolorCursor, VGAarbiterRecolorCursor);
+ WRAP_SCREEN(SetCursorPosition, VGAarbiterSetCursorPosition);
+#ifdef RENDER
+ WRAP_PICT(Composite,VGAarbiterComposite);
+ WRAP_PICT(Glyphs,VGAarbiterGlyphs);
+ WRAP_PICT(CompositeRects,VGAarbiterCompositeRects);
+#endif
+ WRAP_SCREEN_INFO(AdjustFrame, VGAarbiterAdjustFrame);
+ WRAP_SCREEN_INFO(SwitchMode, VGAarbiterSwitchMode);
+ WRAP_SCREEN_INFO(EnterVT, VGAarbiterEnterVT);
+ WRAP_SCREEN_INFO(LeaveVT, VGAarbiterLeaveVT);
+ WRAP_SCREEN_INFO(FreeScreen, VGAarbiterFreeScreen);
+ WRAP_SPRITE;
+ return TRUE;
+}
+
+/* Screen funcs */
+static Bool
+VGAarbiterCloseScreen (int i, ScreenPtr pScreen)
+{
+ Bool val;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, VGAarbiterScreenKey);
+ miPointerScreenPtr PointPriv = (miPointerScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, miPointerScreenKey);
+#ifdef RENDER
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+#endif
+
+ DPRINT_S("VGAarbiterCloseScreen",pScreen->myNum);
+ UNWRAP_SCREEN(CreateGC);
+ UNWRAP_SCREEN(CloseScreen);
+ UNWRAP_SCREEN(GetImage);
+ UNWRAP_SCREEN(GetSpans);
+ UNWRAP_SCREEN(SourceValidate);
+ UNWRAP_SCREEN(CopyWindow);
+ UNWRAP_SCREEN(ClearToBackground);
+ UNWRAP_SCREEN(SaveScreen);
+ UNWRAP_SCREEN(StoreColors);
+ UNWRAP_SCREEN(DisplayCursor);
+ UNWRAP_SCREEN(RealizeCursor);
+ UNWRAP_SCREEN(UnrealizeCursor);
+ UNWRAP_SCREEN(RecolorCursor);
+ UNWRAP_SCREEN(SetCursorPosition);
+#ifdef RENDER
+ UNWRAP_PICT(Composite);
+ UNWRAP_PICT(Glyphs);
+ UNWRAP_PICT(CompositeRects);
+#endif
+ UNWRAP_SCREEN_INFO(AdjustFrame);
+ UNWRAP_SCREEN_INFO(SwitchMode);
+ UNWRAP_SCREEN_INFO(EnterVT);
+ UNWRAP_SCREEN_INFO(LeaveVT);
+ UNWRAP_SCREEN_INFO(FreeScreen);
+ UNWRAP_SPRITE;
+
+ xfree ((pointer) pScreenPriv);
+ xf86VGAarbiterLock(xf86Screens[i]);
+ val = (*pScreen->CloseScreen) (i, pScreen);
+ xf86VGAarbiterUnlock(xf86Screens[i]);
+ return val;
+}
+
+static void
+VGAarbiterBlockHandler(int i,
+ pointer blockData, pointer pTimeout, pointer pReadmask)
+{
+ ScreenPtr pScreen = screenInfo.screens[i];
+ SCREEN_PROLOG(BlockHandler);
+ VGAGet();
+ pScreen->BlockHandler(i, blockData, pTimeout, pReadmask);
+ VGAPut();
+ SCREEN_EPILOG(BlockHandler, VGAarbiterBlockHandler);
+}
+
+static void
+VGAarbiterWakeupHandler(int i, pointer blockData, unsigned long result, pointer pReadmask)
+{
+ ScreenPtr pScreen = screenInfo.screens[i];
+ SCREEN_PROLOG(WakeupHandler);
+ VGAGet();
+ pScreen->WakeupHandler(i, blockData, result, pReadmask);
+ VGAPut();
+ SCREEN_EPILOG(WakeupHandler, VGAarbiterWakeupHandler);
+}
+
+static void
+VGAarbiterGetImage (
+ DrawablePtr pDrawable,
+ int sx, int sy, int w, int h,
+ unsigned int format,
+ unsigned long planemask,
+ char *pdstLine
+ )
+{
+ ScreenPtr pScreen = pDrawable->pScreen;
+ DPRINT_S("VGAarbiterGetImage",pScreen->myNum);
+ SCREEN_PROLOG(GetImage);
+// if (xf86Screens[pScreen->myNum]->vtSema) {
+ VGAGet();
+// }
+ (*pScreen->GetImage) (pDrawable, sx, sy, w, h,
+ format, planemask, pdstLine);
+ VGAPut();
+ SCREEN_EPILOG (GetImage, VGAarbiterGetImage);
+}
+
+static void
+VGAarbiterGetSpans (
+ DrawablePtr pDrawable,
+ int wMax,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int nspans,
+ char *pdstStart
+ )
+{
+ ScreenPtr pScreen = pDrawable->pScreen;
+
+ DPRINT_S("VGAarbiterGetSpans",pScreen->myNum);
+ SCREEN_PROLOG (GetSpans);
+ VGAGet();
+ (*pScreen->GetSpans) (pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
+ VGAPut();
+ SCREEN_EPILOG (GetSpans, VGAarbiterGetSpans);
+}
+
+static void
+VGAarbiterSourceValidate (
+ DrawablePtr pDrawable,
+ int x, int y, int width, int height )
+{
+ ScreenPtr pScreen = pDrawable->pScreen;
+ DPRINT_S("VGAarbiterSourceValidate",pScreen->myNum);
+ SCREEN_PROLOG (SourceValidate);
+ VGAGet();
+ if (pScreen->SourceValidate)
+ (*pScreen->SourceValidate) (pDrawable, x, y, width, height);
+ VGAPut();
+ SCREEN_EPILOG (SourceValidate, VGAarbiterSourceValidate);
+}
+
+static void
+VGAarbiterCopyWindow(
+ WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc )
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ DPRINT_S("VGAarbiterCopyWindow",pScreen->myNum);
+ SCREEN_PROLOG (CopyWindow);
+ VGAGet();
+ (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
+ VGAPut();
+ SCREEN_EPILOG (CopyWindow, VGAarbiterCopyWindow);
+}
+
+static void
+VGAarbiterClearToBackground (
+ WindowPtr pWin,
+ int x, int y,
+ int w, int h,
+ Bool generateExposures )
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ DPRINT_S("VGAarbiterClearToBackground",pScreen->myNum);
+ SCREEN_PROLOG ( ClearToBackground);
+ VGAGet();
+ (*pScreen->ClearToBackground) (pWin, x, y, w, h, generateExposures);
+ VGAPut();
+ SCREEN_EPILOG (ClearToBackground, VGAarbiterClearToBackground);
+}
+
+static PixmapPtr
+VGAarbiterCreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned usage_hint)
+{
+ PixmapPtr pPix;
+
+ DPRINT_S("VGAarbiterCreatePixmap",pScreen->myNum);
+ SCREEN_PROLOG ( CreatePixmap);
+ VGAGet();
+ pPix = (*pScreen->CreatePixmap) (pScreen, w, h, depth, usage_hint);
+ VGAPut();
+ SCREEN_EPILOG (CreatePixmap, VGAarbiterCreatePixmap);
+
+ return pPix;
+}
+
+static Bool
+VGAarbiterSaveScreen(ScreenPtr pScreen, Bool unblank)
+{
+ Bool val;
+
+ DPRINT_S("VGAarbiterSaveScreen",pScreen->myNum);
+ SCREEN_PROLOG (SaveScreen);
+ VGAGet();
+ val = (*pScreen->SaveScreen) (pScreen, unblank);
+ VGAPut();
+ SCREEN_EPILOG (SaveScreen, VGAarbiterSaveScreen);
+
+ return val;
+}
+
+static void
+VGAarbiterStoreColors (
+ ColormapPtr pmap,
+ int ndef,
+ xColorItem *pdefs)
+{
+ ScreenPtr pScreen = pmap->pScreen;
+
+ DPRINT_S("VGAarbiterStoreColors",pScreen->myNum);
+ SCREEN_PROLOG (StoreColors);
+ VGAGet();
+ (*pScreen->StoreColors) (pmap,ndef,pdefs);
+ VGAPut();
+ SCREEN_EPILOG ( StoreColors, VGAarbiterStoreColors);
+}
+
+static void
+VGAarbiterRecolorCursor (
+ DeviceIntPtr pDev,
+ ScreenPtr pScreen,
+ CursorPtr pCurs,
+ Bool displayed
+ )
+{
+ DPRINT_S("VGAarbiterRecolorCursor",pScreen->myNum);
+ SCREEN_PROLOG (RecolorCursor);
+ VGAGet();
+ (*pScreen->RecolorCursor) (pDev, pScreen, pCurs, displayed);
+ VGAPut();
+ SCREEN_EPILOG ( RecolorCursor, VGAarbiterRecolorCursor);
+}
+
+static Bool
+VGAarbiterRealizeCursor (
+ DeviceIntPtr pDev,
+ ScreenPtr pScreen,
+ CursorPtr pCursor
+ )
+{
+ Bool val;
+
+ DPRINT_S("VGAarbiterRealizeCursor",pScreen->myNum);
+ SCREEN_PROLOG (RealizeCursor);
+ VGAGet();
+ val = (*pScreen->RealizeCursor) (pDev, pScreen,pCursor);
+ VGAPut();
+ SCREEN_EPILOG ( RealizeCursor, VGAarbiterRealizeCursor);
+ return val;
+}
+
+static Bool
+VGAarbiterUnrealizeCursor (
+ DeviceIntPtr pDev,
+ ScreenPtr pScreen,
+ CursorPtr pCursor
+ )
+{
+ Bool val;
+
+ DPRINT_S("VGAarbiterUnrealizeCursor",pScreen->myNum);
+ SCREEN_PROLOG (UnrealizeCursor);
+ VGAGet();
+ val = (*pScreen->UnrealizeCursor) (pDev, pScreen, pCursor);
+ VGAPut();
+ SCREEN_EPILOG ( UnrealizeCursor, VGAarbiterUnrealizeCursor);
+ return val;
+}
+
+static Bool
+VGAarbiterDisplayCursor (
+ DeviceIntPtr pDev,
+ ScreenPtr pScreen,
+ CursorPtr pCursor
+ )
+{
+ Bool val;
+
+ DPRINT_S("VGAarbiterDisplayCursor",pScreen->myNum);
+ SCREEN_PROLOG (DisplayCursor);
+ VGAGet();
+ val = (*pScreen->DisplayCursor) (pDev, pScreen, pCursor);
+ VGAPut();
+ SCREEN_EPILOG ( DisplayCursor, VGAarbiterDisplayCursor);
+ return val;
+}
+
+static Bool
+VGAarbiterSetCursorPosition (
+ DeviceIntPtr pDev,
+ ScreenPtr pScreen,
+ int x, int y,
+ Bool generateEvent)
+{
+ Bool val;
+
+ DPRINT_S("VGAarbiterSetCursorPosition",pScreen->myNum);
+ SCREEN_PROLOG (SetCursorPosition);
+ VGAGet();
+ val = (*pScreen->SetCursorPosition) (pDev, pScreen, x, y, generateEvent);
+ VGAPut();
+ SCREEN_EPILOG ( SetCursorPosition, VGAarbiterSetCursorPosition);
+ return val;
+}
+
+static void
+VGAarbiterAdjustFrame(int index, int x, int y, int flags)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, VGAarbiterScreenKey);
+
+ DPRINT_S("VGAarbiterAdjustFrame",index);
+ VGAGet();
+ (*pScreenPriv->AdjustFrame)(index, x, y, flags);
+ VGAPut();
+}
+
+static Bool
+VGAarbiterSwitchMode(int index, DisplayModePtr mode, int flags)
+{
+ Bool val;
+ ScreenPtr pScreen = screenInfo.screens[index];
+ VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, VGAarbiterScreenKey);
+
+ DPRINT_S("VGAarbiterSwitchMode",index);
+ VGAGet();
+ val = (*pScreenPriv->SwitchMode)(index, mode, flags);
+ VGAPut();
+ return val;
+}
+
+static Bool
+VGAarbiterEnterVT(int index, int flags)
+{
+ Bool val;
+ ScreenPtr pScreen = screenInfo.screens[index];
+ VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, VGAarbiterScreenKey);
+
+ DPRINT_S("VGAarbiterEnterVT",index);
+ VGAGet();
+ val = (*pScreenPriv->EnterVT)(index, flags);
+ VGAPut();
+ return val;
+}
+
+static void
+VGAarbiterLeaveVT(int index, int flags)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, VGAarbiterScreenKey);
+
+ DPRINT_S("VGAarbiterLeaveVT",index);
+
+ VGAGet();
+ (*pScreenPriv->LeaveVT)(index, flags);
+ VGAPut();
+}
+
+static void
+VGAarbiterFreeScreen(int index, int flags)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ VGAarbiterScreenPtr pScreenPriv = (VGAarbiterScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, VGAarbiterScreenKey);
+
+ DPRINT_S("VGAarbiterFreeScreen",index);
+
+ VGAGet();
+ (*pScreenPriv->FreeScreen)(index, flags);
+ VGAPut();
+}
+
+static Bool
+VGAarbiterCreateGC(GCPtr pGC)
+{
+ ScreenPtr pScreen = pGC->pScreen;
+ VGAarbiterGCPtr pGCPriv = (VGAarbiterGCPtr)dixLookupPrivate(&pGC->devPrivates, VGAarbiterGCKey);
+ Bool ret;
+
+ DPRINT_S("VGAarbiterCreateGC",pScreen->myNum);
+ SCREEN_PROLOG(CreateGC);
+ VGAGet();
+ ret = (*pScreen->CreateGC)(pGC);
+ VGAPut();
+ GC_WRAP(pGC);
+ SCREEN_EPILOG(CreateGC,VGAarbiterCreateGC);
+
+ return ret;
+}
+
+/* GC funcs */
+static void
+VGAarbiterValidateGC(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw )
+{
+ GC_UNWRAP(pGC);
+ DPRINT("VGAarbiterValidateGC");
+ (*pGC->funcs->ValidateGC)(pGC, changes, pDraw);
+ GC_WRAP(pGC);
+}
+
+
+static void
+VGAarbiterDestroyGC(GCPtr pGC)
+{
+ GC_UNWRAP (pGC);
+ DPRINT("VGAarbiterDestroyGC");
+ (*pGC->funcs->DestroyGC)(pGC);
+ GC_WRAP (pGC);
+}
+
+static void
+VGAarbiterChangeGC (
+ GCPtr pGC,
+ unsigned long mask)
+{
+ GC_UNWRAP (pGC);
+ DPRINT("VGAarbiterChangeGC");
+ (*pGC->funcs->ChangeGC) (pGC, mask);
+ GC_WRAP (pGC);
+}
+
+static void
+VGAarbiterCopyGC (
+ GCPtr pGCSrc,
+ unsigned long mask,
+ GCPtr pGCDst)
+{
+ GC_UNWRAP (pGCDst);
+ DPRINT("VGAarbiterCopyGC");
+ (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst);
+ GC_WRAP (pGCDst);
+}
+
+static void
+VGAarbiterChangeClip (
+ GCPtr pGC,
+ int type,
+ pointer pvalue,
+ int nrects )
+{
+ GC_UNWRAP (pGC);
+ DPRINT("VGAarbiterChangeClip");
+ (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
+ GC_WRAP (pGC);
+}
+
+static void
+VGAarbiterCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
+{
+ GC_UNWRAP (pgcDst);
+ DPRINT("VGAarbiterCopyClip");
+ (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
+ GC_WRAP (pgcDst);
+}
+
+static void
+VGAarbiterDestroyClip(GCPtr pGC)
+{
+ GC_UNWRAP (pGC);
+ DPRINT("VGAarbiterDestroyClip");
+ (* pGC->funcs->DestroyClip)(pGC);
+ GC_WRAP (pGC);
+}
+
+/* GC Ops */
+static void
+VGAarbiterFillSpans(
+ DrawablePtr pDraw,
+ GC *pGC,
+ int nInit,
+ DDXPointPtr pptInit,
+ int *pwidthInit,
+ int fSorted )
+{
+ GC_UNWRAP(pGC);
+ DPRINT("VGAarbiterFillSpans");
+ VGAGet_GC();
+ (*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+}
+
+static void
+VGAarbiterSetSpans(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ char *pcharsrc,
+ register DDXPointPtr ppt,
+ int *pwidth,
+ int nspans,
+ int fSorted )
+{
+ GC_UNWRAP(pGC);
+ DPRINT("VGAarbiterSetSpans");
+ VGAGet_GC();
+ (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, ppt, pwidth, nspans, fSorted);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+}
+
+static void
+VGAarbiterPutImage(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int depth,
+ int x, int y, int w, int h,
+ int leftPad,
+ int format,
+ char *pImage )
+{
+ GC_UNWRAP(pGC);
+ DPRINT("VGAarbiterPutImage");
+ VGAGet_GC();
+ (*pGC->ops->PutImage)(pDraw, pGC, depth, x, y, w, h,
+ leftPad, format, pImage);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+}
+
+static RegionPtr
+VGAarbiterCopyArea(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GC *pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty )
+{
+ RegionPtr ret;
+
+ GC_UNWRAP(pGC);
+ DPRINT("VGAarbiterCopyArea");
+ VGAGet_GC();
+ ret = (*pGC->ops->CopyArea)(pSrc, pDst,
+ pGC, srcx, srcy, width, height, dstx, dsty);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+ return ret;
+}
+
+static RegionPtr
+VGAarbiterCopyPlane(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty,
+ unsigned long bitPlane )
+{
+ RegionPtr ret;
+
+ GC_UNWRAP(pGC);
+ DPRINT("VGAarbiterCopyPlane");
+ VGAGet_GC();
+ ret = (*pGC->ops->CopyPlane)(pSrc, pDst, pGC, srcx, srcy,
+ width, height, dstx, dsty, bitPlane);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+ return ret;
+}
+
+static void
+VGAarbiterPolyPoint(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ xPoint *pptInit )
+{
+ GC_UNWRAP(pGC);
+ DPRINT("VGAarbiterPolyPoint");
+ VGAGet_GC();
+ (*pGC->ops->PolyPoint)(pDraw, pGC, mode, npt, pptInit);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+}
+
+
+static void
+VGAarbiterPolylines(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr pptInit )
+{
+ GC_UNWRAP(pGC);
+ DPRINT("VGAarbiterPolylines");
+ VGAGet_GC();
+ (*pGC->ops->Polylines)(pDraw, pGC, mode, npt, pptInit);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+}
+
+static void
+VGAarbiterPolySegment(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nseg,
+ xSegment *pSeg )
+{
+ GC_UNWRAP(pGC);
+ DPRINT("VGAarbiterPolySegment");
+ VGAGet_GC();
+ (*pGC->ops->PolySegment)(pDraw, pGC, nseg, pSeg);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+}
+
+static void
+VGAarbiterPolyRectangle(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nRectsInit,
+ xRectangle *pRectsInit )
+{
+ GC_UNWRAP(pGC);
+ DPRINT("VGAarbiterPolyRectangle");
+ VGAGet_GC();
+ (*pGC->ops->PolyRectangle)(pDraw, pGC, nRectsInit, pRectsInit);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+}
+
+static void
+VGAarbiterPolyArc(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int narcs,
+ xArc *parcs )
+{
+ GC_UNWRAP(pGC);
+ DPRINT("VGAarbiterPolyArc");
+ VGAGet_GC();
+ (*pGC->ops->PolyArc)(pDraw, pGC, narcs, parcs);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+}
+
+static void
+VGAarbiterFillPolygon(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int count,
+ DDXPointPtr ptsIn )
+{
+ GC_UNWRAP(pGC);
+ DPRINT("VGAarbiterFillPolygon");
+ VGAGet_GC();
+ (*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, ptsIn);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+}
+
+static void
+VGAarbiterPolyFillRect(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nrectFill,
+ xRectangle *prectInit)
+{
+ GC_UNWRAP(pGC);
+ DPRINT("VGAarbiterPolyFillRect");
+ VGAGet_GC();
+ (*pGC->ops->PolyFillRect)(pDraw, pGC, nrectFill, prectInit);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+}
+
+static void
+VGAarbiterPolyFillArc(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int narcs,
+ xArc *parcs )
+{
+ GC_UNWRAP(pGC);
+ DPRINT("VGAarbiterPolyFillArc");
+ VGAGet_GC();
+ (*pGC->ops->PolyFillArc)(pDraw, pGC, narcs, parcs);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+}
+
+static int
+VGAarbiterPolyText8(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *chars )
+{
+ int ret;
+
+ GC_UNWRAP(pGC);
+ DPRINT("VGAarbiterPolyText8");
+ VGAGet_GC();
+ ret = (*pGC->ops->PolyText8)(pDraw, pGC, x, y, count, chars);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+ return ret;
+}
+
+static int
+VGAarbiterPolyText16(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *chars )
+{
+ int ret;
+
+ GC_UNWRAP(pGC);
+ DPRINT("VGAarbiterPolyText16");
+ VGAGet_GC();
+ ret = (*pGC->ops->PolyText16)(pDraw, pGC, x, y, count, chars);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+ return ret;
+}
+
+static void
+VGAarbiterImageText8(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *chars )
+{
+ GC_UNWRAP(pGC);
+ DPRINT("VGAarbiterImageText8");
+ VGAGet_GC();
+ (*pGC->ops->ImageText8)(pDraw, pGC, x, y, count, chars);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+}
+
+static void
+VGAarbiterImageText16(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *chars )
+{
+ GC_UNWRAP(pGC);
+ DPRINT("VGAarbiterImageText16");
+ VGAGet_GC();
+ (*pGC->ops->ImageText16)(pDraw, pGC, x, y, count, chars);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+}
+
+
+static void
+VGAarbiterImageGlyphBlt(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase )
+{
+ GC_UNWRAP(pGC);
+ DPRINT("VGAarbiterImageGlyphBlt");
+ VGAGet_GC();
+ (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, xInit, yInit,
+ nglyph, ppci, pglyphBase);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+}
+
+static void
+VGAarbiterPolyGlyphBlt(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase )
+{
+ GC_UNWRAP(pGC);
+ DPRINT("VGAarbiterPolyGlyphBlt");
+ VGAGet_GC();
+ (*pGC->ops->PolyGlyphBlt)(pDraw, pGC, xInit, yInit,
+ nglyph, ppci, pglyphBase);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+}
+
+static void
+VGAarbiterPushPixels(
+ GCPtr pGC,
+ PixmapPtr pBitMap,
+ DrawablePtr pDraw,
+ int dx, int dy, int xOrg, int yOrg )
+{
+ GC_UNWRAP(pGC);
+ DPRINT("VGAarbiterPushPixels");
+ VGAGet_GC();
+ (*pGC->ops->PushPixels)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
+ VGAPut_GC();
+ GC_WRAP(pGC);
+}
+
+
+/* miSpriteFuncs */
+static Bool
+VGAarbiterSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCur)
+{
+ Bool val;
+ SPRITE_PROLOG;
+ DPRINT_S("VGAarbiterSpriteRealizeCursor",pScreen->myNum);
+ VGAGet();
+ val = PointPriv->spriteFuncs->RealizeCursor(pDev, pScreen, pCur);
+ VGAPut();
+ SPRITE_EPILOG;
+ return val;
+}
+
+static Bool
+VGAarbiterSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCur)
+{
+ Bool val;
+ SPRITE_PROLOG;
+ DPRINT_S("VGAarbiterSpriteUnrealizeCursor",pScreen->myNum);
+ VGAGet();
+ val = PointPriv->spriteFuncs->UnrealizeCursor(pDev, pScreen, pCur);
+ VGAPut();
+ SPRITE_EPILOG;
+ return val;
+}
+
+static void
+VGAarbiterSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCur, int x, int y)
+{
+ SPRITE_PROLOG;
+ DPRINT_S("VGAarbiterSpriteSetCursor",pScreen->myNum);
+ VGAGet();
+ PointPriv->spriteFuncs->SetCursor(pDev, pScreen, pCur, x, y);
+ VGAPut();
+ SPRITE_EPILOG;
+}
+
+static void
+VGAarbiterSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
+{
+ SPRITE_PROLOG;
+ DPRINT_S("VGAarbiterSpriteMoveCursor",pScreen->myNum);
+ VGAGet();
+ PointPriv->spriteFuncs->MoveCursor(pDev, pScreen, x, y);
+ VGAPut();
+ SPRITE_EPILOG;
+}
+
+static Bool
+VGAarbiterDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
+{
+ Bool val;
+ SPRITE_PROLOG;
+ DPRINT_S("VGAarbiterDeviceCursorInitialize",pScreen->myNum);
+ VGAGet();
+ val = PointPriv->spriteFuncs->DeviceCursorInitialize(pDev, pScreen);
+ VGAPut();
+ SPRITE_EPILOG;
+ return val;
+}
+
+static void
+VGAarbiterDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
+{
+ SPRITE_PROLOG;
+ DPRINT_S("VGAarbiterDeviceCursorCleanup",pScreen->myNum);
+ VGAGet();
+ PointPriv->spriteFuncs->DeviceCursorCleanup(pDev, pScreen);
+ VGAPut();
+ SPRITE_EPILOG;
+}
+
+#ifdef RENDER
+static void
+VGAarbiterComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask,
+ PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask,
+ INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width,
+ CARD16 height)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+
+ PICTURE_PROLOGUE(Composite);
+
+ VGAGet();
+ (*ps->Composite) (op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst,
+ yDst, width, height);
+ VGAPut();
+ PICTURE_EPILOGUE(Composite, VGAarbiterComposite);
+}
+
+static void
+VGAarbiterGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist,
+ GlyphListPtr list, GlyphPtr *glyphs)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+
+ PICTURE_PROLOGUE(Glyphs);
+
+ VGAGet();
+ (*ps->Glyphs)(op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs);
+ VGAPut();
+ PICTURE_EPILOGUE (Glyphs, VGAarbiterGlyphs);
+}
+
+static void
+VGAarbiterCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor *color, int nRect,
+ xRectangle *rects)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+
+ PICTURE_PROLOGUE(CompositeRects);
+
+ VGAGet();
+ (*ps->CompositeRects)(op, pDst, color, nRect, rects);
+ VGAPut();
+ PICTURE_EPILOGUE (CompositeRects, VGAarbiterCompositeRects);
+}
+#endif
+#else
+/* dummy functions */
+void xf86VGAarbiterInit(void) {}
+void xf86VGAarbiterFini(void) {}
+
+void xf86VGAarbiterLock(ScrnInfoPtr pScrn) {}
+void xf86VGAarbiterUnlock(ScrnInfoPtr pScrn) {}
+Bool xf86VGAarbiterAllowDRI(ScreenPtr pScreen) { return TRUE; }
+void xf86VGAarbiterScrnInit(ScrnInfoPtr pScrn) {}
+void xf86VGAarbiterDeviceDecodes(ScrnInfoPtr pScrn) {}
+Bool xf86VGAarbiterWrapFunctions(ScreenPtr pScreen) { return FALSE; }
+
+#endif
diff --git a/xorg-server/hw/xfree86/common/xf86VGAarbiter.h b/xorg-server/hw/xfree86/common/xf86VGAarbiter.h
new file mode 100644
index 000000000..145d31c78
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86VGAarbiter.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2009 Tiago Vignatti
+ *
+ * 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 AUTHORS OR COPYRIGHT
+ * HOLDERS 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.
+ */
+
+#ifndef __XF86VGAARBITER_H
+#define __XF86VGAARBITER_H
+
+#include "screenint.h"
+#include "misc.h"
+#include "xf86.h"
+
+/* Functions */
+extern void xf86VGAarbiterInit(void);
+extern void xf86VGAarbiterFini(void);
+void xf86VGAarbiterScrnInit(ScrnInfoPtr pScrn);
+extern Bool xf86VGAarbiterWrapFunctions(ScreenPtr pScreen);
+extern void xf86VGAarbiterLock(ScrnInfoPtr pScrn);
+extern void xf86VGAarbiterUnlock(ScrnInfoPtr pScrn);
+
+/* allow a driver to remove itself from arbiter - really should be
+ * done in the kernel though */
+extern _X_EXPORT void xf86VGAarbiterDeviceDecodes(ScrnInfoPtr pScrn);
+/* DRI and arbiter are really not possible together,
+ * you really want to remove the card from arbitration if you can */
+extern _X_EXPORT Bool xf86VGAarbiterAllowDRI(ScreenPtr pScreen);
+
+#endif /* __XF86VGAARBITER_H */
diff --git a/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h b/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h
new file mode 100644
index 000000000..40d436856
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h
@@ -0,0 +1,266 @@
+/*
+ * Copyright (c) 2009 Tiago Vignatti
+ *
+ * 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 AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include <X11/X.h>
+#include "colormapst.h"
+#include "scrnintstr.h"
+#include "screenint.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "pixmap.h"
+#include "windowstr.h"
+#include "window.h"
+#include "xf86str.h"
+#include "mipointer.h"
+#include "mipointrst.h"
+#ifdef RENDER
+# include "picturestr.h"
+#endif
+
+
+#define WRAP_SCREEN(x,y) {pScreenPriv->x = pScreen->x; pScreen->x = y;}
+
+#define UNWRAP_SCREEN(x) pScreen->x = pScreenPriv->x
+
+#define SCREEN_PROLOG(x) pScreen->x = ((VGAarbiterScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, VGAarbiterScreenKey))->x
+
+#define SCREEN_EPILOG(x,y) pScreen->x = y;
+
+#define WRAP_PICT(x,y) if (ps) {pScreenPriv->x = ps->x;\
+ ps->x = y;}
+
+#define UNWRAP_PICT(x) if (ps) {ps->x = pScreenPriv->x;}
+
+#define PICTURE_PROLOGUE(field) ps->field = \
+ ((VGAarbiterScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, \
+ VGAarbiterScreenKey))->field
+
+#define PICTURE_EPILOGUE(field, wrap) ps->field = wrap
+
+#define WRAP_SCREEN_INFO(x,y) do {pScreenPriv->x = pScrn->x; pScrn->x = y;} while(0)
+
+#define UNWRAP_SCREEN_INFO(x) pScrn->x = pScreenPriv->x
+
+#define SPRITE_PROLOG miPointerScreenPtr PointPriv = \
+ (miPointerScreenPtr)dixLookupPrivate(&pScreen->devPrivates, \
+ miPointerScreenKey); VGAarbiterScreenPtr pScreenPriv = \
+ ((VGAarbiterScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, \
+ VGAarbiterScreenKey)); PointPriv->spriteFuncs = pScreenPriv->miSprite;
+
+#define SPRITE_EPILOG pScreenPriv->miSprite = PointPriv->spriteFuncs;\
+ PointPriv->spriteFuncs = &VGAarbiterSpriteFuncs;
+
+#define WRAP_SPRITE do { pScreenPriv->miSprite = PointPriv->spriteFuncs;\
+ PointPriv->spriteFuncs = &VGAarbiterSpriteFuncs; \
+ } while (0)
+
+#define UNWRAP_SPRITE PointPriv->spriteFuncs = pScreenPriv->miSprite
+
+#define GC_WRAP(x) pGCPriv->wrapOps = (x)->ops;\
+ pGCPriv->wrapFuncs = (x)->funcs; (x)->ops = &VGAarbiterGCOps;\
+ (x)->funcs = &VGAarbiterGCFuncs;
+
+#define GC_UNWRAP(x) VGAarbiterGCPtr pGCPriv = \
+ (VGAarbiterGCPtr)dixLookupPrivate(&(x)->devPrivates, VGAarbiterGCKey);\
+ (x)->ops = pGCPriv->wrapOps; (x)->funcs = pGCPriv->wrapFuncs;
+
+#define GC_SCREEN register ScrnInfoPtr pScrn = \
+ xf86Screens[pGC->pScreen->myNum]
+
+#define VGAGet(x)\
+ pci_device_vgaarb_set_target(xf86Screens[pScreen->myNum]->vgaDev); \
+ pci_device_vgaarb_lock();
+
+#define VGAGet_GC(x)\
+ pci_device_vgaarb_set_target(xf86Screens[pGC->pScreen->myNum]->vgaDev); \
+ pci_device_vgaarb_lock();
+
+#define VGAPut(x)\
+ pci_device_vgaarb_unlock();
+
+#define VGAPut_GC(x)\
+ pci_device_vgaarb_unlock();
+
+
+typedef struct _VGAarbiterScreen {
+ CreateGCProcPtr CreateGC;
+ CloseScreenProcPtr CloseScreen;
+ ScreenBlockHandlerProcPtr BlockHandler;
+ ScreenWakeupHandlerProcPtr WakeupHandler;
+ GetImageProcPtr GetImage;
+ GetSpansProcPtr GetSpans;
+ SourceValidateProcPtr SourceValidate;
+ CopyWindowProcPtr CopyWindow;
+ ClearToBackgroundProcPtr ClearToBackground;
+ CreatePixmapProcPtr CreatePixmap;
+ SaveScreenProcPtr SaveScreen;
+ /* Colormap */
+ StoreColorsProcPtr StoreColors;
+ /* Cursor */
+ DisplayCursorProcPtr DisplayCursor;
+ RealizeCursorProcPtr RealizeCursor;
+ UnrealizeCursorProcPtr UnrealizeCursor;
+ RecolorCursorProcPtr RecolorCursor;
+ SetCursorPositionProcPtr SetCursorPosition;
+ void (*AdjustFrame)(int,int,int,int);
+ Bool (*SwitchMode)(int, DisplayModePtr,int);
+ Bool (*EnterVT)(int, int);
+ void (*LeaveVT)(int, int);
+ void (*FreeScreen)(int, int);
+ miPointerSpriteFuncPtr miSprite;
+#ifdef RENDER
+ CompositeProcPtr Composite;
+ GlyphsProcPtr Glyphs;
+ CompositeRectsProcPtr CompositeRects;
+#endif
+} VGAarbiterScreenRec, *VGAarbiterScreenPtr;
+
+typedef struct _VGAarbiterGC {
+ GCOps *wrapOps;
+ GCFuncs *wrapFuncs;
+} VGAarbiterGCRec, *VGAarbiterGCPtr;
+
+/* Screen funcs */
+static void VGAarbiterBlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask);
+static void VGAarbiterWakeupHandler(int i, pointer blockData, unsigned long result, pointer pReadmask);
+static Bool VGAarbiterCloseScreen (int i, ScreenPtr pScreen);
+static void VGAarbiterGetImage (DrawablePtr pDrawable, int sx, int sy, int w,
+ int h, unsigned int format, unsigned long planemask, char *pdstLine);
+static void VGAarbiterGetSpans (DrawablePtr pDrawable, int wMax, DDXPointPtr
+ ppt, int *pwidth, int nspans, char *pdstStart);
+static void VGAarbiterSourceValidate (DrawablePtr pDrawable, int x, int y,
+ int width, int height);
+static void VGAarbiterCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc);
+static void VGAarbiterClearToBackground (WindowPtr pWin, int x, int y, int w,
+ int h, Bool generateExposures);
+static PixmapPtr VGAarbiterCreatePixmap(ScreenPtr pScreen, int w, int h,
+ int depth, unsigned int usage_hint);
+static Bool VGAarbiterCreateGC(GCPtr pGC);
+static Bool VGAarbiterSaveScreen(ScreenPtr pScreen, Bool unblank);
+static void VGAarbiterStoreColors (ColormapPtr pmap, int ndef, xColorItem
+ *pdefs);
+static void VGAarbiterRecolorCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
+ CursorPtr pCurs, Bool displayed);
+static Bool VGAarbiterRealizeCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
+ CursorPtr pCursor);
+static Bool VGAarbiterUnrealizeCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
+ CursorPtr pCursor);
+static Bool VGAarbiterDisplayCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
+ CursorPtr pCursor);
+static Bool VGAarbiterSetCursorPosition (DeviceIntPtr pDev, ScreenPtr
+ pScreen, int x, int y, Bool generateEvent);
+static void VGAarbiterAdjustFrame(int index, int x, int y, int flags);
+static Bool VGAarbiterSwitchMode(int index, DisplayModePtr mode, int flags);
+static Bool VGAarbiterEnterVT(int index, int flags);
+static void VGAarbiterLeaveVT(int index, int flags);
+static void VGAarbiterFreeScreen(int index, int flags);
+
+/* GC funcs */
+static void VGAarbiterValidateGC(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw);
+static void VGAarbiterChangeGC(GCPtr pGC, unsigned long mask);
+static void VGAarbiterCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
+static void VGAarbiterDestroyGC(GCPtr pGC);
+static void VGAarbiterChangeClip(GCPtr pGC, int type, pointer pvalue,
+ int nrects);
+static void VGAarbiterDestroyClip(GCPtr pGC);
+static void VGAarbiterCopyClip(GCPtr pgcDst, GCPtr pgcSrc);
+
+/* GC ops */
+static void VGAarbiterFillSpans( DrawablePtr pDraw, GC *pGC, int nInit,
+ DDXPointPtr pptInit, int *pwidthInit, int fSorted);
+static void VGAarbiterSetSpans(DrawablePtr pDraw, GCPtr pGC, char *pcharsrc,
+ register DDXPointPtr ppt, int *pwidth, int nspans, int fSorted);
+static void VGAarbiterPutImage(DrawablePtr pDraw, GCPtr pGC, int depth,
+ int x, int y, int w, int h, int leftPad, int format, char *pImage);
+static RegionPtr VGAarbiterCopyArea(DrawablePtr pSrc, DrawablePtr pDst,
+ GC *pGC, int srcx, int srcy, int width, int height, int dstx, int dsty);
+static RegionPtr VGAarbiterCopyPlane(DrawablePtr pSrc, DrawablePtr pDst,
+ GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty,
+ unsigned long bitPlane);
+static void VGAarbiterPolyPoint(DrawablePtr pDraw, GCPtr pGC, int mode,
+ int npt, xPoint *pptInit);
+static void VGAarbiterPolylines(DrawablePtr pDraw, GCPtr pGC, int mode,
+ int npt, DDXPointPtr pptInit);
+static void VGAarbiterPolySegment(DrawablePtr pDraw, GCPtr pGC, int nseg,
+ xSegment *pSeg);
+static void VGAarbiterPolyRectangle(DrawablePtr pDraw, GCPtr pGC,
+ int nRectsInit, xRectangle *pRectsInit);
+static void VGAarbiterPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs,
+ xArc *parcs);
+static void VGAarbiterFillPolygon(DrawablePtr pDraw, GCPtr pGC, int shape,
+ int mode, int count, DDXPointPtr ptsIn);
+static void VGAarbiterPolyFillRect( DrawablePtr pDraw, GCPtr pGC,
+ int nrectFill, xRectangle *prectInit);
+static void VGAarbiterPolyFillArc(DrawablePtr pDraw, GCPtr pGC, int narcs,
+ xArc *parcs);
+static int VGAarbiterPolyText8(DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, char *chars);
+static int VGAarbiterPolyText16(DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, unsigned short *chars);
+static void VGAarbiterImageText8(DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, char *chars);
+static void VGAarbiterImageText16(DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, unsigned short *chars);
+static void VGAarbiterImageGlyphBlt(DrawablePtr pDraw, GCPtr pGC, int xInit,
+ int yInit, unsigned int nglyph, CharInfoPtr *ppci, pointer pglyphBase);
+static void VGAarbiterPolyGlyphBlt(DrawablePtr pDraw, GCPtr pGC, int xInit,
+ int yInit, unsigned int nglyph, CharInfoPtr *ppci, pointer pglyphBase);
+static void VGAarbiterPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr
+ pDraw, int dx, int dy, int xOrg, int yOrg);
+
+/* miSpriteFuncs */
+static Bool VGAarbiterSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr
+ pScreen, CursorPtr pCur);
+static Bool VGAarbiterSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr
+ pScreen, CursorPtr pCur);
+static void VGAarbiterSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
+ CursorPtr pCur, int x, int y);
+static void VGAarbiterSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
+ int x, int y);
+static Bool VGAarbiterDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen);
+static void VGAarbiterDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen);
+
+
+#ifdef RENDER
+static void VGAarbiterComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask,
+ PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask,
+ INT16 xDst, INT16 yDst, CARD16 width, CARD16 height);
+static void VGAarbiterGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist, GlyphListPtr
+ list, GlyphPtr *glyphs);
+static void VGAarbiterCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor
+ *color, int nRect, xRectangle *rects);
+#endif
diff --git a/xorg-server/hw/xfree86/common/xf86VidMode.c b/xorg-server/hw/xfree86/common/xf86VidMode.c
index 24fccd31b..49b86e73a 100644
--- a/xorg-server/hw/xfree86/common/xf86VidMode.c
+++ b/xorg-server/hw/xfree86/common/xf86VidMode.c
@@ -56,20 +56,14 @@ static Bool VidModeClose(int i, ScreenPtr pScreen);
#endif
-#ifdef DEBUG
-# define DEBUG_P(x) ErrorF(x"\n");
-#else
-# define DEBUG_P(x) /**/
-#endif
-
-_X_EXPORT Bool
+Bool
VidModeExtensionInit(ScreenPtr pScreen)
{
#ifdef XF86VIDMODE
VidModePtr pVidMode;
if (!xf86GetVidModeEnabled()) {
- DEBUG_P("!xf86GetVidModeEnabled()");
+ DebugF("!xf86GetVidModeEnabled()\n");
return FALSE;
}
@@ -77,7 +71,7 @@ VidModeExtensionInit(ScreenPtr pScreen)
if (!dixSetPrivate(&pScreen->devPrivates, VidModeKey,
xcalloc(sizeof(VidModeRec), 1))) {
- DEBUG_P("xcalloc failed");
+ DebugF("xcalloc failed\n");
return FALSE;
}
@@ -89,7 +83,7 @@ VidModeExtensionInit(ScreenPtr pScreen)
VidModeCount++;
return TRUE;
#else
- DEBUG_P("no vidmode extension");
+ DebugF("no vidmode extension\n");
return FALSE;
#endif
}
@@ -123,13 +117,13 @@ VidModeAvailable(int scrnIndex)
VidModePtr pVidMode;
if (VidModeKey == NULL) {
- DEBUG_P("VidModeKey == NULL");
+ DebugF("VidModeKey == NULL\n");
return FALSE;
}
pScrn = xf86Screens[scrnIndex];
if (pScrn == NULL) {
- DEBUG_P("pScrn == NULL");
+ DebugF("pScrn == NULL\n");
return FALSE;
}
@@ -137,12 +131,12 @@ VidModeAvailable(int scrnIndex)
if (pVidMode)
return TRUE;
else {
- DEBUG_P("pVidMode == NULL");
+ DebugF("pVidMode == NULL\n");
return FALSE;
}
}
-_X_EXPORT Bool
+Bool
VidModeGetCurrentModeline(int scrnIndex, pointer *mode, int *dotClock)
{
ScrnInfoPtr pScrn;
@@ -161,7 +155,7 @@ VidModeGetCurrentModeline(int scrnIndex, pointer *mode, int *dotClock)
return FALSE;
}
-_X_EXPORT int
+int
VidModeGetDotClock(int scrnIndex, int Clock)
{
ScrnInfoPtr pScrn;
@@ -176,7 +170,7 @@ VidModeGetDotClock(int scrnIndex, int Clock)
return pScrn->clock[Clock];
}
-_X_EXPORT int
+int
VidModeGetNumOfClocks(int scrnIndex, Bool *progClock)
{
ScrnInfoPtr pScrn;
@@ -194,7 +188,7 @@ VidModeGetNumOfClocks(int scrnIndex, Bool *progClock)
}
}
-_X_EXPORT Bool
+Bool
VidModeGetClocks(int scrnIndex, int *Clocks)
{
ScrnInfoPtr pScrn;
@@ -215,7 +209,7 @@ VidModeGetClocks(int scrnIndex, int *Clocks)
}
-_X_EXPORT Bool
+Bool
VidModeGetFirstModeline(int scrnIndex, pointer *mode, int *dotClock)
{
ScrnInfoPtr pScrn;
@@ -238,7 +232,7 @@ VidModeGetFirstModeline(int scrnIndex, pointer *mode, int *dotClock)
return VidModeGetNextModeline(scrnIndex, mode, dotClock);
}
-_X_EXPORT Bool
+Bool
VidModeGetNextModeline(int scrnIndex, pointer *mode, int *dotClock)
{
ScrnInfoPtr pScrn;
@@ -263,7 +257,7 @@ VidModeGetNextModeline(int scrnIndex, pointer *mode, int *dotClock)
return FALSE;
}
-_X_EXPORT Bool
+Bool
VidModeDeleteModeline(int scrnIndex, pointer mode)
{
ScrnInfoPtr pScrn;
@@ -276,7 +270,7 @@ VidModeDeleteModeline(int scrnIndex, pointer mode)
return TRUE;
}
-_X_EXPORT Bool
+Bool
VidModeZoomViewport(int scrnIndex, int zoom)
{
ScrnInfoPtr pScrn;
@@ -289,7 +283,7 @@ VidModeZoomViewport(int scrnIndex, int zoom)
return TRUE;
}
-_X_EXPORT Bool
+Bool
VidModeSetViewPort(int scrnIndex, int x, int y)
{
ScrnInfoPtr pScrn;
@@ -310,7 +304,7 @@ VidModeSetViewPort(int scrnIndex, int x, int y)
return TRUE;
}
-_X_EXPORT Bool
+Bool
VidModeGetViewPort(int scrnIndex, int *x, int *y)
{
ScrnInfoPtr pScrn;
@@ -324,7 +318,7 @@ VidModeGetViewPort(int scrnIndex, int *x, int *y)
return TRUE;
}
-_X_EXPORT Bool
+Bool
VidModeSwitchMode(int scrnIndex, pointer mode)
{
ScrnInfoPtr pScrn;
@@ -346,7 +340,7 @@ VidModeSwitchMode(int scrnIndex, pointer mode)
return retval;
}
-_X_EXPORT Bool
+Bool
VidModeLockZoom(int scrnIndex, Bool lock)
{
ScrnInfoPtr pScrn;
@@ -363,7 +357,7 @@ VidModeLockZoom(int scrnIndex, Bool lock)
return TRUE;
}
-_X_EXPORT Bool
+Bool
VidModeGetMonitor(int scrnIndex, pointer *monitor)
{
ScrnInfoPtr pScrn;
@@ -377,7 +371,7 @@ VidModeGetMonitor(int scrnIndex, pointer *monitor)
return TRUE;
}
-_X_EXPORT ModeStatus
+ModeStatus
VidModeCheckModeForMonitor(int scrnIndex, pointer mode)
{
ScrnInfoPtr pScrn;
@@ -390,7 +384,7 @@ VidModeCheckModeForMonitor(int scrnIndex, pointer mode)
return xf86CheckModeForMonitor((DisplayModePtr)mode, pScrn->monitor);
}
-_X_EXPORT ModeStatus
+ModeStatus
VidModeCheckModeForDriver(int scrnIndex, pointer mode)
{
ScrnInfoPtr pScrn;
@@ -403,7 +397,7 @@ VidModeCheckModeForDriver(int scrnIndex, pointer mode)
return xf86CheckModeForDriver(pScrn, (DisplayModePtr)mode, 0);
}
-_X_EXPORT void
+void
VidModeSetCrtcForMode(int scrnIndex, pointer mode)
{
ScrnInfoPtr pScrn;
@@ -422,7 +416,7 @@ VidModeSetCrtcForMode(int scrnIndex, pointer mode)
return;
}
-_X_EXPORT Bool
+Bool
VidModeAddModeline(int scrnIndex, pointer mode)
{
ScrnInfoPtr pScrn;
@@ -443,7 +437,7 @@ VidModeAddModeline(int scrnIndex, pointer mode)
return TRUE;
}
-_X_EXPORT int
+int
VidModeGetNumOfModes(int scrnIndex)
{
pointer mode = NULL;
@@ -459,7 +453,7 @@ VidModeGetNumOfModes(int scrnIndex)
} while (TRUE);
}
-_X_EXPORT Bool
+Bool
VidModeSetGamma(int scrnIndex, float red, float green, float blue)
{
ScrnInfoPtr pScrn;
@@ -478,7 +472,7 @@ VidModeSetGamma(int scrnIndex, float red, float green, float blue)
return TRUE;
}
-_X_EXPORT Bool
+Bool
VidModeGetGamma(int scrnIndex, float *red, float *green, float *blue)
{
ScrnInfoPtr pScrn;
@@ -493,7 +487,7 @@ VidModeGetGamma(int scrnIndex, float *red, float *green, float *blue)
return TRUE;
}
-_X_EXPORT Bool
+Bool
VidModeSetGammaRamp(int scrnIndex, int size, CARD16 *r, CARD16 *g, CARD16 *b)
{
ScrnInfoPtr pScrn;
@@ -506,7 +500,7 @@ VidModeSetGammaRamp(int scrnIndex, int size, CARD16 *r, CARD16 *g, CARD16 *b)
return TRUE;
}
-_X_EXPORT Bool
+Bool
VidModeGetGammaRamp(int scrnIndex, int size, CARD16 *r, CARD16 *g, CARD16 *b)
{
ScrnInfoPtr pScrn;
@@ -519,7 +513,7 @@ VidModeGetGammaRamp(int scrnIndex, int size, CARD16 *r, CARD16 *g, CARD16 *b)
return TRUE;
}
-_X_EXPORT int
+int
VidModeGetGammaRampSize(int scrnIndex)
{
if (!VidModeAvailable(scrnIndex))
@@ -528,7 +522,7 @@ VidModeGetGammaRampSize(int scrnIndex)
return xf86GetGammaRampSize(xf86Screens[scrnIndex]->pScreen);
}
-_X_EXPORT pointer
+pointer
VidModeCreateMode(void)
{
DisplayModePtr mode;
@@ -544,14 +538,14 @@ VidModeCreateMode(void)
return mode;
}
-_X_EXPORT void
+void
VidModeCopyMode(pointer modefrom, pointer modeto)
{
memcpy(modeto, modefrom, sizeof(DisplayModeRec));
}
-_X_EXPORT int
+int
VidModeGetModeValue(pointer mode, int valtyp)
{
int ret = 0;
@@ -594,7 +588,7 @@ VidModeGetModeValue(pointer mode, int valtyp)
return ret;
}
-_X_EXPORT void
+void
VidModeSetModeValue(pointer mode, int valtyp, int val)
{
switch (valtyp) {
@@ -635,7 +629,7 @@ VidModeSetModeValue(pointer mode, int valtyp, int val)
return;
}
-_X_EXPORT vidMonitorValue
+vidMonitorValue
VidModeGetMonitorValue(pointer monitor, int valtyp, int indx)
{
vidMonitorValue ret;
diff --git a/xorg-server/hw/xfree86/common/xf86Xinput.c b/xorg-server/hw/xfree86/common/xf86Xinput.c
index 1f412349c..3543811db 100644
--- a/xorg-server/hw/xfree86/common/xf86Xinput.c
+++ b/xorg-server/hw/xfree86/common/xf86Xinput.c
@@ -54,6 +54,7 @@
#include <X11/Xmd.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
+#include <X11/Xatom.h>
#include "xf86.h"
#include "xf86Priv.h"
#include "xf86Xinput.h"
@@ -65,15 +66,14 @@
#include "extinit.h"
#ifdef DPMSExtension
-#define DPMS_SERVER
-#include <X11/extensions/dpms.h>
+#include <X11/extensions/dpmsconst.h>
#include "dpmsproc.h"
#endif
#include "exevents.h" /* AddInputDevice */
#include "exglobals.h"
+#include "eventstr.h"
-#define EXTENSION_PROC_ARGS void *
#include "extnsionst.h"
#include "windowstr.h" /* screenIsSaved */
@@ -85,14 +85,13 @@
#include "mi.h"
#include <ptrveloc.h> /* dix pointer acceleration */
+#include <xserver-properties.h>
#ifdef XFreeXDGA
#include "dgaproc.h"
#endif
-#ifdef XKB
#include "xkbsrv.h"
-#endif
#include "os.h"
@@ -102,54 +101,79 @@ EventListPtr xf86Events = NULL;
* Eval config and modify DeviceVelocityRec accordingly
*/
static void
-ProcessVelocityConfiguration(char* devname, pointer list, DeviceVelocityPtr s){
- int tempi, i;
- float tempf, tempf2;
+ProcessVelocityConfiguration(DeviceIntPtr pDev, char* devname, pointer list,
+ DeviceVelocityPtr s)
+{
+ int tempi;
+ float tempf;
+ Atom float_prop = XIGetKnownProperty(XATOM_FLOAT);
+ Atom prop;
if(!s)
return;
- tempf = xf86SetRealOption(list, "FilterHalflife", -1);
- if(tempf > 0)
- tempf = 1.0 / tempf; /* set reciprocal if possible */
-
- tempf2 = xf86SetRealOption(list, "FilterChainProgression", 2.0);
- xf86Msg(X_CONFIG, "%s: (accel) filter chain progression: %.2f\n",
- devname, tempf2);
- if(tempf2 < 1)
- tempf2 = 2;
-
- tempi = xf86SetIntOption(list, "FilterChainLength", 1);
- if(tempi < 1 || tempi > MAX_VELOCITY_FILTERS)
- tempi = 1;
-
- if(tempf > 0.0f && tempi >= 1 && tempf2 >= 1.0f)
- InitFilterChain(s, tempf, tempf2, tempi, 40);
-
- for(i = 0; i < tempi; i++)
- xf86Msg(X_CONFIG, "%s: (accel) filter stage %i: %.2f ms\n",
- devname, i, 1.0f / (s->filters[i].rdecay));
-
- tempf = xf86SetRealOption(list, "ConstantDeceleration", 1.0);
+ /* common settings (available via device properties) */
+ tempf = xf86SetIntOption(list, "ConstantDeceleration", 1);
if(tempf > 1.0){
xf86Msg(X_CONFIG, "%s: (accel) constant deceleration by %.1f\n",
devname, tempf);
- s->const_acceleration = 1.0 / tempf; /* set reciprocal deceleration
- alias acceleration */
+ prop = XIGetKnownProperty(ACCEL_PROP_CONSTANT_DECELERATION);
+ XIChangeDeviceProperty(pDev, prop, float_prop, 32,
+ PropModeReplace, 1, &tempf, FALSE);
}
- tempf = xf86SetRealOption(list, "AdaptiveDeceleration", 1.0);
+ tempf = xf86SetIntOption(list, "AdaptiveDeceleration", 1);
if(tempf > 1.0){
xf86Msg(X_CONFIG, "%s: (accel) adaptive deceleration by %.1f\n",
devname, tempf);
- s->min_acceleration = 1.0 / tempf; /* set minimum acceleration */
+ prop = XIGetKnownProperty(ACCEL_PROP_ADAPTIVE_DECELERATION);
+ XIChangeDeviceProperty(pDev, prop, float_prop, 32,
+ PropModeReplace, 1, &tempf, FALSE);
+ }
+
+ /* select profile by number */
+ tempi = xf86SetIntOption(list, "AccelerationProfile",
+ s->statistics.profile_number);
+
+ prop = XIGetKnownProperty(ACCEL_PROP_PROFILE_NUMBER);
+ if (XIChangeDeviceProperty(pDev, prop, XA_INTEGER, 32,
+ PropModeReplace, 1, &tempi, FALSE) == Success)
+ {
+ xf86Msg(X_CONFIG, "%s: (accel) acceleration profile %i\n", devname,
+ tempi);
+ } else {
+ xf86Msg(X_CONFIG, "%s: (accel) acceleration profile %i is unknown\n",
+ devname, tempi);
+ }
+
+ /* set scaling */
+ tempf = xf86SetRealOption(list, "ExpectedRate", 0);
+ prop = XIGetKnownProperty(ACCEL_PROP_VELOCITY_SCALING);
+ if(tempf > 0){
+ tempf = 1000.0 / tempf;
+ XIChangeDeviceProperty(pDev, prop, float_prop, 32,
+ PropModeReplace, 1, &tempf, FALSE);
+ }else{
+ tempf = xf86SetRealOption(list, "VelocityScale", s->corr_mul);
+ XIChangeDeviceProperty(pDev, prop, float_prop, 32,
+ PropModeReplace, 1, &tempf, FALSE);
+ }
+
+ tempi = xf86SetIntOption(list, "VelocityTrackerCount", -1);
+ if(tempi > 1){
+ InitTrackers(s, tempi);
}
- tempf = xf86SetRealOption(list, "VelocityCoupling", -1);
+ s->initial_range = xf86SetIntOption(list, "VelocityInitialRange",
+ s->initial_range);
+
+ s->max_diff = xf86SetRealOption(list, "VelocityAbsDiff", s->max_diff);
+
+ tempf = xf86SetRealOption(list, "VelocityRelDiff", -1);
if(tempf >= 0){
- xf86Msg(X_CONFIG, "%s: (accel) velocity coupling is %.1f%%\n", devname,
- tempf*100.0);
- s->coupling = tempf;
+ xf86Msg(X_CONFIG, "%s: (accel) max rel. velocity difference: %.1f%%\n",
+ devname, tempf*100.0);
+ s->max_rel_diff = tempf;
}
/* Configure softening. If const deceleration is used, this is expected
@@ -163,24 +187,6 @@ ProcessVelocityConfiguration(char* devname, pointer list, DeviceVelocityPtr s){
s->average_accel);
s->reset_time = xf86SetIntOption(list, "VelocityReset", s->reset_time);
-
- tempf = xf86SetRealOption(list, "ExpectedRate", 0);
- if(tempf > 0){
- s->corr_mul = 1000.0 / tempf;
- }else{
- s->corr_mul = xf86SetRealOption(list, "VelocityScale", s->corr_mul);
- }
-
- /* select profile by number */
- tempi= xf86SetIntOption(list, "AccelerationProfile",
- s->statistics.profile_number);
-
- if(SetAccelerationProfile(s, tempi)){
- xf86Msg(X_CONFIG, "%s: (accel) set acceleration profile %i\n", devname, tempi);
- }else{
- xf86Msg(X_CONFIG, "%s: (accel) acceleration profile %i is unknown\n",
- devname, tempi);
- }
}
static void
@@ -229,7 +235,7 @@ ApplyAccelerationSettings(DeviceIntPtr dev){
switch(scheme){
case PtrAccelPredictable:
pVel = GetDevicePredictableAccelData(dev);
- ProcessVelocityConfiguration (local->name, local->options,
+ ProcessVelocityConfiguration (dev, local->name, local->options,
pVel);
break;
}
@@ -255,7 +261,7 @@ xf86SendDragEvents(DeviceIntPtr device)
*
***********************************************************************
*/
-_X_EXPORT void
+void
xf86ProcessCommonOptions(LocalDevicePtr local,
pointer list)
{
@@ -293,7 +299,7 @@ xf86ProcessCommonOptions(LocalDevicePtr local,
* Returns TRUE on success, or FALSE otherwise.
***********************************************************************
*/
-_X_EXPORT int
+int
xf86ActivateDevice(LocalDevicePtr local)
{
DeviceIntPtr dev;
@@ -317,24 +323,14 @@ xf86ActivateDevice(LocalDevicePtr local)
local->dev = dev;
dev->coreEvents = local->flags & XI86_ALWAYS_CORE;
- dev->isMaster = FALSE;
+ dev->type = SLAVE;
dev->spriteInfo->spriteOwner = FALSE;
- if (DeviceIsPointerType(dev))
- {
- dev->deviceGrab.ActivateGrab = ActivatePointerGrab;
- dev->deviceGrab.DeactivateGrab = DeactivatePointerGrab;
- } else
- {
- dev->deviceGrab.ActivateGrab = ActivateKeyboardGrab;
- dev->deviceGrab.DeactivateGrab = DeactivateKeyboardGrab;
- }
+ dev->deviceGrab.ActivateGrab = ActivateKeyboardGrab;
+ dev->deviceGrab.DeactivateGrab = DeactivateKeyboardGrab;
RegisterOtherDevice(dev);
-#ifdef XKB
- if (!noXkbExtension)
- XkbSetExtension(dev, ProcessKeyboardEvent);
-#endif
+ XkbSetExtension(dev, ProcessKeyboardEvent);
if (serverGeneration == 1)
xf86Msg(X_INFO, "XINPUT: Adding extended input device \"%s\" (type: %s)\n",
@@ -374,7 +370,7 @@ OpenInputDevice(DeviceIntPtr dev,
int *status)
{
if (!dev->inited)
- ActivateDevice(dev);
+ ActivateDevice(dev, TRUE);
*status = Success;
}
@@ -471,7 +467,7 @@ ChangeDeviceControl (ClientPtr client, DeviceIntPtr dev, xDeviceCtl *control)
}
void
-AddOtherInputDevices()
+AddOtherInputDevices(void)
{
}
@@ -541,18 +537,24 @@ xf86NewInputDevice(IDevPtr idev, DeviceIntPtr *pdev, BOOL enable)
}
dev = pInfo->dev;
- rval = ActivateDevice(dev);
+ rval = ActivateDevice(dev, TRUE);
if (rval != Success)
{
xf86Msg(X_ERROR, "Couldn't init device \"%s\"\n", idev->identifier);
- RemoveDevice(dev);
+ RemoveDevice(dev, TRUE);
goto unwind;
}
/* Enable it if it's properly initialised and we're currently in the VT */
if (enable && dev->inited && dev->startup && xf86Screens[0]->vtSema)
{
- EnableDevice(dev);
+ EnableDevice(dev, TRUE);
+ if (!dev->enabled)
+ {
+ xf86Msg(X_ERROR, "Couldn't init device \"%s\"\n", idev->identifier);
+ rval = BadMatch;
+ goto unwind;
+ }
/* send enter/leave event, update sprite window */
CheckMotion(NULL, dev);
}
@@ -570,7 +572,7 @@ unwind:
return rval;
}
-_X_EXPORT int
+int
NewInputDeviceRequest (InputOption *options, DeviceIntPtr *pdev)
{
IDevRec *idev = NULL;
@@ -611,12 +613,11 @@ NewInputDeviceRequest (InputOption *options, DeviceIntPtr *pdev)
/* Right now, the only automatic config we know of is HAL. */
if (strcmp(option->key, "_source") == 0 &&
strcmp(option->value, "server/hal") == 0) {
+ is_auto = 1;
if (!xf86Info.autoAddDevices) {
rval = BadMatch;
goto unwind;
}
-
- is_auto = 1;
}
}
if (!idev->driver || !idev->identifier) {
@@ -645,6 +646,8 @@ NewInputDeviceRequest (InputOption *options, DeviceIntPtr *pdev)
return Success;
unwind:
+ if (is_auto && !xf86Info.autoAddDevices)
+ xf86Msg(X_INFO, "AutoAddDevices is off - not adding device.\n");
if(idev->driver)
xfree(idev->driver);
if(idev->identifier)
@@ -654,14 +657,14 @@ unwind:
return rval;
}
-_X_EXPORT void
+void
DeleteInputDeviceRequest(DeviceIntPtr pDev)
{
LocalDevicePtr pInfo = (LocalDevicePtr) pDev->public.devicePrivate;
InputDriverPtr drv = NULL;
IDevRec *idev = NULL;
IDevPtr *it;
- Bool isMaster = pDev->isMaster;
+ Bool isMaster = IsMaster(pDev);
if (pInfo) /* need to get these before RemoveDevice */
{
@@ -670,9 +673,9 @@ DeleteInputDeviceRequest(DeviceIntPtr pDev)
}
OsBlockSignals();
- RemoveDevice(pDev);
+ RemoveDevice(pDev, TRUE);
- if (!isMaster)
+ if (!isMaster && pInfo != NULL)
{
if(drv->UnInit)
drv->UnInit(drv, pInfo, 0);
@@ -699,7 +702,7 @@ DeleteInputDeviceRequest(DeviceIntPtr pDev)
* convenient functions to post events
*/
-_X_EXPORT void
+void
xf86PostMotionEvent(DeviceIntPtr device,
int is_absolute,
int first_valuator,
@@ -710,11 +713,7 @@ xf86PostMotionEvent(DeviceIntPtr device,
int i = 0;
static int valuators[MAX_VALUATORS];
- if (num_valuators > MAX_VALUATORS) {
- xf86Msg(X_ERROR, "%s: num_valuator %d is greater than"
- " MAX_VALUATORS\n", __FUNCTION__, num_valuators);
- return;
- }
+ XI_VERIFY_VALUATORS(num_valuators);
va_start(var, num_valuators);
for (i = 0; i < num_valuators; i++)
@@ -724,7 +723,7 @@ xf86PostMotionEvent(DeviceIntPtr device,
xf86PostMotionEventP(device, is_absolute, first_valuator, num_valuators, valuators);
}
-_X_EXPORT void
+void
xf86PostMotionEventP(DeviceIntPtr device,
int is_absolute,
int first_valuator,
@@ -734,15 +733,11 @@ xf86PostMotionEventP(DeviceIntPtr device,
int i = 0, nevents = 0;
int dx = 0, dy = 0;
Bool drag = xf86SendDragEvents(device);
- xEvent *xE = NULL;
+ DeviceEvent *event;
int index;
int flags = 0;
- if (num_valuators > MAX_VALUATORS) {
- xf86Msg(X_ERROR, "%s: num_valuator %d is greater than"
- " MAX_VALUATORS\n", __FUNCTION__, num_valuators);
- return;
- }
+ XI_VERIFY_VALUATORS(num_valuators);
if (is_absolute)
flags = POINTER_ABSOLUTE;
@@ -780,16 +775,17 @@ xf86PostMotionEventP(DeviceIntPtr device,
valuators);
for (i = 0; i < nevents; i++) {
- xE = (xf86Events + i)->event;
+ event = (DeviceEvent*)((xf86Events + i)->event);
/* Don't post core motion events for devices not registered to send
* drag events. */
- if (xE->u.u.type != MotionNotify || drag) {
- mieqEnqueue(device, (xf86Events + i)->event);
+ if (event->header == ET_Internal &&
+ (event->type != ET_Motion || drag)) {
+ mieqEnqueue(device, (InternalEvent*)((xf86Events + i)->event));
}
}
}
-_X_EXPORT void
+void
xf86PostProximityEvent(DeviceIntPtr device,
int is_in,
int first_valuator,
@@ -797,31 +793,42 @@ xf86PostProximityEvent(DeviceIntPtr device,
...)
{
va_list var;
- int i, nevents;
+ int i;
int valuators[MAX_VALUATORS];
-
- if (num_valuators > MAX_VALUATORS) {
- xf86Msg(X_ERROR, "%s: num_valuator %d is greater than"
- " MAX_VALUATORS\n", __FUNCTION__, num_valuators);
- return;
- }
+ XI_VERIFY_VALUATORS(num_valuators);
va_start(var, num_valuators);
for (i = 0; i < num_valuators; i++)
valuators[i] = va_arg(var, int);
va_end(var);
+ xf86PostProximityEventP(device, is_in, first_valuator, num_valuators,
+ valuators);
+
+}
+
+void
+xf86PostProximityEventP(DeviceIntPtr device,
+ int is_in,
+ int first_valuator,
+ int num_valuators,
+ int *valuators)
+{
+ int i, nevents;
+
+ XI_VERIFY_VALUATORS(num_valuators);
+
GetEventList(&xf86Events);
nevents = GetProximityEvents(xf86Events, device,
is_in ? ProximityIn : ProximityOut,
first_valuator, num_valuators, valuators);
for (i = 0; i < nevents; i++)
- mieqEnqueue(device, (xf86Events + i)->event);
+ mieqEnqueue(device, (InternalEvent*)((xf86Events + i)->event));
}
-_X_EXPORT void
+void
xf86PostButtonEvent(DeviceIntPtr device,
int is_absolute,
int button,
@@ -832,8 +839,39 @@ xf86PostButtonEvent(DeviceIntPtr device,
{
va_list var;
int valuators[MAX_VALUATORS];
+ int i = 0;
+
+ XI_VERIFY_VALUATORS(num_valuators);
+
+ va_start(var, num_valuators);
+ for (i = 0; i < num_valuators; i++)
+ valuators[i] = va_arg(var, int);
+ va_end(var);
+
+ xf86PostButtonEventP(device, is_absolute, button, is_down, first_valuator,
+ num_valuators, valuators);
+
+}
+
+void
+xf86PostButtonEventP(DeviceIntPtr device,
+ int is_absolute,
+ int button,
+ int is_down,
+ int first_valuator,
+ int num_valuators,
+ int *valuators)
+{
int i = 0, nevents = 0;
int index;
+ int flags = 0;
+
+ XI_VERIFY_VALUATORS(num_valuators);
+
+ if (is_absolute)
+ flags = POINTER_ABSOLUTE;
+ else
+ flags = POINTER_RELATIVE | POINTER_ACCELERATE;
#if XFreeXDGA
if (miPointerGetScreen(device)) {
@@ -842,29 +880,18 @@ xf86PostButtonEvent(DeviceIntPtr device,
return;
}
#endif
- if (num_valuators > MAX_VALUATORS) {
- xf86Msg(X_ERROR, "%s: num_valuator %d is greater than"
- " MAX_VALUATORS\n", __FUNCTION__, num_valuators);
- return;
- }
-
- va_start(var, num_valuators);
- for (i = 0; i < num_valuators; i++)
- valuators[i] = va_arg(var, int);
- va_end(var);
GetEventList(&xf86Events);
nevents = GetPointerEvents(xf86Events, device,
is_down ? ButtonPress : ButtonRelease, button,
- (is_absolute) ? POINTER_ABSOLUTE : POINTER_RELATIVE,
- first_valuator, num_valuators, valuators);
+ flags, first_valuator, num_valuators, valuators);
for (i = 0; i < nevents; i++)
- mieqEnqueue(device, (xf86Events + i)->event);
+ mieqEnqueue(device, (InternalEvent*)((xf86Events + i)->event));
}
-_X_EXPORT void
+void
xf86PostKeyEvent(DeviceIntPtr device,
unsigned int key_code,
int is_down,
@@ -874,7 +901,7 @@ xf86PostKeyEvent(DeviceIntPtr device,
...)
{
va_list var;
- int i = 0, nevents = 0;
+ int i = 0;
static int valuators[MAX_VALUATORS];
/* instil confidence in the user */
@@ -882,18 +909,37 @@ xf86PostKeyEvent(DeviceIntPtr device,
"badly south after this message, then xf86PostKeyEvent is "
"broken.\n");
- if (num_valuators > MAX_VALUATORS) {
- xf86Msg(X_ERROR, "%s: num_valuator %d is greater than"
- " MAX_VALUATORS\n", __FUNCTION__, num_valuators);
- return;
- }
+ XI_VERIFY_VALUATORS(num_valuators);
- if (is_absolute) {
- va_start(var, num_valuators);
- for (i = 0; i < num_valuators; i++)
- valuators[i] = va_arg(var, int);
- va_end(var);
+ va_start(var, num_valuators);
+ for (i = 0; i < num_valuators; i++)
+ valuators[i] = va_arg(var, int);
+ va_end(var);
+ xf86PostKeyEventP(device, key_code, is_down, is_absolute, first_valuator,
+ num_valuators, valuators);
+
+}
+
+void
+xf86PostKeyEventP(DeviceIntPtr device,
+ unsigned int key_code,
+ int is_down,
+ int is_absolute,
+ int first_valuator,
+ int num_valuators,
+ int *valuators)
+{
+ int i = 0, nevents = 0;
+
+ /* instil confidence in the user */
+ DebugF("this function has never been tested properly. if things go quite "
+ "badly south after this message, then xf86PostKeyEvent is "
+ "broken.\n");
+
+ XI_VERIFY_VALUATORS(num_valuators);
+
+ if (is_absolute) {
GetEventList(&xf86Events);
nevents = GetKeyboardValuatorEvents(xf86Events, device,
is_down ? KeyPress : KeyRelease,
@@ -907,40 +953,19 @@ xf86PostKeyEvent(DeviceIntPtr device,
}
for (i = 0; i < nevents; i++)
- mieqEnqueue(device, (xf86Events + i)->event);
+ mieqEnqueue(device, (InternalEvent*)((xf86Events + i)->event));
}
-_X_EXPORT void
+void
xf86PostKeyboardEvent(DeviceIntPtr device,
unsigned int key_code,
int is_down)
{
- int nevents = 0, i = 0;
- int index;
-
-#if XFreeXDGA
- DeviceIntPtr pointer;
-
- /* Some pointers send key events, paired device is wrong then. */
- pointer = IsPointerDevice(device) ? device : GetPairedDevice(device);
-
- if (miPointerGetScreen(pointer)) {
- index = miPointerGetScreen(pointer)->myNum;
- if (DGAStealKeyEvent(device, index, key_code, is_down))
- return;
- }
-#endif
-
- GetEventList(&xf86Events);
- nevents = GetKeyboardEvents(xf86Events, device,
- is_down ? KeyPress : KeyRelease, key_code);
-
- for (i = 0; i < nevents; i++)
- mieqEnqueue(device, (xf86Events + i)->event);
+ xf86PostKeyEventP(device, key_code, is_down, 0, 0, 0, NULL);
}
-_X_EXPORT LocalDevicePtr
-xf86FirstLocalDevice()
+LocalDevicePtr
+xf86FirstLocalDevice(void)
{
return xf86InputDevs;
}
@@ -958,7 +983,7 @@ xf86FirstLocalDevice()
* different orgins on the touch screen vs X.
*/
-_X_EXPORT int
+int
xf86ScaleAxis(int Cx,
int Sxhigh,
int Sxlow,
@@ -992,7 +1017,7 @@ xf86ScaleAxis(int Cx,
* ReadInput function before any events are posted, if the device is screen
* specific like a touch screen.
*/
-_X_EXPORT void
+void
xf86XInputSetScreen(LocalDevicePtr local,
int screen_number,
int x,
@@ -1005,14 +1030,14 @@ xf86XInputSetScreen(LocalDevicePtr local,
}
-_X_EXPORT void
-xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval, int maxval,
+void
+xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval, int maxval,
int resolution, int min_res, int max_res)
{
if (!dev || !dev->valuator)
return;
- InitValuatorAxisStruct(dev, axnum, minval, maxval, resolution, min_res,
+ InitValuatorAxisStruct(dev, axnum, label, minval, maxval, resolution, min_res,
max_res);
}
@@ -1020,7 +1045,7 @@ xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval, int maxval,
* Set the valuator values to be in synch with dix/event.c
* DefineInitialRootWindow().
*/
-_X_EXPORT void
+void
xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum)
{
if (axnum == 0) {
@@ -1046,7 +1071,7 @@ xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum)
*
* @param panic True if device is unrecoverable and needs to be removed.
*/
-_X_EXPORT void
+void
xf86DisableDevice(DeviceIntPtr dev, Bool panic)
{
devicePresenceNotify ev;
@@ -1054,7 +1079,7 @@ xf86DisableDevice(DeviceIntPtr dev, Bool panic)
if(!panic)
{
- DisableDevice(dev);
+ DisableDevice(dev, TRUE);
} else
{
ev.type = DevicePresenceNotify;
@@ -1074,10 +1099,10 @@ xf86DisableDevice(DeviceIntPtr dev, Bool panic)
* out that the read error wasn't quite that bad after all.
* Device will be re-activated, and an event sent to the client.
*/
-_X_EXPORT void
+void
xf86EnableDevice(DeviceIntPtr dev)
{
- EnableDevice(dev);
+ EnableDevice(dev, TRUE);
}
/* end of xf86Xinput.c */
diff --git a/xorg-server/hw/xfree86/common/xf86Xinput.h b/xorg-server/hw/xfree86/common/xf86Xinput.h
index 2ca2073f9..aa9e9d507 100644
--- a/xorg-server/hw/xfree86/common/xf86Xinput.h
+++ b/xorg-server/hw/xfree86/common/xf86Xinput.h
@@ -52,9 +52,6 @@
#ifndef _xf86Xinput_h
#define _xf86Xinput_h
-#ifndef NEED_EVENTS
-#define NEED_EVENTS
-#endif
#include "xf86str.h"
#include "inputstr.h"
#include <X11/extensions/XI.h>
@@ -83,6 +80,14 @@
#define XI_PRIVATE(dev) \
(((LocalDevicePtr)((dev)->public.devicePrivate))->private)
+/* Valuator verification macro */
+#define XI_VERIFY_VALUATORS(num_valuators) \
+ if (num_valuators > MAX_VALUATORS) { \
+ xf86Msg(X_ERROR, "%s: num_valuator %d is greater than" \
+ " MAX_VALUATORS\n", __FUNCTION__, num_valuators); \
+ return; \
+ }
+
/* Stupid API backwards-compatibility. */
#define TS_Raw 60
#define TS_Scaled 61
@@ -152,53 +157,58 @@ typedef struct _DeviceAssocRec
} DeviceAssocRec, *DeviceAssocPtr;
/* xf86Globals.c */
-extern InputInfoPtr xf86InputDevs;
+extern _X_EXPORT InputInfoPtr xf86InputDevs;
/* xf86Xinput.c */
-void InitExtInput(void);
-void xf86PostMotionEvent(DeviceIntPtr device, int is_absolute,
+extern _X_EXPORT void xf86PostMotionEvent(DeviceIntPtr device, int is_absolute,
int first_valuator, int num_valuators, ...);
-void xf86PostMotionEventP(DeviceIntPtr device, int is_absolute,
+extern _X_EXPORT void xf86PostMotionEventP(DeviceIntPtr device, int is_absolute,
int first_valuator, int num_valuators, int *valuators);
-void xf86PostProximityEvent(DeviceIntPtr device, int is_in,
+extern _X_EXPORT void xf86PostProximityEvent(DeviceIntPtr device, int is_in,
int first_valuator, int num_valuators, ...);
-void xf86PostButtonEvent(DeviceIntPtr device, int is_absolute, int button,
+extern _X_EXPORT void xf86PostProximityEventP(DeviceIntPtr device, int is_in, int first_valuator,
+ int num_valuators, int *valuators);
+extern _X_EXPORT void xf86PostButtonEvent(DeviceIntPtr device, int is_absolute, int button,
int is_down, int first_valuator, int num_valuators,
...);
-void xf86PostKeyEvent(DeviceIntPtr device, unsigned int key_code, int is_down,
+extern _X_EXPORT void xf86PostButtonEventP(DeviceIntPtr device, int is_absolute, int button,
+ int is_down, int first_valuator, int num_valuators,
+ int *valuators);
+extern _X_EXPORT void xf86PostKeyEvent(DeviceIntPtr device, unsigned int key_code, int is_down,
int is_absolute, int first_valuator, int num_valuators,
...);
-void xf86PostKeyboardEvent(DeviceIntPtr device, unsigned int key_code,
+extern _X_EXPORT void xf86PostKeyEventP(DeviceIntPtr device, unsigned int key_code, int is_down,
+ int is_absolute, int first_valuator, int num_valuators,
+ int *valuators);
+extern _X_EXPORT void xf86PostKeyboardEvent(DeviceIntPtr device, unsigned int key_code,
int is_down);
-int xf86ActivateDevice(LocalDevicePtr local);
-LocalDevicePtr xf86FirstLocalDevice(void);
-int xf86ScaleAxis(int Cx, int Sxhigh, int Sxlow, int Rxhigh, int Rxlow);
-void xf86XInputSetScreen(LocalDevicePtr local, int screen_number, int x, int y);
-void xf86ProcessCommonOptions(InputInfoPtr pInfo, pointer options);
-void xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval,
+extern _X_EXPORT int xf86ActivateDevice(LocalDevicePtr local);
+extern _X_EXPORT LocalDevicePtr xf86FirstLocalDevice(void);
+extern _X_EXPORT int xf86ScaleAxis(int Cx, int Sxhigh, int Sxlow, int Rxhigh, int Rxlow);
+extern _X_EXPORT void xf86XInputSetScreen(LocalDevicePtr local, int screen_number, int x, int y);
+extern _X_EXPORT void xf86ProcessCommonOptions(InputInfoPtr pInfo, pointer options);
+extern _X_EXPORT void xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval,
int maxval, int resolution, int min_res,
int max_res);
-void xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum);
-void xf86AddEnabledDevice(InputInfoPtr pInfo);
-void xf86RemoveEnabledDevice(InputInfoPtr pInfo);
-void xf86DisableDevice(DeviceIntPtr dev, Bool panic);
-void xf86EnableDevice(DeviceIntPtr dev);
+extern _X_EXPORT void xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum);
+extern _X_EXPORT void xf86AddEnabledDevice(InputInfoPtr pInfo);
+extern _X_EXPORT void xf86RemoveEnabledDevice(InputInfoPtr pInfo);
+extern _X_EXPORT void xf86DisableDevice(DeviceIntPtr dev, Bool panic);
+extern _X_EXPORT void xf86EnableDevice(DeviceIntPtr dev);
+/* not exported */
int xf86NewInputDevice(IDevPtr idev, DeviceIntPtr *pdev, BOOL is_auto);
/* xf86Helper.c */
-void xf86AddInputDriver(InputDriverPtr driver, pointer module, int flags);
-void xf86DeleteInputDriver(int drvIndex);
-InputInfoPtr xf86AllocateInput(InputDriverPtr drv, int flags);
-InputDriverPtr xf86LookupInputDriver(const char *name);
-InputInfoPtr xf86LookupInput(const char *name);
-void xf86DeleteInput(InputInfoPtr pInp, int flags);
-void xf86MotionHistoryAllocate(LocalDevicePtr local);
-int xf86GetMotionEvents(DeviceIntPtr dev, xTimecoord *buff,
- unsigned long start, unsigned long stop,
- ScreenPtr pScreen, BOOL core);
+extern _X_EXPORT void xf86AddInputDriver(InputDriverPtr driver, pointer module, int flags);
+extern _X_EXPORT void xf86DeleteInputDriver(int drvIndex);
+extern _X_EXPORT InputInfoPtr xf86AllocateInput(InputDriverPtr drv, int flags);
+extern _X_EXPORT InputDriverPtr xf86LookupInputDriver(const char *name);
+extern _X_EXPORT InputInfoPtr xf86LookupInput(const char *name);
+extern _X_EXPORT void xf86DeleteInput(InputInfoPtr pInp, int flags);
+extern _X_EXPORT void xf86MotionHistoryAllocate(LocalDevicePtr local);
/* xf86Option.c */
-void xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts,
+extern _X_EXPORT void xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts,
pointer extraOpts);
diff --git a/xorg-server/hw/xfree86/common/xf86cmap.c b/xorg-server/hw/xfree86/common/xf86cmap.c
index e57844764..36e6f96de 100644
--- a/xorg-server/hw/xfree86/common/xf86cmap.c
+++ b/xorg-server/hw/xfree86/common/xf86cmap.c
@@ -49,10 +49,10 @@
#include "xf86_OSproc.h"
#include "xf86str.h"
#include "micmap.h"
+#include "xf86Crtc.h"
#ifdef XFreeXDGA
-#define _XF86DGA_SERVER_
-#include <X11/extensions/xf86dgastr.h>
+#include <X11/extensions/xf86dgaproto.h>
#include "dgaproc.h"
#endif
@@ -84,6 +84,7 @@ typedef struct {
Bool (*EnterVT)(int, int);
Bool (*SwitchMode)(int, DisplayModePtr, int);
int (*SetDGAMode)(int, int, DGADevicePtr);
+ xf86ChangeGammaProc *ChangeGamma;
int maxColors;
int sigRGBbits;
int gammaElements;
@@ -126,7 +127,7 @@ static void CMapUnwrapScreen(ScreenPtr pScreen);
-_X_EXPORT Bool xf86HandleColormaps(
+Bool xf86HandleColormaps(
ScreenPtr pScreen,
int maxColors,
int sigRGBbits,
@@ -141,6 +142,10 @@ _X_EXPORT Bool xf86HandleColormaps(
int *indices;
int elements;
+ /* If we support a better colormap system, then pretend we succeeded. */
+ if (xf86_crtc_supports_gamma(pScrn))
+ return TRUE;
+
if(!maxColors || !sigRGBbits || !loadPalette)
return FALSE;
@@ -190,6 +195,7 @@ _X_EXPORT Bool xf86HandleColormaps(
pScreenPriv->EnterVT = pScrn->EnterVT;
pScreenPriv->SwitchMode = pScrn->SwitchMode;
pScreenPriv->SetDGAMode = pScrn->SetDGAMode;
+ pScreenPriv->ChangeGamma = pScrn->ChangeGamma;
if (!(flags & CMAP_LOAD_EVEN_IF_OFFSCREEN)) {
pScrn->EnterVT = CMapEnterVT;
@@ -204,8 +210,8 @@ _X_EXPORT Bool xf86HandleColormaps(
ComputeGamma(pScreenPriv);
/* get the default map */
-
- pDefMap = (ColormapPtr) LookupIDByType(pScreen->defColormap, RT_COLORMAP);
+ dixLookupResourceByType((pointer *)&pDefMap, pScreen->defColormap,
+ RT_COLORMAP, serverClient, DixInstallAccess);
if(!CMapAllocateColormapPrivate(pDefMap)) {
CMapUnwrapScreen(pScreen);
@@ -557,8 +563,8 @@ CMapRefreshColors(ColormapPtr pmap, int defs, int* indices)
switch(pVisual->class) {
case StaticGray:
- for(i = 0; i <= numColors - 1; i++) {
- index = i * maxValue / numColors;
+ for(i = 0; i < numColors; i++) {
+ index = (i+1) * maxValue / numColors;
colors[i].red = gamma[index].red;
colors[i].green = gamma[index].green;
colors[i].blue = gamma[index].blue;
@@ -819,6 +825,7 @@ CMapUnwrapScreen(ScreenPtr pScreen)
pScrn->EnterVT = pScreenPriv->EnterVT;
pScrn->SwitchMode = pScreenPriv->SwitchMode;
pScrn->SetDGAMode = pScreenPriv->SetDGAMode;
+ pScrn->ChangeGamma = pScreenPriv->ChangeGamma;
xfree(pScreenPriv->gamma);
xfree(pScreenPriv->PreAllocIndices);
@@ -884,6 +891,7 @@ CMapChangeGamma(
int index,
Gamma gamma
){
+ int ret = Success;
ScrnInfoPtr pScrn = xf86Screens[index];
ScreenPtr pScreen = pScrn->pScreen;
CMapColormapPtr pColPriv;
@@ -949,7 +957,12 @@ CMapChangeGamma(
CMapReinstallMap(pMap);
}
- return Success;
+ pScrn->ChangeGamma = pScreenPriv->ChangeGamma;
+ if (pScrn->ChangeGamma)
+ ret = pScrn->ChangeGamma(index, gamma);
+ pScrn->ChangeGamma = CMapChangeGamma;
+
+ return ret;
}
@@ -972,7 +985,7 @@ ComputeGammaRamp (
}
}
-_X_EXPORT int
+int
xf86ChangeGammaRamp(
ScreenPtr pScreen,
int size,
@@ -985,6 +998,18 @@ xf86ChangeGammaRamp(
CMapScreenPtr pScreenPriv;
CMapLinkPtr pLink;
+ if (xf86_crtc_supports_gamma(pScrn)) {
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ RRCrtcPtr crtc = config->output[config->compat_output]->crtc->randr_crtc;
+
+ if (crtc->gammaSize != size)
+ return BadValue;
+
+ RRCrtcGammaSet(crtc, red, green, blue);
+
+ return Success;
+ }
+
if(CMapScreenKey == NULL)
return BadImplementation;
@@ -1040,11 +1065,19 @@ xf86ChangeGammaRamp(
return Success;
}
-_X_EXPORT int
+int
xf86GetGammaRampSize(ScreenPtr pScreen)
{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
CMapScreenPtr pScreenPriv;
+ if (xf86_crtc_supports_gamma(pScrn)) {
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ RRCrtcPtr crtc = config->output[config->compat_output]->crtc->randr_crtc;
+
+ return crtc->gammaSize;
+ }
+
if(CMapScreenKey == NULL) return 0;
pScreenPriv = (CMapScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
@@ -1054,7 +1087,7 @@ xf86GetGammaRampSize(ScreenPtr pScreen)
return pScreenPriv->gammaElements;
}
-_X_EXPORT int
+int
xf86GetGammaRamp(
ScreenPtr pScreen,
int size,
@@ -1062,10 +1095,28 @@ xf86GetGammaRamp(
unsigned short *green,
unsigned short *blue
){
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
CMapScreenPtr pScreenPriv;
LOCO *entry;
int shift, sigbits;
+ if (xf86_crtc_supports_gamma(pScrn)) {
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ RRCrtcPtr crtc = config->output[config->compat_output]->crtc->randr_crtc;
+
+ if (crtc->gammaSize < size)
+ return BadValue;
+
+ if (!RRCrtcGammaGet(crtc))
+ return BadImplementation;
+
+ memcpy(red, crtc->gammaRed, size * sizeof(*red));
+ memcpy(green, crtc->gammaGreen, size * sizeof(*green));
+ memcpy(blue, crtc->gammaBlue, size * sizeof(*blue));
+
+ return Success;
+ }
+
if(CMapScreenKey == NULL)
return BadImplementation;
@@ -1108,5 +1159,5 @@ xf86ChangeGamma(
if(pScrn->ChangeGamma)
return (*pScrn->ChangeGamma)(pScreen->myNum, gamma);
- return Success; /* Success? */
+ return BadImplementation;
}
diff --git a/xorg-server/hw/xfree86/common/xf86cmap.h b/xorg-server/hw/xfree86/common/xf86cmap.h
index b98bd3bfd..f15844e59 100644
--- a/xorg-server/hw/xfree86/common/xf86cmap.h
+++ b/xorg-server/hw/xfree86/common/xf86cmap.h
@@ -36,7 +36,7 @@
#define CMAP_RELOAD_ON_MODE_SWITCH 0x0000002
#define CMAP_LOAD_EVEN_IF_OFFSCREEN 0x0000004
-Bool xf86HandleColormaps(
+extern _X_EXPORT Bool xf86HandleColormaps(
ScreenPtr pScreen,
int maxCol,
int sigRGBbits,
@@ -45,13 +45,13 @@ Bool xf86HandleColormaps(
unsigned int flags
);
-int
+extern _X_EXPORT int
xf86ChangeGamma(
ScreenPtr pScreen,
Gamma newGamma
);
-int
+extern _X_EXPORT int
xf86ChangeGammaRamp(
ScreenPtr pScreen,
int size,
@@ -60,9 +60,9 @@ xf86ChangeGammaRamp(
unsigned short *blue
);
-int xf86GetGammaRampSize(ScreenPtr pScreen);
+extern _X_EXPORT int xf86GetGammaRampSize(ScreenPtr pScreen);
-int
+extern _X_EXPORT int
xf86GetGammaRamp(
ScreenPtr pScreen,
int size,
diff --git a/xorg-server/hw/xfree86/common/xf86fbBus.c b/xorg-server/hw/xfree86/common/xf86fbBus.c
index 102f6b1b2..059e378e3 100644
--- a/xorg-server/hw/xfree86/common/xf86fbBus.c
+++ b/xorg-server/hw/xfree86/common/xf86fbBus.c
@@ -1,4 +1,3 @@
-
/*
* Copyright (c) 2000-2001 by The XFree86 Project, Inc.
*
@@ -41,36 +40,35 @@
#include "os.h"
#include "xf86.h"
#include "xf86Priv.h"
-#include "xf86Resources.h"
#include "xf86Bus.h"
#define XF86_OS_PRIVS
-#define NEED_OS_RAC_PROTOS
#include "xf86_OSproc.h"
-#include "xf86RAC.h"
-
Bool fbSlotClaimed = FALSE;
-_X_EXPORT int
+int
xf86ClaimFbSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active)
{
EntityPtr p;
int num;
+
+ if (pciSlotClaimed)
+ return -1;
+#if defined(__sparc__) || defined (__sparc64__)
+ if (sbusSlotClaimed)
+ return -1;
+#endif
num = xf86AllocateEntity();
p = xf86Entities[num];
p->driver = drvp;
p->chipset = 0;
- p->busType = BUS_NONE;
+ p->bus.type = BUS_NONE;
p->active = active;
p->inUse = FALSE;
xf86AddDevToEntity(num, dev);
- p->access = xnfcalloc(1,sizeof(EntityAccessRec));
- p->access->fallback = &AccessNULL;
- p->access->pAccess = &AccessNULL;
- p->busAcc = NULL;
fbSlotClaimed = TRUE;
return num;
@@ -88,7 +86,7 @@ xf86GetFbInfoForScreen(int scrnIndex)
for (i = 0; i < xf86Screens[scrnIndex]->numEntities; i++) {
p = xf86Entities[xf86Screens[scrnIndex]->entityList[i]];
- if (p->busType == BUS_NONE) {
+ if (p->bus.type == BUS_NONE) {
num++;
}
}
diff --git a/xorg-server/hw/xfree86/common/xf86fbman.c b/xorg-server/hw/xfree86/common/xf86fbman.c
index 5471c58f0..5b8871723 100644
--- a/xorg-server/hw/xfree86/common/xf86fbman.c
+++ b/xorg-server/hw/xfree86/common/xf86fbman.c
@@ -45,7 +45,7 @@
static int xf86FBManagerKeyIndex;
static DevPrivateKey xf86FBManagerKey;
-_X_EXPORT Bool xf86RegisterOffscreenManager(
+Bool xf86RegisterOffscreenManager(
ScreenPtr pScreen,
FBManagerFuncsPtr funcs
){
@@ -57,7 +57,7 @@ _X_EXPORT Bool xf86RegisterOffscreenManager(
}
-_X_EXPORT Bool
+Bool
xf86FBManagerRunning(ScreenPtr pScreen)
{
if(xf86FBManagerKey == NULL)
@@ -68,7 +68,7 @@ xf86FBManagerRunning(ScreenPtr pScreen)
return TRUE;
}
-_X_EXPORT Bool
+Bool
xf86RegisterFreeBoxCallback(
ScreenPtr pScreen,
FreeBoxCallbackProcPtr FreeBoxCallback,
@@ -86,7 +86,7 @@ xf86RegisterFreeBoxCallback(
}
-_X_EXPORT FBAreaPtr
+FBAreaPtr
xf86AllocateOffscreenArea(
ScreenPtr pScreen,
int w, int h,
@@ -108,7 +108,7 @@ xf86AllocateOffscreenArea(
}
-_X_EXPORT FBLinearPtr
+FBLinearPtr
xf86AllocateOffscreenLinear(
ScreenPtr pScreen,
int length,
@@ -130,7 +130,7 @@ xf86AllocateOffscreenLinear(
}
-_X_EXPORT void
+void
xf86FreeOffscreenArea(FBAreaPtr area)
{
FBManagerFuncsPtr funcs;
@@ -149,7 +149,7 @@ xf86FreeOffscreenArea(FBAreaPtr area)
}
-_X_EXPORT void
+void
xf86FreeOffscreenLinear(FBLinearPtr linear)
{
FBManagerFuncsPtr funcs;
@@ -168,7 +168,7 @@ xf86FreeOffscreenLinear(FBLinearPtr linear)
}
-_X_EXPORT Bool
+Bool
xf86ResizeOffscreenArea(
FBAreaPtr resize,
int w, int h
@@ -186,7 +186,7 @@ xf86ResizeOffscreenArea(
return (*funcs->ResizeOffscreenArea)(resize, w, h);
}
-_X_EXPORT Bool
+Bool
xf86ResizeOffscreenLinear(
FBLinearPtr resize,
int size
@@ -205,7 +205,7 @@ xf86ResizeOffscreenLinear(
}
-_X_EXPORT Bool
+Bool
xf86QueryLargestOffscreenArea(
ScreenPtr pScreen,
int *w, int *h,
@@ -228,7 +228,7 @@ xf86QueryLargestOffscreenArea(
pScreen, w, h, gran, preferences, severity);
}
-_X_EXPORT Bool
+Bool
xf86QueryLargestOffscreenLinear(
ScreenPtr pScreen,
int *size,
@@ -250,7 +250,7 @@ xf86QueryLargestOffscreenLinear(
}
-_X_EXPORT Bool
+Bool
xf86PurgeUnlockedOffscreenAreas(ScreenPtr pScreen)
{
FBManagerFuncsPtr funcs;
@@ -802,10 +802,10 @@ LinearRemoveCBWrapper(FBAreaPtr area)
xfree(pLink);
}
-#ifdef DEBUG
static void
-Dump(FBLinearLinkPtr pLink)
+DumpDebug(FBLinearLinkPtr pLink)
{
+#ifdef DEBUG
if (!pLink) ErrorF("MMmm, PLINK IS NULL!\n");
while (pLink) {
@@ -817,8 +817,8 @@ Dump(FBLinearLinkPtr pLink)
pLink = pLink->next;
}
-}
#endif
+}
static FBLinearPtr
AllocateLinear(
@@ -889,9 +889,7 @@ AllocateLinear(
linear->linear.RemoveLinearCallback = NULL;
linear->linear.devPrivate.ptr = NULL;
-#ifdef DEBUG
- Dump(offman->LinearAreas);
-#endif
+ DumpDebug(offman->LinearAreas);
return &(linear->linear);
}
@@ -916,15 +914,11 @@ localAllocateOffscreenLinear(
xf86FBScreenKey);
/* Try to allocate from linear memory first...... */
-#ifdef DEBUG
- ErrorF("ALLOCATING LINEAR\n");
-#endif
+ DebugF("ALLOCATING LINEAR\n");
if ((linear = AllocateLinear(offman, length, gran, privData)))
return linear;
-#ifdef DEBUG
- ErrorF("NOPE, ALLOCATING AREA\n");
-#endif
+ DebugF("NOPE, ALLOCATING AREA\n");
if(!(link = xalloc(sizeof(FBLinearLink))))
return NULL;
@@ -978,9 +972,7 @@ localAllocateOffscreenLinear(
} else
xfree(link);
-#ifdef DEBUG
- Dump(offman->LinearAreas);
-#endif
+ DumpDebug(offman->LinearAreas);
return linear;
}
@@ -1005,17 +997,13 @@ localFreeOffscreenLinear(FBLinearPtr linear)
}
if(pLink->area) { /* really an XY area */
-#ifdef DEBUG
- ErrorF("FREEING AREA\n");
-#endif
+ DebugF("FREEING AREA\n");
localFreeOffscreenArea(pLink->area);
if(pLinkPrev)
pLinkPrev->next = pLink->next;
else offman->LinearAreas = pLink->next;
xfree(pLink);
-#ifdef DEBUG
- Dump(offman->LinearAreas);
-#endif
+ DumpDebug(offman->LinearAreas);
return;
}
@@ -1037,10 +1025,8 @@ localFreeOffscreenLinear(FBLinearPtr linear)
}
}
-#ifdef DEBUG
- ErrorF("FREEING LINEAR\n");
- Dump(offman->LinearAreas);
-#endif
+ DebugF("FREEING LINEAR\n");
+ DumpDebug(offman->LinearAreas);
}
@@ -1196,7 +1182,7 @@ xf86FBCloseScreen (int i, ScreenPtr pScreen)
return (*pScreen->CloseScreen) (i, pScreen);
}
-_X_EXPORT Bool
+Bool
xf86InitFBManager(
ScreenPtr pScreen,
BoxPtr FullBox
@@ -1233,7 +1219,7 @@ xf86InitFBManager(
return ret;
}
-_X_EXPORT Bool
+Bool
xf86InitFBManagerArea(
ScreenPtr pScreen,
int PixelArea,
@@ -1325,7 +1311,7 @@ xf86InitFBManagerArea(
return ret;
}
-_X_EXPORT Bool
+Bool
xf86InitFBManagerRegion(
ScreenPtr pScreen,
RegionPtr FullRegion
@@ -1363,7 +1349,7 @@ xf86InitFBManagerRegion(
return TRUE;
}
-_X_EXPORT Bool
+Bool
xf86InitFBManagerLinear(
ScreenPtr pScreen,
int offset,
@@ -1407,7 +1393,7 @@ xf86InitFBManagerLinear(
disappear after the next release. People should use the
real linear functions instead */
-_X_EXPORT FBAreaPtr
+FBAreaPtr
xf86AllocateLinearOffscreenArea (
ScreenPtr pScreen,
int length,
diff --git a/xorg-server/hw/xfree86/common/xf86fbman.h b/xorg-server/hw/xfree86/common/xf86fbman.h
index 4f2eac5e6..1b3c31635 100644
--- a/xorg-server/hw/xfree86/common/xf86fbman.h
+++ b/xorg-server/hw/xfree86/common/xf86fbman.h
@@ -110,43 +110,43 @@ typedef struct {
} FBManagerFuncs, *FBManagerFuncsPtr;
-Bool xf86RegisterOffscreenManager(
+extern _X_EXPORT Bool xf86RegisterOffscreenManager(
ScreenPtr pScreen,
FBManagerFuncsPtr funcs
);
-Bool
+extern _X_EXPORT Bool
xf86InitFBManagerRegion(
ScreenPtr pScreen,
RegionPtr ScreenRegion
);
-Bool
+extern _X_EXPORT Bool
xf86InitFBManagerArea(
ScreenPtr pScreen,
int PixalArea,
int Verbosity
);
-Bool
+extern _X_EXPORT Bool
xf86InitFBManager(
ScreenPtr pScreen,
BoxPtr FullBox
);
-Bool
+extern _X_EXPORT Bool
xf86InitFBManagerLinear(
ScreenPtr pScreen,
int offset,
int size
);
-Bool
+extern _X_EXPORT Bool
xf86FBManagerRunning(
ScreenPtr pScreen
);
-FBAreaPtr
+extern _X_EXPORT FBAreaPtr
xf86AllocateOffscreenArea (
ScreenPtr pScreen,
int w, int h,
@@ -156,7 +156,7 @@ xf86AllocateOffscreenArea (
pointer privData
);
-FBAreaPtr
+extern _X_EXPORT FBAreaPtr
xf86AllocateLinearOffscreenArea (
ScreenPtr pScreen,
int length,
@@ -166,7 +166,7 @@ xf86AllocateLinearOffscreenArea (
pointer privData
);
-FBLinearPtr
+extern _X_EXPORT FBLinearPtr
xf86AllocateOffscreenLinear (
ScreenPtr pScreen,
int length,
@@ -176,36 +176,36 @@ xf86AllocateOffscreenLinear (
pointer privData
);
-void xf86FreeOffscreenArea(FBAreaPtr area);
-void xf86FreeOffscreenLinear(FBLinearPtr area);
+extern _X_EXPORT void xf86FreeOffscreenArea(FBAreaPtr area);
+extern _X_EXPORT void xf86FreeOffscreenLinear(FBLinearPtr area);
-Bool
+extern _X_EXPORT Bool
xf86ResizeOffscreenArea(
FBAreaPtr resize,
int w, int h
);
-Bool
+extern _X_EXPORT Bool
xf86ResizeOffscreenLinear(
FBLinearPtr resize,
int size
);
-Bool
+extern _X_EXPORT Bool
xf86RegisterFreeBoxCallback(
ScreenPtr pScreen,
FreeBoxCallbackProcPtr FreeBoxCallback,
pointer devPriv
);
-Bool
+extern _X_EXPORT Bool
xf86PurgeUnlockedOffscreenAreas(
ScreenPtr pScreen
);
-Bool
+extern _X_EXPORT Bool
xf86QueryLargestOffscreenArea(
ScreenPtr pScreen,
int *width, int *height,
@@ -214,7 +214,7 @@ xf86QueryLargestOffscreenArea(
int priority
);
-Bool
+extern _X_EXPORT Bool
xf86QueryLargestOffscreenLinear(
ScreenPtr pScreen,
int *size,
diff --git a/xorg-server/hw/xfree86/common/xf86noBus.c b/xorg-server/hw/xfree86/common/xf86noBus.c
index 0e3e3cc6b..0b9634918 100644
--- a/xorg-server/hw/xfree86/common/xf86noBus.c
+++ b/xorg-server/hw/xfree86/common/xf86noBus.c
@@ -1,4 +1,3 @@
-
/*
* Copyright (c) 2000-2002 by The XFree86 Project, Inc.
*
@@ -41,17 +40,13 @@
#include "os.h"
#include "xf86.h"
#include "xf86Priv.h"
-#include "xf86Resources.h"
#include "xf86Bus.h"
#define XF86_OS_PRIVS
-#define NEED_OS_RAC_PROTOS
#include "xf86_OSproc.h"
-#include "xf86RAC.h"
-
-_X_EXPORT int
+int
xf86ClaimNoSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active)
{
EntityPtr p;
@@ -61,14 +56,10 @@ xf86ClaimNoSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active)
p = xf86Entities[num];
p->driver = drvp;
p->chipset = 0;
- p->busType = BUS_NONE;
+ p->bus.type = BUS_NONE;
p->active = active;
p->inUse = FALSE;
xf86AddDevToEntity(num, dev);
- p->access = xnfcalloc(1,sizeof(EntityAccessRec));
- p->access->fallback = &AccessNULL;
- p->access->pAccess = &AccessNULL;
- p->busAcc = NULL;
return num;
}
diff --git a/xorg-server/hw/xfree86/common/xf86pciBus.c b/xorg-server/hw/xfree86/common/xf86pciBus.c
index 5b29a1511..df62e0766 100644
--- a/xorg-server/hw/xfree86/common/xf86pciBus.c
+++ b/xorg-server/hw/xfree86/common/xf86pciBus.c
@@ -41,23 +41,17 @@
#include "Pci.h"
#include "xf86.h"
#include "xf86Priv.h"
-#include "xf86Resources.h"
/* Bus-specific headers */
#include "xf86Bus.h"
#define XF86_OS_PRIVS
-#define NEED_OS_RAC_PROTOS
#include "xf86_OSproc.h"
-#include "xf86RAC.h"
/* Bus-specific globals */
Bool pciSlotClaimed = FALSE;
-static struct pci_device ** xf86PciVideoInfo = NULL; /* PCI probe for video hw */
-
-/* PCI classes that get included in xf86PciVideoInfo */
#define PCIINFOCLASSES(c) \
( (((c) & 0x00ff0000) == (PCI_CLASS_PREHISTORIC << 16)) \
|| (((c) & 0x00ff0000) == (PCI_CLASS_DISPLAY << 16)) \
@@ -81,23 +75,7 @@ static struct pci_device ** xf86PciVideoInfo = NULL; /* PCI probe for video hw *
(((c) & 0x00ffff00) \
== ((PCI_CLASS_DISPLAY << 16) | (PCI_SUBCLASS_DISPLAY_VGA << 8)))
-/*
- * PCI classes for which potentially destructive checking of the map sizes
- * may be done. Any classes where this may be unsafe should be omitted
- * from this list.
- */
-#define PCINONSYSTEMCLASSES(c) PCIALWAYSPRINTCLASSES(c)
-
-/*
- * PCI classes that use RAC
- */
-#define PCISHAREDIOCLASSES(c) \
- ( (((c) & 0x00ffff00) \
- == ((PCI_CLASS_PREHISTORIC << 16) | (PCI_SUBCLASS_PREHISTORIC_VGA << 8))) \
- || IS_VGA(c) )
-
-
-_X_EXPORT void
+void
xf86FormatPciBusNumber(int busnum, char *buffer)
{
/* 'buffer' should be at least 8 characters long */
@@ -108,241 +86,6 @@ xf86FormatPciBusNumber(int busnum, char *buffer)
}
/*
- * IO enable/disable related routines for PCI
- */
-#define pArg ((pciArg*)arg)
-#define SETBITS PCI_CMD_IO_ENABLE
-static void
-pciIoAccessEnable(void* arg)
-{
-#if 0
-#ifdef DEBUG
- ErrorF("pciIoAccessEnable: 0x%05lx\n", *(PCITAG *)arg);
-#endif
- pArg->ctrl |= SETBITS | PCI_CMD_MASTER_ENABLE;
- pci_device_cfg_write_u32(pArg->dev, pArg->ctrl, PCI_CMD_STAT_REG);
-#endif
-}
-
-static void
-pciIoAccessDisable(void* arg)
-{
-#if 0
-#ifdef DEBUG
- ErrorF("pciIoAccessDisable: 0x%05lx\n", *(PCITAG *)arg);
-#endif
- pArg->ctrl &= ~SETBITS;
- pci_device_cfg_write_u32(pArg->dev, pArg->ctrl, PCI_CMD_STAT_REG);
-#endif
-}
-
-#undef SETBITS
-#define SETBITS (PCI_CMD_IO_ENABLE | PCI_CMD_MEM_ENABLE)
-static void
-pciIo_MemAccessEnable(void* arg)
-{
-#if 0
-#ifdef DEBUG
- ErrorF("pciIo_MemAccessEnable: 0x%05lx\n", *(PCITAG *)arg);
-#endif
- pArg->ctrl |= SETBITS | PCI_CMD_MASTER_ENABLE;
- pci_device_cfg_write_u32(pArg->dev, pArg->ctrl, PCI_CMD_STAT_REG);
-#endif
-}
-
-static void
-pciIo_MemAccessDisable(void* arg)
-{
-#if 0
-#ifdef DEBUG
- ErrorF("pciIo_MemAccessDisable: 0x%05lx\n", *(PCITAG *)arg);
-#endif
- pArg->ctrl &= ~SETBITS;
- pci_device_cfg_write_u32(pArg->dev, pArg->ctrl, PCI_CMD_STAT_REG);
-#endif
-}
-
-#undef SETBITS
-#define SETBITS (PCI_CMD_MEM_ENABLE)
-static void
-pciMemAccessEnable(void* arg)
-{
-#if 0
-#ifdef DEBUG
- ErrorF("pciMemAccessEnable: 0x%05lx\n", *(PCITAG *)arg);
-#endif
- pArg->ctrl |= SETBITS | PCI_CMD_MASTER_ENABLE;
- pci_device_cfg_write_u32(pArg->dev, pArg->ctrl, PCI_CMD_STAT_REG);
-#endif
-}
-
-static void
-pciMemAccessDisable(void* arg)
-{
-#if 0
-#ifdef DEBUG
- ErrorF("pciMemAccessDisable: 0x%05lx\n", *(PCITAG *)arg);
-#endif
- pArg->ctrl &= ~SETBITS;
- pci_device_cfg_write_u32(pArg->dev, pArg->ctrl, PCI_CMD_STAT_REG);
-#endif
-}
-#undef SETBITS
-#undef pArg
-
-
-/* move to OS layer */
-#define MASKBITS (PCI_PCI_BRIDGE_VGA_EN | PCI_PCI_BRIDGE_MASTER_ABORT_EN)
-static void
-pciBusAccessEnable(BusAccPtr ptr)
-{
-#if 0
- struct pci_device * const dev = ptr->busdep.pci.dev;
- uint16_t ctrl;
-
-#ifdef DEBUG
- ErrorF("pciBusAccessEnable: bus=%d\n", ptr->busdep.pci.bus);
-#endif
- pci_device_cfg_read_u16( dev, & ctrl, PCI_PCI_BRIDGE_CONTROL_REG );
- if ((ctrl & MASKBITS) != PCI_PCI_BRIDGE_VGA_EN) {
- ctrl = (ctrl | PCI_PCI_BRIDGE_VGA_EN) &
- ~(PCI_PCI_BRIDGE_MASTER_ABORT_EN | PCI_PCI_BRIDGE_SECONDARY_RESET);
- pci_device_cfg_write_u16(dev, ctrl, PCI_PCI_BRIDGE_CONTROL_REG);
- }
-#endif
-}
-
-/* move to OS layer */
-static void
-pciBusAccessDisable(BusAccPtr ptr)
-{
-#if 0
- struct pci_device * const dev = ptr->busdep.pci.dev;
- uint16_t ctrl;
-
-#ifdef DEBUG
- ErrorF("pciBusAccessDisable: bus=%d\n", ptr->busdep.pci.bus);
-#endif
- pci_device_cfg_read_u16( dev, & ctrl, PCI_PCI_BRIDGE_CONTROL_REG );
- if (ctrl & MASKBITS) {
- ctrl &= ~(MASKBITS | PCI_PCI_BRIDGE_SECONDARY_RESET);
- pci_device_cfg_write_u16(dev, ctrl, PCI_PCI_BRIDGE_CONTROL_REG);
- }
-#endif
-}
-#undef MASKBITS
-
-static void
-pciSetBusAccess(BusAccPtr ptr)
-{
-#if 0
-#ifdef DEBUG
- ErrorF("pciSetBusAccess: route VGA to bus %d\n", ptr->busdep.pci.bus);
-#endif
-
- if (!ptr->primary && !ptr->current)
- return;
-
- if (ptr->current && ptr->current->disable_f)
- (*ptr->current->disable_f)(ptr->current);
- ptr->current = NULL;
-
- /* walk down */
- while (ptr->primary) { /* No enable for root bus */
- if (ptr != ptr->primary->current) {
- if (ptr->primary->current && ptr->primary->current->disable_f)
- (*ptr->primary->current->disable_f)(ptr->primary->current);
- if (ptr->enable_f)
- (*ptr->enable_f)(ptr);
- ptr->primary->current = ptr;
- }
- ptr = ptr->primary;
- }
-#endif
-}
-
-/* move to OS layer */
-static void
-savePciState( struct pci_device * dev, pciSavePtr ptr )
-{
-#if 0
- int i;
-
- pci_device_cfg_read_u32( dev, & ptr->command, PCI_CMD_STAT_REG );
-
- for ( i = 0; i < 6; i++ ) {
- pci_device_cfg_read_u32( dev, & ptr->base[i],
- PCI_CMD_BASE_REG + (i * 4) );
- }
-
- pci_device_cfg_read_u32( dev, & ptr->biosBase, PCI_CMD_BIOS_REG );
-#endif
-}
-
-/* move to OS layer */
-#if 0
-static void
-restorePciState( struct pci_device * dev, pciSavePtr ptr)
-{
- int i;
-
- /* disable card before setting anything */
- pci_device_cfg_write_bits(dev, PCI_CMD_MEM_ENABLE | PCI_CMD_IO_ENABLE, 0,
- PCI_CMD_STAT_REG);
-
- pci_device_cfg_write_u32(dev, ptr->biosBase, PCI_CMD_BIOS_REG);
-
- for ( i = 0; i < 6; i++ ) {
- pci_device_cfg_write_u32(dev, ptr->base[i],
- PCI_CMD_BASE_REG + (i * 4));
- }
-
- pci_device_cfg_write_u32(dev, ptr->command, PCI_CMD_STAT_REG);
-}
-#endif
-
-/* move to OS layer */
-static void
-savePciBusState(BusAccPtr ptr)
-{
-#if 0
- struct pci_device * const dev = ptr->busdep.pci.dev;
- uint16_t temp;
-
- pci_device_cfg_read_u16( dev, & temp, PCI_PCI_BRIDGE_CONTROL_REG );
- ptr->busdep.pci.save.control = temp & ~PCI_PCI_BRIDGE_SECONDARY_RESET;
-
- /* Allow master aborts to complete normally on non-root buses */
- if ( ptr->busdep.pci.save.control & PCI_PCI_BRIDGE_MASTER_ABORT_EN ) {
- temp = ptr->busdep.pci.save.control & ~PCI_PCI_BRIDGE_MASTER_ABORT_EN;
- pci_device_cfg_read_u16( dev, & temp, PCI_PCI_BRIDGE_CONTROL_REG );
- }
-#endif
-}
-
-/* move to OS layer */
-#define MASKBITS (PCI_PCI_BRIDGE_VGA_EN | PCI_PCI_BRIDGE_MASTER_ABORT_EN)
-static void
-restorePciBusState(BusAccPtr ptr)
-{
-#if 0
- struct pci_device * const dev = ptr->busdep.pci.dev;
- uint16_t ctrl;
-
- /* Only restore the bits we've changed (and don't cause resets) */
- pci_device_cfg_read_u16( dev, & ctrl, PCI_PCI_BRIDGE_CONTROL_REG );
-
- if ((ctrl ^ ptr->busdep.pci.save.control) & MASKBITS) {
- ctrl &= ~(MASKBITS | PCI_PCI_BRIDGE_SECONDARY_RESET);
- ctrl |= ptr->busdep.pci.save.control & MASKBITS;
- pci_device_cfg_write_u16(dev, ctrl, PCI_PCI_BRIDGE_CONTROL_REG);
- }
-#endif
-}
-#undef MASKBITS
-
-
-/*
* xf86Bus.c interface
*/
@@ -353,6 +96,7 @@ xf86PciProbe(void)
int num = 0;
struct pci_device *info;
struct pci_device_iterator *iter;
+ struct pci_device ** xf86PciVideoInfo = NULL;
if (!xf86scanpci()) {
@@ -371,6 +115,12 @@ xf86PciProbe(void)
xf86PciVideoInfo[num - 1] = info;
pci_device_probe(info);
+#ifdef HAVE_PCI_DEVICE_IS_BOOT_VGA
+ if (pci_device_is_boot_vga(info)) {
+ primaryBus.type = BUS_PCI;
+ primaryBus.id.pci = info;
+ }
+#endif
info->user_data = 0;
}
}
@@ -464,250 +214,16 @@ xf86PciProbe(void)
}
}
-void
-initPciState(void)
-{
- unsigned i;
- pciAccPtr pcaccp;
-
- if (xf86PciVideoInfo == NULL) {
- return;
- }
-
- for (i = 0 ; xf86PciVideoInfo[i] != NULL ; i++) {
- struct pci_device * const pvp = xf86PciVideoInfo[i];
-
- if (pvp->user_data == 0) {
- pcaccp = xnfalloc( sizeof( pciAccRec ) );
- pvp->user_data = (intptr_t) pcaccp;
-
- pcaccp->arg.dev = pvp;
- pcaccp->ioAccess.AccessDisable = pciIoAccessDisable;
- pcaccp->ioAccess.AccessEnable = pciIoAccessEnable;
- pcaccp->ioAccess.arg = &pcaccp->arg;
- pcaccp->io_memAccess.AccessDisable = pciIo_MemAccessDisable;
- pcaccp->io_memAccess.AccessEnable = pciIo_MemAccessEnable;
- pcaccp->io_memAccess.arg = &pcaccp->arg;
- pcaccp->memAccess.AccessDisable = pciMemAccessDisable;
- pcaccp->memAccess.AccessEnable = pciMemAccessEnable;
- pcaccp->memAccess.arg = &pcaccp->arg;
-
- pcaccp->ctrl = PCISHAREDIOCLASSES(pvp->device_class);
-
- savePciState(pvp, &pcaccp->save);
- pcaccp->arg.ctrl = pcaccp->save.command;
- }
- }
-}
-
-/*
- * initPciBusState() - fill out the BusAccRec for a PCI bus.
- * Theory: each bus is associated with one bridge connecting it
- * to its parent bus. The address of a bridge is therefore stored
- * in the BusAccRec of the bus it connects to. Each bus can
- * have several bridges connecting secondary buses to it. Only one
- * of these bridges can be open. Therefore the status of a bridge
- * associated with a bus is stored in the BusAccRec of the parent
- * the bridge connects to. The first member of the structure is
- * a pointer to a function that open access to this bus. This function
- * receives a pointer to the structure itself as argument. This
- * design should be common to BusAccRecs of any type of buses we
- * support. The remeinder of the structure is bus type specific.
- * In this case it contains a pointer to the structure of the
- * parent bus. Thus enabling access to a specific bus is simple:
- * 1. Close any bridge going to secondary buses.
- * 2. Climb down the ladder and enable any bridge on buses
- * on the path from the CPU to this bus.
- */
-
-void
-initPciBusState(void)
-{
- static const struct pci_id_match bridge_match = {
- PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY,
- (PCI_CLASS_BRIDGE << 16), 0x0000ff0000, 0
- };
- struct pci_device *dev;
- struct pci_device_iterator *iter;
- BusAccPtr pbap, pbap_tmp;
-
- iter = pci_id_match_iterator_create(& bridge_match);
- while((dev = pci_device_next(iter)) != NULL) {
- const uint8_t subclass = (dev->device_class >> 8) & 0x0ff;
- int primary;
- int secondary;
- int subordinate;
-
-
- pci_device_get_bridge_buses(dev, &primary, &secondary, &subordinate);
-
- pbap = xnfcalloc(1,sizeof(BusAccRec));
- pbap->busdep.pci.bus = secondary;
- pbap->busdep.pci.primary_bus = primary;
- pbap->busdep_type = BUS_PCI;
- pbap->busdep.pci.dev = dev;
-
- pbap->set_f = pciSetBusAccess;
-
- switch (subclass) {
- case PCI_SUBCLASS_BRIDGE_HOST:
- pbap->type = BUS_PCI;
- break;
- case PCI_SUBCLASS_BRIDGE_PCI:
- case PCI_SUBCLASS_BRIDGE_CARDBUS:
- pbap->type = BUS_PCI;
- pbap->save_f = savePciBusState;
- pbap->restore_f = restorePciBusState;
- pbap->enable_f = pciBusAccessEnable;
- pbap->disable_f = pciBusAccessDisable;
- savePciBusState(pbap);
- break;
- }
- pbap->next = xf86BusAccInfo;
- xf86BusAccInfo = pbap;
- }
-
- pci_iterator_destroy(iter);
-
- for (pbap = xf86BusAccInfo; pbap; pbap = pbap->next) {
- pbap->primary = NULL;
-
- if (pbap->busdep_type == BUS_PCI
- && pbap->busdep.pci.primary_bus > -1) {
- pbap_tmp = xf86BusAccInfo;
- while (pbap_tmp) {
- if (pbap_tmp->busdep_type == BUS_PCI &&
- pbap_tmp->busdep.pci.bus == pbap->busdep.pci.primary_bus) {
- /* Don't create loops */
- if (pbap == pbap_tmp)
- break;
- pbap->primary = pbap_tmp;
- break;
- }
- pbap_tmp = pbap_tmp->next;
- }
- }
- }
-}
-
-void
-PciStateEnter(void)
-{
-#if 0
- unsigned i;
-
- if (xf86PciVideoInfo == NULL)
- return;
-
- for ( i = 0 ; xf86PciVideoInfo[i] != NULL ; i++ ) {
- pciAccPtr paccp = (pciAccPtr) xf86PciVideoInfo[i]->user_data;
-
- if ( (paccp != NULL) && paccp->ctrl ) {
- savePciState(paccp->arg.dev, &paccp->save);
- restorePciState(paccp->arg.dev, &paccp->restore);
- paccp->arg.ctrl = paccp->restore.command;
- }
- }
-#endif
-}
-
-void
-PciBusStateEnter(void)
-{
-#if 0
- BusAccPtr pbap = xf86BusAccInfo;
-
- while (pbap) {
- if (pbap->save_f)
- pbap->save_f(pbap);
- pbap = pbap->next;
- }
-#endif
-}
-
-void
-PciStateLeave(void)
-{
-#if 0
- unsigned i;
-
- if (xf86PciVideoInfo == NULL)
- return;
-
- for ( i = 0 ; xf86PciVideoInfo[i] != NULL ; i++ ) {
- pciAccPtr paccp = (pciAccPtr) xf86PciVideoInfo[i]->user_data;
-
- if ( (paccp != NULL) && paccp->ctrl ) {
- savePciState(paccp->arg.dev, &paccp->restore);
- restorePciState(paccp->arg.dev, &paccp->save);
- }
- }
-#endif
-}
-
-void
-PciBusStateLeave(void)
-{
-#if 0
- BusAccPtr pbap = xf86BusAccInfo;
-
- while (pbap) {
- if (pbap->restore_f)
- pbap->restore_f(pbap);
- pbap = pbap->next;
- }
-#endif
-}
-
-void
-DisablePciAccess(void)
-{
-#if 0
- unsigned i;
-
- if (xf86PciVideoInfo == NULL)
- return;
-
- for ( i = 0 ; xf86PciVideoInfo[i] != NULL ; i++ ) {
- pciAccPtr paccp = (pciAccPtr) xf86PciVideoInfo[i]->user_data;
-
- if ( (paccp != NULL) && paccp->ctrl ) {
- pciIo_MemAccessDisable(paccp->io_memAccess.arg);
- }
- }
-#endif
-}
-
-void
-DisablePciBusAccess(void)
-{
-#if 0
- BusAccPtr pbap = xf86BusAccInfo;
-
- while (pbap) {
- if (pbap->disable_f)
- pbap->disable_f(pbap);
- if (pbap->primary)
- pbap->primary->current = NULL;
- pbap = pbap->next;
- }
-#endif
-}
-
/*
* If the slot requested is already in use, return -1.
* Otherwise, claim the slot for the screen requesting it.
*/
-_X_EXPORT int
+int
xf86ClaimPciSlot(struct pci_device * d, DriverPtr drvp,
int chipset, GDevPtr dev, Bool active)
{
EntityPtr p = NULL;
- pciAccPtr paccp = (pciAccPtr) d->user_data;
- BusAccPtr pbap = xf86BusAccInfo;
- const unsigned bus = PCI_MAKE_BUS(d->domain, d->bus);
-
int num;
if (xf86CheckPciSlot(d)) {
@@ -721,25 +237,6 @@ xf86ClaimPciSlot(struct pci_device * d, DriverPtr drvp,
p->inUse = FALSE;
if (dev)
xf86AddDevToEntity(num, dev);
- /* Here we initialize the access structure */
- p->access = xnfcalloc(1,sizeof(EntityAccessRec));
- if (paccp != NULL) {
- p->access->fallback = & paccp->io_memAccess;
- p->access->pAccess = & paccp->io_memAccess;
- paccp->ctrl = TRUE; /* mark control if not already */
- }
- else {
- p->access->fallback = &AccessNULL;
- p->access->pAccess = &AccessNULL;
- }
-
- p->busAcc = NULL;
- while (pbap) {
- if (pbap->type == BUS_PCI && pbap->busdep.pci.bus == bus)
- p->busAcc = pbap;
- pbap = pbap->next;
- }
-
pciSlotClaimed = TRUE;
if (active) {
@@ -753,11 +250,30 @@ xf86ClaimPciSlot(struct pci_device * d, DriverPtr drvp,
}
/*
+ * Unclaim PCI slot, e.g. if probing failed, so that a different driver can claim.
+ */
+void
+xf86UnclaimPciSlot(struct pci_device *d)
+{
+ int i;
+
+ for (i = 0; i < xf86NumEntities; i++) {
+ const EntityPtr p = xf86Entities[i];
+
+ if ((p->bus.type == BUS_PCI) && (p->bus.id.pci == d)) {
+ /* Probably the slot should be deallocated? */
+ p->bus.type = BUS_NONE;
+ return;
+ }
+ }
+}
+
+/*
* Parse a BUS ID string, and return the PCI bus parameters if it was
* in the correct format for a PCI bus id.
*/
-_X_EXPORT Bool
+Bool
xf86ParsePciBusString(const char *busID, int *bus, int *device, int *func)
{
/*
@@ -831,7 +347,7 @@ xf86ParsePciBusString(const char *busID, int *bus, int *device, int *func)
* Compare a BUS ID string with a PCI bus id. Return TRUE if they match.
*/
-_X_EXPORT Bool
+Bool
xf86ComparePciBusString(const char *busID, int bus, int device, int func)
{
int ibus, idevice, ifunc;
@@ -848,7 +364,7 @@ xf86ComparePciBusString(const char *busID, int bus, int device, int func)
* is PCI and bus, dev and func numbers match.
*/
-_X_EXPORT Bool
+Bool
xf86IsPrimaryPci(struct pci_device *pPci)
{
return ((primaryBus.type == BUS_PCI) && (pPci == primaryBus.id.pci));
@@ -857,7 +373,7 @@ xf86IsPrimaryPci(struct pci_device *pPci)
/*
* xf86GetPciInfoForEntity() -- Get the pciVideoRec of entity.
*/
-_X_EXPORT struct pci_device *
+struct pci_device *
xf86GetPciInfoForEntity(int entityIndex)
{
EntityPtr p;
@@ -873,7 +389,7 @@ xf86GetPciInfoForEntity(int entityIndex)
* xf86CheckPciMemBase() checks that the memory base value matches one of the
* PCI base address register values for the given PCI device.
*/
-_X_EXPORT Bool
+Bool
xf86CheckPciMemBase( struct pci_device * pPci, memType base )
{
int i;
@@ -888,7 +404,7 @@ xf86CheckPciMemBase( struct pci_device * pPci, memType base )
* Check if the slot requested is free. If it is already in use, return FALSE.
*/
-_X_EXPORT Bool
+Bool
xf86CheckPciSlot(const struct pci_device *d)
{
int i;
@@ -904,52 +420,3 @@ xf86CheckPciSlot(const struct pci_device *d)
}
-void
-pciConvertRange2Host(int entityIndex, resRange *pRange)
-{
- struct pci_device *const pvp = xf86GetPciInfoForEntity(entityIndex);
- const PCITAG tag = PCI_MAKE_TAG(PCI_MAKE_BUS(pvp->domain, pvp->bus),
- pvp->dev, pvp->func);
-
- if (pvp == NULL) {
- return;
- }
-
- if (!(pRange->type & ResBus))
- return;
-
- switch(pRange->type & ResPhysMask) {
- case ResMem:
- switch(pRange->type & ResExtMask) {
- case ResBlock:
- pRange->rBegin = pciBusAddrToHostAddr(tag,PCI_MEM, pRange->rBegin);
- pRange->rEnd = pciBusAddrToHostAddr(tag,PCI_MEM, pRange->rEnd);
- break;
- case ResSparse:
- pRange->rBase = pciBusAddrToHostAddr(tag,PCI_MEM_SPARSE_BASE,
- pRange->rBegin);
- pRange->rMask = pciBusAddrToHostAddr(tag,PCI_MEM_SPARSE_MASK,
- pRange->rEnd);
- break;
- }
- break;
- case ResIo:
- switch(pRange->type & ResExtMask) {
- case ResBlock:
- pRange->rBegin = pciBusAddrToHostAddr(tag,PCI_IO, pRange->rBegin);
- pRange->rEnd = pciBusAddrToHostAddr(tag,PCI_IO, pRange->rEnd);
- break;
- case ResSparse:
- pRange->rBase = pciBusAddrToHostAddr(tag,PCI_IO_SPARSE_BASE
- , pRange->rBegin);
- pRange->rMask = pciBusAddrToHostAddr(tag,PCI_IO_SPARSE_MASK
- , pRange->rEnd);
- break;
- }
- break;
- }
-
- /* Set domain number */
- pRange->type &= ~(ResDomain | ResBus);
- pRange->type |= pvp->domain << 24;
-}
diff --git a/xorg-server/hw/xfree86/common/xf86pciBus.h b/xorg-server/hw/xfree86/common/xf86pciBus.h
index 1cbfa38ea..3125e0db8 100644
--- a/xorg-server/hw/xfree86/common/xf86pciBus.h
+++ b/xorg-server/hw/xfree86/common/xf86pciBus.h
@@ -33,42 +33,6 @@
#ifndef _XF86_PCI_BUS_H
#define _XF86_PCI_BUS_H
-#define PCITAG_SPECIAL pciTag(0xFF,0xFF,0xFF)
-
-typedef struct {
- CARD32 command;
- CARD32 base[6];
- CARD32 biosBase;
-} pciSave, *pciSavePtr;
-
-typedef struct {
- struct pci_device * dev;
- CARD32 ctrl;
-} pciArg;
-
-typedef struct {
- pciArg arg;
- xf86AccessRec ioAccess;
- xf86AccessRec io_memAccess;
- xf86AccessRec memAccess;
- pciSave save;
- pciSave restore;
- Bool ctrl;
-} pciAccRec, *pciAccPtr;
-
-typedef union {
- CARD16 control;
-} pciBridgesSave, *pciBridgesSavePtr;
-
void xf86PciProbe(void);
-void initPciState(void);
-void initPciBusState(void);
-void DisablePciAccess(void);
-void DisablePciBusAccess(void);
-void PciStateEnter(void);
-void PciBusStateEnter(void);
-void PciStateLeave(void);
-void PciBusStateLeave(void);
-void pciConvertRange2Host(int entityIndex, resRange *pRange);
#endif /* _XF86_PCI_BUS_H */
diff --git a/xorg-server/hw/xfree86/common/xf86sbusBus.c b/xorg-server/hw/xfree86/common/xf86sbusBus.c
index af2b14539..7b23233aa 100644
--- a/xorg-server/hw/xfree86/common/xf86sbusBus.c
+++ b/xorg-server/hw/xfree86/common/xf86sbusBus.c
@@ -33,7 +33,6 @@
#include "xf86.h"
#include "xf86Priv.h"
#include "xf86_OSlib.h"
-#include "xf86Resources.h"
#include "xf86cmap.h"
#include "xf86Bus.h"
@@ -320,7 +319,7 @@ xf86CheckSbusSlot(int fbNum)
for (i = 0; i < xf86NumEntities; i++) {
p = xf86Entities[i];
/* Check if this SBUS slot is taken */
- if (p->busType == BUS_SBUS && p->sbusBusId.fbNum == fbNum)
+ if (p->bus.type == BUS_SBUS && p->bus.id.sbus.fbNum == fbNum)
return FALSE;
}
@@ -345,22 +344,18 @@ xf86ClaimSbusSlot(sbusDevicePtr psdp, DriverPtr drvp,
p = xf86Entities[num];
p->driver = drvp;
p->chipset = -1;
- p->busType = BUS_SBUS;
+ p->bus.type = BUS_SBUS;
xf86AddDevToEntity(num, dev);
- p->sbusBusId.fbNum = psdp->fbNum;
+ p->bus.id.sbus.fbNum = psdp->fbNum;
p->active = active;
p->inUse = FALSE;
- /* Here we initialize the access structure */
- p->access = xnfcalloc(1,sizeof(EntityAccessRec));
- p->access->fallback = &AccessNULL;
- p->access->pAccess = &AccessNULL;
sbusSlotClaimed = TRUE;
return num;
} else
return -1;
}
-_X_EXPORT int
+int
xf86MatchSbusInstances(const char *driverName, int sbusDevId,
GDevPtr *devList, int numDevs, DriverPtr drvp,
int **foundEntities)
@@ -406,11 +401,6 @@ xf86MatchSbusInstances(const char *driverName, int sbusDevId,
return 0;
}
- if (xf86DoProbe) {
- xfree(instances);
- return numFound;
- }
-
if (sparcPromInit() >= 0)
useProm = 1;
@@ -435,9 +425,7 @@ xf86MatchSbusInstances(const char *driverName, int sbusDevId,
return actualcards;
}
-#ifdef DEBUG
- ErrorF("%s instances found: %d\n", driverName, allocatedInstances);
-#endif
+ DebugF("%s instances found: %d\n", driverName, allocatedInstances);
for (i = 0; i < allocatedInstances; i++) {
char *promPath = NULL;
@@ -494,9 +482,7 @@ xf86MatchSbusInstances(const char *driverName, int sbusDevId,
xfree(promPath);
}
-#ifdef DEBUG
- ErrorF("%s instances found: %d\n", driverName, numClaimedInstances);
-#endif
+ DebugF("%s instances found: %d\n", driverName, numClaimedInstances);
/*
* Of the claimed instances, check that another driver hasn't already
@@ -510,11 +496,9 @@ xf86MatchSbusInstances(const char *driverName, int sbusDevId,
if (!xf86CheckSbusSlot(psdp->fbNum))
continue;
-#ifdef DEBUG
- ErrorF("%s: card at fb%d %08x is claimed by a Device section\n",
+ DebugF("%s: card at fb%d %08x is claimed by a Device section\n",
driverName, psdp->fbNum, psdp->node.node);
-#endif
-
+
/* Allocate an entry in the lists to be returned */
numFound++;
retEntities = xnfrealloc(retEntities, numFound * sizeof(int));
@@ -536,38 +520,38 @@ xf86MatchSbusInstances(const char *driverName, int sbusDevId,
/*
* xf86GetSbusInfoForEntity() -- Get the sbusDevicePtr of entity.
*/
-_X_EXPORT sbusDevicePtr
+sbusDevicePtr
xf86GetSbusInfoForEntity(int entityIndex)
{
sbusDevicePtr *psdpp;
EntityPtr p = xf86Entities[entityIndex];
if (entityIndex >= xf86NumEntities
- || p->busType != BUS_SBUS) return NULL;
+ || p->bus.type != BUS_SBUS) return NULL;
for (psdpp = xf86SbusInfo; *psdpp != NULL; psdpp++) {
- if (p->sbusBusId.fbNum == (*psdpp)->fbNum)
+ if (p->bus.id.sbus.fbNum == (*psdpp)->fbNum)
return (*psdpp);
}
return NULL;
}
-_X_EXPORT int
+int
xf86GetEntityForSbusInfo(sbusDevicePtr psdp)
{
int i;
for (i = 0; i < xf86NumEntities; i++) {
EntityPtr p = xf86Entities[i];
- if (p->busType != BUS_SBUS) continue;
+ if (p->bus.type != BUS_SBUS) continue;
- if (p->sbusBusId.fbNum == psdp->fbNum)
+ if (p->bus.id.sbus.fbNum == psdp->fbNum)
return i;
}
return -1;
}
-_X_EXPORT void
+void
xf86SbusUseBuiltinMode(ScrnInfoPtr pScrn, sbusDevicePtr psdp)
{
DisplayModePtr mode;
@@ -667,7 +651,7 @@ xf86SbusCmapCloseScreen(int i, ScreenPtr pScreen)
return (*pScreen->CloseScreen) (i, pScreen);
}
-_X_EXPORT Bool
+Bool
xf86SbusHandleColormaps(ScreenPtr pScreen, sbusDevicePtr psdp)
{
sbusCmapPtr cmap;
diff --git a/xorg-server/hw/xfree86/common/xf86sbusBus.h b/xorg-server/hw/xfree86/common/xf86sbusBus.h
index 6161a08e2..5cdb0951a 100644
--- a/xorg-server/hw/xfree86/common/xf86sbusBus.h
+++ b/xorg-server/hw/xfree86/common/xf86sbusBus.h
@@ -56,44 +56,45 @@ typedef struct sbus_device {
char *device;
} sbusDevice, *sbusDevicePtr;
-extern struct sbus_devtable {
+struct sbus_devtable {
int devId;
int fbType;
char *promName;
char *driverName;
char *descr;
-} sbusDeviceTable[];
+};
-void xf86SbusProbe(void);
-extern sbusDevicePtr *xf86SbusInfo;
+extern _X_EXPORT void xf86SbusProbe(void);
+extern _X_EXPORT sbusDevicePtr *xf86SbusInfo;
+extern _X_EXPORT struct sbus_devtable sbusDeviceTable[];
-int xf86MatchSbusInstances(const char *driverName, int sbusDevId,
+extern _X_EXPORT int xf86MatchSbusInstances(const char *driverName, int sbusDevId,
GDevPtr *devList, int numDevs, DriverPtr drvp,
int **foundEntities);
-sbusDevicePtr xf86GetSbusInfoForEntity(int entityIndex);
-int xf86GetEntityForSbusInfo(sbusDevicePtr psdp);
-void xf86SbusUseBuiltinMode(ScrnInfoPtr pScrn, sbusDevicePtr psdp);
-pointer xf86MapSbusMem(sbusDevicePtr psdp, unsigned long offset,
+extern _X_EXPORT sbusDevicePtr xf86GetSbusInfoForEntity(int entityIndex);
+extern _X_EXPORT int xf86GetEntityForSbusInfo(sbusDevicePtr psdp);
+extern _X_EXPORT void xf86SbusUseBuiltinMode(ScrnInfoPtr pScrn, sbusDevicePtr psdp);
+extern _X_EXPORT pointer xf86MapSbusMem(sbusDevicePtr psdp, unsigned long offset,
unsigned long size);
-void xf86UnmapSbusMem(sbusDevicePtr psdp, pointer addr, unsigned long size);
-void xf86SbusHideOsHwCursor(sbusDevicePtr psdp);
-void xf86SbusSetOsHwCursorCmap(sbusDevicePtr psdp, int bg, int fg);
-Bool xf86SbusHandleColormaps(ScreenPtr pScreen, sbusDevicePtr psdp);
+extern _X_EXPORT void xf86UnmapSbusMem(sbusDevicePtr psdp, pointer addr, unsigned long size);
+extern _X_EXPORT void xf86SbusHideOsHwCursor(sbusDevicePtr psdp);
+extern _X_EXPORT void xf86SbusSetOsHwCursorCmap(sbusDevicePtr psdp, int bg, int fg);
+extern _X_EXPORT Bool xf86SbusHandleColormaps(ScreenPtr pScreen, sbusDevicePtr psdp);
-extern int promRootNode;
+extern _X_EXPORT int promRootNode;
-int promGetSibling(int node);
-int promGetChild(int node);
-char * promGetProperty(const char *prop, int *lenp);
-int promGetBool(const char *prop);
+extern _X_EXPORT int promGetSibling(int node);
+extern _X_EXPORT int promGetChild(int node);
+extern _X_EXPORT char * promGetProperty(const char *prop, int *lenp);
+extern _X_EXPORT int promGetBool(const char *prop);
-int sparcPromInit(void);
-void sparcPromClose(void);
-char * sparcPromGetProperty(sbusPromNodePtr pnode, const char *prop, int *lenp);
-int sparcPromGetBool(sbusPromNodePtr pnode, const char *prop);
-void sparcPromAssignNodes(void);
-char * sparcPromNode2Pathname(sbusPromNodePtr pnode);
-int sparcPromPathname2Node(const char *pathName);
-char *sparcDriverName(void);
+extern _X_EXPORT int sparcPromInit(void);
+extern _X_EXPORT void sparcPromClose(void);
+extern _X_EXPORT char * sparcPromGetProperty(sbusPromNodePtr pnode, const char *prop, int *lenp);
+extern _X_EXPORT int sparcPromGetBool(sbusPromNodePtr pnode, const char *prop);
+extern _X_EXPORT void sparcPromAssignNodes(void);
+extern _X_EXPORT char * sparcPromNode2Pathname(sbusPromNodePtr pnode);
+extern _X_EXPORT int sparcPromPathname2Node(const char *pathName);
+extern _X_EXPORT char *sparcDriverName(void);
#endif /* _XF86_SBUSBUS_H */
diff --git a/xorg-server/hw/xfree86/common/xf86str.h b/xorg-server/hw/xfree86/common/xf86str.h
index 904c369a6..b9a2e06de 100644
--- a/xorg-server/hw/xfree86/common/xf86str.h
+++ b/xorg-server/hw/xfree86/common/xf86str.h
@@ -342,21 +342,6 @@ typedef struct _DriverRec {
*/
#define HaveDriverFuncs 1
-
-/*
- * The optional module list struct. This allows modules exporting helping
- * functions to configuration tools, the Xserver, or any other
- * application/module interested in such information.
- */
-_X_DEPRECATED typedef struct _ModuleInfoRec {
- int moduleVersion;
- char * moduleName;
- pointer module;
- int refCount;
- const OptionInfoRec * (*AvailableOptions)(void *unused);
- pointer unused[8]; /* leave some space for more fields */
-} ModuleInfoRec, *ModuleInfoPtr;
-
/*
* These are the private bus types. New types can be added here. Types
* required for the public interface should be added to xf86str.h, with
@@ -532,7 +517,7 @@ typedef struct _confdrirec {
/* These values should be adjusted when new fields are added to ScrnInfoRec */
#define NUM_RESERVED_INTS 16
-#define NUM_RESERVED_POINTERS 15
+#define NUM_RESERVED_POINTERS 14
#define NUM_RESERVED_FUNCS 11
typedef pointer (*funcPointer)(void);
@@ -571,145 +556,6 @@ typedef enum {
PM_NONE
} pmWait;
-/*
- * The IO access enabler struct. This contains the address for
- * the IOEnable/IODisable funcs for their specific bus along
- * with a pointer to data needed by them
- */
-typedef struct _AccessRec {
- void (*AccessDisable)(void *arg);
- void (*AccessEnable)(void *arg);
- void *arg;
-} xf86AccessRec, *xf86AccessPtr;
-
-typedef struct {
- xf86AccessPtr mem;
- xf86AccessPtr io;
- xf86AccessPtr io_mem;
-} xf86SetAccessFuncRec, *xf86SetAccessFuncPtr;
-
-/* bus-access-related types */
-typedef enum {
- NONE,
- IO,
- MEM_IO,
- MEM
-} resType;
-
-typedef struct _EntityAccessRec {
- xf86AccessPtr fallback;
- xf86AccessPtr pAccess;
- resType rt;
- pointer busAcc;
- struct _EntityAccessRec *next;
-} EntityAccessRec, *EntityAccessPtr;
-
-typedef struct _CurrAccRec {
- EntityAccessPtr pMemAccess;
- EntityAccessPtr pIoAccess;
-} xf86CurrentAccessRec, *xf86CurrentAccessPtr;
-
-/* new RAC */
-
-/* Resource Type values */
-#define ResNone ((unsigned long)(-1))
-
-#define ResMem 0x0001
-#define ResIo 0x0002
-#define ResPhysMask 0x000F
-
-#define ResExclusive 0x0010
-#define ResShared 0x0020
-#define ResAny 0x0040
-#define ResAccMask 0x0070
-#define ResUnused 0x0080
-
-#define ResUnusedOpr 0x0100
-#define ResDisableOpr 0x0200
-#define ResOprMask 0x0300
-
-#define ResBlock 0x0400
-#define ResSparse 0x0800
-#define ResExtMask 0x0C00
-
-#define ResEstimated 0x001000
-#define ResInit 0x002000
-#define ResBios 0x004000
-#define ResMiscMask 0x00F000
-
-#define ResBus 0x010000
-
-#if defined(__alpha__) && defined(linux)
-# define ResDomain 0x1ff000000ul
-#else
-# define ResDomain 0xff000000ul
-#endif
-#define ResTypeMask (ResPhysMask | ResDomain) /* For conflict check */
-
-#define ResEnd ResNone
-
-#define ResExcMemBlock (ResMem | ResExclusive | ResBlock)
-#define ResExcIoBlock (ResIo | ResExclusive | ResBlock)
-#define ResShrMemBlock (ResMem | ResShared | ResBlock)
-#define ResShrIoBlock (ResIo | ResShared | ResBlock)
-#define ResExcUusdMemBlock (ResMem | ResExclusive | ResUnused | ResBlock)
-#define ResExcUusdIoBlock (ResIo | ResExclusive | ResUnused | ResBlock)
-#define ResShrUusdMemBlock (ResMem | ResShared | ResUnused | ResBlock)
-#define ResShrUusdIoBlock (ResIo | ResShared | ResUnused | ResBlock)
-#define ResExcUusdMemSparse (ResMem | ResExclusive | ResUnused | ResSparse)
-#define ResExcUusdIoSparse (ResIo | ResExclusive | ResUnused | ResSparse)
-#define ResShrUusdMemSparse (ResMem | ResShared | ResUnused | ResSparse)
-#define ResShrUusdIoSparse (ResIo | ResShared | ResUnused | ResSparse)
-
-#define ResExcMemSparse (ResMem | ResExclusive | ResSparse)
-#define ResExcIoSparse (ResIo | ResExclusive | ResSparse)
-#define ResShrMemSparse (ResMem | ResShared | ResSparse)
-#define ResShrIoSparse (ResIo | ResShared | ResSparse)
-#define ResUusdMemSparse (ResMem | ResUnused | ResSparse)
-#define ResUusdIoSparse (ResIo | ResUnused | ResSparse)
-
-#define ResIsMem(r) (((r)->type & ResPhysMask) == ResMem)
-#define ResIsIo(r) (((r)->type & ResPhysMask) == ResIo)
-#define ResIsExclusive(r) (((r)->type & ResAccMask) == ResExclusive)
-#define ResIsShared(r) (((r)->type & ResAccMask) == ResShared)
-#define ResIsUnused(r) (((r)->type & ResAccMask) == ResUnused)
-#define ResIsBlock(r) (((r)->type & ResExtMask) == ResBlock)
-#define ResIsSparse(r) (((r)->type & ResExtMask) == ResSparse)
-#define ResIsEstimated(r) (((r)->type & ResMiscMask) == ResEstimated)
-
-typedef struct {
- unsigned long type; /* shared, exclusive, unused etc. */
- memType a;
- memType b;
-} resRange, *resList;
-
-#define RANGE_TYPE(type, domain) \
- (((unsigned long)(domain) << 24) | ((type) & ~ResBus))
-#define RANGE(r,u,v,t) {\
- (r).a = (u);\
- (r).b = (v);\
- (r).type = (t);\
- }
-
-#define rBase a
-#define rMask b
-#define rBegin a
-#define rEnd b
-
-/* resource record */
-typedef struct _resRec *resPtr;
-typedef struct _resRec {
- resRange val;
- int entityIndex; /* who owns the resource */
- resPtr next;
-} resRec;
-
-#define sparse_base val.rBase
-#define sparse_mask val.rMask
-#define block_begin val.rBegin
-#define block_end val.rEnd
-#define res_type val.type
-
typedef struct _PciChipsets {
/**
* Key used to match this device with its name in an array of
@@ -735,12 +581,14 @@ typedef struct _PciChipsets {
*/
int PCIid;
- /**
- * Resources associated with this type of device.
- */
- resRange *resList;
+/* dummy place holders for drivers to build against old/new servers */
+#define RES_UNDEFINED NULL
+#define RES_EXCLUSIVE_VGA NULL
+#define RES_SHARED_VGA NULL
+ void *dummy;
} PciChipsets;
+
/* Entity properties */
typedef void (*EntityProc)(int entityIndex,pointer private);
@@ -749,7 +597,6 @@ typedef struct _entityInfo {
BusRec location;
int chipset;
Bool active;
- resPtr resources;
GDevPtr device;
DriverPtr driver;
} EntityInfoRec, *EntityInfoPtr;
@@ -761,18 +608,6 @@ typedef enum {
OPERATING
} xf86State;
-typedef enum {
- NOTIFY_SETUP_TRANSITION,
- NOTIFY_SETUP,
- NOTIFY_OPERATING,
- NOTIFY_OPERATING_TRANSITION,
- NOTIFY_ENABLE,
- NOTIFY_ENTER,
- NOTIFY_LEAVE
-} xf86NotifyState;
-
-typedef void (*xf86StateChangeNotificationCallbackFunc)(xf86NotifyState state,pointer);
-
/* DGA */
typedef struct {
@@ -941,12 +776,6 @@ typedef struct _ScrnInfoRec {
int chipID;
int chipRev;
- int racMemFlags;
- int racIoFlags;
- pointer access;
- xf86CurrentAccessPtr CurrentAccess;
- resType resourceType;
- pointer busAccess;
/* Allow screens to be enabled/disabled individually */
Bool vtSema;
@@ -967,6 +796,8 @@ typedef struct _ScrnInfoRec {
int reservedInt[NUM_RESERVED_INTS];
int * entityInstanceList;
+ struct pci_device *vgaDev;
+
pointer reservedPtr[NUM_RESERVED_POINTERS];
/*
diff --git a/xorg-server/hw/xfree86/common/xf86xv.c b/xorg-server/hw/xfree86/common/xf86xv.c
index 02d6e37a4..abbe03397 100644
--- a/xorg-server/hw/xfree86/common/xf86xv.c
+++ b/xorg-server/hw/xfree86/common/xf86xv.c
@@ -132,7 +132,7 @@ int (*XvScreenInitProc)(ScreenPtr) = NULL;
static xf86XVInitGenericAdaptorPtr *GenDrivers = NULL;
static int NumGenDrivers = 0;
-_X_EXPORT int
+int
xf86XVRegisterGenericAdaptorDriver(
xf86XVInitGenericAdaptorPtr InitFunc
){
@@ -149,7 +149,7 @@ xf86XVRegisterGenericAdaptorDriver(
return 1;
}
-_X_EXPORT int
+int
xf86XVListGenericAdaptors(
ScrnInfoPtr pScrn,
XF86VideoAdaptorPtr **adaptors
@@ -188,7 +188,7 @@ typedef struct {
static OffscreenImageRec OffscreenImages[MAXSCREENS];
-_X_EXPORT Bool
+Bool
xf86XVRegisterOffscreenImages(
ScreenPtr pScreen,
XF86OffscreenImagePtr images,
@@ -200,7 +200,7 @@ xf86XVRegisterOffscreenImages(
return TRUE;
}
-_X_EXPORT XF86OffscreenImagePtr
+XF86OffscreenImagePtr
xf86XVQueryOffscreenImages(
ScreenPtr pScreen,
int *num
@@ -210,20 +210,20 @@ xf86XVQueryOffscreenImages(
}
-_X_EXPORT XF86VideoAdaptorPtr
+XF86VideoAdaptorPtr
xf86XVAllocateVideoAdaptorRec(ScrnInfoPtr pScrn)
{
return xcalloc(1, sizeof(XF86VideoAdaptorRec));
}
-_X_EXPORT void
+void
xf86XVFreeVideoAdaptorRec(XF86VideoAdaptorPtr ptr)
{
xfree(ptr);
}
-_X_EXPORT Bool
+Bool
xf86XVScreenInit(
ScreenPtr pScreen,
XF86VideoAdaptorPtr *adaptors,
@@ -1123,6 +1123,10 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy)
pPriv->pCompositeClip = NULL;
+ if (pPriv->AdaptorRec->ClipNotify)
+ (*pPriv->AdaptorRec->ClipNotify)(pPriv->pScrn, pPriv->DevPriv.ptr,
+ pWin, dx, dy);
+
/* Stop everything except images, but stop them too if the
window isn't visible. But we only remove the images. */
@@ -1814,7 +1818,7 @@ xf86XVQueryImageAttributes(
}
-_X_EXPORT void
+void
xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes)
{
ScreenPtr pScreen = pDraw->pScreen;
@@ -1864,7 +1868,7 @@ xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes)
xfree(rects);
}
-_X_EXPORT void
+void
xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes)
{
DrawablePtr root = &WindowTable[pScreen->myNum]->drawable;
@@ -1909,7 +1913,7 @@ xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes)
#define DummyScreen screenInfo.screens[0]
-_X_EXPORT Bool
+Bool
xf86XVClipVideoHelper(
BoxPtr dst,
INT32 *xa,
@@ -1991,7 +1995,7 @@ xf86XVClipVideoHelper(
return TRUE;
}
-_X_EXPORT void
+void
xf86XVCopyYUV12ToPacked(
const void *srcy,
const void *srcv,
@@ -2049,7 +2053,7 @@ xf86XVCopyYUV12ToPacked(
}
}
-_X_EXPORT void
+void
xf86XVCopyPacked(
const void *src,
void *dst,
diff --git a/xorg-server/hw/xfree86/common/xf86xv.h b/xorg-server/hw/xfree86/common/xf86xv.h
index 817e2b994..c3db6cc73 100644
--- a/xorg-server/hw/xfree86/common/xf86xv.h
+++ b/xorg-server/hw/xfree86/common/xf86xv.h
@@ -112,6 +112,8 @@ typedef int (* ReputImageFuncPtr)( ScrnInfoPtr pScrn, short drw_x, short drw_y,
typedef int (*QueryImageAttributesFuncPtr)(ScrnInfoPtr pScrn,
int image, unsigned short *width, unsigned short *height,
int *pitches, int *offsets);
+typedef void (*ClipNotifyFuncPtr)(ScrnInfoPtr pScrn, pointer data,
+ WindowPtr window, int dx, int dy);
typedef enum {
XV_OFF,
@@ -165,6 +167,7 @@ typedef struct {
PutImageFuncPtr PutImage;
ReputImageFuncPtr ReputImage;
QueryImageAttributesFuncPtr QueryImageAttributes;
+ ClipNotifyFuncPtr ClipNotify;
} XF86VideoAdaptorRec, *XF86VideoAdaptorPtr;
typedef struct {
@@ -191,7 +194,7 @@ typedef struct {
XF86AttributePtr attributes;
} XF86OffscreenImageRec, *XF86OffscreenImagePtr;
-Bool
+extern _X_EXPORT Bool
xf86XVScreenInit(
ScreenPtr pScreen,
XF86VideoAdaptorPtr *Adaptors,
@@ -201,41 +204,41 @@ xf86XVScreenInit(
typedef int (* xf86XVInitGenericAdaptorPtr)(ScrnInfoPtr pScrn,
XF86VideoAdaptorPtr **Adaptors);
-int
+extern _X_EXPORT int
xf86XVRegisterGenericAdaptorDriver(
xf86XVInitGenericAdaptorPtr InitFunc
);
-int
+extern _X_EXPORT int
xf86XVListGenericAdaptors(
ScrnInfoPtr pScrn,
XF86VideoAdaptorPtr **Adaptors
);
-Bool
+extern _X_EXPORT Bool
xf86XVRegisterOffscreenImages(
ScreenPtr pScreen,
XF86OffscreenImagePtr images,
int num
);
-XF86OffscreenImagePtr
+extern _X_EXPORT XF86OffscreenImagePtr
xf86XVQueryOffscreenImages(
ScreenPtr pScreen,
int *num
);
-XF86VideoAdaptorPtr xf86XVAllocateVideoAdaptorRec(ScrnInfoPtr pScrn);
+extern _X_EXPORT XF86VideoAdaptorPtr xf86XVAllocateVideoAdaptorRec(ScrnInfoPtr pScrn);
-void xf86XVFreeVideoAdaptorRec(XF86VideoAdaptorPtr ptr);
+extern _X_EXPORT void xf86XVFreeVideoAdaptorRec(XF86VideoAdaptorPtr ptr);
-void
+extern _X_EXPORT void
xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes);
-void
+extern _X_EXPORT void
xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes);
-Bool
+extern _X_EXPORT Bool
xf86XVClipVideoHelper(
BoxPtr dst,
INT32 *xa,
@@ -247,7 +250,7 @@ xf86XVClipVideoHelper(
INT32 height
);
-void
+extern _X_EXPORT void
xf86XVCopyYUV12ToPacked(
const void *srcy,
const void *srcv,
@@ -260,7 +263,7 @@ xf86XVCopyYUV12ToPacked(
int w
);
-void
+extern _X_EXPORT void
xf86XVCopyPacked(
const void *src,
void *dst,
@@ -270,4 +273,8 @@ xf86XVCopyPacked(
int w
);
+extern _X_EXPORT DevPrivateKey (*XvGetScreenKeyProc)(void);
+extern _X_EXPORT unsigned long (*XvGetRTPortProc)(void);
+extern _X_EXPORT int (*XvScreenInitProc)(ScreenPtr);
+
#endif /* _XF86XV_H_ */
diff --git a/xorg-server/hw/xfree86/common/xf86xvmc.c b/xorg-server/hw/xfree86/common/xf86xvmc.c
index 41ef0a0ca..39d33da08 100644
--- a/xorg-server/hw/xfree86/common/xf86xvmc.c
+++ b/xorg-server/hw/xfree86/common/xf86xvmc.c
@@ -45,8 +45,7 @@
#include "xf86xvpriv.h"
#include "xf86xvmc.h"
-typedef int (*XvMCScreenInitProcPtr)(ScreenPtr, int, XvMCAdaptorPtr);
-_X_EXPORT XvMCScreenInitProcPtr XvMCScreenInitProc = NULL;
+XvMCScreenInitProcPtr XvMCScreenInitProc = NULL;
typedef struct {
@@ -156,7 +155,7 @@ xf86XvMCCloseScreen (int i, ScreenPtr pScreen)
return (*pScreen->CloseScreen)(i, pScreen);
}
-_X_EXPORT Bool xf86XvMCScreenInit(
+Bool xf86XvMCScreenInit(
ScreenPtr pScreen,
int num_adaptors,
XF86MCAdaptorPtr *adaptors
@@ -219,12 +218,12 @@ _X_EXPORT Bool xf86XvMCScreenInit(
return TRUE;
}
-_X_EXPORT XF86MCAdaptorPtr xf86XvMCCreateAdaptorRec (void)
+XF86MCAdaptorPtr xf86XvMCCreateAdaptorRec (void)
{
return xcalloc(1, sizeof(XF86MCAdaptorRec));
}
-_X_EXPORT void xf86XvMCDestroyAdaptorRec(XF86MCAdaptorPtr adaptor)
+void xf86XvMCDestroyAdaptorRec(XF86MCAdaptorPtr adaptor)
{
xfree(adaptor);
}
diff --git a/xorg-server/hw/xfree86/common/xf86xvmc.h b/xorg-server/hw/xfree86/common/xf86xvmc.h
index bc7a98c6a..902b4f8fc 100644
--- a/xorg-server/hw/xfree86/common/xf86xvmc.h
+++ b/xorg-server/hw/xfree86/common/xf86xvmc.h
@@ -151,13 +151,16 @@ typedef struct {
an array of structures.
*/
-Bool xf86XvMCScreenInit(
+extern _X_EXPORT Bool xf86XvMCScreenInit(
ScreenPtr pScreen,
int num_adaptors,
XF86MCAdaptorPtr *adaptors
);
-XF86MCAdaptorPtr xf86XvMCCreateAdaptorRec (void);
-void xf86XvMCDestroyAdaptorRec(XF86MCAdaptorPtr adaptor);
+extern _X_EXPORT XF86MCAdaptorPtr xf86XvMCCreateAdaptorRec (void);
+extern _X_EXPORT void xf86XvMCDestroyAdaptorRec(XF86MCAdaptorPtr adaptor);
+
+typedef int (*XvMCScreenInitProcPtr)(ScreenPtr, int, XvMCAdaptorPtr);
+extern _X_EXPORT XvMCScreenInitProcPtr XvMCScreenInitProc;
#endif /* _XF86XVMC_H */
diff --git a/xorg-server/hw/xfree86/common/xf86xvpriv.h b/xorg-server/hw/xfree86/common/xf86xvpriv.h
index 4200dac80..7623d297d 100644
--- a/xorg-server/hw/xfree86/common/xf86xvpriv.h
+++ b/xorg-server/hw/xfree86/common/xf86xvpriv.h
@@ -34,7 +34,7 @@
/*** These are DDX layer privates ***/
-extern DevPrivateKey XF86XvScreenKey;
+extern _X_EXPORT DevPrivateKey XF86XvScreenKey;
typedef struct {
DestroyWindowProcPtr DestroyWindow;
@@ -59,6 +59,7 @@ typedef struct {
PutImageFuncPtr PutImage;
ReputImageFuncPtr ReputImage;
QueryImageAttributesFuncPtr QueryImageAttributes;
+ ClipNotifyFuncPtr ClipNotify;
} XvAdaptorRecPrivate, *XvAdaptorRecPrivatePtr;
typedef struct {
diff --git a/xorg-server/hw/xfree86/common/xisb.c b/xorg-server/hw/xfree86/common/xisb.c
index 6314094a0..1cb9e4854 100644
--- a/xorg-server/hw/xfree86/common/xisb.c
+++ b/xorg-server/hw/xfree86/common/xisb.c
@@ -62,7 +62,7 @@
* Function Definitions
****************************************************************************/
-_X_EXPORT XISBuffer *
+XISBuffer *
XisbNew (int fd, ssize_t size)
{
XISBuffer *b;
@@ -86,14 +86,14 @@ XisbNew (int fd, ssize_t size)
return (b);
}
-_X_EXPORT void
+void
XisbFree (XISBuffer *b)
{
xfree (b->buf);
xfree (b);
}
-_X_EXPORT int
+int
XisbRead (XISBuffer *b)
{
int ret;
@@ -136,7 +136,7 @@ XisbRead (XISBuffer *b)
}
/* the only purpose of this function is to provide output tracing */
-_X_EXPORT ssize_t
+ssize_t
XisbWrite (XISBuffer *b, unsigned char *msg, ssize_t len)
{
if (b->trace)
@@ -149,7 +149,7 @@ XisbWrite (XISBuffer *b, unsigned char *msg, ssize_t len)
}
/* turn tracing of this buffer on (1) or off (0) */
-_X_EXPORT void
+void
XisbTrace (XISBuffer *b, int trace)
{
b->trace = trace;
@@ -167,7 +167,7 @@ XisbTrace (XISBuffer *b, int trace)
* give duration in usecs.
*/
-_X_EXPORT void
+void
XisbBlockDuration (XISBuffer *b, int block_duration)
{
b->block_duration = block_duration;
diff --git a/xorg-server/hw/xfree86/common/xisb.h b/xorg-server/hw/xfree86/common/xisb.h
index b7bdd5682..bacfde166 100644
--- a/xorg-server/hw/xfree86/common/xisb.h
+++ b/xorg-server/hw/xfree86/common/xisb.h
@@ -52,12 +52,12 @@ typedef struct _XISBuffer
* of globals.
* put locals in the .c file.
*****************************************************************************/
-XISBuffer * XisbNew (int fd, ssize_t size);
-void XisbFree (XISBuffer *b);
-int XisbRead (XISBuffer *b);
-ssize_t XisbWrite (XISBuffer *b, unsigned char *msg, ssize_t len);
-void XisbTrace (XISBuffer *b, int trace);
-void XisbBlockDuration (XISBuffer *b, int block_duration);
+extern _X_EXPORT XISBuffer * XisbNew (int fd, ssize_t size);
+extern _X_EXPORT void XisbFree (XISBuffer *b);
+extern _X_EXPORT int XisbRead (XISBuffer *b);
+extern _X_EXPORT ssize_t XisbWrite (XISBuffer *b, unsigned char *msg, ssize_t len);
+extern _X_EXPORT void XisbTrace (XISBuffer *b, int trace);
+extern _X_EXPORT void XisbBlockDuration (XISBuffer *b, int block_duration);
/*
* DO NOT PUT ANYTHING AFTER THIS ENDIF
diff --git a/xorg-server/hw/xfree86/common/xorgHelper.c b/xorg-server/hw/xfree86/common/xorgHelper.c
index 7f9dd507a..7a8e5167d 100644
--- a/xorg-server/hw/xfree86/common/xorgHelper.c
+++ b/xorg-server/hw/xfree86/common/xorgHelper.c
@@ -17,7 +17,7 @@
CARD32
-xorgGetVersion()
+xorgGetVersion(void)
{
return XORG_VERSION_CURRENT;
}