aboutsummaryrefslogtreecommitdiff
path: root/xorg-server
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server')
-rw-r--r--xorg-server/configure.ac4556
-rw-r--r--xorg-server/exa/exa_mixed.c579
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxcmds.c7302
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxsingle.c2031
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxvendor.c1170
-rw-r--r--xorg-server/hw/dmx/glxProxy/render2swap.c626
-rw-r--r--xorg-server/hw/xfree86/common/xf86Helper.c4100
-rw-r--r--xorg-server/hw/xfree86/common/xf86Module.h2
-rw-r--r--xorg-server/hw/xfree86/common/xf86sbusBus.c1428
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Crtc.c6523
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Crtc.h2047
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Cursors.c1376
-rw-r--r--xorg-server/hw/xfree86/modes/xf86RandR12.c3831
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Rotate.c1090
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/bsd_init.c1516
-rw-r--r--xorg-server/hw/xfree86/os-support/xf86_OSlib.h8
-rw-r--r--xorg-server/hw/xquartz/bundle/Info.plist.cpp2
-rw-r--r--xorg-server/hw/xquartz/bundle/Resources/French.lproj/locversion.plist28
-rw-r--r--xorg-server/hw/xquartz/bundle/Resources/French.lproj/main.nib/designable.nib7383
-rw-r--r--xorg-server/hw/xquartz/bundle/Resources/French.lproj/main.nib/keyedobjects.nibbin55820 -> 36464 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/Resources/German.lproj/locversion.plist4
-rw-r--r--xorg-server/hw/xquartz/bundle/Resources/German.lproj/main.nib/designable.nib360
-rw-r--r--xorg-server/hw/xquartz/bundle/Resources/German.lproj/main.nib/keyedobjects.nibbin52574 -> 35590 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/Resources/Japanese.lproj/locversion.plist4
-rw-r--r--xorg-server/hw/xquartz/bundle/Resources/Japanese.lproj/main.nib/designable.nib323
-rw-r--r--xorg-server/hw/xquartz/bundle/Resources/Japanese.lproj/main.nib/keyedobjects.nibbin46474 -> 33650 bytes
-rw-r--r--xorg-server/include/colormapst.h264
-rw-r--r--xorg-server/include/protocol-versions.h296
-rw-r--r--xorg-server/include/scrnintstr.h2
-rw-r--r--xorg-server/include/xorg-server.h.in7
-rw-r--r--xorg-server/randr/Makefile.am62
-rw-r--r--xorg-server/randr/randr.c1019
-rw-r--r--xorg-server/randr/randrstr.h2099
-rw-r--r--xorg-server/randr/rrcrtc.c3150
-rw-r--r--xorg-server/randr/rrdispatch.c462
-rw-r--r--xorg-server/randr/rrinfo.c682
-rw-r--r--xorg-server/randr/rrscreen.c32
-rw-r--r--xorg-server/randr/rrsdispatch.c1138
-rw-r--r--xorg-server/randr/rrtransform.c620
-rw-r--r--xorg-server/randr/rrtransform.h161
-rw-r--r--xorg-server/record/record.c5864
-rw-r--r--xorg-server/xkeyboard-config/rules/base.ml_s.part83
42 files changed, 30770 insertions, 31460 deletions
diff --git a/xorg-server/configure.ac b/xorg-server/configure.ac
index 21b2a28f4..f3b293940 100644
--- a/xorg-server/configure.ac
+++ b/xorg-server/configure.ac
@@ -1,2278 +1,2278 @@
-dnl Copyright © 2003-2007 Keith Packard, Daniel Stone
-dnl
-dnl Permission is hereby granted, free of charge, to any person obtaining a
-dnl copy of this software and associated documentation files (the "Software"),
-dnl to deal in the Software without restriction, including without limitation
-dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
-dnl and/or sell copies of the Software, and to permit persons to whom the
-dnl Software is furnished to do so, subject to the following conditions:
-dnl
-dnl The above copyright notice and this permission notice (including the next
-dnl paragraph) shall be included in all copies or substantial portions of the
-dnl Software.
-dnl
-dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-dnl DEALINGS IN THE SOFTWARE.
-dnl
-dnl Authors: Keith Packard <keithp@keithp.com>
-dnl Daniel Stone <daniel@fooishbar.org>
-dnl an unwitting cast of miscellaneous others
-dnl
-dnl Process this file with autoconf to create configure.
-
-AC_PREREQ(2.57)
-AC_INIT([xorg-server], 1.9.99.902, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2011-2-18"
-AC_CONFIG_SRCDIR([Makefile.am])
-AM_INIT_AUTOMAKE([foreign dist-bzip2])
-AM_MAINTAINER_MODE
-
-# Require xorg-macros minimum of 1.10 for XORG_CHECK_SGML_DOCTOOLS
-m4_ifndef([XORG_MACROS_VERSION],
- [m4_fatal([must install xorg-macros 1.10 or later before running autoconf/autogen])])
-XORG_MACROS_VERSION(1.10)
-XORG_DEFAULT_OPTIONS
-XORG_WITH_DOXYGEN(1.6.1)
-XORG_CHECK_SGML_DOCTOOLS(1.5)
-
-m4_ifndef([XORG_FONT_MACROS_VERSION], [m4_fatal([must install fontutil 1.1 or later before running autoconf/autogen])])
-XORG_FONT_MACROS_VERSION(1.1)
-
-dnl this gets generated by autoheader, and thus contains all the defines. we
-dnl don't ever actually use it, internally.
-AC_CONFIG_HEADERS(include/do-not-use-config.h)
-dnl xorg-server.h is an external header, designed to be included by loadable
-dnl drivers.
-AC_CONFIG_HEADERS(include/xorg-server.h)
-dnl dix-config.h covers most of the DIX (i.e. everything but the DDX, not just
-dnl dix/).
-AC_CONFIG_HEADERS(include/dix-config.h)
-dnl xorg-config.h covers the Xorg DDX.
-AC_CONFIG_HEADERS(include/xorg-config.h)
-dnl xkb-config.h covers XKB for the Xorg and Xnest DDXs.
-AC_CONFIG_HEADERS(include/xkb-config.h)
-dnl xwin-config.h covers the XWin DDX.
-AC_CONFIG_HEADERS(include/xwin-config.h)
-dnl kdrive-config.h covers the kdrive DDX
-AC_CONFIG_HEADERS(include/kdrive-config.h)
-dnl version-config.h covers the version numbers so they can be bumped without
-dnl forcing an entire recompile.x
-AC_CONFIG_HEADERS(include/version-config.h)
-
-AM_PROG_AS
-AC_PROG_LN_S
-AC_LIBTOOL_WIN32_DLL
-AC_DISABLE_STATIC
-AC_PROG_LIBTOOL
-AC_PROG_MAKE_SET
-PKG_PROG_PKG_CONFIG
-AC_PROG_LEX
-AC_PROG_YACC
-AC_SYS_LARGEFILE
-XORG_PROG_RAWCPP
-
-# Quoted so that make will expand $(CWARNFLAGS) in makefiles to allow
-# easier overrides at build time.
-XSERVER_CFLAGS='$(CWARNFLAGS)'
-
-dnl Check for dtrace program (needed to build Xserver dtrace probes)
-dnl Also checks for <sys/sdt.h>, since some Linux distros have an
-dnl ISDN trace program named dtrace
-AC_ARG_WITH(dtrace, AS_HELP_STRING([--with-dtrace=PATH],
- [Enable dtrace probes (default: enabled if dtrace found)]),
- [WDTRACE=$withval], [WDTRACE=auto])
-if test "x$WDTRACE" = "xyes" -o "x$WDTRACE" = "xauto" ; then
- AC_PATH_PROG(DTRACE, [dtrace], [not_found], [$PATH:/usr/sbin])
- if test "x$DTRACE" = "xnot_found" ; then
- if test "x$WDTRACE" = "xyes" ; then
- AC_MSG_FAILURE([dtrace requested but not found])
- fi
- WDTRACE="no"
- else
- AC_CHECK_HEADER(sys/sdt.h, [HAS_SDT_H="yes"], [HAS_SDT_H="no"])
- if test "x$WDTRACE" = "xauto" -a "x$HAS_SDT_H" = "xno" ; then
- WDTRACE="no"
- fi
- fi
-fi
-if test "x$WDTRACE" != "xno" ; then
- AC_DEFINE(XSERVER_DTRACE, 1,
- [Define to 1 if the DTrace Xserver provider probes should be built in.])
-
-# Solaris/OpenSolaris require dtrace -G to build dtrace probe information into
-# object files, and require linking with those as relocatable objects, not .a
-# archives. MacOS X handles all this in the normal compiler toolchain, and on
-# some releases (like Tiger), will error out on dtrace -G. For now, other
-# platforms with Dtrace ports are assumed to support -G (the FreeBSD and Linux
-# ports appear to, based on my web searches, but have not yet been tested).
- case $host_os in
- darwin*) SPECIAL_DTRACE_OBJECTS=no ;;
- *) SPECIAL_DTRACE_OBJECTS=yes ;;
- esac
-fi
-AM_CONDITIONAL(XSERVER_DTRACE, [test "x$WDTRACE" != "xno"])
-AM_CONDITIONAL(SPECIAL_DTRACE_OBJECTS, [test "x$SPECIAL_DTRACE_OBJECTS" = "xyes"])
-
-AC_HEADER_DIRENT
-AC_HEADER_STDC
-AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h dlfcn.h stropts.h fnmatch.h sys/utsname.h])
-
-dnl Checks for typedefs, structures, and compiler characteristics.
-AC_C_CONST
-AC_C_BIGENDIAN([ENDIAN="X_BIG_ENDIAN"], [ENDIAN="X_LITTLE_ENDIAN"])
-
-AC_CHECK_SIZEOF([unsigned long])
-if test "$ac_cv_sizeof_unsigned_long" = 8; then
- AC_DEFINE(_XSERVER64, 1, [Define to 1 if unsigned long is 64 bits.])
-fi
-
-AC_TYPE_PID_T
-
-# Checks for headers/macros for byte swapping
-# Known variants:
-# <byteswap.h> bswap_16, bswap_32, bswap_64 (glibc)
-# <sys/endian.h> __swap16, __swap32, __swap64 (OpenBSD)
-# <sys/endian.h> bswap16, bswap32, bswap64 (other BSD's)
-# and a fallback to local macros if none of the above are found
-
-# if <byteswap.h> is found, assume it's the correct version
-AC_CHECK_HEADERS([byteswap.h])
-
-# if <sys/endian.h> is found, have to check which version
-AC_CHECK_HEADER([sys/endian.h], [HAVE_SYS_ENDIAN_H="yes"], [HAVE_SYS_ENDIAN_H="no"])
-
-if test "x$HAVE_SYS_ENDIAN_H" = "xyes" ; then
- AC_MSG_CHECKING([for __swap16 variant of <sys/endian.h> byteswapping macros])
- AC_LINK_IFELSE([AC_LANG_PROGRAM([
-#include <sys/types.h>
-#include <sys/endian.h>
- ], [
-int a = 1, b;
-b = __swap16(a);
- ])
-], [SYS_ENDIAN__SWAP='yes'], [SYS_ENDIAN__SWAP='no'])
- AC_MSG_RESULT([$SYS_ENDIAN__SWAP])
-
- AC_MSG_CHECKING([for bswap16 variant of <sys/endian.h> byteswapping macros])
- AC_LINK_IFELSE([AC_LANG_PROGRAM([
-#include <sys/types.h>
-#include <sys/endian.h>
- ], [
-int a = 1, b;
-b = bswap16(a);
- ])
-], [SYS_ENDIAN_BSWAP='yes'], [SYS_ENDIAN_BSWAP='no'])
- AC_MSG_RESULT([$SYS_ENDIAN_BSWAP])
-
- if test "$SYS_ENDIAN_BSWAP" = "yes" ; then
- USE_SYS_ENDIAN_H=yes
- BSWAP=bswap
- else
- if test "$SYS_ENDIAN__SWAP" = "yes" ; then
- USE_SYS_ENDIAN_H=yes
- BSWAP=__swap
- else
- USE_SYS_ENDIAN_H=no
- fi
- fi
-
- if test "$USE_SYS_ENDIAN_H" = "yes" ; then
- AC_DEFINE([USE_SYS_ENDIAN_H], 1,
- [Define to use byteswap macros from <sys/endian.h>])
- AC_DEFINE_UNQUOTED([bswap_16], ${BSWAP}16,
- [Define to 16-bit byteswap macro])
- AC_DEFINE_UNQUOTED([bswap_32], ${BSWAP}32,
- [Define to 32-bit byteswap macro])
- AC_DEFINE_UNQUOTED([bswap_64], ${BSWAP}64,
- [Define to 64-bit byteswap macro])
- fi
-fi
-
-dnl Check to see if dlopen is in default libraries (like Solaris, which
-dnl has it in libc), or if libdl is needed to get it.
-AC_CHECK_FUNC([dlopen], [],
- AC_CHECK_LIB([dl], [dlopen], DLOPEN_LIBS="-ldl"))
-AC_SUBST(DLOPEN_LIBS)
-
-dnl Checks for library functions.
-AC_FUNC_VPRINTF
-AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr \
- strtol getopt getopt_long vsnprintf walkcontext backtrace \
- getisax getzoneid shmctl64 strcasestr ffs vasprintf])
-AC_FUNC_ALLOCA
-dnl Old HAS_* names used in os/*.c.
-AC_CHECK_FUNC([getdtablesize],
- AC_DEFINE(HAS_GETDTABLESIZE, 1, [Have the 'getdtablesize' function.]))
-AC_CHECK_FUNC([getifaddrs],
- AC_DEFINE(HAS_GETIFADDRS, 1, [Have the 'getifaddrs' function.]))
-AC_CHECK_FUNC([getpeereid],
- AC_DEFINE(HAS_GETPEEREID, 1, [Have the 'getpeereid' function.]))
-AC_CHECK_FUNC([getpeerucred],
- AC_DEFINE(HAS_GETPEERUCRED, 1, [Have the 'getpeerucred' function.]))
-AC_CHECK_FUNC([strlcat], HAVE_STRLCAT=yes, HAVE_STRLCAT=no)
-AM_CONDITIONAL(NEED_STRLCAT, [test x$HAVE_STRLCAT = xno])
-AC_CHECK_FUNC([strlcpy], AC_DEFINE(HAS_STRLCPY, 1, [Have the 'strlcpy' function]))
-
-AM_CONDITIONAL(NEED_VSNPRINTF, [test x$HAVE_VSNPRINTF = xno])
-
-dnl Check for mmap support for Xvfb
-AC_CHECK_FUNC([mmap], AC_DEFINE(HAS_MMAP, 1, [Have the 'mmap' function.]))
-
-dnl Find the math libary
-AC_CHECK_LIB(m, sqrt)
-AC_CHECK_LIB(m, cbrt, AC_DEFINE(HAVE_CBRT, 1, [Have the 'cbrt' function]))
-
-AC_CHECK_HEADERS([ndbm.h dbm.h rpcsvc/dbm.h])
-
-dnl AGPGART headers
-AC_CHECK_HEADERS([linux/agpgart.h sys/agpio.h sys/agpgart.h], AGP=yes)
-AM_CONDITIONAL(AGP, [test "x$AGP" = xyes])
-
-dnl APM header
-AC_CHECK_HEADERS([linux/apm_bios.h], LNXAPM=yes)
-AM_CONDITIONAL(LNXAPM, [test "x$LNXAPM" = xyes])
-
-dnl fbdev header
-AC_CHECK_HEADERS([linux/fb.h], FBDEV=yes)
-AM_CONDITIONAL(FBDEVHW, [test "x$FBDEV" = xyes])
-
-dnl MTRR header
-AC_CHECK_HEADERS([asm/mtrr.h], ac_cv_asm_mtrr_h=yes)
-if test "x$ac_cv_asm_mtrr_h" = xyes; then
- HAVE_MTRR=yes
-fi
-
-dnl BSD MTRR header
-AC_CHECK_HEADERS([sys/memrange.h], ac_cv_memrange_h=yes)
-if test "x$ac_cv_memrange_h" = xyes; then
- HAVE_MTRR=yes
-fi
-
-if test "x$HAVE_MTRR" = xyes; then
- AC_DEFINE(HAS_MTRR_SUPPORT, 1, [MTRR support available])
-fi
-
-dnl A NetBSD MTRR header
-AC_CHECK_HEADERS([machine/mtrr.h], ac_cv_machine_mtrr_h=yes)
-if test "x$ac_cv_machine_mtrr_h" = xyes; then
- AC_DEFINE(HAS_MTRR_BUILTIN, 1, [Define to 1 if NetBSD built-in MTRR
- support is available])
-fi
-
-dnl FreeBSD kldload support (sys/linker.h)
-AC_CHECK_HEADERS([sys/linker.h],
- [ac_cv_sys_linker_h=yes],
- [ac_cv_sys_linker_h=no],
- [#include <sys/param.h>])
-AM_CONDITIONAL(FREEBSD_KLDLOAD, [test "x$ac_cv_sys_linker_h" = xyes])
-
-AC_CACHE_CHECK([for SYSV IPC],
- ac_cv_sysv_ipc,
- [AC_TRY_LINK([
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-],[
-{
- int id;
- id = shmget(IPC_PRIVATE, 512, SHM_W | SHM_R);
- if (id < 0) return -1;
- return shmctl(id, IPC_RMID, 0);
-}],
- [ac_cv_sysv_ipc=yes],
- [ac_cv_sysv_ipc=no])])
-if test "x$ac_cv_sysv_ipc" = xyes; then
- AC_DEFINE(HAVE_SYSV_IPC, 1, [Define to 1 if SYSV IPC is available])
-fi
-
-dnl OpenBSD /dev/xf86 aperture driver
-if test -c /dev/xf86 ; then
- AC_DEFINE(HAS_APERTURE_DRV, 1, [System has /dev/xf86 aperture driver])
-fi
-
-dnl BSD APM support
-AC_CHECK_HEADER([machine/apmvar.h],[
- AC_CHECK_HEADER([sys/event.h],
- ac_cv_BSD_KQUEUE_APM=yes,
- ac_cv_BSD_APM=yes)])
-
-AM_CONDITIONAL(BSD_APM, [test "x$ac_cv_BSD_APM" = xyes])
-AM_CONDITIONAL(BSD_KQUEUE_APM, [test "x$ac_cv_BSD_KQUEUE_APM" = xyes])
-
-dnl glibc backtrace support check (hw/xfree86/common/xf86Events.c)
-AC_CHECK_HEADER([execinfo.h],[
- AC_CHECK_LIB(c, backtrace, [
- AC_DEFINE(HAVE_BACKTRACE, 1, [Has backtrace support])
- AC_DEFINE(HAVE_EXECINFO_H, 1, [Have execinfo.h])
- ])]
-)
-
-dnl ARM needs additional compiler flags for proper backtraces if GCC is
-dnl used. Compile a dummy program with the -mapcs-frame option. If it
-dnl succeeds, we know that we are building for ARM with GCC.
-old_CFLAGS="$CFLAGS"
-CFLAGS="-mapcs-frame"
-AC_COMPILE_IFELSE(
- AC_LANG_PROGRAM([[ ]]),
- ARM_BACKTRACE_CFLAGS="$CFLAGS",
- ARM_BACKTRACE_CFLAGS=""
-)
-CFLAGS="$old_CFLAGS"
-AC_SUBST(ARM_BACKTRACE_CFLAGS)
-
-dnl ---------------------------------------------------------------------------
-dnl Bus options and CPU capabilities. Replaces logic in
-dnl hw/xfree86/os-support/bus/Makefile.am, among others.
-dnl ---------------------------------------------------------------------------
-DEFAULT_INT10="x86emu"
-
-dnl Override defaults as needed for specific platforms:
-
-case $host_cpu in
- alpha*)
- ALPHA_VIDEO=yes
- case $host_os in
- *freebsd*) SYS_LIBS=-lio ;;
- *netbsd*) AC_DEFINE(USE_ALPHA_PIO, 1, [NetBSD PIO alpha IO]) ;;
- esac
- GLX_ARCH_DEFINES="-D__GLX_ALIGN64 -mieee"
- ;;
- arm*)
- ARM_VIDEO=yes
- ;;
- i*86)
- I386_VIDEO=yes
- case $host_os in
- *freebsd*) AC_DEFINE(USE_DEV_IO) ;;
- *dragonfly*) AC_DEFINE(USE_DEV_IO) ;;
- *netbsd*) AC_DEFINE(USE_I386_IOPL)
- SYS_LIBS=-li386
- ;;
- *openbsd*) AC_DEFINE(USE_I386_IOPL)
- SYS_LIBS=-li386
- ;;
- esac
- ;;
- powerpc*)
- PPC_VIDEO=yes
- case $host_os in
- *freebsd*) DEFAULT_INT10=stub ;;
- esac
- ;;
- sparc*)
- SPARC64_VIDEO=yes
- BSD_ARCH_SOURCES="sparc64_video.c ioperm_noop.c"
- GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
- ;;
- x86_64*|amd64*)
- I386_VIDEO=yes
- case $host_os in
- *freebsd*) AC_DEFINE(USE_DEV_IO, 1, [BSD /dev/io]) ;;
- *dragonfly*) AC_DEFINE(USE_DEV_IO, 1, [BSD /dev/io]) ;;
- *netbsd*) AC_DEFINE(USE_I386_IOPL, 1, [BSD i386 iopl])
- SYS_LIBS=-lx86_64
- ;;
- *openbsd*) AC_DEFINE(USE_AMD64_IOPL, 1, [BSD AMD64 iopl])
- SYS_LIBS=-lamd64
- ;;
- esac
- GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
- ;;
- ia64*)
- GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
- ;;
- s390*)
- GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
- ;;
-esac
-AC_SUBST(GLX_ARCH_DEFINES)
-
-dnl BSD *_video.c selection
-AM_CONDITIONAL(ALPHA_VIDEO, [test "x$ALPHA_VIDEO" = xyes])
-AM_CONDITIONAL(ARM_VIDEO, [test "x$ARM_VIDEO" = xyes])
-AM_CONDITIONAL(I386_VIDEO, [test "x$I386_VIDEO" = xyes])
-AM_CONDITIONAL(PPC_VIDEO, [test "x$PPC_VIDEO" = xyes])
-AM_CONDITIONAL(SPARC64_VIDEO, [test "x$SPARC64_VIDEO" = xyes])
-
-DRI=no
-USE_SIGIO_BY_DEFAULT="yes"
-dnl it would be nice to autodetect these *CONS_SUPPORTs
-case $host_os in
- *freebsd* | *dragonfly*)
- case $host_os in
- kfreebsd*-gnu) ;;
- *) AC_DEFINE(CSRG_BASED, 1, [System is BSD-like]) ;;
- esac
- AC_DEFINE(PCCONS_SUPPORT, 1, [System has PC console])
- AC_DEFINE(PCVT_SUPPORT, 1, [System has PCVT console])
- AC_DEFINE(SYSCONS_SUPPORT, 1, [System has syscons console])
- DRI=yes
- ;;
- *netbsd*)
- AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
- AC_DEFINE(PCCONS_SUPPORT, 1, [System has PC console])
- AC_DEFINE(PCVT_SUPPORT, 1, [System has PCVT console])
- AC_DEFINE(WSCONS_SUPPORT, 1, [System has wscons console])
- DRI=yes
- ;;
- *openbsd*)
- AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
- AC_DEFINE(PCVT_SUPPORT, 1, [System has PC console])
- AC_DEFINE(WSCONS_SUPPORT, 1, [System has wscons console])
- ;;
- *linux*)
- DRI=yes
- ;;
- *solaris*)
- PKG_CHECK_EXISTS(libdrm, DRI=yes, DRI=no)
- # Disable use of SIGIO by default until some system bugs are
- # fixed - see Sun/OpenSolaris bug id 6879897
- USE_SIGIO_BY_DEFAULT="no"
- ;;
- darwin*)
- AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
- ;;
- cygwin*)
- CFLAGS="$CFLAGS -DFD_SETSIZE=256"
- ;;
-esac
-
-dnl augment XORG_RELEASE_VERSION for our snapshot number and to expose the
-dnl major number
-PVMAJOR=`echo $PACKAGE_VERSION | cut -d . -f 1`
-PVS=`echo $PACKAGE_VERSION | cut -d . -f 4 | cut -d - -f 1`
-if test "x$PVS" = "x"; then
- PVS="0"
-fi
-
-VENDOR_RELEASE="((($PVMAJOR) * 10000000) + (($PVM) * 100000) + (($PVP) * 1000) + $PVS)"
-VENDOR_MAN_VERSION="Version ${PACKAGE_VERSION}"
-
-VENDOR_NAME="The X.Org Foundation"
-VENDOR_NAME_SHORT="X.Org"
-VENDOR_WEB="http://wiki.x.org"
-
-m4_ifdef([AS_HELP_STRING], , [m4_define([AS_HELP_STRING], m4_defn([AC_HELP_STRING]))])
-
-dnl Build options.
-AC_ARG_ENABLE(werror, AS_HELP_STRING([--enable-werror],
- [Obsolete - use --enable-strict-compilation instead]),
- AC_MSG_ERROR([--enable-werror has been replaced by --enable-strict-compilation]))
-
-AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug],
- [Enable debugging (default: disabled)]),
- [DEBUGGING=$enableval], [DEBUGGING=no])
-AC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
- [Enable unit-tests (default: auto)]),
- [UNITTESTS=$enableval], [UNITTESTS=auto])
-AC_ARG_ENABLE(use-sigio-by-default, AS_HELP_STRING([--enable-use-sigio-by-default]
- [Enable SIGIO input handlers by default (default: $USE_SIGIO_BY_DEFAULT)]),
- [USE_SIGIO_BY_DEFAULT=$enableval], [])
-AC_ARG_WITH(int10, AS_HELP_STRING([--with-int10=BACKEND], [int10 backend: vm86, x86emu or stub]),
- [INT10="$withval"],
- [INT10="$DEFAULT_INT10"])
-AC_ARG_WITH(vendor-name, AS_HELP_STRING([--with-vendor-name=VENDOR],
- [Vendor string reported by the server]),
- [ VENDOR_NAME="$withval" ], [])
-AC_ARG_WITH(vendor-name-short, AS_HELP_STRING([--with-vendor-name-short=VENDOR],
- [Short version of vendor string reported by the server]),
- [ VENDOR_NAME_SHORT="$withval" ], [])
-AC_ARG_WITH(vendor-web, AS_HELP_STRING([--with-vendor-web=URL],
- [Vendor web address reported by the server]),
- [ VENDOR_WEB="$withval" ], [])
-AC_ARG_WITH(module-dir, AS_HELP_STRING([--with-module-dir=DIR],
- [Directory where modules are installed (default: $libdir/xorg/modules)]),
- [ moduledir="$withval" ],
- [ moduledir="${libdir}/xorg/modules" ])
-AC_ARG_WITH(log-dir, AS_HELP_STRING([--with-log-dir=DIR],
- [Directory where log files are kept (default: $localstatedir/log)]),
- [ logdir="$withval" ],
- [ logdir="$localstatedir/log" ])
-AC_ARG_WITH(builder-addr, AS_HELP_STRING([--with-builder-addr=ADDRESS],
- [Builder address (default: xorg@lists.freedesktop.org)]),
- [ BUILDERADDR="$withval" ],
- [ BUILDERADDR="xorg@lists.freedesktop.org" ])
-AC_ARG_WITH(os-name, AS_HELP_STRING([--with-os-name=OSNAME], [Name of OS (default: output of "uname -srm")]),
- [ OSNAME="$withval" ],
- [ OSNAME=`uname -srm` ])
-AC_ARG_WITH(os-vendor, AS_HELP_STRING([--with-os-vendor=OSVENDOR], [Name of OS vendor]),
- [ OSVENDOR="$withval" ],
- [ OSVENDOR="" ])
-AC_ARG_WITH(builderstring, AS_HELP_STRING([--with-builderstring=BUILDERSTRING], [Additional builder string]),
- [ BUILDERSTRING="$withval" ]
- [ ])
-
-dnl Determine font path
-XORG_FONTROOTDIR
-XORG_FONTSUBDIR(FONTMISCDIR, fontmiscdir, misc)
-XORG_FONTSUBDIR(FONTOTFDIR, fontotfdir, OTF)
-XORG_FONTSUBDIR(FONTTTFDIR, fontttfdir, TTF)
-XORG_FONTSUBDIR(FONTTYPE1DIR, fonttype1dir, Type1)
-XORG_FONTSUBDIR(FONT75DPIDIR, font75dpidir, 75dpi)
-XORG_FONTSUBDIR(FONT100DPIDIR, font100dpidir, 100dpi)
-
-dnl Uses --default-font-path if set, otherwise checks for /etc/X11/fontpath.d,
-dnl otherwise uses standard subdirectories of FONTROOTDIR. When cross
-dnl compiling, assume default font path uses standard FONTROOTDIR directories.
-DEFAULT_FONT_PATH="${FONTMISCDIR}/,${FONTTTFDIR}/,${FONTOTFDIR}/,${FONTTYPE1DIR}/,${FONT100DPIDIR}/,${FONT75DPIDIR}/"
-if test "$cross_compiling" != yes; then
- AC_CHECK_FILE([${sysconfdir}/X11/fontpath.d],
- [DEFAULT_FONT_PATH='catalogue:${sysconfdir}/X11/fontpath.d'],
- [case $host_os in
- darwin*) DEFAULT_FONT_PATH="${DEFAULT_FONT_PATH},/Library/Fonts,/System/Library/Fonts" ;;
- esac])
-fi
-AC_ARG_WITH(default-font-path, AS_HELP_STRING([--with-default-font-path=PATH], [Comma separated list of font dirs]),
- [ FONTPATH="$withval" ],
- [ FONTPATH="${DEFAULT_FONT_PATH}" ])
-
-AC_MSG_CHECKING([for default font path])
-AC_MSG_RESULT([$FONTPATH])
-
-AC_ARG_WITH(xkb-path, AS_HELP_STRING([--with-xkb-path=PATH], [Path to XKB base dir (default: ${datadir}/X11/xkb)]),
- [ XKBPATH="$withval" ],
- [ XKBPATH="${datadir}/X11/xkb" ])
-AC_ARG_WITH(xkb-output, AS_HELP_STRING([--with-xkb-output=PATH], [Path to XKB output dir (default: ${datadir}/X11/xkb/compiled)]),
- [ XKBOUTPUT="$withval" ],
- [ XKBOUTPUT="compiled" ])
-AC_ARG_WITH(default-xkb-rules, AS_HELP_STRING([--with-default-xkb-rules=RULES],
- [Keyboard ruleset (default: base/evdev)]),
- [ XKB_DFLT_RULES="$withval" ],
- [ XKB_DFLT_RULES="" ])
-AC_ARG_WITH(default-xkb-model, AS_HELP_STRING([--with-default-xkb-model=MODEL],
- [Keyboard model (default: pc105)]),
- [ XKB_DFLT_MODEL="$withval" ],
- [ XKB_DFLT_MODEL="pc105" ])
-AC_ARG_WITH(default-xkb-layout, AS_HELP_STRING([--with-default-xkb-layout=LAYOUT],
- [Keyboard layout (default: us)]),
- [ XKB_DFLT_LAYOUT="$withval" ],
- [ XKB_DFLT_LAYOUT="us" ])
-AC_ARG_WITH(default-xkb-variant, AS_HELP_STRING([--with-default-xkb-variant=VARIANT],
- [Keyboard variant (default: (none))]),
- [ XKB_DFLT_VARIANT="$withval" ],
- [ XKB_DFLT_VARIANT="" ])
-AC_ARG_WITH(default-xkb-options, AS_HELP_STRING([--with-default-xkb-options=OPTIONS],
- [Keyboard layout options (default: (none))]),
- [ XKB_DFLT_OPTIONS="$withval" ],
- [ XKB_DFLT_OPTIONS="" ])
-AC_ARG_WITH(serverconfig-path, AS_HELP_STRING([--with-serverconfig-path=PATH],
- [Directory where ancillary server config files are installed (default: ${libdir}/xorg)]),
- [ SERVERCONFIG="$withval" ],
- [ SERVERCONFIG="${libdir}/xorg" ])
-AC_ARG_WITH(apple-applications-dir,AS_HELP_STRING([--with-apple-applications-dir=PATH], [Path to the Applications directory (default: /Applications/Utilities)]),
- [ APPLE_APPLICATIONS_DIR="${withval}" ],
- [ APPLE_APPLICATIONS_DIR="/Applications/Utilities" ])
-AC_SUBST([APPLE_APPLICATIONS_DIR])
-AC_ARG_WITH(apple-application-name,AS_HELP_STRING([--with-apple-application-name=NAME], [Name for the .app (default: X11)]),
- [ APPLE_APPLICATION_NAME="${withval}" ],
- [ APPLE_APPLICATION_NAME="X11" ])
-AC_SUBST([APPLE_APPLICATION_NAME])
-AC_ARG_WITH(launchd-id-prefix, AS_HELP_STRING([--with-launchd-id-prefix=PATH], [Prefix to use for launchd identifiers (default: org.x)]),
- [ LAUNCHD_ID_PREFIX="${withval}" ],
- [ LAUNCHD_ID_PREFIX="org.x" ])
-AC_SUBST([LAUNCHD_ID_PREFIX])
-AC_DEFINE_UNQUOTED(LAUNCHD_ID_PREFIX, "$LAUNCHD_ID_PREFIX", [Prefix to use for launchd identifiers])
-AC_ARG_ENABLE(sparkle,AS_HELP_STRING([--enable-sparkle], [Enable updating of X11.app using the Sparkle Framework (default: disabled)]),
- [ XQUARTZ_SPARKLE="${enableval}" ],
- [ XQUARTZ_SPARKLE="no" ])
-AC_SUBST([XQUARTZ_SPARKLE])
-AC_ARG_ENABLE(install-libxf86config,
- AS_HELP_STRING([--enable-install-libxf86config],
- [Install libxf86config (default: disabled)]),
- [INSTALL_LIBXF86CONFIG=$enableval],
- [INSTALL_LIBXF86CONFIG=no])
-AC_ARG_ENABLE(visibility, AC_HELP_STRING([--enable-visibility], [Enable symbol visibility (default: auto)]),
- [SYMBOL_VISIBILITY=$enableval],
- [SYMBOL_VISIBILITY=auto])
-AC_ARG_ENABLE(pc98, AC_HELP_STRING([--enable-pc98], [Enable PC98 support in Xorg (default: auto)]),
- [SUPPORT_PC98=$enableval],
- [SUPPORT_PC98=auto])
-
-dnl GLX build options
-AC_ARG_ENABLE(aiglx, AS_HELP_STRING([--enable-aiglx], [Build accelerated indirect GLX (default: enabled)]),
- [AIGLX=$enableval],
- [AIGLX=yes])
-AX_TLS
-AC_ARG_ENABLE(glx-tls, AS_HELP_STRING([--enable-glx-tls], [Build GLX with TLS support (default: auto)]),
- [GLX_USE_TLS=$enableval],
- [GLX_USE_TLS=no
- if test "${ac_cv_tls}" != "none" ; then
- GLX_USE_TLS=yes
- fi])
-AC_SUBST(GLX_TLS, ${GLX_USE_TLS})
-
-dnl Extensions.
-AC_ARG_ENABLE(registry, AS_HELP_STRING([--disable-registry], [Build string registry module (default: enabled)]), [XREGISTRY=$enableval], [XREGISTRY=yes])
-AC_ARG_ENABLE(composite, AS_HELP_STRING([--disable-composite], [Build Composite extension (default: enabled)]), [COMPOSITE=$enableval], [COMPOSITE=yes])
-AC_ARG_ENABLE(mitshm, AS_HELP_STRING([--disable-shm], [Build SHM extension (default: enabled)]), [MITSHM=$enableval], [MITSHM=yes])
-AC_ARG_ENABLE(xres, AS_HELP_STRING([--disable-xres], [Build XRes extension (default: enabled)]), [RES=$enableval], [RES=yes])
-AC_ARG_ENABLE(record, AS_HELP_STRING([--disable-record], [Build Record extension (default: enabled)]), [RECORD=$enableval], [RECORD=yes])
-AC_ARG_ENABLE(xv, AS_HELP_STRING([--disable-xv], [Build Xv extension (default: enabled)]), [XV=$enableval], [XV=yes])
-AC_ARG_ENABLE(xvmc, AS_HELP_STRING([--disable-xvmc], [Build XvMC extension (default: enabled)]), [XVMC=$enableval], [XVMC=yes])
-AC_ARG_ENABLE(dga, AS_HELP_STRING([--disable-dga], [Build DGA extension (default: auto)]), [DGA=$enableval], [DGA=auto])
-AC_ARG_ENABLE(screensaver, AS_HELP_STRING([--disable-screensaver], [Build ScreenSaver extension (default: enabled)]), [SCREENSAVER=$enableval], [SCREENSAVER=yes])
-AC_ARG_ENABLE(xdmcp, AS_HELP_STRING([--disable-xdmcp], [Build XDMCP extension (default: auto)]), [XDMCP=$enableval], [XDMCP=auto])
-AC_ARG_ENABLE(xdm-auth-1, AS_HELP_STRING([--disable-xdm-auth-1], [Build XDM-Auth-1 extension (default: auto)]), [XDMAUTH=$enableval], [XDMAUTH=auto])
-AC_ARG_ENABLE(glx, AS_HELP_STRING([--disable-glx], [Build GLX extension (default: enabled)]), [GLX=$enableval], [GLX=yes])
-AC_ARG_ENABLE(dri, AS_HELP_STRING([--enable-dri], [Build DRI extension (default: auto)]), [DRI=$enableval])
-AC_ARG_ENABLE(dri2, AS_HELP_STRING([--enable-dri2], [Build DRI2 extension (default: auto)]), [DRI2=$enableval], [DRI2=auto])
-AC_ARG_ENABLE(xinerama, AS_HELP_STRING([--disable-xinerama], [Build Xinerama extension (default: enabled)]), [XINERAMA=$enableval], [XINERAMA=yes])
-AC_ARG_ENABLE(xf86vidmode, AS_HELP_STRING([--disable-xf86vidmode], [Build XF86VidMode extension (default: auto)]), [XF86VIDMODE=$enableval], [XF86VIDMODE=auto])
-AC_ARG_ENABLE(xace, AS_HELP_STRING([--disable-xace], [Build X-ACE extension (default: enabled)]), [XACE=$enableval], [XACE=yes])
-AC_ARG_ENABLE(xselinux, AS_HELP_STRING([--enable-xselinux], [Build SELinux extension (default: disabled)]), [XSELINUX=$enableval], [XSELINUX=no])
-AC_ARG_ENABLE(xcsecurity, AS_HELP_STRING([--enable-xcsecurity], [Build Security extension (default: disabled)]), [XCSECURITY=$enableval], [XCSECURITY=no])
-AC_ARG_ENABLE(xcalibrate, AS_HELP_STRING([--enable-xcalibrate], [Build XCalibrate extension (default: disabled)]), [XCALIBRATE=$enableval], [XCALIBRATE=no])
-AC_ARG_ENABLE(tslib, AS_HELP_STRING([--enable-tslib], [Build kdrive tslib touchscreen support (default: disabled)]), [TSLIB=$enableval], [TSLIB=no])
-AC_ARG_ENABLE(dbe, AS_HELP_STRING([--disable-dbe], [Build DBE extension (default: enabled)]), [DBE=$enableval], [DBE=yes])
-AC_ARG_ENABLE(xf86bigfont, AS_HELP_STRING([--enable-xf86bigfont], [Build XF86 Big Font extension (default: disabled)]), [XF86BIGFONT=$enableval], [XF86BIGFONT=no])
-AC_ARG_ENABLE(dpms, AS_HELP_STRING([--disable-dpms], [Build DPMS extension (default: enabled)]), [DPMSExtension=$enableval], [DPMSExtension=yes])
-AC_ARG_ENABLE(config-udev, AS_HELP_STRING([--enable-config-udev], [Build udev support (default: auto)]), [CONFIG_UDEV=$enableval], [CONFIG_UDEV=auto])
-AC_ARG_ENABLE(config-dbus, AS_HELP_STRING([--enable-config-dbus], [Build D-BUS API support (default: no)]), [CONFIG_DBUS_API=$enableval], [CONFIG_DBUS_API=no])
-AC_ARG_ENABLE(config-hal, AS_HELP_STRING([--disable-config-hal], [Build HAL support (default: auto)]), [CONFIG_HAL=$enableval], [CONFIG_HAL=auto])
-AC_ARG_ENABLE(xfree86-utils, AS_HELP_STRING([--enable-xfree86-utils], [Build xfree86 DDX utilities (default: enabled)]), [XF86UTILS=$enableval], [XF86UTILS=yes])
-AC_ARG_ENABLE(xaa, AS_HELP_STRING([--enable-xaa], [Build XAA (default: enabled)]), [XAA=$enableval], [XAA=yes])
-AC_ARG_ENABLE(vgahw, AS_HELP_STRING([--enable-vgahw], [Build Xorg with vga access (default: enabled)]), [VGAHW=$enableval], [VGAHW=yes])
-AC_ARG_ENABLE(vbe, AS_HELP_STRING([--enable-vbe], [Build Xorg with VBE module (default: enabled)]), [VBE=$enableval], [VBE=yes])
-AC_ARG_ENABLE(int10-module, AS_HELP_STRING([--enable-int10-module], [Build Xorg with int10 module (default: enabled)]), [INT10MODULE=$enableval], [INT10MODULE=yes])
-AC_ARG_ENABLE(windowswm, AS_HELP_STRING([--enable-windowswm], [Build XWin with WindowsWM extension (default: no)]), [WINDOWSWM=$enableval], [WINDOWSWM=no])
-AC_ARG_ENABLE(libdrm, AS_HELP_STRING([--enable-libdrm], [Build Xorg with libdrm support (default: enabled)]), [DRM=$enableval],[DRM=yes])
-
-dnl DDXes.
-AC_ARG_ENABLE(xorg, AS_HELP_STRING([--enable-xorg], [Build Xorg server (default: auto)]), [XORG=$enableval], [XORG=auto])
-AC_ARG_ENABLE(dmx, AS_HELP_STRING([--enable-dmx], [Build DMX server (default: auto)]), [DMX=$enableval], [DMX=auto])
-AC_ARG_ENABLE(xvfb, AS_HELP_STRING([--enable-xvfb], [Build Xvfb server (default: yes)]), [XVFB=$enableval], [XVFB=yes])
-AC_ARG_ENABLE(xnest, AS_HELP_STRING([--enable-xnest], [Build Xnest server (default: auto)]), [XNEST=$enableval], [XNEST=auto])
-AC_ARG_ENABLE(xquartz, AS_HELP_STRING([--enable-xquartz], [Build Xquartz server for OS-X (default: auto)]), [XQUARTZ=$enableval], [XQUARTZ=auto])
-AC_ARG_ENABLE(standalone-xpbproxy, AS_HELP_STRING([--enable-standalone-xpbproxy], [Build a standalone xpbproxy (in addition to the one integrated into Xquartz as a separate thread) (default: no)]), [STANDALONE_XPBPROXY=$enableval], [STANDALONE_XPBPROXY=no])
-AC_ARG_ENABLE(xwin, AS_HELP_STRING([--enable-xwin], [Build XWin server (default: auto)]), [XWIN=$enableval], [XWIN=auto])
-dnl kdrive and its subsystems
-AC_ARG_ENABLE(kdrive, AS_HELP_STRING([--enable-kdrive], [Build kdrive servers (default: no)]), [KDRIVE=$enableval], [KDRIVE=no])
-AC_ARG_ENABLE(xephyr, AS_HELP_STRING([--enable-xephyr], [Build the kdrive Xephyr server (default: auto)]), [XEPHYR=$enableval], [XEPHYR=auto])
-AC_ARG_ENABLE(xfake, AS_HELP_STRING([--enable-xfake], [Build the kdrive 'fake' server (default: auto)]), [XFAKE=$enableval], [XFAKE=auto])
-AC_ARG_ENABLE(xfbdev, AS_HELP_STRING([--enable-xfbdev], [Build the kdrive framebuffer device server (default: auto)]), [XFBDEV=$enableval], [XFBDEV=auto])
-dnl kdrive options
-AC_ARG_ENABLE(kdrive-kbd, AS_HELP_STRING([--enable-kdrive-kbd], [Build kbd driver for kdrive (default: auto)]), [KDRIVE_KBD=$enableval], [KDRIVE_KBD=auto])
-AC_ARG_ENABLE(kdrive-mouse, AC_HELP_STRING([--enable-kdrive-mouse], [Build mouse driver for kdrive (default: auto)]), [KDRIVE_MOUSE=$enableval], [KDRIVE_MOUSE=auto])
-AC_ARG_ENABLE(kdrive-evdev, AC_HELP_STRING([--enable-kdrive-evdev], [Build evdev driver for kdrive (default: auto)]), [KDRIVE_EVDEV=$enableval], [KDRIVE_EVDEV=auto])
-
-
-dnl chown/chmod to be setuid root as part of build
-dnl Replaces InstallXserverSetUID in imake
-AC_ARG_ENABLE(install-setuid,
- AS_HELP_STRING([--enable-install-setuid],
- [Install Xorg server as owned by root with setuid bit (default: auto)]),
- [SETUID=$enableval], [SETUID=auto])
-AC_MSG_CHECKING([to see if we can install the Xorg server as root])
-if test "x$SETUID" = "xauto" ; then
- case $host_os in
- cygwin*) SETUID="no" ;;
- darwin*) SETUID="no" ;;
- *)
- case $host_cpu in
- sparc) SETUID="no" ;;
- *) SETUID="yes" ;;
- esac
- esac
- if test "x$SETUID" = xyes; then
- touch testfile
- chown root testfile > /dev/null 2>&1 || SETUID="no"
- rm -f testfile
- fi
-fi
-AC_MSG_RESULT([$SETUID])
-AM_CONDITIONAL(INSTALL_SETUID, [test "x$SETUID" = "xyes"])
-
-dnl Issue an error if xtrans.m4 was not found and XTRANS_CONNECTION_FLAGS macro
-dnl was not expanded, since xorg-server with no transport types is rather useless.
-dnl
-dnl If you're seeing an error here, be sure you installed the lib/xtrans module
-dnl first and if it's not in the default location, that you set the ACLOCAL
-dnl environment variable to find it, such as:
-dnl ACLOCAL="aclocal -I ${PREFIX}/share/aclocal"
-m4_pattern_forbid([^XTRANS_CONNECTION_FLAGS$])
-
-# Transport selection macro from xtrans.m4
-XTRANS_CONNECTION_FLAGS
-
-# Secure RPC detection macro from xtrans.m4
-XTRANS_SECURE_RPC_FLAGS
-AM_CONDITIONAL(SECURE_RPC, [test "x$SECURE_RPC" = xyes])
-
-AM_CONDITIONAL(INT10_VM86, [test "x$INT10" = xvm86])
-AM_CONDITIONAL(INT10_X86EMU, [test "x$INT10" = xx86emu])
-AM_CONDITIONAL(INT10_STUB, [test "x$INT10" = xstub])
-if test "x$INT10" = xyes; then
- dnl VM86 headers
- AC_CHECK_HEADERS([sys/vm86.h sys/io.h])
-fi
-
-XORG_ENABLE_DOCS
-XORG_ENABLE_DEVEL_DOCS
-XORG_WITH_XMLTO(0.0.20)
-XORG_WITH_FOP
-
-dnl Handle installing libxf86config
-AM_CONDITIONAL(INSTALL_LIBXF86CONFIG, [test "x$INSTALL_LIBXF86CONFIG" = xyes])
-
-dnl DDX Detection... Yes, it's ugly to have it here... but we need to
-dnl handle this early on so that we don't require unsupported extensions
-case $host_os in
- cygwin*)
- DGA=no
- DRI2=no
- XF86VIDMODE=no
- XSELINUX=no
- XV=no
- ;;
- darwin*)
- DRI2=no
-
- if test x$XQUARTZ = xauto; then
- AC_CACHE_CHECK([whether to build Xquartz],xorg_cv_Carbon_framework,[
- save_LDFLAGS=$LDFLAGS
- LDFLAGS="$LDFLAGS -framework Carbon"
- AC_LINK_IFELSE([char FSFindFolder(); int main() { FSFindFolder(); return 0;}],
- [xorg_cv_Carbon_framework=yes],
- [xorg_cv_Carbon_framework=no])
- LDFLAGS=$save_LDFLAGS])
-
- if test "X$xorg_cv_Carbon_framework" = Xyes; then
- XQUARTZ=yes
- else
- XQUARTZ=no
- fi
- fi
-
- if test "x$XQUARTZ" = xyes ; then
- XQUARTZ=yes
- XVFB=no
- XNEST=no
-
- COMPOSITE=no
- DGA=no
- DPMSExtension=no
- XF86VIDMODE=no
- fi
- ;;
- *) XQUARTZ=no ;;
-esac
-
-dnl ---------------------------------------------------------------------------
-dnl Extension section
-dnl ---------------------------------------------------------------------------
-XEXT_INC='-I$(top_srcdir)/Xext'
-XEXT_LIB='$(top_builddir)/Xext/libXext.la'
-XEXTXORG_LIB='$(top_builddir)/Xext/libXextbuiltin.la'
-
-dnl Optional modules
-VIDEOPROTO="videoproto"
-COMPOSITEPROTO="compositeproto >= 0.4"
-RECORDPROTO="recordproto >= 1.13.99.1"
-SCRNSAVERPROTO="scrnsaverproto >= 1.1"
-RESOURCEPROTO="resourceproto"
-DRIPROTO="xf86driproto >= 2.1.0"
-DRI2PROTO="dri2proto >= 2.3"
-XINERAMAPROTO="xineramaproto"
-BIGFONTPROTO="xf86bigfontproto >= 1.2.0"
-XCALIBRATEPROTO="xcalibrateproto"
-DGAPROTO="xf86dgaproto >= 2.0.99.1"
-GLPROTO="glproto >= 1.4.10"
-DMXPROTO="dmxproto >= 2.2.99.1"
-VIDMODEPROTO="xf86vidmodeproto >= 2.2.99.1"
-WINDOWSWMPROTO="windowswmproto"
-APPLEWMPROTO="applewmproto >= 1.4"
-
-dnl Core modules for most extensions, et al.
-SDK_REQUIRED_MODULES="[xproto >= 7.0.17] [randrproto >= 1.4] [renderproto >= 0.11] [xextproto >= 7.1.99] [inputproto >= 1.9.99.902] [kbproto >= 1.0.3] fontsproto"
-# Make SDK_REQUIRED_MODULES available for inclusion in xorg-server.pc
-AC_SUBST(SDK_REQUIRED_MODULES)
-
-dnl List of libraries that require a specific version
-LIBAPPLEWM="applewm >= 1.4"
-LIBDMX="dmx >= 1.0.99.1"
-LIBDRI="dri >= 7.8.0"
-LIBDRM="libdrm >= 2.3.0"
-LIBGL="gl >= 7.1.0"
-LIBXEXT="xext >= 1.0.99.4"
-LIBXFONT="xfont >= 1.4.2"
-LIBXI="xi >= 1.2.99.1"
-LIBXTST="xtst >= 1.0.99.2"
-LIBPCIACCESS="pciaccess >= 0.8.0"
-LIBGLIB="glib-2.0 >= 2.16"
-LIBUDEV="libudev >= 143"
-LIBSELINUX="libselinux >= 2.0.86"
-LIBDBUS="dbus-1 >= 1.0"
-LIBPIXMAN="pixman-1 >= 0.15.20"
-
-dnl Pixman is always required, but we separate it out so we can link
-dnl specific modules against it
-PKG_CHECK_MODULES(PIXMAN, $LIBPIXMAN)
-REQUIRED_LIBS="$REQUIRED_LIBS $LIBPIXMAN $LIBXFONT xau"
-
-REQUIRED_MODULES="[fixesproto >= 4.1] [damageproto >= 1.1] [xcmiscproto >= 1.2.0] [xtrans >= 1.2.2] [bigreqsproto >= 1.1.0] $SDK_REQUIRED_MODULES"
-
-if test "x$CONFIG_UDEV" = xyes &&
- { test "x$CONFIG_DBUS_API" = xyes || test "x$CONFIG_HAL" = xyes; }; then
- AC_MSG_ERROR([Hotplugging through both libudev and dbus/hal not allowed])
-fi
-
-PKG_CHECK_MODULES(UDEV, $LIBUDEV, [HAVE_LIBUDEV=yes], [HAVE_LIBUDEV=no])
-if test "x$CONFIG_UDEV" = xauto; then
- CONFIG_UDEV="$HAVE_LIBUDEV"
-fi
-AM_CONDITIONAL(CONFIG_UDEV, [test "x$CONFIG_UDEV" = xyes])
-if test "x$CONFIG_UDEV" = xyes; then
- CONFIG_DBUS_API=no
- CONFIG_HAL=no
- if ! test "x$HAVE_LIBUDEV" = xyes; then
- AC_MSG_ERROR([udev configuration API requested, but libudev is not installed])
- fi
- AC_DEFINE(CONFIG_UDEV, 1, [Use libudev for input hotplug])
-fi
-
-dnl HAVE_DBUS is true if we actually have the D-Bus library, whereas
-dnl CONFIG_DBUS_API is true if we want to enable the D-Bus config
-dnl API.
-PKG_CHECK_MODULES(DBUS, $LIBDBUS, [HAVE_DBUS=yes], [HAVE_DBUS=no])
-if test "x$HAVE_DBUS" = xyes; then
- AC_DEFINE(HAVE_DBUS, 1, [Have D-Bus support])
-fi
-AM_CONDITIONAL(HAVE_DBUS, [test "x$HAVE_DBUS" = xyes])
-
-if test "x$CONFIG_DBUS_API" = xauto; then
- CONFIG_DBUS_API="$HAVE_DBUS"
-fi
-if test "x$CONFIG_DBUS_API" = xyes; then
- if ! test "x$HAVE_DBUS" = xyes; then
- AC_MSG_ERROR([D-Bus configuration API requested, but D-Bus is not installed.])
- fi
-
- AC_DEFINE(CONFIG_DBUS_API, 1, [Use the D-Bus input configuration API])
- CONFIG_NEED_DBUS="yes"
-fi
-AM_CONDITIONAL(CONFIG_DBUS_API, [test "x$CONFIG_DBUS_API" = xyes])
-
-PKG_CHECK_MODULES(HAL, hal, [HAVE_HAL=yes], [HAVE_HAL=no])
-if test "x$CONFIG_HAL" = xauto; then
- CONFIG_HAL="$HAVE_HAL"
-fi
-if test "x$CONFIG_HAL" = xyes; then
- if ! test "x$HAVE_HAL" = xyes; then
- AC_MSG_ERROR([HAL hotplug API requested, but HAL is not installed.])
- fi
-
- AC_DEFINE(CONFIG_HAL, 1, [Use the HAL hotplug API])
- CONFIG_NEED_DBUS="yes"
-fi
-AM_CONDITIONAL(CONFIG_HAL, [test "x$CONFIG_HAL" = xyes])
-
-if test "x$CONFIG_NEED_DBUS" = xyes; then
- AC_DEFINE(CONFIG_NEED_DBUS, 1, [Use D-Bus for input hotplug])
-fi
-AM_CONDITIONAL(CONFIG_NEED_DBUS, [test "x$CONFIG_NEED_DBUS" = xyes])
-
-if test "x$USE_SIGIO_BY_DEFAULT" = xyes; then
- USE_SIGIO_BY_DEFAULT_VALUE=TRUE
-else
- USE_SIGIO_BY_DEFAULT_VALUE=FALSE
-fi
-AC_DEFINE_UNQUOTED([USE_SIGIO_BY_DEFAULT], [$USE_SIGIO_BY_DEFAULT_VALUE],
- [Use SIGIO handlers for input device events by default])
-
-AC_MSG_CHECKING([for glibc...])
-AC_PREPROC_IFELSE([
-#include <features.h>
-#ifndef __GLIBC__
-#error
-#endif
-], glibc=yes, glibc=no)
-AC_MSG_RESULT([$glibc])
-
-AC_CHECK_FUNCS([clock_gettime], [have_clock_gettime=yes],
- [AC_CHECK_LIB([rt], [clock_gettime], [have_clock_gettime=-lrt],
- [have_clock_gettime=no])])
-
-AC_MSG_CHECKING([for a useful monotonic clock ...])
-
-if ! test "x$have_clock_gettime" = xno; then
- if ! test "x$have_clock_gettime" = xyes; then
- CLOCK_LIBS="$have_clock_gettime"
- else
- CLOCK_LIBS=""
- fi
-
- LIBS_SAVE="$LIBS"
- LIBS="$CLOCK_LIBS"
- CPPFLAGS_SAVE="$CPPFLAGS"
-
- if test x"$glibc" = xyes; then
- CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L"
- fi
-
- AC_RUN_IFELSE([
-#include <time.h>
-
-int main(int argc, char *argv[[]]) {
- struct timespec tp;
-
- if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
- return 0;
- else
- return 1;
-}
- ], [MONOTONIC_CLOCK=yes], [MONOTONIC_CLOCK=no],
- [MONOTONIC_CLOCK="cross compiling"])
-
- LIBS="$LIBS_SAVE"
- CPPFLAGS="$CPPFLAGS_SAVE"
-else
- MONOTONIC_CLOCK=no
-fi
-
-AC_MSG_RESULT([$MONOTONIC_CLOCK])
-
-if test "x$MONOTONIC_CLOCK" = xyes; then
- AC_DEFINE(MONOTONIC_CLOCK, 1, [Have monotonic clock from clock_gettime()])
- LIBS="$LIBS $CLOCK_LIBS"
-fi
-
-AM_CONDITIONAL(XV, [test "x$XV" = xyes])
-if test "x$XV" = xyes; then
- AC_DEFINE(XV, 1, [Support Xv extension])
- AC_DEFINE(XvExtension, 1, [Build Xv extension])
- REQUIRED_MODULES="$REQUIRED_MODULES $VIDEOPROTO"
- SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $VIDEOPROTO"
-else
- XVMC=no
-fi
-
-AM_CONDITIONAL(XVMC, [test "x$XVMC" = xyes])
-if test "x$XVMC" = xyes; then
- AC_DEFINE(XvMCExtension, 1, [Build XvMC extension])
-fi
-
-AM_CONDITIONAL(XREGISTRY, [test "x$XREGISTRY" = xyes])
-if test "x$XREGISTRY" = xyes; then
- AC_DEFINE(XREGISTRY, 1, [Build registry module])
-fi
-
-AM_CONDITIONAL(COMPOSITE, [test "x$COMPOSITE" = xyes])
-if test "x$COMPOSITE" = xyes; then
- AC_DEFINE(COMPOSITE, 1, [Support Composite Extension])
- REQUIRED_MODULES="$REQUIRED_MODULES $COMPOSITEPROTO"
- COMPOSITE_LIB='$(top_builddir)/composite/libcomposite.la'
- COMPOSITE_INC='-I$(top_srcdir)/composite'
-fi
-
-AM_CONDITIONAL(MITSHM, [test "x$MITSHM" = xyes])
-if test "x$MITSHM" = xyes; then
- AC_DEFINE(MITSHM, 1, [Support MIT-SHM extension])
- AC_DEFINE(HAS_SHM, 1, [Support SHM])
-fi
-
-AM_CONDITIONAL(RECORD, [test "x$RECORD" = xyes])
-if test "x$RECORD" = xyes; then
- AC_DEFINE(XRECORD, 1, [Support Record extension])
- REQUIRED_MODULES="$REQUIRED_MODULES $RECORDPROTO"
- RECORD_LIB='$(top_builddir)/record/librecord.la'
-fi
-
-AM_CONDITIONAL(SCREENSAVER, [test "x$SCREENSAVER" = xyes])
-if test "x$SCREENSAVER" = xyes; then
- AC_DEFINE(SCREENSAVER, 1, [Support MIT-SCREEN-SAVER extension])
- REQUIRED_MODULES="$REQUIRED_MODULES $SCRNSAVERPROTO"
-fi
-
-AM_CONDITIONAL(RES, [test "x$RES" = xyes])
-if test "x$RES" = xyes; then
- AC_DEFINE(RES, 1, [Support X resource extension])
- REQUIRED_MODULES="$REQUIRED_MODULES $RESOURCEPROTO"
-fi
-
-if test "x$GLX" = xyes; then
- PKG_CHECK_MODULES([XLIB], [x11])
- PKG_CHECK_MODULES([GL], $GLPROTO $LIBGL)
- AC_SUBST(XLIB_CFLAGS)
- AC_DEFINE(GLXEXT, 1, [Build GLX extension])
- GLX_LIBS='$(top_builddir)/glx/libglx.la'
- GLX_SYS_LIBS="$GLX_SYS_LIBS"
-else
- GLX=no
-fi
-AM_CONDITIONAL(GLX, test "x$GLX" = xyes)
-
-if test "x$AIGLX" = xyes -a "x$GLX" = xyes -a "x$DRI" = xyes; then
- AC_DEFINE(AIGLX, 1, [Build AIGLX loader])
-else
- AIGLX=no
-fi
-AM_CONDITIONAL(AIGLX, test "x$AIGLX" = xyes)
-
-if test "x$GLX_USE_TLS" = xyes ; then
- GLX_DEFINES="-DGLX_USE_TLS -DPTHREADS"
- GLX_SYS_LIBS="$GLX_SYS_LIBS -lpthread"
-fi
-AC_SUBST([GLX_DEFINES])
-
-AM_CONDITIONAL(DRI, test "x$DRI" = xyes)
-if test "x$DRI" = xyes; then
- AC_DEFINE(XF86DRI, 1, [Build DRI extension])
- PKG_CHECK_MODULES([DRIPROTO], [$DRIPROTO])
- PKG_CHECK_MODULES([DRI], $GLPROTO $LIBDRI)
- AC_SUBST(DRIPROTO_CFLAGS)
-fi
-
-PKG_CHECK_MODULES([DRI2PROTO], $DRI2PROTO,
- [HAVE_DRI2PROTO=yes], [HAVE_DRI2PROTO=no])
-case "$DRI2,$HAVE_DRI2PROTO" in
- yes,no)
- AC_MSG_ERROR([DRI2 requested, but dri2proto not found.])
- ;;
- yes,yes | auto,yes)
- AC_DEFINE(DRI2, 1, [Build DRI2 extension])
- DRI2=yes
- SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $DRI2PROTO"
- ;;
-esac
-AM_CONDITIONAL(DRI2, test "x$DRI2" = xyes)
-
-if test "x$DRI" = xyes || test "x$DRI2" = xyes; then
- if test "x$DRM" = xyes; then
- AC_DEFINE(WITH_LIBDRM, 1, [Building with libdrm support])
- PKG_CHECK_MODULES([LIBDRM], $LIBDRM)
- fi
-fi
-
-if test "x$DRI2" = xyes; then
- save_CFLAGS=$CFLAGS
- CFLAGS="$GL_CFLAGS $LIBDRM_CFLAGS"
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <GL/gl.h>
-#include <GL/internal/dri_interface.h>
-#ifndef __DRI_DRI2
-#error DRI2 extension not available.
-#endif]])],
- [HAVE_DRI2EXTENSION=yes],
- [HAVE_DRI2EXTENSION=no])
- CFLAGS=$save_CFLAGS
- if test "x$HAVE_DRI2EXTENSION" = xyes; then
- AC_DEFINE(DRI2_AIGLX, 1, [Build DRI2 AIGLX loader])
- DRI2_AIGLX=yes
- else
- AC_MSG_NOTICE([DRI2 AIGLX disabled, __DRI_DRI2 not defined in dri_interface.h.])
- DRI2_AIGLX=no
- fi
-fi
-AM_CONDITIONAL(DRI2_AIGLX, test "x$DRI2_AIGLX" = xyes)
-
-
-AM_CONDITIONAL(XINERAMA, [test "x$XINERAMA" = xyes])
-if test "x$XINERAMA" = xyes; then
- AC_DEFINE(XINERAMA, 1, [Support Xinerama extension])
- AC_DEFINE(PANORAMIX, 1, [Internal define for Xinerama])
- REQUIRED_MODULES="$REQUIRED_MODULES $XINERAMAPROTO"
- SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $XINERAMAPROTO"
-fi
-
-AM_CONDITIONAL(XACE, [test "x$XACE" = xyes])
-if test "x$XACE" = xyes; then
- AC_DEFINE(XACE, 1, [Build X-ACE extension])
-fi
-
-AM_CONDITIONAL(XSELINUX, [test "x$XSELINUX" = xyes])
-if test "x$XSELINUX" = xyes; then
- if test "x$XACE" != xyes; then
- AC_MSG_ERROR([cannot build SELinux extension without X-ACE])
- fi
- AC_CHECK_HEADERS([libaudit.h], [], AC_MSG_ERROR([SELinux extension requires audit system headers]))
- AC_CHECK_LIB(audit, audit_open, [], AC_MSG_ERROR([SELinux extension requires audit system library]))
- PKG_CHECK_MODULES([SELINUX], $LIBSELINUX)
- SELINUX_LIBS="$SELINUX_LIBS -laudit"
- AC_DEFINE(XSELINUX, 1, [Build SELinux extension])
-fi
-
-AM_CONDITIONAL(XCSECURITY, [test "x$XCSECURITY" = xyes])
-if test "x$XCSECURITY" = xyes; then
- if test "x$XACE" != xyes; then
- AC_MSG_ERROR([cannot build Security extension without X-ACE])
- fi
- AC_DEFINE(XCSECURITY, 1, [Build Security extension])
-fi
-
-AM_CONDITIONAL(DBE, [test "x$DBE" = xyes])
-if test "x$DBE" = xyes; then
- AC_DEFINE(DBE, 1, [Support DBE extension])
- DBE_LIB='$(top_builddir)/dbe/libdbe.la'
-fi
-
-AM_CONDITIONAL(XF86BIGFONT, [test "x$XF86BIGFONT" = xyes])
-if test "x$XF86BIGFONT" = xyes; then
- AC_DEFINE(XF86BIGFONT, 1, [Support XF86 Big font extension])
- REQUIRED_MODULES="$REQUIRED_MODULES $BIGFONTPROTO"
-fi
-
-AM_CONDITIONAL(DPMSExtension, [test "x$DPMSExtension" = xyes])
-if test "x$DPMSExtension" = xyes; then
- AC_DEFINE(DPMSExtension, 1, [Support DPMS extension])
-fi
-
-if test "x$XCALIBRATE" = xyes && test "$KDRIVE" = yes; then
- AC_DEFINE(XCALIBRATE, 1, [Build XCalibrate extension])
- REQUIRED_MODULES="$REQUIRED_MODULES $XCALIBRATEPROTO"
-else
- XCALIBRATE=no
-fi
-AM_CONDITIONAL(XCALIBRATE, [test "x$XCALIBRATE" = xyes])
-
-AC_DEFINE(RENDER, 1, [Support RENDER extension])
-RENDER_LIB='$(top_builddir)/render/librender.la'
-RENDER_INC='-I$(top_srcdir)/render'
-
-AC_DEFINE(RANDR, 1, [Support RANDR extension])
-RANDR_LIB='$(top_builddir)/randr/librandr.la'
-RANDR_INC='-I$(top_srcdir)/randr'
-
-AC_DEFINE(XFIXES,1,[Support XFixes extension])
-FIXES_LIB='$(top_builddir)/xfixes/libxfixes.la'
-FIXES_INC='-I$(top_srcdir)/xfixes'
-
-AC_DEFINE(DAMAGE,1,[Support Damage extension])
-DAMAGE_LIB='$(top_builddir)/damageext/libdamageext.la'
-DAMAGE_INC='-I$(top_srcdir)/damageext'
-MIEXT_DAMAGE_LIB='$(top_builddir)/miext/damage/libdamage.la'
-MIEXT_DAMAGE_INC='-I$(top_srcdir)/miext/damage'
-
-# XINPUT extension is integral part of the server
-AC_DEFINE(XINPUT, 1, [Support X Input extension])
-XI_LIB='$(top_builddir)/Xi/libXi.la'
-XI_INC='-I$(top_srcdir)/Xi'
-
-AM_CONDITIONAL(XF86UTILS, test "x$XF86UTILS" = xyes)
-AM_CONDITIONAL(XAA, test "x$XAA" = xyes)
-AM_CONDITIONAL(VGAHW, test "x$VGAHW" = xyes)
-AM_CONDITIONAL(VBE, test "x$VBE" = xyes)
-AM_CONDITIONAL(INT10MODULE, test "x$INT10MODULE" = xyes)
-
-AC_DEFINE(SHAPE, 1, [Support SHAPE extension])
-
-AC_DEFINE_DIR(XKB_BASE_DIRECTORY, XKBPATH, [Path to XKB data])
-AC_ARG_WITH(xkb-bin-directory,
- AS_HELP_STRING([--with-xkb-bin-directory=DIR], [Directory containing xkbcomp program]),
- [XKB_BIN_DIRECTORY="$withval"],
- [XKB_BIN_DIRECTORY="$bindir"])
-
-AC_DEFINE_DIR(XKB_BIN_DIRECTORY, XKB_BIN_DIRECTORY, [Path to XKB bin dir])
-
-dnl Make sure XKM_OUTPUT_DIR is an absolute path
-XKBOUTPUT_FIRSTCHAR=`echo $XKBOUTPUT | cut -b 1`
-if [[ x$XKBOUTPUT_FIRSTCHAR != x/ -a x$XKBOUTPUT_FIRSTCHAR != 'x$' ]] ; then
- XKBOUTPUT="$XKB_BASE_DIRECTORY/$XKBOUTPUT"
-fi
-
-dnl XKM_OUTPUT_DIR (used in code) must end in / or file names get hosed
-dnl XKB_COMPILED_DIR (used in Makefiles) must not or install-sh gets confused
-
-XKBOUTPUT=`echo $XKBOUTPUT/ | $SED 's|/*$|/|'`
-XKB_COMPILED_DIR=`echo $XKBOUTPUT | $SED 's|/*$||'`
-AC_DEFINE_DIR(XKM_OUTPUT_DIR, XKBOUTPUT, [Path to XKB output dir])
-AC_SUBST(XKB_COMPILED_DIR)
-
-if test "x$XKB_DFLT_RULES" = x; then
- case $host_os in
- linux*)
- dnl doesn't take AutoAddDevices into account, but whatever.
- if test "x$CONFIG_HAL" = xyes; then
- XKB_DFLT_RULES="evdev"
- else
- XKB_DFLT_RULES="base"
- fi
- ;;
- *)
- XKB_DFLT_RULES="base"
- ;;
- esac
-fi
-AC_DEFINE_UNQUOTED(XKB_DFLT_RULES, ["$XKB_DFLT_RULES"], [Default XKB ruleset])
-AC_DEFINE_UNQUOTED(XKB_DFLT_MODEL, ["$XKB_DFLT_MODEL"], [Default XKB model])
-AC_DEFINE_UNQUOTED(XKB_DFLT_LAYOUT, ["$XKB_DFLT_LAYOUT"], [Default XKB layout])
-AC_DEFINE_UNQUOTED(XKB_DFLT_VARIANT, ["$XKB_DFLT_VARIANT"], [Default XKB variant])
-AC_DEFINE_UNQUOTED(XKB_DFLT_OPTIONS, ["$XKB_DFLT_OPTIONS"], [Default XKB options])
-
-XKB_LIB='$(top_builddir)/xkb/libxkb.la'
-XKB_STUB_LIB='$(top_builddir)/xkb/libxkbstubs.la'
-REQUIRED_MODULES="$REQUIRED_MODULES xkbfile"
-
-AC_CHECK_FUNC(strcasecmp, [], AC_DEFINE([NEED_STRCASECMP], 1,
- [Do not have 'strcasecmp'.]))
-AC_CHECK_FUNC(strncasecmp, [], AC_DEFINE([NEED_STRNCASECMP], 1,
- [Do not have 'strncasecmp'.]))
-AC_CHECK_FUNC(strcasestr, [], AC_DEFINE([NEED_STRCASESTR], 1,
- [Do not have 'strcasestr'.]))
-
-PKG_CHECK_MODULES([XDMCP], [xdmcp], [have_libxdmcp="yes"], [have_libxdmcp="no"])
-if test "x$have_libxdmcp" = xyes; then
- AC_CHECK_LIB(Xdmcp, XdmcpWrap, [have_xdmcpwrap="yes"], [have_xdmcpwrap="no"], [$XDMCP_LIBS])
-fi
-if test "x$XDMCP" = xauto; then
- if test "x$have_libxdmcp" = xyes; then
- XDMCP=yes
- else
- XDMCP=no
- fi
-fi
-if test "x$XDMAUTH" = xauto; then
- if test "x$have_libxdmcp" = xyes && test "x$have_xdmcpwrap" = xyes; then
- XDMAUTH=yes
- else
- XDMAUTH=no
- fi
-fi
-
-AM_CONDITIONAL(XDMCP, [test "x$XDMCP" = xyes])
-if test "x$XDMCP" = xyes; then
- AC_DEFINE(XDMCP, 1, [Support XDM Control Protocol])
- REQUIRED_LIBS="$REQUIRED_LIBS xdmcp"
- XDMCP_MODULES="xdmcp"
-fi
-
-AM_CONDITIONAL(XDMAUTH, [test "x$XDMAUTH" = xyes])
-if test "x$XDMAUTH" = xyes; then
- AC_DEFINE(HASXDMAUTH,1,[Support XDM-AUTH*-1])
- if ! test "x$XDMCP" = xyes; then
- REQUIRED_LIBS="$REQUIRED_LIBS xdmcp"
- XDMCP_MODULES="xdmcp"
- fi
-fi
-
-AC_DEFINE_DIR(COMPILEDDEFAULTFONTPATH, FONTPATH, [Default font path])
-AC_DEFINE_DIR(PCI_TXT_IDS_PATH, PCI_TXT_IDS_DIR, [Default PCI text file ID path])
-AC_DEFINE_DIR(SERVER_MISC_CONFIG_PATH, SERVERCONFIG, [Server miscellaneous config path])
-AC_DEFINE_DIR(BASE_FONT_PATH, FONTROOTDIR, [Default base font path])
-dridriverdir=`$PKG_CONFIG --variable=dridriverdir dri`
-AC_DEFINE_DIR(DRI_DRIVER_PATH, dridriverdir, [Default DRI driver path])
-AC_DEFINE_UNQUOTED(XVENDORNAME, ["$VENDOR_NAME"], [Vendor name])
-AC_DEFINE_UNQUOTED(XVENDORNAMESHORT, ["$VENDOR_NAME_SHORT"], [Short vendor name])
-AC_DEFINE_UNQUOTED(XORG_DATE, ["$RELEASE_DATE"], [Vendor release])
-AC_DEFINE_UNQUOTED(XORG_MAN_VERSION, ["$VENDOR_MAN_VERSION"], [Vendor man version])
-AC_DEFINE_UNQUOTED(BUILDERADDR, ["$BUILDERADDR"], [Builder address])
-
-if test -z "$OSNAME"; then
- OSNAME="UNKNOWN"
-fi
-
-AC_DEFINE_UNQUOTED(OSNAME, ["$OSNAME"], [Operating System Name])
-AC_DEFINE_UNQUOTED(OSVENDOR, ["$OSVENDOR"], [Operating System Vendor])
-AC_DEFINE_UNQUOTED(BUILDERSTRING, ["$BUILDERSTRING"], [Builder string])
-
-AC_SUBST([VENDOR_NAME_SHORT])
-AC_DEFINE_UNQUOTED(VENDOR_NAME, ["$VENDOR_NAME"], [Vendor name])
-AC_DEFINE_UNQUOTED(VENDOR_NAME_SHORT, ["$VENDOR_NAME_SHORT"], [Vendor name])
-AC_DEFINE_UNQUOTED(VENDOR_RELEASE, [$VENDOR_RELEASE], [Vendor release])
-AC_DEFINE_UNQUOTED(VENDOR_MAN_VERSION, ["$VENDOR_MAN_VERSION"], [Vendor man version])
-
-AC_DEFINE(NO_LIBCWRAPPER, 1, [Define to 1 if modules should avoid the libcwrapper])
-
-if test "x$DEBUGGING" = xyes; then
- AC_DEFINE(DEBUG, 1, [Enable debugging code])
-fi
-AM_CONDITIONAL(DEBUG, [test "x$DEBUGGING" = xyes])
-
-# If unittests aren't explicitly disabled, check for required support
-if test "x$UNITTESTS" != xno ; then
- PKG_CHECK_MODULES([GLIB], $LIBGLIB,
- [HAVE_GLIB=yes], [HAVE_GLIB=no])
-
- # Check if linker supports -wrap, passed via compiler flags
- # When cross-compiling, reports no, since unit tests run from
- # "make check", so would be running on build machine, not target
- AC_MSG_CHECKING([whether the linker supports -wrap])
- save_LDFLAGS="$LDFLAGS"
- LDFLAGS="$LDFLAGS -Wl,-wrap,exit"
- AC_RUN_IFELSE([AC_LANG_PROGRAM([[
- void __wrap_exit (int s)
- {
- __real_exit (0);
- }]],
- [[exit (1);]])],
- [linker_can_wrap="yes"],
- [linker_can_wrap="no"],
- [linker_can_wrap="no"])
- AC_MSG_RESULT([$linker_can_wrap])
- LDFLAGS="$save_LDFLAGS"
-fi
-
-if test "x$UNITTESTS" = xauto; then
- if test "x$HAVE_GLIB" = xyes && test "x$linker_can_wrap" = xyes; then
- UNITTESTS=yes
- else
- UNITTESTS=no
- fi
-fi
-if test "x$UNITTESTS" = xyes; then
- if test "x$HAVE_GLIB" = xno; then
- AC_MSG_ERROR([glib required to build unit tests])
- fi
- if test "x$linker_can_wrap" = xno; then
- AC_MSG_ERROR([ld -wrap support required to build unit tests])
- fi
- AC_DEFINE(UNITTESTS, 1, [Enable unit tests])
- AC_SUBST([GLIB_LIBS])
- AC_SUBST([GLIB_CFLAGS])
-fi
-AM_CONDITIONAL(UNITTESTS, [test "x$UNITTESTS" = xyes])
-
-AC_DEFINE(XTEST, 1, [Support XTest extension])
-AC_DEFINE(XSYNC, 1, [Support XSync extension])
-AC_DEFINE(XCMISC, 1, [Support XCMisc extension])
-AC_DEFINE(BIGREQS, 1, [Support BigRequests extension])
-
-if test "x$SPECIAL_DTRACE_OBJECTS" = "xyes" ; then
- DIX_LIB='$(top_builddir)/dix/dix.O'
- OS_LIB='$(top_builddir)/os/os.O $(SHA1_LIBS) $(DLOPEN_LIBS)'
-else
- DIX_LIB='$(top_builddir)/dix/libdix.la'
- OS_LIB='$(top_builddir)/os/libos.la'
-fi
-AC_SUBST([DIX_LIB])
-AC_SUBST([OS_LIB])
-
-MAIN_LIB='$(top_builddir)/dix/libmain.la'
-AC_SUBST([MAIN_LIB])
-
-MI_LIB='$(top_builddir)/mi/libmi.la'
-MI_EXT_LIB='$(top_builddir)/mi/libmiext.la'
-MI_INC='-I$(top_srcdir)/mi'
-FB_LIB='$(top_builddir)/fb/libfb.la'
-FB_INC='-I$(top_srcdir)/fb'
-MIEXT_SHADOW_INC='-I$(top_srcdir)/miext/shadow'
-MIEXT_SHADOW_LIB='$(top_builddir)/miext/shadow/libshadow.la'
-MIEXT_SYNC_INC='-I$(top_srcdir)/miext/sync'
-MIEXT_SYNC_LIB='$(top_builddir)/miext/sync/libsync.la'
-CORE_INCS='-I$(top_srcdir)/include -I$(top_builddir)/include'
-
-# SHA1 hashing
-AC_ARG_WITH([sha1],
- [AS_HELP_STRING([--with-sha1=libc|libmd|libgcrypt|libcrypto|libsha1|CommonCrypto],
- [choose SHA1 implementation])])
-AC_CHECK_FUNC([SHA1Init], [HAVE_SHA1_IN_LIBC=yes])
-if test "x$with_sha1" = x && test "x$HAVE_SHA1_IN_LIBC" = xyes; then
- with_sha1=libc
-fi
-if test "x$with_sha1" = xlibc && test "x$HAVE_SHA1_IN_LIBC" != xyes; then
- AC_MSG_ERROR([libc requested but not found])
-fi
-if test "x$with_sha1" = xlibc; then
- AC_DEFINE([HAVE_SHA1_IN_LIBC], [1],
- [Use libc SHA1 functions])
- SHA1_LIBS=""
-fi
-AC_CHECK_FUNC([CC_SHA1_Init], [HAVE_SHA1_IN_COMMONCRYPTO=yes])
-if test "x$with_sha1" = x && test "x$HAVE_SHA1_IN_COMMONCRYPTO" = xyes; then
- with_sha1=CommonCrypto
-fi
-if test "x$with_sha1" = xCommonCrypto && test "x$HAVE_SHA1_IN_COMMONCRYPTO" != xyes; then
- AC_MSG_ERROR([CommonCrypto requested but not found])
-fi
-if test "x$with_sha1" = xCommonCrypto; then
- AC_DEFINE([HAVE_SHA1_IN_COMMONCRYPTO], [1],
- [Use CommonCrypto SHA1 functions])
- SHA1_LIBS=""
-fi
-AC_CHECK_LIB([md], [SHA1Init], [HAVE_LIBMD=yes])
-if test "x$with_sha1" = x && test "x$HAVE_LIBMD" = xyes; then
- with_sha1=libmd
-fi
-if test "x$with_sha1" = xlibmd && test "x$HAVE_LIBMD" != xyes; then
- AC_MSG_ERROR([libmd requested but not found])
-fi
-if test "x$with_sha1" = xlibmd; then
- AC_DEFINE([HAVE_SHA1_IN_LIBMD], [1],
- [Use libmd SHA1 functions])
- SHA1_LIBS=-lmd
-fi
-PKG_CHECK_MODULES([LIBSHA1], [libsha1], [HAVE_LIBSHA1=yes], [HAVE_LIBSHA1=no])
-if test "x$with_sha1" = x && test "x$HAVE_LIBSHA1" = xyes; then
- with_sha1=libsha1
-fi
-if test "x$with_sha1" = xlibsha1 && test "x$HAVE_LIBSHA1" != xyes; then
- AC_MSG_ERROR([libsha1 requested but not found])
-fi
-if test "x$with_sha1" = xlibsha1; then
- AC_DEFINE([HAVE_SHA1_IN_LIBSHA1], [1],
- [Use libsha1 for SHA1])
- SHA1_LIBS=-lsha1
-fi
-AC_CHECK_LIB([gcrypt], [gcry_md_open], [HAVE_LIBGCRYPT=yes])
-if test "x$with_sha1" = x && test "x$HAVE_LIBGCRYPT" = xyes; then
- with_sha1=libgcrypt
-fi
-if test "x$with_sha1" = xlibgcrypt && test "x$HAVE_LIBGCRYPT" != xyes; then
- AC_MSG_ERROR([libgcrypt requested but not found])
-fi
-if test "x$with_sha1" = xlibgcrypt; then
- AC_DEFINE([HAVE_SHA1_IN_LIBGCRYPT], [1],
- [Use libgcrypt SHA1 functions])
- SHA1_LIBS=-lgcrypt
-fi
-# We don't need all of the OpenSSL libraries, just libcrypto
-AC_CHECK_LIB([crypto], [SHA1_Init], [HAVE_LIBCRYPTO=yes])
-PKG_CHECK_MODULES([OPENSSL], [openssl], [HAVE_OPENSSL_PKC=yes],
- [HAVE_OPENSSL_PKC=no])
-if test "x$HAVE_LIBCRYPTO" = xyes || test "x$HAVE_OPENSSL_PKC" = xyes; then
- if test "x$with_sha1" = x; then
- with_sha1=libcrypto
- fi
-else
- if test "x$with_sha1" = xlibcrypto; then
- AC_MSG_ERROR([OpenSSL libcrypto requested but not found])
- fi
-fi
-if test "x$with_sha1" = xlibcrypto; then
- if test "x$HAVE_LIBCRYPTO" = xyes; then
- SHA1_LIBS=-lcrypto
- else
- SHA1_LIBS="$OPENSSL_LIBS"
- SHA1_CFLAGS="$OPENSSL_CFLAGS"
- fi
-fi
-AC_MSG_CHECKING([for SHA1 implementation])
-if test "x$with_sha1" = x; then
- AC_MSG_ERROR([No suitable SHA1 implementation found])
-fi
-AC_MSG_RESULT([$with_sha1])
-AC_SUBST(SHA1_LIBS)
-AC_SUBST(SHA1_CFLAGS)
-
-PKG_CHECK_MODULES([XSERVERCFLAGS], [$REQUIRED_MODULES $REQUIRED_LIBS])
-PKG_CHECK_MODULES([XSERVERLIBS], [$REQUIRED_LIBS])
-
-# Autotools has some unfortunate issues with library handling. In order to
-# get a server to rebuild when a dependency in the tree is changed, it must
-# be listed in SERVERNAME_DEPENDENCIES. However, no system libraries may be
-# listed there, or some versions of autotools will break (especially if a -L
-# is required to find the library). So, we keep two sets of libraries
-# detected: NAMESPACE_LIBS for in-tree libraries to be linked against, which
-# will go into the _DEPENDENCIES and _LDADD of the server, and
-# NAMESPACE_SYS_LIBS which will go into only the _LDADD. The
-# NAMESPACEMODULES_LIBS detected from pkgconfig should always go in
-# NAMESPACE_SYS_LIBS.
-#
-# XSERVER_LIBS is the set of in-tree libraries which all servers require.
-# XSERVER_SYS_LIBS is the set of out-of-tree libraries which all servers
-# require.
-#
-XSERVER_CFLAGS="${XSERVER_CFLAGS} ${XSERVERCFLAGS_CFLAGS}"
-XSERVER_LIBS="$DIX_LIB $MI_LIB $OS_LIB"
-XSERVER_SYS_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} ${LIBS}"
-AC_SUBST([XSERVER_LIBS])
-AC_SUBST([XSERVER_SYS_LIBS])
-
-UTILS_SYS_LIBS="${SYS_LIBS}"
-AC_SUBST([UTILS_SYS_LIBS])
-
-# The Xorg binary needs to export symbols so that they can be used from modules
-# Some platforms require extra flags to do this. libtool should set the
-# necessary flags for each platform when -export-dynamic is passed to it.
-LD_EXPORT_SYMBOLS_FLAG="-export-dynamic"
-AC_SUBST([LD_EXPORT_SYMBOLS_FLAG])
-
-dnl Imake defines SVR4 on SVR4 systems, and many files check for it, so
-dnl we need to replicate that here until those can all be fixed
-AC_MSG_CHECKING([if SVR4 needs to be defined])
-AC_EGREP_CPP([I_AM_SVR4],[
-#if defined(SVR4) || defined(__svr4__) || defined(__SVR4)
- I_AM_SVR4
-#endif
-],[
-AC_DEFINE([SVR4],1,[Define to 1 on systems derived from System V Release 4])
-AC_MSG_RESULT([yes])], AC_MSG_RESULT([no]))
-
-XSERVER_CFLAGS="$XSERVER_CFLAGS $CORE_INCS $XEXT_INC $COMPOSITE_INC $DAMAGE_INC $FIXES_INC $XI_INC $MI_INC $MIEXT_SYNC_INC $MIEXT_SHADOW_INC $MIEXT_LAYER_INC $MIEXT_DAMAGE_INC $RENDER_INC $RANDR_INC $FB_INC"
-
-dnl ---------------------------------------------------------------------------
-dnl DDX section.
-dnl ---------------------------------------------------------------------------
-
-dnl Xvfb DDX
-
-AC_MSG_CHECKING([whether to build Xvfb DDX])
-AC_MSG_RESULT([$XVFB])
-AM_CONDITIONAL(XVFB, [test "x$XVFB" = xyes])
-
-if test "x$XVFB" = xyes; then
- XVFB_LIBS="$FB_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB"
- XVFB_SYS_LIBS="$XVFBMODULES_LIBS $GLX_SYS_LIBS"
- AC_SUBST([XVFB_LIBS])
- AC_SUBST([XVFB_SYS_LIBS])
-fi
-
-
-dnl Xnest DDX
-
-PKG_CHECK_MODULES(XNESTMODULES, [$LIBXEXT x11 xau $XDMCP_MODULES], [have_xnest=yes], [have_xnest=no])
-AC_MSG_CHECKING([whether to build Xnest DDX])
-if test "x$XNEST" = xauto; then
- XNEST="$have_xnest"
-fi
-AC_MSG_RESULT([$XNEST])
-AM_CONDITIONAL(XNEST, [test "x$XNEST" = xyes])
-
-if test "x$XNEST" = xyes; then
- if test "x$have_xnest" = xno; then
- AC_MSG_ERROR([Xnest build explicitly requested, but required modules not found.])
- fi
- XNEST_LIBS="$FB_LIB $FIXES_LIB $MI_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $DIX_LIB $MAIN_LIB $OS_LIB"
- XNEST_SYS_LIBS="$XNESTMODULES_LIBS $GLX_SYS_LIBS"
- AC_SUBST([XNEST_LIBS])
- AC_SUBST([XNEST_SYS_LIBS])
-fi
-
-
-dnl Xorg DDX
-
-AC_MSG_CHECKING([whether to build Xorg DDX])
-if test "x$XORG" = xauto; then
- XORG="yes"
- case $host_os in
- cygwin*) XORG="no" ;;
- darwin*) XORG="no" ;;
- esac
-fi
-AC_MSG_RESULT([$XORG])
-
-xorg_bus_linuxpci=no
-xorg_bus_bsdpci=no
-xorg_bus_sparc=no
-
-if test "x$XORG" = xyes; then
- XORG_DDXINCS='-I$(top_srcdir)/hw/xfree86 -I$(top_srcdir)/hw/xfree86/include -I$(top_srcdir)/hw/xfree86/common'
- XORG_OSINCS='-I$(top_srcdir)/hw/xfree86/os-support -I$(top_srcdir)/hw/xfree86/os-support/bus -I$(top_srcdir)/os'
- XORG_INCS="$XORG_DDXINCS $XORG_OSINCS"
- XORG_CFLAGS="$XORGSERVER_CFLAGS -DHAVE_XORG_CONFIG_H"
- XORG_LIBS="$COMPOSITE_LIB $FIXES_LIB $XEXTXORG_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB"
-
- dnl ==================================================================
- dnl symbol visibility
- symbol_visibility=
- have_visibility=disabled
- if test x$SYMBOL_VISIBILITY != xno; then
- AC_MSG_CHECKING(for symbol visibility support)
- if test x$GCC = xyes; then
- VISIBILITY_CFLAGS="-fvisibility=hidden"
- else
- AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
- if test x$SUNCC = xyes; then
- VISIBILITY_CFLAGS="-xldscope=hidden"
- else
- have_visibility=no
- fi
- fi
- if test x$have_visibility != xno; then
- save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $VISIBILITY_CFLAGS"
- AC_TRY_COMPILE(
- [#include <X11/Xfuncproto.h>
- extern _X_HIDDEN int hidden_int;
- extern _X_EXPORT int public_int;
- extern _X_HIDDEN int hidden_int_func(void);
- extern _X_EXPORT int public_int_func(void);],
- [],
- have_visibility=yes,
- have_visibility=no)
- CFLAGS=$save_CFLAGS
- fi
- AC_MSG_RESULT([$have_visibility])
- if test x$have_visibility != xno; then
- symbol_visibility=$VISIBILITY_CFLAGS
- XORG_CFLAGS="$XORG_CFLAGS $VISIBILITY_CFLAGS"
- XSERVER_CFLAGS="$XSERVER_CFLAGS $VISIBILITY_CFLAGS"
- fi
- fi
- dnl added to xorg-server.pc
- AC_SUBST([symbol_visibility])
- dnl ===================================================================
-
- PKG_CHECK_MODULES([PCIACCESS], $LIBPCIACCESS)
- SAVE_LIBS=$LIBS
- SAVE_CFLAGS=$CFLAGS
- CFLAGS=$PCIACCESS_CFLAGS
- LIBS=$PCIACCESS_LIBS
- AC_CHECK_FUNCS([pci_system_init_dev_mem])
- AC_CHECK_FUNCS([pci_device_enable])
- AC_CHECK_FUNCS([pci_device_is_boot_vga])
- AC_CHECK_FUNCS([pci_device_vgaarb_init])
- LIBS=$SAVE_LIBS
- CFLAGS=$SAVE_CFLAGS
- XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $GLX_SYS_LIBS"
- XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS"
-
- case $host_os in
- linux*)
- if test "x$LNXAPM" = xyes; then
- XORG_CFLAGS="$XORG_CFLAGS -DXF86PM"
- fi
- XORG_OS="linux"
- XORG_OS_SUBDIR="linux"
- xorg_bus_linuxpci="yes"
- linux_acpi="no"
- case $host_cpu in
- ia64*)
- linux_ia64=yes
- linux_acpi="yes"
- ;;
- alpha*)
- linux_alpha=yes
- ;;
- i*86|amd64*|x86_64*)
- linux_acpi="yes"
- ;;
- *)
- ;;
- esac
- ;;
- freebsd* | kfreebsd*-gnu | dragonfly*)
- XORG_OS="freebsd"
- XORG_OS_SUBDIR="bsd"
- xorg_bus_bsdpci="yes"
- ;;
- netbsd*)
- XORG_OS="netbsd"
- XORG_OS_SUBDIR="bsd"
- xorg_bus_bsdpci="yes"
- ;;
- openbsd*)
- if test "x$ac_cv_BSD_APM" = xyes \
- -o "x$ac_cv_BSD_KQUEUE_APM" = xyes; then
- XORG_CFLAGS="$XORG_CFLAGS -DXF86PM"
- fi
- XORG_OS="openbsd"
- XORG_OS_SUBDIR="bsd"
- xorg_bus_bsdpci="yes"
- ;;
- solaris*)
- XORG_OS="solaris"
- XORG_OS_SUBDIR="solaris"
- XORG_CFLAGS="$XORG_CFLAGS -DXF86PM"
- # Use the same stubs as BSD for old functions, since we now
- # use libpciaccess for PCI
- xorg_bus_bsdpci="yes"
- AC_CHECK_HEADERS([sys/kd.h])
- AC_CHECK_HEADERS([sys/vt.h], [solaris_vt=yes], [solaris_vt=no])
- # Check for minimum supported release
- AC_MSG_CHECKING([Solaris version])
- OS_MINOR=`echo ${host_os}|$SED -e 's/^.*solaris2\.//' -e s'/\..*$//'`
- if test "${OS_MINOR}" -ge 7 ; then
- AC_MSG_RESULT(Solaris ${OS_MINOR})
- else
- AC_MSG_RESULT(Solaris `echo ${host_os}|$SED -e 's/^.*solaris//`)
- fi
- if test "${OS_MINOR}" -lt 8 ; then
- AC_MSG_ERROR([This release no longer supports Solaris versions older than Solaris 8.])
- fi
- AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
- if test "x$SUNCC" = "xyes"; then
- solaris_asm_inline="yes"
- fi
- AC_CHECK_DECL([_LP64], [SOLARIS_64="yes"], [SOLARIS_64="no"])
-
- case $host_cpu in
- sparc*)
- SOLARIS_INOUT_ARCH="sparcv8plus"
- ;;
- i*86)
- if test x$SOLARIS_64 = xyes ; then
- SOLARIS_INOUT_ARCH="amd64"
- else
- SOLARIS_INOUT_ARCH="ia32"
- fi
- ;;
- *)
- AC_MSG_ERROR([Unsupported Solaris platform. Only SPARC & x86 \
- are supported on Solaris in this release. If you are \
- interested in porting Xorg to your platform, please email \
- xorg@lists.freedesktop.org.]) ;;
- esac
- AC_SUBST([SOLARIS_INOUT_ARCH])
- if test x$solaris_asm_inline = xyes ; then
- SOLARIS_ASM_CFLAGS='$(top_srcdir)/hw/xfree86/os-support/solaris/solaris-$(SOLARIS_INOUT_ARCH).il'
- XORG_CFLAGS="${XORG_CFLAGS} "'$(SOLARIS_ASM_CFLAGS)'
- fi
- AC_SUBST([SOLARIS_ASM_CFLAGS])
- if test "x$SUPPORT_PC98" = xauto; then
- SUPPORT_PC98="no"
- fi
- ;;
- gnu*)
- XORG_OS="gnu"
- XORG_OS_SUBDIR="hurd"
- # Use the same stubs as BSD for old functions, since we now
- # use libpciaccess for PCI
- xorg_bus_bsdpci="yes"
- ;;
- *)
- XORG_OS="unknown"
- XORG_OS_SUBDIR="unknown"
- AC_MSG_ERROR([m4_text_wrap(m4_join([ ],
- [Your OS is unknown. Xorg currently only supports Linux,],
- [Free/Open/Net/DragonFlyBSD, Solaris/OpenSolaris, & GNU Hurd.],
- [If you are interested in porting Xorg to your platform,],
- [please email xorg@lists.freedesktop.org.]))])
- ;;
- esac
-
- case $host_cpu in
- sparc*)
- xorg_bus_sparc="yes"
- ;;
- i*86)
- if test "x$SUPPORT_PC98" = xauto; then
- SUPPORT_PC98="yes"
- fi
- ;;
- esac
-
- if test "x$SUPPORT_PC98" = xauto; then
- SUPPORT_PC98="no"
- fi
- if test "x$SUPPORT_PC98" = xyes; then
- AC_DEFINE(SUPPORT_PC98, 1, [Support PC98])
- fi
- if test "x$XORG_OS_PCI" = x ; then
- XORG_OS_PCI=$XORG_OS
- fi
- if test "x$DGA" = xauto; then
- PKG_CHECK_MODULES(DGA, $DGAPROTO, [DGA=yes], [DGA=no])
- fi
- if test "x$DGA" = xyes; then
- XORG_MODULES="$XORG_MODULES $DGAPROTO"
- PKG_CHECK_MODULES(DGA, $DGAPROTO)
- AC_DEFINE(DGA, 1, [Support DGA extension])
- AC_DEFINE(XFreeXDGA, 1, [Build XDGA support])
- fi
-
- if test "x$XF86VIDMODE" = xauto; then
- PKG_CHECK_MODULES(XF86VIDMODE, $VIDMODEPROTO, [XF86VIDMODE=yes], [XF86VIDMODE=no])
- fi
- if test "x$XF86VIDMODE" = xyes; then
- XORG_MODULES="$XORG_MODULES $VIDMODEPROTO"
- PKG_CHECK_MODULES(XF86VIDMODE, $VIDMODEPROTO)
- AC_DEFINE(XF86VIDMODE, 1, [Support XFree86 Video Mode extension])
- fi
-
- if test -n "$XORG_MODULES"; then
- PKG_CHECK_MODULES(XORG_MODULES, [$XORG_MODULES])
- XORG_CFLAGS="$XORG_CFLAGS $XORG_MODULES_CFLAGS"
- XORG_SYS_LIBS="$XORG_SYS_LIBS $XORG_MODULES_LIBS"
- fi
-
- AC_SUBST([XORG_LIBS])
- AC_SUBST([XORG_SYS_LIBS])
- AC_SUBST([XORG_INCS])
- AC_SUBST([XORG_OS])
- AC_SUBST([XORG_OS_SUBDIR])
-
- AC_PATH_PROG(PERL, perl, no)
- dnl unlikely as this may be ...
- if test "x$PERL" = xno; then
- AC_MSG_ERROR([Perl is required to build the XFree86/Xorg DDX.])
- fi
- AC_SUBST(PERL)
-
- AC_SUBST([XORG_CFLAGS])
-
- dnl these only go in xorg-config.h
- XF86CONFIGFILE="xorg.conf"
- XF86CONFIGDIR="xorg.conf.d"
- AC_SUBST(XF86CONFIGDIR)
- CONFIGFILE="$sysconfdir/$XF86CONFIGFILE"
- LOGPREFIX="$logdir/Xorg."
- AC_DEFINE(XORG_SERVER, 1, [Building Xorg server])
- AC_DEFINE(XORGSERVER, 1, [Building Xorg server])
- AC_DEFINE(XFree86Server, 1, [Building XFree86 server])
- AC_DEFINE(XFree86LOADER, 1, [Building loadable XFree86 server])
- AC_DEFINE_UNQUOTED(XORG_VERSION_CURRENT, [$VENDOR_RELEASE], [Current Xorg version])
- AC_DEFINE(NEED_XF86_TYPES, 1, [Need XFree86 typedefs])
- AC_DEFINE(NEED_XF86_PROTOTYPES, 1, [Need XFree86 helper functions])
- AC_DEFINE(__XSERVERNAME__, "Xorg", [Name of X server])
- AC_DEFINE_DIR(__XCONFIGFILE__, XF86CONFIGFILE, [Name of configuration file])
- AC_DEFINE_DIR(XF86CONFIGFILE, XF86CONFIGFILE, [Name of configuration file])
- AC_DEFINE_DIR(__XCONFIGDIR__, XF86CONFIGDIR, [Name of configuration directory])
- AC_DEFINE_DIR(DEFAULT_MODULE_PATH, moduledir, [Default module search path])
- AC_DEFINE_DIR(DEFAULT_LIBRARY_PATH, libdir, [Default library install path])
- AC_DEFINE_DIR(DEFAULT_LOGPREFIX, LOGPREFIX, [Default log location])
- AC_DEFINE_UNQUOTED(__VENDORDWEBSUPPORT__, ["$VENDOR_WEB"], [Vendor web address for support])
- AC_DEFINE(XSERVER_LIBPCIACCESS, 1, [Use libpciaccess for all pci manipulation])
- if test "x$VGAHW" = xyes; then
- AC_DEFINE(WITH_VGAHW, 1, [Building vgahw module])
- fi
-
- driverdir="$moduledir/drivers"
- AC_SUBST([moduledir])
- AC_SUBST([driverdir])
- sdkdir="$includedir/xorg"
- extdir="$includedir/X11/extensions"
- sysconfigdir="$datadir/X11/$XF86CONFIGDIR"
- AC_SUBST([sdkdir])
- AC_SUBST([extdir])
- AC_SUBST([sysconfigdir])
- AC_SUBST([logdir])
-
- # stuff the ABI versions into the pc file too
- extract_abi() {
- grep ^.define.*${1}_VERSION ${srcdir}/hw/xfree86/common/xf86Module.h | tr '(),' ' .' | awk '{ print $4$5 }'
- }
- abi_ansic=`extract_abi ANSIC`
- abi_videodrv=`extract_abi VIDEODRV`
- abi_xinput=`extract_abi XINPUT`
- abi_extension=`extract_abi EXTENSION`
- AC_SUBST([abi_ansic])
- AC_SUBST([abi_videodrv])
- AC_SUBST([abi_xinput])
- AC_SUBST([abi_extension])
-fi
-AM_CONDITIONAL([XORG], [test "x$XORG" = xyes])
-AM_CONDITIONAL([XORG_BUS_LINUXPCI], [test "x$xorg_bus_linuxpci" = xyes])
-AM_CONDITIONAL([XORG_BUS_BSDPCI], [test "x$xorg_bus_bsdpci" = xyes])
-AM_CONDITIONAL([XORG_BUS_SPARC], [test "x$xorg_bus_sparc" = xyes])
-AM_CONDITIONAL([LINUX_IA64], [test "x$linux_ia64" = xyes])
-AM_CONDITIONAL([LINUX_ALPHA], [test "x$linux_alpha" = xyes])
-AM_CONDITIONAL([LNXACPI], [test "x$linux_acpi" = xyes])
-AM_CONDITIONAL([SOLARIS_ASM_INLINE], [test "x$solaris_asm_inline" = xyes])
-AM_CONDITIONAL([SOLARIS_VT], [test "x$solaris_vt" = xyes])
-AM_CONDITIONAL([DGA], [test "x$DGA" = xyes])
-AM_CONDITIONAL([XF86VIDMODE], [test "x$XF86VIDMODE" = xyes])
-
-dnl XWin DDX
-
-AC_MSG_CHECKING([whether to build XWin DDX])
-if test "x$XWIN" = xauto; then
- case $host_os in
- cygwin*) XWIN="yes" ;;
- mingw*) XWIN="yes" ;;
- *) XWIN="no" ;;
- esac
-fi
-AC_MSG_RESULT([$XWIN])
-
-if test "x$XWIN" = xyes; then
- AC_DEFINE_DIR(SYSCONFDIR, sysconfdir, [Location of system.XWinrc])
- AC_DEFINE_DIR(DEFAULT_LOGDIR, logdir, [Default log location])
- AC_DEFINE_UNQUOTED(XORG_VERSION_CURRENT, [$VENDOR_RELEASE], [Current Xorg version])
- AC_DEFINE_UNQUOTED(__VENDORDWEBSUPPORT__, ["$VENDOR_WEB"], [Vendor web address for support])
- AC_CHECK_TOOL(WINDRES, windres)
-
- PKG_CHECK_MODULES([XWINMODULES],[x11 xdmcp xau])
-
- if test "x$WINDOWSWM" = xauto; then
- PKG_CHECK_EXISTS($WINDOWSWMPROTO, [WINDOWSWM=yes], [WINDOWSWM=no])
- fi
- if test "x$WINDOWSWM" = xyes ; then
- PKG_CHECK_MODULES(WINDOWSWM, $WINDOWSWMPROTO)
- XWINMODULES_CFLAGS="$XWINMODULES_CFLAGS $WINDOWSWM_CFLAGS"
- AC_DEFINE(ROOTLESS,1,[Build Rootless code])
- fi
-
- case $host_os in
- cygwin*)
- XWIN_SERVER_NAME=XWin
- AC_DEFINE(HAS_DEVWINDOWS,1,[Cygwin has /dev/windows for signaling new win32 messages])
- ;;
- mingw*)
- XWIN_SERVER_NAME=Xming
- AC_DEFINE(RELOCATE_PROJECTROOT,1,[Make PROJECT_ROOT relative to the xserver location])
- AC_DEFINE(HAS_WINSOCK,1,[Use Windows sockets])
- XWIN_SYS_LIBS=-lwinsock2
- ;;
- esac
- XWIN_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $RANDR_LIB $RENDER_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $DAMAGE_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $OS_LIB"
- XWIN_SYS_LIBS="$XWIN_SYS_LIBS $XWINMODULES_LIBS"
- AC_SUBST(XWIN_LIBS)
- AC_SUBST(XWIN_SERVER_NAME)
- AC_SUBST(XWIN_SYS_LIBS)
-
- if test "x$DEBUGGING" = xyes; then
- AC_DEFINE(CYGDEBUG, 1, [Simple debug messages])
- AC_DEFINE(CYGWINDOWING_DEBUG, 1, [Debug messages for window handling])
- AC_DEFINE(CYGMULTIWINDOW_DEBUG, 1, [Debug window manager])
- fi
-
- AC_DEFINE(DDXOSVERRORF, 1, [Use OsVendorVErrorF])
- AC_DEFINE(DDXBEFORERESET, 1, [Use ddxBeforeReset ])
-fi
-AM_CONDITIONAL(XWIN, [test "x$XWIN" = xyes])
-AM_CONDITIONAL(XWIN_MULTIWINDOW, [test "x$XWIN" = xyes])
-AM_CONDITIONAL(XWIN_MULTIWINDOWEXTWM, [test "x$XWIN" = xyes && test "x$WINDOWSWM" = xyes])
-AM_CONDITIONAL(XWIN_CLIPBOARD, [test "x$XWIN" = xyes])
-AM_CONDITIONAL(XWIN_GLX_WINDOWS, [test "x$XWIN" = xyes && false])
-AM_CONDITIONAL(XWIN_NATIVEGDI, [test "x$XWIN" = xyes])
-AM_CONDITIONAL(XWIN_PRIMARYFB, [test "x$XWIN" = xyes])
-AM_CONDITIONAL(XWIN_RANDR, [test "x$XWIN" = xyes])
-AM_CONDITIONAL(XWIN_XV, [test "x$XWIN" = xyes && test "x$XV" = xyes])
-
-dnl Darwin / OS X DDX
-if test "x$XQUARTZ" = xyes; then
- AC_DEFINE(XQUARTZ,1,[Have Quartz])
- AC_DEFINE(ROOTLESS,1,[Build Rootless code])
-
- DARWIN_LIBS="$MI_LIB $OS_LIB $DIX_LIB $MAIN_LIB $FB_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $XPSTUBS_LIB"
- AC_SUBST([DARWIN_LIBS])
-
- AC_CHECK_LIB([Xplugin],[xp_init],[:])
-
- CFLAGS="${CFLAGS} -DROOTLESS_SAFEALPHA -DNO_ALLOCA"
-
- PKG_CHECK_MODULES(XPBPROXY, $APPLEWMPROTO $LIBAPPLEWM xfixes x11)
-
- if test "x$XQUARTZ_SPARKLE" = xyes ; then
- AC_DEFINE(XQUARTZ_SPARKLE,1,[Support application updating through sparkle.])
- fi
-
- if test "x$STANDALONE_XPBPROXY" = xyes ; then
- AC_DEFINE(STANDALONE_XPBPROXY,1,[Build a standalone xpbproxy])
- fi
-fi
-
-# Support for objc in autotools is minimal and not documented.
-OBJC='$(CC)'
-OBJCLD='$(CCLD)'
-OBJCLINK='$(LINK)'
-OBJCFLAGS='$(CFLAGS)'
-AC_SUBST([OBJC])
-AC_SUBST([OBJCCLD])
-AC_SUBST([OBJCLINK])
-AC_SUBST([OBJCFLAGS])
-# internal, undocumented automake func follows :(
-_AM_DEPENDENCIES([OBJC])
-AM_CONDITIONAL(XQUARTZ, [test "x$XQUARTZ" = xyes])
-AM_CONDITIONAL(XQUARTZ_SPARKLE, [test "x$XQUARTZ_SPARKLE" != "xno"])
-AM_CONDITIONAL(STANDALONE_XPBPROXY, [test "x$STANDALONE_XPBPROXY" = xyes])
-
-dnl DMX DDX
-PKG_CHECK_MODULES(
- [DMXMODULES],
- [xmuu $LIBXEXT x11 xrender xfixes $LIBXI $DMXPROTO xau $XDMCP_MODULES],
- [PKG_CHECK_MODULES(
- [XDMXCONFIG_DEP],
- [xaw7 xmu xt xpm x11],
- [have_dmx=yes],
- [have_dmx=no])],
- [have_dmx=no])
-AC_MSG_CHECKING([whether to build Xdmx DDX])
-if test "x$DMX" = xauto; then
- DMX="$have_dmx"
- case $host_os in
- cygwin*) DMX="no" ;;
- darwin*) DMX="no" ;;
- esac
-fi
-AC_MSG_RESULT([$DMX])
-AM_CONDITIONAL(DMX, [test "x$DMX" = xyes])
-
-if test "x$DMX" = xyes; then
- if test "x$have_dmx" = xno; then
- AC_MSG_ERROR([Xdmx build explicitly requested, but required
- modules not found.])
- fi
- DMX_INCLUDES="$XEXT_INC $RENDER_INC $RECORD_INC"
- XDMX_CFLAGS="$DMXMODULES_CFLAGS"
- XDMX_LIBS="$FB_LIB $MI_LIB $XEXT_LIB $RENDER_LIB $RECORD_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $MIEXT_SYNC_LIB $MIEXT_SHADOW_LIB $MIEXT_DAMAGE_LIB $COMPOSITE_LIB $DAMAGE_LIB $MAIN_LIB $DIX_LIB $CONFIG_LIB $OS_LIB $FIXES_LIB"
- XDMX_SYS_LIBS="$DMXMODULES_LIBS"
- AC_SUBST([XDMX_CFLAGS])
- AC_SUBST([XDMX_LIBS])
- AC_SUBST([XDMX_SYS_LIBS])
-
-dnl USB sources in DMX require <linux/input.h>
- AC_CHECK_HEADER([linux/input.h], DMX_BUILD_USB="yes",
- DMX_BUILD_USB="no")
-dnl Linux sources in DMX require <linux/keyboard.h>
- AC_CHECK_HEADER([linux/keyboard.h], DMX_BUILD_LNX="yes",
- DMX_BUILD_LNX="no")
- AC_SUBST(XDMXCONFIG_DEP_CFLAGS)
- AC_SUBST(XDMXCONFIG_DEP_LIBS)
- PKG_CHECK_MODULES([DMXEXAMPLES_DEP], [$LIBDMX $LIBXEXT x11])
- AC_SUBST(DMXEXAMPLES_DEP_LIBS)
- PKG_CHECK_MODULES([DMXXMUEXAMPLES_DEP], [$LIBDMX xmu $LIBXEXT x11])
- AC_SUBST(DMXXMUEXAMPLES_DEP_LIBS)
- PKG_CHECK_MODULES([DMXXIEXAMPLES_DEP], [$LIBDMX $LIBXI $LIBXEXT x11])
- AC_SUBST(DMXXIEXAMPLES_DEP_LIBS)
- PKG_CHECK_MODULES([XTSTEXAMPLES_DEP], [$LIBXTST $LIBXEXT x11])
- AC_SUBST(XTSTEXAMPLES_DEP_LIBS)
- PKG_CHECK_MODULES([XRESEXAMPLES_DEP], [xres $LIBXEXT x11])
- AC_SUBST(XRESEXAMPLES_DEP_LIBS)
- PKG_CHECK_MODULES([X11EXAMPLES_DEP], [$LIBXEXT x11])
- AC_SUBST(X11EXAMPLES_DEP_LIBS)
-
-fi
-AM_CONDITIONAL([DMX_BUILD_LNX], [test "x$DMX_BUILD_LNX" = xyes])
-AM_CONDITIONAL([DMX_BUILD_USB], [test "x$DMX_BUILD_USB" = xyes])
-
-dnl kdrive DDX
-
-XEPHYR_LIBS=
-XEPHYR_INCS=
-
-AM_CONDITIONAL(KDRIVE, [test x$KDRIVE = xyes])
-
-if test "$KDRIVE" = yes; then
- AC_DEFINE(KDRIVESERVER,1,[Build Kdrive X server])
- AC_DEFINE(KDRIVEDDXACTIONS,,[Build kdrive ddx])
-
- AC_CHECK_HEADERS([linux/fb.h])
- if test "$ac_cv_header_linux_fb_h" = yes && test "x$XFBDEV" = xauto; then
- XFBDEV=yes
- fi
-
- if test "x$XFBDEV" = xyes; then
- KDRIVEFBDEVLIB=yes
- AC_DEFINE(KDRIVEFBDEV, 1, [Build fbdev-based kdrive server])
- fi
-
-
- PKG_CHECK_MODULES([TSLIB], [tslib-0.0], [HAVE_TSLIB="yes"], [HAVE_TSLIB="no"])
- if test "x$HAVE_TSLIB" = xno; then
- AC_CHECK_LIB(ts, ts_open, [
- HAVE_TSLIB="yes"
- TSLIB_LIBS="-lts"
- ])
- fi
-
- if test "xTSLIB" = xauto; then
- TSLIB="$HAVE_TSLIB"
- fi
-
- if test "x$TSLIB" = xyes; then
- if ! test "x$HAVE_TSLIB" = xyes; then
- AC_MSG_ERROR([tslib must be installed to build the tslib driver. See http://tslib.berlios.de/])
- else
- AC_DEFINE(TSLIB, 1, [Have tslib support])
- fi
- fi
-
- if test "x$KDRIVE_KBD" = xyes; then
- AC_DEFINE(KDRIVE_KBD, 1, [Enable KDrive kbd driver])
- fi
- if test "x$KDRIVE_EVDEV" = xyes; then
- AC_DEFINE(KDRIVE_EVDEV, 1, [Enable KDrive evdev driver])
- fi
- if test "x$KDRIVE_MOUSE" = xyes; then
- AC_DEFINE(KDRIVE_MOUSE, 1, [Enable KDrive mouse driver])
- fi
-
- XEPHYR_REQUIRED_LIBS="x11 $LIBXEXT xau xdmcp"
- if test "x$XV" = xyes; then
- XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS xv"
- fi
- if test "x$DRI" = xyes && test "x$GLX" = xyes; then
- XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS $LIBGL libdrm"
- fi
-
- PKG_CHECK_MODULES(XEPHYR, $XEPHYR_REQUIRED_LIBS, [xephyr="yes"], [xephyr="no"])
- if test "x$XEPHYR" = xauto; then
- XEPHYR=$xephyr
- fi
- if test "x$XEPHYR" = xyes && test "x$xephyr" = xno; then
- AC_MSG_ERROR([Xephyr dependencies missing])
- fi
-
- # Xephyr needs nanosleep() which is in librt on Solaris
- AC_CHECK_FUNC([nanosleep], [],
- AC_CHECK_LIB([rt], [nanosleep], XEPHYR_LIBS="$XEPHYR_LIBS -lrt"))
-
- # damage shadow extension glx (NOTYET) fb mi
- KDRIVE_INC='-I$(top_srcdir)/hw/kdrive/src'
- KDRIVE_PURE_INCS="$KDRIVE_INC $MIEXT_SYNC_INC $MIEXT_DAMAGE_INC $MIEXT_SHADOW_INC $XEXT_INC $FB_INC $MI_INC"
- KDRIVE_OS_INC='-I$(top_srcdir)/hw/kdrive/linux'
- KDRIVE_INCS="$KDRIVE_PURE_INCS $KDRIVE_OS_INC"
-
- KDRIVE_CFLAGS="$XSERVER_CFLAGS -DHAVE_KDRIVE_CONFIG_H $TSLIB_CFLAGS"
-
- KDRIVE_PURE_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $OS_LIB"
- KDRIVE_LIB='$(top_builddir)/hw/kdrive/src/libkdrive.la'
- case $host_os in
- *linux*)
- KDRIVE_OS_LIB='$(top_builddir)/hw/kdrive/linux/liblinux.la'
- KDRIVELINUX=yes
- if test "x$KDRIVE_EVDEV" = xauto; then
- KDRIVE_EVDEV=yes
- fi
- if test "x$KDRIVE_KBD" = xauto; then
- KDRIVE_KBD=yes
- fi
- if test "x$KDRIVE_MOUSE" = xauto; then
- KDRIVE_MOUSE=yes
- fi
- ;;
- *)
- if test "x$KDRIVE_EVDEV" = xauto; then
- KDRIVE_EVDEV=no
- fi
- if test "x$KDRIVE_KBD" = xauto; then
- KDRIVE_KBD=no
- fi
- if test "x$KDRIVE_MOUSE" = xauto; then
- KDRIVE_MOUSE=no
- fi
- ;;
- esac
- KDRIVE_STUB_LIB='$(top_builddir)/hw/kdrive/src/libkdrivestubs.la'
- KDRIVE_LOCAL_LIBS="$MAIN_LIB $DIX_LIB $KDRIVE_LIB $KDRIVE_STUB_LIB"
- KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $FB_LIB $MI_LIB $KDRIVE_PURE_LIBS"
- KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $KDRIVE_OS_LIB"
- KDRIVE_LIBS="$KDRIVE_LOCAL_LIBS $XSERVER_SYS_LIBS $GLX_SYS_LIBS $DLOPEN_LIBS $TSLIB_LIBS"
-
- AC_SUBST([XEPHYR_LIBS])
- AC_SUBST([XEPHYR_INCS])
-fi
-AC_SUBST([KDRIVE_INCS])
-AC_SUBST([KDRIVE_PURE_INCS])
-AC_SUBST([KDRIVE_CFLAGS])
-AC_SUBST([KDRIVE_PURE_LIBS])
-AC_SUBST([KDRIVE_LOCAL_LIBS])
-AC_SUBST([KDRIVE_LIBS])
-AM_CONDITIONAL(KDRIVELINUX, [test "x$KDRIVELINUX" = xyes])
-AM_CONDITIONAL(KDRIVE_EVDEV, [test "x$KDRIVE_EVDEV" = xyes])
-AM_CONDITIONAL(KDRIVE_KBD, [test "x$KDRIVE_KBD" = xyes])
-AM_CONDITIONAL(KDRIVE_MOUSE, [test "x$KDRIVE_MOUSE" = xyes])
-AM_CONDITIONAL(TSLIB, [test "x$HAVE_TSLIB" = xyes])
-AM_CONDITIONAL(KDRIVEFBDEV, [test "x$XFBDEV" = xyes])
-AM_CONDITIONAL(XEPHYR, [test "x$KDRIVE" = xyes && test "x$XEPHYR" = xyes])
-AM_CONDITIONAL(BUILD_KDRIVEFBDEVLIB, [test "x$KDRIVE" = xyes && test "x$KDRIVEFBDEVLIB" = xyes])
-AM_CONDITIONAL(XFAKESERVER, [test "x$KDRIVE" = xyes && test "x$XFAKE" = xyes])
-
-dnl and the rest of these are generic, so they're in config.h
-dnl
-dnl though, thanks to the passing of some significant amount of time, the
-dnl above is probably a complete fallacy, and you should not rely on it.
-dnl but this is still actually better than imake, honest. -daniels
-
-AC_TRY_COMPILE([
-#include <features.h>
-#ifndef __GLIBC__
-#error not glibc
-#endif
-], [], [AC_DEFINE(_GNU_SOURCE, 1,
- [ Enable GNU and other extensions to the C environment for glibc])])
-
-AC_DEFINE_DIR(PROJECTROOT, prefix, [Overall prefix])
-
-AC_SUBST([RELEASE_DATE])
-BUILD_DATE="`date +'%Y%m%d'`"
-AC_SUBST([BUILD_DATE])
-BUILD_TIME="`date +'1%H%M%S'`"
-AC_SUBST([BUILD_TIME])
-
-DIX_CFLAGS="-DHAVE_DIX_CONFIG_H $XSERVER_CFLAGS"
-
-AC_SUBST([DIX_CFLAGS])
-
-AC_SUBST([libdir])
-AC_SUBST([exec_prefix])
-AC_SUBST([prefix])
-
-AC_OUTPUT([
-Makefile
-glx/Makefile
-include/Makefile
-composite/Makefile
-damageext/Makefile
-dbe/Makefile
-dix/Makefile
-doc/Makefile
-doc/man/Makefile
-doc/xml/Makefile
-doc/xml/dtrace/Makefile
-doc/xml/xserver.ent
-fb/Makefile
-record/Makefile
-config/Makefile
-mi/Makefile
-miext/Makefile
-miext/sync/Makefile
-miext/damage/Makefile
-miext/shadow/Makefile
-miext/cw/Makefile
-miext/rootless/Makefile
-os/Makefile
-randr/Makefile
-render/Makefile
-xkb/Makefile
-Xext/Makefile
-Xi/Makefile
-xfixes/Makefile
-exa/Makefile
-hw/Makefile
-hw/xfree86/Makefile
-hw/xfree86/common/Makefile
-hw/xfree86/common/xf86Build.h
-hw/xfree86/ddc/Makefile
-hw/xfree86/dixmods/Makefile
-hw/xfree86/dixmods/extmod/Makefile
-hw/xfree86/doc/Makefile
-hw/xfree86/doc/devel/Makefile
-hw/xfree86/doc/man/Makefile
-hw/xfree86/doc/sgml/Makefile
-hw/xfree86/dri/Makefile
-hw/xfree86/dri2/Makefile
-hw/xfree86/exa/Makefile
-hw/xfree86/exa/man/Makefile
-hw/xfree86/fbdevhw/Makefile
-hw/xfree86/fbdevhw/man/Makefile
-hw/xfree86/i2c/Makefile
-hw/xfree86/int10/Makefile
-hw/xfree86/loader/Makefile
-hw/xfree86/modes/Makefile
-hw/xfree86/os-support/Makefile
-hw/xfree86/os-support/bsd/Makefile
-hw/xfree86/os-support/bus/Makefile
-hw/xfree86/os-support/hurd/Makefile
-hw/xfree86/os-support/misc/Makefile
-hw/xfree86/os-support/linux/Makefile
-hw/xfree86/os-support/solaris/Makefile
-hw/xfree86/parser/Makefile
-hw/xfree86/ramdac/Makefile
-hw/xfree86/shadowfb/Makefile
-hw/xfree86/vbe/Makefile
-hw/xfree86/vgahw/Makefile
-hw/xfree86/x86emu/Makefile
-hw/xfree86/xaa/Makefile
-hw/xfree86/utils/Makefile
-hw/xfree86/utils/man/Makefile
-hw/xfree86/utils/cvt/Makefile
-hw/xfree86/utils/gtf/Makefile
-hw/dmx/config/Makefile
-hw/dmx/config/man/Makefile
-hw/dmx/doc/Makefile
-hw/dmx/examples/Makefile
-hw/dmx/input/Makefile
-hw/dmx/glxProxy/Makefile
-hw/dmx/Makefile
-hw/dmx/man/Makefile
-hw/vfb/Makefile
-hw/vfb/man/Makefile
-hw/xnest/Makefile
-hw/xnest/man/Makefile
-hw/xwin/Makefile
-hw/xwin/glx/Makefile
-hw/xwin/man/Makefile
-hw/xquartz/Makefile
-hw/xquartz/GL/Makefile
-hw/xquartz/bundle/Makefile
-hw/xquartz/man/Makefile
-hw/xquartz/mach-startup/Makefile
-hw/xquartz/pbproxy/Makefile
-hw/xquartz/xpr/Makefile
-hw/kdrive/Makefile
-hw/kdrive/ephyr/Makefile
-hw/kdrive/ephyr/man/Makefile
-hw/kdrive/fake/Makefile
-hw/kdrive/fbdev/Makefile
-hw/kdrive/linux/Makefile
-hw/kdrive/src/Makefile
-test/Makefile
-test/xi2/Makefile
-xorg-server.pc
-])
+dnl Copyright © 2003-2007 Keith Packard, Daniel Stone
+dnl
+dnl Permission is hereby granted, free of charge, to any person obtaining a
+dnl copy of this software and associated documentation files (the "Software"),
+dnl to deal in the Software without restriction, including without limitation
+dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
+dnl and/or sell copies of the Software, and to permit persons to whom the
+dnl Software is furnished to do so, subject to the following conditions:
+dnl
+dnl The above copyright notice and this permission notice (including the next
+dnl paragraph) shall be included in all copies or substantial portions of the
+dnl Software.
+dnl
+dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+dnl DEALINGS IN THE SOFTWARE.
+dnl
+dnl Authors: Keith Packard <keithp@keithp.com>
+dnl Daniel Stone <daniel@fooishbar.org>
+dnl an unwitting cast of miscellaneous others
+dnl
+dnl Process this file with autoconf to create configure.
+
+AC_PREREQ(2.57)
+AC_INIT([xorg-server], 1.9.99.903, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2011-2-24"
+AC_CONFIG_SRCDIR([Makefile.am])
+AM_INIT_AUTOMAKE([foreign dist-bzip2])
+AM_MAINTAINER_MODE
+
+# Require xorg-macros minimum of 1.10 for XORG_CHECK_SGML_DOCTOOLS
+m4_ifndef([XORG_MACROS_VERSION],
+ [m4_fatal([must install xorg-macros 1.10 or later before running autoconf/autogen])])
+XORG_MACROS_VERSION(1.10)
+XORG_DEFAULT_OPTIONS
+XORG_WITH_DOXYGEN(1.6.1)
+XORG_CHECK_SGML_DOCTOOLS(1.5)
+
+m4_ifndef([XORG_FONT_MACROS_VERSION], [m4_fatal([must install fontutil 1.1 or later before running autoconf/autogen])])
+XORG_FONT_MACROS_VERSION(1.1)
+
+dnl this gets generated by autoheader, and thus contains all the defines. we
+dnl don't ever actually use it, internally.
+AC_CONFIG_HEADERS(include/do-not-use-config.h)
+dnl xorg-server.h is an external header, designed to be included by loadable
+dnl drivers.
+AC_CONFIG_HEADERS(include/xorg-server.h)
+dnl dix-config.h covers most of the DIX (i.e. everything but the DDX, not just
+dnl dix/).
+AC_CONFIG_HEADERS(include/dix-config.h)
+dnl xorg-config.h covers the Xorg DDX.
+AC_CONFIG_HEADERS(include/xorg-config.h)
+dnl xkb-config.h covers XKB for the Xorg and Xnest DDXs.
+AC_CONFIG_HEADERS(include/xkb-config.h)
+dnl xwin-config.h covers the XWin DDX.
+AC_CONFIG_HEADERS(include/xwin-config.h)
+dnl kdrive-config.h covers the kdrive DDX
+AC_CONFIG_HEADERS(include/kdrive-config.h)
+dnl version-config.h covers the version numbers so they can be bumped without
+dnl forcing an entire recompile.x
+AC_CONFIG_HEADERS(include/version-config.h)
+
+AM_PROG_AS
+AC_PROG_LN_S
+AC_LIBTOOL_WIN32_DLL
+AC_DISABLE_STATIC
+AC_PROG_LIBTOOL
+AC_PROG_MAKE_SET
+PKG_PROG_PKG_CONFIG
+AC_PROG_LEX
+AC_PROG_YACC
+AC_SYS_LARGEFILE
+XORG_PROG_RAWCPP
+
+# Quoted so that make will expand $(CWARNFLAGS) in makefiles to allow
+# easier overrides at build time.
+XSERVER_CFLAGS='$(CWARNFLAGS)'
+
+dnl Check for dtrace program (needed to build Xserver dtrace probes)
+dnl Also checks for <sys/sdt.h>, since some Linux distros have an
+dnl ISDN trace program named dtrace
+AC_ARG_WITH(dtrace, AS_HELP_STRING([--with-dtrace=PATH],
+ [Enable dtrace probes (default: enabled if dtrace found)]),
+ [WDTRACE=$withval], [WDTRACE=auto])
+if test "x$WDTRACE" = "xyes" -o "x$WDTRACE" = "xauto" ; then
+ AC_PATH_PROG(DTRACE, [dtrace], [not_found], [$PATH:/usr/sbin])
+ if test "x$DTRACE" = "xnot_found" ; then
+ if test "x$WDTRACE" = "xyes" ; then
+ AC_MSG_FAILURE([dtrace requested but not found])
+ fi
+ WDTRACE="no"
+ else
+ AC_CHECK_HEADER(sys/sdt.h, [HAS_SDT_H="yes"], [HAS_SDT_H="no"])
+ if test "x$WDTRACE" = "xauto" -a "x$HAS_SDT_H" = "xno" ; then
+ WDTRACE="no"
+ fi
+ fi
+fi
+if test "x$WDTRACE" != "xno" ; then
+ AC_DEFINE(XSERVER_DTRACE, 1,
+ [Define to 1 if the DTrace Xserver provider probes should be built in.])
+
+# Solaris/OpenSolaris require dtrace -G to build dtrace probe information into
+# object files, and require linking with those as relocatable objects, not .a
+# archives. MacOS X handles all this in the normal compiler toolchain, and on
+# some releases (like Tiger), will error out on dtrace -G. For now, other
+# platforms with Dtrace ports are assumed to support -G (the FreeBSD and Linux
+# ports appear to, based on my web searches, but have not yet been tested).
+ case $host_os in
+ darwin*) SPECIAL_DTRACE_OBJECTS=no ;;
+ *) SPECIAL_DTRACE_OBJECTS=yes ;;
+ esac
+fi
+AM_CONDITIONAL(XSERVER_DTRACE, [test "x$WDTRACE" != "xno"])
+AM_CONDITIONAL(SPECIAL_DTRACE_OBJECTS, [test "x$SPECIAL_DTRACE_OBJECTS" = "xyes"])
+
+AC_HEADER_DIRENT
+AC_HEADER_STDC
+AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h dlfcn.h stropts.h fnmatch.h sys/utsname.h])
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_C_BIGENDIAN([ENDIAN="X_BIG_ENDIAN"], [ENDIAN="X_LITTLE_ENDIAN"])
+
+AC_CHECK_SIZEOF([unsigned long])
+if test "$ac_cv_sizeof_unsigned_long" = 8; then
+ AC_DEFINE(_XSERVER64, 1, [Define to 1 if unsigned long is 64 bits.])
+fi
+
+AC_TYPE_PID_T
+
+# Checks for headers/macros for byte swapping
+# Known variants:
+# <byteswap.h> bswap_16, bswap_32, bswap_64 (glibc)
+# <sys/endian.h> __swap16, __swap32, __swap64 (OpenBSD)
+# <sys/endian.h> bswap16, bswap32, bswap64 (other BSD's)
+# and a fallback to local macros if none of the above are found
+
+# if <byteswap.h> is found, assume it's the correct version
+AC_CHECK_HEADERS([byteswap.h])
+
+# if <sys/endian.h> is found, have to check which version
+AC_CHECK_HEADER([sys/endian.h], [HAVE_SYS_ENDIAN_H="yes"], [HAVE_SYS_ENDIAN_H="no"])
+
+if test "x$HAVE_SYS_ENDIAN_H" = "xyes" ; then
+ AC_MSG_CHECKING([for __swap16 variant of <sys/endian.h> byteswapping macros])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([
+#include <sys/types.h>
+#include <sys/endian.h>
+ ], [
+int a = 1, b;
+b = __swap16(a);
+ ])
+], [SYS_ENDIAN__SWAP='yes'], [SYS_ENDIAN__SWAP='no'])
+ AC_MSG_RESULT([$SYS_ENDIAN__SWAP])
+
+ AC_MSG_CHECKING([for bswap16 variant of <sys/endian.h> byteswapping macros])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([
+#include <sys/types.h>
+#include <sys/endian.h>
+ ], [
+int a = 1, b;
+b = bswap16(a);
+ ])
+], [SYS_ENDIAN_BSWAP='yes'], [SYS_ENDIAN_BSWAP='no'])
+ AC_MSG_RESULT([$SYS_ENDIAN_BSWAP])
+
+ if test "$SYS_ENDIAN_BSWAP" = "yes" ; then
+ USE_SYS_ENDIAN_H=yes
+ BSWAP=bswap
+ else
+ if test "$SYS_ENDIAN__SWAP" = "yes" ; then
+ USE_SYS_ENDIAN_H=yes
+ BSWAP=__swap
+ else
+ USE_SYS_ENDIAN_H=no
+ fi
+ fi
+
+ if test "$USE_SYS_ENDIAN_H" = "yes" ; then
+ AC_DEFINE([USE_SYS_ENDIAN_H], 1,
+ [Define to use byteswap macros from <sys/endian.h>])
+ AC_DEFINE_UNQUOTED([bswap_16], ${BSWAP}16,
+ [Define to 16-bit byteswap macro])
+ AC_DEFINE_UNQUOTED([bswap_32], ${BSWAP}32,
+ [Define to 32-bit byteswap macro])
+ AC_DEFINE_UNQUOTED([bswap_64], ${BSWAP}64,
+ [Define to 64-bit byteswap macro])
+ fi
+fi
+
+dnl Check to see if dlopen is in default libraries (like Solaris, which
+dnl has it in libc), or if libdl is needed to get it.
+AC_CHECK_FUNC([dlopen], [],
+ AC_CHECK_LIB([dl], [dlopen], DLOPEN_LIBS="-ldl"))
+AC_SUBST(DLOPEN_LIBS)
+
+dnl Checks for library functions.
+AC_FUNC_VPRINTF
+AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr \
+ strtol getopt getopt_long vsnprintf walkcontext backtrace \
+ getisax getzoneid shmctl64 strcasestr ffs vasprintf])
+AC_FUNC_ALLOCA
+dnl Old HAS_* names used in os/*.c.
+AC_CHECK_FUNC([getdtablesize],
+ AC_DEFINE(HAS_GETDTABLESIZE, 1, [Have the 'getdtablesize' function.]))
+AC_CHECK_FUNC([getifaddrs],
+ AC_DEFINE(HAS_GETIFADDRS, 1, [Have the 'getifaddrs' function.]))
+AC_CHECK_FUNC([getpeereid],
+ AC_DEFINE(HAS_GETPEEREID, 1, [Have the 'getpeereid' function.]))
+AC_CHECK_FUNC([getpeerucred],
+ AC_DEFINE(HAS_GETPEERUCRED, 1, [Have the 'getpeerucred' function.]))
+AC_CHECK_FUNC([strlcat], HAVE_STRLCAT=yes, HAVE_STRLCAT=no)
+AM_CONDITIONAL(NEED_STRLCAT, [test x$HAVE_STRLCAT = xno])
+AC_CHECK_FUNC([strlcpy], AC_DEFINE(HAS_STRLCPY, 1, [Have the 'strlcpy' function]))
+
+AM_CONDITIONAL(NEED_VSNPRINTF, [test x$HAVE_VSNPRINTF = xno])
+
+dnl Check for mmap support for Xvfb
+AC_CHECK_FUNC([mmap], AC_DEFINE(HAS_MMAP, 1, [Have the 'mmap' function.]))
+
+dnl Find the math libary
+AC_CHECK_LIB(m, sqrt)
+AC_CHECK_LIB(m, cbrt, AC_DEFINE(HAVE_CBRT, 1, [Have the 'cbrt' function]))
+
+AC_CHECK_HEADERS([ndbm.h dbm.h rpcsvc/dbm.h])
+
+dnl AGPGART headers
+AC_CHECK_HEADERS([linux/agpgart.h sys/agpio.h sys/agpgart.h], AGP=yes)
+AM_CONDITIONAL(AGP, [test "x$AGP" = xyes])
+
+dnl APM header
+AC_CHECK_HEADERS([linux/apm_bios.h], LNXAPM=yes)
+AM_CONDITIONAL(LNXAPM, [test "x$LNXAPM" = xyes])
+
+dnl fbdev header
+AC_CHECK_HEADERS([linux/fb.h], FBDEV=yes)
+AM_CONDITIONAL(FBDEVHW, [test "x$FBDEV" = xyes])
+
+dnl MTRR header
+AC_CHECK_HEADERS([asm/mtrr.h], ac_cv_asm_mtrr_h=yes)
+if test "x$ac_cv_asm_mtrr_h" = xyes; then
+ HAVE_MTRR=yes
+fi
+
+dnl BSD MTRR header
+AC_CHECK_HEADERS([sys/memrange.h], ac_cv_memrange_h=yes)
+if test "x$ac_cv_memrange_h" = xyes; then
+ HAVE_MTRR=yes
+fi
+
+if test "x$HAVE_MTRR" = xyes; then
+ AC_DEFINE(HAS_MTRR_SUPPORT, 1, [MTRR support available])
+fi
+
+dnl A NetBSD MTRR header
+AC_CHECK_HEADERS([machine/mtrr.h], ac_cv_machine_mtrr_h=yes)
+if test "x$ac_cv_machine_mtrr_h" = xyes; then
+ AC_DEFINE(HAS_MTRR_BUILTIN, 1, [Define to 1 if NetBSD built-in MTRR
+ support is available])
+fi
+
+dnl FreeBSD kldload support (sys/linker.h)
+AC_CHECK_HEADERS([sys/linker.h],
+ [ac_cv_sys_linker_h=yes],
+ [ac_cv_sys_linker_h=no],
+ [#include <sys/param.h>])
+AM_CONDITIONAL(FREEBSD_KLDLOAD, [test "x$ac_cv_sys_linker_h" = xyes])
+
+AC_CACHE_CHECK([for SYSV IPC],
+ ac_cv_sysv_ipc,
+ [AC_TRY_LINK([
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+],[
+{
+ int id;
+ id = shmget(IPC_PRIVATE, 512, SHM_W | SHM_R);
+ if (id < 0) return -1;
+ return shmctl(id, IPC_RMID, 0);
+}],
+ [ac_cv_sysv_ipc=yes],
+ [ac_cv_sysv_ipc=no])])
+if test "x$ac_cv_sysv_ipc" = xyes; then
+ AC_DEFINE(HAVE_SYSV_IPC, 1, [Define to 1 if SYSV IPC is available])
+fi
+
+dnl OpenBSD /dev/xf86 aperture driver
+if test -c /dev/xf86 ; then
+ AC_DEFINE(HAS_APERTURE_DRV, 1, [System has /dev/xf86 aperture driver])
+fi
+
+dnl BSD APM support
+AC_CHECK_HEADER([machine/apmvar.h],[
+ AC_CHECK_HEADER([sys/event.h],
+ ac_cv_BSD_KQUEUE_APM=yes,
+ ac_cv_BSD_APM=yes)])
+
+AM_CONDITIONAL(BSD_APM, [test "x$ac_cv_BSD_APM" = xyes])
+AM_CONDITIONAL(BSD_KQUEUE_APM, [test "x$ac_cv_BSD_KQUEUE_APM" = xyes])
+
+dnl glibc backtrace support check (hw/xfree86/common/xf86Events.c)
+AC_CHECK_HEADER([execinfo.h],[
+ AC_CHECK_LIB(c, backtrace, [
+ AC_DEFINE(HAVE_BACKTRACE, 1, [Has backtrace support])
+ AC_DEFINE(HAVE_EXECINFO_H, 1, [Have execinfo.h])
+ ])]
+)
+
+dnl ARM needs additional compiler flags for proper backtraces if GCC is
+dnl used. Compile a dummy program with the -mapcs-frame option. If it
+dnl succeeds, we know that we are building for ARM with GCC.
+old_CFLAGS="$CFLAGS"
+CFLAGS="-mapcs-frame"
+AC_COMPILE_IFELSE(
+ AC_LANG_PROGRAM([[ ]]),
+ ARM_BACKTRACE_CFLAGS="$CFLAGS",
+ ARM_BACKTRACE_CFLAGS=""
+)
+CFLAGS="$old_CFLAGS"
+AC_SUBST(ARM_BACKTRACE_CFLAGS)
+
+dnl ---------------------------------------------------------------------------
+dnl Bus options and CPU capabilities. Replaces logic in
+dnl hw/xfree86/os-support/bus/Makefile.am, among others.
+dnl ---------------------------------------------------------------------------
+DEFAULT_INT10="x86emu"
+
+dnl Override defaults as needed for specific platforms:
+
+case $host_cpu in
+ alpha*)
+ ALPHA_VIDEO=yes
+ case $host_os in
+ *freebsd*) SYS_LIBS=-lio ;;
+ *netbsd*) AC_DEFINE(USE_ALPHA_PIO, 1, [NetBSD PIO alpha IO]) ;;
+ esac
+ GLX_ARCH_DEFINES="-D__GLX_ALIGN64 -mieee"
+ ;;
+ arm*)
+ ARM_VIDEO=yes
+ ;;
+ i*86)
+ I386_VIDEO=yes
+ case $host_os in
+ *freebsd*) AC_DEFINE(USE_DEV_IO) ;;
+ *dragonfly*) AC_DEFINE(USE_DEV_IO) ;;
+ *netbsd*) AC_DEFINE(USE_I386_IOPL)
+ SYS_LIBS=-li386
+ ;;
+ *openbsd*) AC_DEFINE(USE_I386_IOPL)
+ SYS_LIBS=-li386
+ ;;
+ esac
+ ;;
+ powerpc*)
+ PPC_VIDEO=yes
+ case $host_os in
+ *freebsd*) DEFAULT_INT10=stub ;;
+ esac
+ ;;
+ sparc*)
+ SPARC64_VIDEO=yes
+ BSD_ARCH_SOURCES="sparc64_video.c ioperm_noop.c"
+ GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
+ ;;
+ x86_64*|amd64*)
+ I386_VIDEO=yes
+ case $host_os in
+ *freebsd*) AC_DEFINE(USE_DEV_IO, 1, [BSD /dev/io]) ;;
+ *dragonfly*) AC_DEFINE(USE_DEV_IO, 1, [BSD /dev/io]) ;;
+ *netbsd*) AC_DEFINE(USE_I386_IOPL, 1, [BSD i386 iopl])
+ SYS_LIBS=-lx86_64
+ ;;
+ *openbsd*) AC_DEFINE(USE_AMD64_IOPL, 1, [BSD AMD64 iopl])
+ SYS_LIBS=-lamd64
+ ;;
+ esac
+ GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
+ ;;
+ ia64*)
+ GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
+ ;;
+ s390*)
+ GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
+ ;;
+esac
+AC_SUBST(GLX_ARCH_DEFINES)
+
+dnl BSD *_video.c selection
+AM_CONDITIONAL(ALPHA_VIDEO, [test "x$ALPHA_VIDEO" = xyes])
+AM_CONDITIONAL(ARM_VIDEO, [test "x$ARM_VIDEO" = xyes])
+AM_CONDITIONAL(I386_VIDEO, [test "x$I386_VIDEO" = xyes])
+AM_CONDITIONAL(PPC_VIDEO, [test "x$PPC_VIDEO" = xyes])
+AM_CONDITIONAL(SPARC64_VIDEO, [test "x$SPARC64_VIDEO" = xyes])
+
+DRI=no
+USE_SIGIO_BY_DEFAULT="yes"
+dnl it would be nice to autodetect these *CONS_SUPPORTs
+case $host_os in
+ *freebsd* | *dragonfly*)
+ case $host_os in
+ kfreebsd*-gnu) ;;
+ *) AC_DEFINE(CSRG_BASED, 1, [System is BSD-like]) ;;
+ esac
+ AC_DEFINE(PCCONS_SUPPORT, 1, [System has PC console])
+ AC_DEFINE(PCVT_SUPPORT, 1, [System has PCVT console])
+ AC_DEFINE(SYSCONS_SUPPORT, 1, [System has syscons console])
+ DRI=yes
+ ;;
+ *netbsd*)
+ AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
+ AC_DEFINE(PCCONS_SUPPORT, 1, [System has PC console])
+ AC_DEFINE(PCVT_SUPPORT, 1, [System has PCVT console])
+ AC_DEFINE(WSCONS_SUPPORT, 1, [System has wscons console])
+ DRI=yes
+ ;;
+ *openbsd*)
+ AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
+ AC_DEFINE(PCVT_SUPPORT, 1, [System has PC console])
+ AC_DEFINE(WSCONS_SUPPORT, 1, [System has wscons console])
+ ;;
+ *linux*)
+ DRI=yes
+ ;;
+ *solaris*)
+ PKG_CHECK_EXISTS(libdrm, DRI=yes, DRI=no)
+ # Disable use of SIGIO by default until some system bugs are
+ # fixed - see Sun/OpenSolaris bug id 6879897
+ USE_SIGIO_BY_DEFAULT="no"
+ ;;
+ darwin*)
+ AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
+ ;;
+ cygwin*)
+ CFLAGS="$CFLAGS -DFD_SETSIZE=256"
+ ;;
+esac
+
+dnl augment XORG_RELEASE_VERSION for our snapshot number and to expose the
+dnl major number
+PVMAJOR=`echo $PACKAGE_VERSION | cut -d . -f 1`
+PVS=`echo $PACKAGE_VERSION | cut -d . -f 4 | cut -d - -f 1`
+if test "x$PVS" = "x"; then
+ PVS="0"
+fi
+
+VENDOR_RELEASE="((($PVMAJOR) * 10000000) + (($PVM) * 100000) + (($PVP) * 1000) + $PVS)"
+VENDOR_MAN_VERSION="Version ${PACKAGE_VERSION}"
+
+VENDOR_NAME="The X.Org Foundation"
+VENDOR_NAME_SHORT="X.Org"
+VENDOR_WEB="http://wiki.x.org"
+
+m4_ifdef([AS_HELP_STRING], , [m4_define([AS_HELP_STRING], m4_defn([AC_HELP_STRING]))])
+
+dnl Build options.
+AC_ARG_ENABLE(werror, AS_HELP_STRING([--enable-werror],
+ [Obsolete - use --enable-strict-compilation instead]),
+ AC_MSG_ERROR([--enable-werror has been replaced by --enable-strict-compilation]))
+
+AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug],
+ [Enable debugging (default: disabled)]),
+ [DEBUGGING=$enableval], [DEBUGGING=no])
+AC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
+ [Enable unit-tests (default: auto)]),
+ [UNITTESTS=$enableval], [UNITTESTS=auto])
+AC_ARG_ENABLE(use-sigio-by-default, AS_HELP_STRING([--enable-use-sigio-by-default]
+ [Enable SIGIO input handlers by default (default: $USE_SIGIO_BY_DEFAULT)]),
+ [USE_SIGIO_BY_DEFAULT=$enableval], [])
+AC_ARG_WITH(int10, AS_HELP_STRING([--with-int10=BACKEND], [int10 backend: vm86, x86emu or stub]),
+ [INT10="$withval"],
+ [INT10="$DEFAULT_INT10"])
+AC_ARG_WITH(vendor-name, AS_HELP_STRING([--with-vendor-name=VENDOR],
+ [Vendor string reported by the server]),
+ [ VENDOR_NAME="$withval" ], [])
+AC_ARG_WITH(vendor-name-short, AS_HELP_STRING([--with-vendor-name-short=VENDOR],
+ [Short version of vendor string reported by the server]),
+ [ VENDOR_NAME_SHORT="$withval" ], [])
+AC_ARG_WITH(vendor-web, AS_HELP_STRING([--with-vendor-web=URL],
+ [Vendor web address reported by the server]),
+ [ VENDOR_WEB="$withval" ], [])
+AC_ARG_WITH(module-dir, AS_HELP_STRING([--with-module-dir=DIR],
+ [Directory where modules are installed (default: $libdir/xorg/modules)]),
+ [ moduledir="$withval" ],
+ [ moduledir="${libdir}/xorg/modules" ])
+AC_ARG_WITH(log-dir, AS_HELP_STRING([--with-log-dir=DIR],
+ [Directory where log files are kept (default: $localstatedir/log)]),
+ [ logdir="$withval" ],
+ [ logdir="$localstatedir/log" ])
+AC_ARG_WITH(builder-addr, AS_HELP_STRING([--with-builder-addr=ADDRESS],
+ [Builder address (default: xorg@lists.freedesktop.org)]),
+ [ BUILDERADDR="$withval" ],
+ [ BUILDERADDR="xorg@lists.freedesktop.org" ])
+AC_ARG_WITH(os-name, AS_HELP_STRING([--with-os-name=OSNAME], [Name of OS (default: output of "uname -srm")]),
+ [ OSNAME="$withval" ],
+ [ OSNAME=`uname -srm` ])
+AC_ARG_WITH(os-vendor, AS_HELP_STRING([--with-os-vendor=OSVENDOR], [Name of OS vendor]),
+ [ OSVENDOR="$withval" ],
+ [ OSVENDOR="" ])
+AC_ARG_WITH(builderstring, AS_HELP_STRING([--with-builderstring=BUILDERSTRING], [Additional builder string]),
+ [ BUILDERSTRING="$withval" ]
+ [ ])
+
+dnl Determine font path
+XORG_FONTROOTDIR
+XORG_FONTSUBDIR(FONTMISCDIR, fontmiscdir, misc)
+XORG_FONTSUBDIR(FONTOTFDIR, fontotfdir, OTF)
+XORG_FONTSUBDIR(FONTTTFDIR, fontttfdir, TTF)
+XORG_FONTSUBDIR(FONTTYPE1DIR, fonttype1dir, Type1)
+XORG_FONTSUBDIR(FONT75DPIDIR, font75dpidir, 75dpi)
+XORG_FONTSUBDIR(FONT100DPIDIR, font100dpidir, 100dpi)
+
+dnl Uses --default-font-path if set, otherwise checks for /etc/X11/fontpath.d,
+dnl otherwise uses standard subdirectories of FONTROOTDIR. When cross
+dnl compiling, assume default font path uses standard FONTROOTDIR directories.
+DEFAULT_FONT_PATH="${FONTMISCDIR}/,${FONTTTFDIR}/,${FONTOTFDIR}/,${FONTTYPE1DIR}/,${FONT100DPIDIR}/,${FONT75DPIDIR}/"
+if test "$cross_compiling" != yes; then
+ AC_CHECK_FILE([${sysconfdir}/X11/fontpath.d],
+ [DEFAULT_FONT_PATH='catalogue:${sysconfdir}/X11/fontpath.d'],
+ [case $host_os in
+ darwin*) DEFAULT_FONT_PATH="${DEFAULT_FONT_PATH},/Library/Fonts,/System/Library/Fonts" ;;
+ esac])
+fi
+AC_ARG_WITH(default-font-path, AS_HELP_STRING([--with-default-font-path=PATH], [Comma separated list of font dirs]),
+ [ FONTPATH="$withval" ],
+ [ FONTPATH="${DEFAULT_FONT_PATH}" ])
+
+AC_MSG_CHECKING([for default font path])
+AC_MSG_RESULT([$FONTPATH])
+
+AC_ARG_WITH(xkb-path, AS_HELP_STRING([--with-xkb-path=PATH], [Path to XKB base dir (default: ${datadir}/X11/xkb)]),
+ [ XKBPATH="$withval" ],
+ [ XKBPATH="${datadir}/X11/xkb" ])
+AC_ARG_WITH(xkb-output, AS_HELP_STRING([--with-xkb-output=PATH], [Path to XKB output dir (default: ${datadir}/X11/xkb/compiled)]),
+ [ XKBOUTPUT="$withval" ],
+ [ XKBOUTPUT="compiled" ])
+AC_ARG_WITH(default-xkb-rules, AS_HELP_STRING([--with-default-xkb-rules=RULES],
+ [Keyboard ruleset (default: base/evdev)]),
+ [ XKB_DFLT_RULES="$withval" ],
+ [ XKB_DFLT_RULES="" ])
+AC_ARG_WITH(default-xkb-model, AS_HELP_STRING([--with-default-xkb-model=MODEL],
+ [Keyboard model (default: pc105)]),
+ [ XKB_DFLT_MODEL="$withval" ],
+ [ XKB_DFLT_MODEL="pc105" ])
+AC_ARG_WITH(default-xkb-layout, AS_HELP_STRING([--with-default-xkb-layout=LAYOUT],
+ [Keyboard layout (default: us)]),
+ [ XKB_DFLT_LAYOUT="$withval" ],
+ [ XKB_DFLT_LAYOUT="us" ])
+AC_ARG_WITH(default-xkb-variant, AS_HELP_STRING([--with-default-xkb-variant=VARIANT],
+ [Keyboard variant (default: (none))]),
+ [ XKB_DFLT_VARIANT="$withval" ],
+ [ XKB_DFLT_VARIANT="" ])
+AC_ARG_WITH(default-xkb-options, AS_HELP_STRING([--with-default-xkb-options=OPTIONS],
+ [Keyboard layout options (default: (none))]),
+ [ XKB_DFLT_OPTIONS="$withval" ],
+ [ XKB_DFLT_OPTIONS="" ])
+AC_ARG_WITH(serverconfig-path, AS_HELP_STRING([--with-serverconfig-path=PATH],
+ [Directory where ancillary server config files are installed (default: ${libdir}/xorg)]),
+ [ SERVERCONFIG="$withval" ],
+ [ SERVERCONFIG="${libdir}/xorg" ])
+AC_ARG_WITH(apple-applications-dir,AS_HELP_STRING([--with-apple-applications-dir=PATH], [Path to the Applications directory (default: /Applications/Utilities)]),
+ [ APPLE_APPLICATIONS_DIR="${withval}" ],
+ [ APPLE_APPLICATIONS_DIR="/Applications/Utilities" ])
+AC_SUBST([APPLE_APPLICATIONS_DIR])
+AC_ARG_WITH(apple-application-name,AS_HELP_STRING([--with-apple-application-name=NAME], [Name for the .app (default: X11)]),
+ [ APPLE_APPLICATION_NAME="${withval}" ],
+ [ APPLE_APPLICATION_NAME="X11" ])
+AC_SUBST([APPLE_APPLICATION_NAME])
+AC_ARG_WITH(launchd-id-prefix, AS_HELP_STRING([--with-launchd-id-prefix=PATH], [Prefix to use for launchd identifiers (default: org.x)]),
+ [ LAUNCHD_ID_PREFIX="${withval}" ],
+ [ LAUNCHD_ID_PREFIX="org.x" ])
+AC_SUBST([LAUNCHD_ID_PREFIX])
+AC_DEFINE_UNQUOTED(LAUNCHD_ID_PREFIX, "$LAUNCHD_ID_PREFIX", [Prefix to use for launchd identifiers])
+AC_ARG_ENABLE(sparkle,AS_HELP_STRING([--enable-sparkle], [Enable updating of X11.app using the Sparkle Framework (default: disabled)]),
+ [ XQUARTZ_SPARKLE="${enableval}" ],
+ [ XQUARTZ_SPARKLE="no" ])
+AC_SUBST([XQUARTZ_SPARKLE])
+AC_ARG_ENABLE(install-libxf86config,
+ AS_HELP_STRING([--enable-install-libxf86config],
+ [Install libxf86config (default: disabled)]),
+ [INSTALL_LIBXF86CONFIG=$enableval],
+ [INSTALL_LIBXF86CONFIG=no])
+AC_ARG_ENABLE(visibility, AC_HELP_STRING([--enable-visibility], [Enable symbol visibility (default: auto)]),
+ [SYMBOL_VISIBILITY=$enableval],
+ [SYMBOL_VISIBILITY=auto])
+AC_ARG_ENABLE(pc98, AC_HELP_STRING([--enable-pc98], [Enable PC98 support in Xorg (default: auto)]),
+ [SUPPORT_PC98=$enableval],
+ [SUPPORT_PC98=auto])
+
+dnl GLX build options
+AC_ARG_ENABLE(aiglx, AS_HELP_STRING([--enable-aiglx], [Build accelerated indirect GLX (default: enabled)]),
+ [AIGLX=$enableval],
+ [AIGLX=yes])
+AX_TLS
+AC_ARG_ENABLE(glx-tls, AS_HELP_STRING([--enable-glx-tls], [Build GLX with TLS support (default: auto)]),
+ [GLX_USE_TLS=$enableval],
+ [GLX_USE_TLS=no
+ if test "${ac_cv_tls}" != "none" ; then
+ GLX_USE_TLS=yes
+ fi])
+AC_SUBST(GLX_TLS, ${GLX_USE_TLS})
+
+dnl Extensions.
+AC_ARG_ENABLE(registry, AS_HELP_STRING([--disable-registry], [Build string registry module (default: enabled)]), [XREGISTRY=$enableval], [XREGISTRY=yes])
+AC_ARG_ENABLE(composite, AS_HELP_STRING([--disable-composite], [Build Composite extension (default: enabled)]), [COMPOSITE=$enableval], [COMPOSITE=yes])
+AC_ARG_ENABLE(mitshm, AS_HELP_STRING([--disable-shm], [Build SHM extension (default: enabled)]), [MITSHM=$enableval], [MITSHM=yes])
+AC_ARG_ENABLE(xres, AS_HELP_STRING([--disable-xres], [Build XRes extension (default: enabled)]), [RES=$enableval], [RES=yes])
+AC_ARG_ENABLE(record, AS_HELP_STRING([--disable-record], [Build Record extension (default: enabled)]), [RECORD=$enableval], [RECORD=yes])
+AC_ARG_ENABLE(xv, AS_HELP_STRING([--disable-xv], [Build Xv extension (default: enabled)]), [XV=$enableval], [XV=yes])
+AC_ARG_ENABLE(xvmc, AS_HELP_STRING([--disable-xvmc], [Build XvMC extension (default: enabled)]), [XVMC=$enableval], [XVMC=yes])
+AC_ARG_ENABLE(dga, AS_HELP_STRING([--disable-dga], [Build DGA extension (default: auto)]), [DGA=$enableval], [DGA=auto])
+AC_ARG_ENABLE(screensaver, AS_HELP_STRING([--disable-screensaver], [Build ScreenSaver extension (default: enabled)]), [SCREENSAVER=$enableval], [SCREENSAVER=yes])
+AC_ARG_ENABLE(xdmcp, AS_HELP_STRING([--disable-xdmcp], [Build XDMCP extension (default: auto)]), [XDMCP=$enableval], [XDMCP=auto])
+AC_ARG_ENABLE(xdm-auth-1, AS_HELP_STRING([--disable-xdm-auth-1], [Build XDM-Auth-1 extension (default: auto)]), [XDMAUTH=$enableval], [XDMAUTH=auto])
+AC_ARG_ENABLE(glx, AS_HELP_STRING([--disable-glx], [Build GLX extension (default: enabled)]), [GLX=$enableval], [GLX=yes])
+AC_ARG_ENABLE(dri, AS_HELP_STRING([--enable-dri], [Build DRI extension (default: auto)]), [DRI=$enableval])
+AC_ARG_ENABLE(dri2, AS_HELP_STRING([--enable-dri2], [Build DRI2 extension (default: auto)]), [DRI2=$enableval], [DRI2=auto])
+AC_ARG_ENABLE(xinerama, AS_HELP_STRING([--disable-xinerama], [Build Xinerama extension (default: enabled)]), [XINERAMA=$enableval], [XINERAMA=yes])
+AC_ARG_ENABLE(xf86vidmode, AS_HELP_STRING([--disable-xf86vidmode], [Build XF86VidMode extension (default: auto)]), [XF86VIDMODE=$enableval], [XF86VIDMODE=auto])
+AC_ARG_ENABLE(xace, AS_HELP_STRING([--disable-xace], [Build X-ACE extension (default: enabled)]), [XACE=$enableval], [XACE=yes])
+AC_ARG_ENABLE(xselinux, AS_HELP_STRING([--enable-xselinux], [Build SELinux extension (default: disabled)]), [XSELINUX=$enableval], [XSELINUX=no])
+AC_ARG_ENABLE(xcsecurity, AS_HELP_STRING([--enable-xcsecurity], [Build Security extension (default: disabled)]), [XCSECURITY=$enableval], [XCSECURITY=no])
+AC_ARG_ENABLE(xcalibrate, AS_HELP_STRING([--enable-xcalibrate], [Build XCalibrate extension (default: disabled)]), [XCALIBRATE=$enableval], [XCALIBRATE=no])
+AC_ARG_ENABLE(tslib, AS_HELP_STRING([--enable-tslib], [Build kdrive tslib touchscreen support (default: disabled)]), [TSLIB=$enableval], [TSLIB=no])
+AC_ARG_ENABLE(dbe, AS_HELP_STRING([--disable-dbe], [Build DBE extension (default: enabled)]), [DBE=$enableval], [DBE=yes])
+AC_ARG_ENABLE(xf86bigfont, AS_HELP_STRING([--enable-xf86bigfont], [Build XF86 Big Font extension (default: disabled)]), [XF86BIGFONT=$enableval], [XF86BIGFONT=no])
+AC_ARG_ENABLE(dpms, AS_HELP_STRING([--disable-dpms], [Build DPMS extension (default: enabled)]), [DPMSExtension=$enableval], [DPMSExtension=yes])
+AC_ARG_ENABLE(config-udev, AS_HELP_STRING([--enable-config-udev], [Build udev support (default: auto)]), [CONFIG_UDEV=$enableval], [CONFIG_UDEV=auto])
+AC_ARG_ENABLE(config-dbus, AS_HELP_STRING([--enable-config-dbus], [Build D-BUS API support (default: no)]), [CONFIG_DBUS_API=$enableval], [CONFIG_DBUS_API=no])
+AC_ARG_ENABLE(config-hal, AS_HELP_STRING([--disable-config-hal], [Build HAL support (default: auto)]), [CONFIG_HAL=$enableval], [CONFIG_HAL=auto])
+AC_ARG_ENABLE(xfree86-utils, AS_HELP_STRING([--enable-xfree86-utils], [Build xfree86 DDX utilities (default: enabled)]), [XF86UTILS=$enableval], [XF86UTILS=yes])
+AC_ARG_ENABLE(xaa, AS_HELP_STRING([--enable-xaa], [Build XAA (default: enabled)]), [XAA=$enableval], [XAA=yes])
+AC_ARG_ENABLE(vgahw, AS_HELP_STRING([--enable-vgahw], [Build Xorg with vga access (default: enabled)]), [VGAHW=$enableval], [VGAHW=yes])
+AC_ARG_ENABLE(vbe, AS_HELP_STRING([--enable-vbe], [Build Xorg with VBE module (default: enabled)]), [VBE=$enableval], [VBE=yes])
+AC_ARG_ENABLE(int10-module, AS_HELP_STRING([--enable-int10-module], [Build Xorg with int10 module (default: enabled)]), [INT10MODULE=$enableval], [INT10MODULE=yes])
+AC_ARG_ENABLE(windowswm, AS_HELP_STRING([--enable-windowswm], [Build XWin with WindowsWM extension (default: no)]), [WINDOWSWM=$enableval], [WINDOWSWM=no])
+AC_ARG_ENABLE(libdrm, AS_HELP_STRING([--enable-libdrm], [Build Xorg with libdrm support (default: enabled)]), [DRM=$enableval],[DRM=yes])
+
+dnl DDXes.
+AC_ARG_ENABLE(xorg, AS_HELP_STRING([--enable-xorg], [Build Xorg server (default: auto)]), [XORG=$enableval], [XORG=auto])
+AC_ARG_ENABLE(dmx, AS_HELP_STRING([--enable-dmx], [Build DMX server (default: auto)]), [DMX=$enableval], [DMX=auto])
+AC_ARG_ENABLE(xvfb, AS_HELP_STRING([--enable-xvfb], [Build Xvfb server (default: yes)]), [XVFB=$enableval], [XVFB=yes])
+AC_ARG_ENABLE(xnest, AS_HELP_STRING([--enable-xnest], [Build Xnest server (default: auto)]), [XNEST=$enableval], [XNEST=auto])
+AC_ARG_ENABLE(xquartz, AS_HELP_STRING([--enable-xquartz], [Build Xquartz server for OS-X (default: auto)]), [XQUARTZ=$enableval], [XQUARTZ=auto])
+AC_ARG_ENABLE(standalone-xpbproxy, AS_HELP_STRING([--enable-standalone-xpbproxy], [Build a standalone xpbproxy (in addition to the one integrated into Xquartz as a separate thread) (default: no)]), [STANDALONE_XPBPROXY=$enableval], [STANDALONE_XPBPROXY=no])
+AC_ARG_ENABLE(xwin, AS_HELP_STRING([--enable-xwin], [Build XWin server (default: auto)]), [XWIN=$enableval], [XWIN=auto])
+dnl kdrive and its subsystems
+AC_ARG_ENABLE(kdrive, AS_HELP_STRING([--enable-kdrive], [Build kdrive servers (default: no)]), [KDRIVE=$enableval], [KDRIVE=no])
+AC_ARG_ENABLE(xephyr, AS_HELP_STRING([--enable-xephyr], [Build the kdrive Xephyr server (default: auto)]), [XEPHYR=$enableval], [XEPHYR=auto])
+AC_ARG_ENABLE(xfake, AS_HELP_STRING([--enable-xfake], [Build the kdrive 'fake' server (default: auto)]), [XFAKE=$enableval], [XFAKE=auto])
+AC_ARG_ENABLE(xfbdev, AS_HELP_STRING([--enable-xfbdev], [Build the kdrive framebuffer device server (default: auto)]), [XFBDEV=$enableval], [XFBDEV=auto])
+dnl kdrive options
+AC_ARG_ENABLE(kdrive-kbd, AS_HELP_STRING([--enable-kdrive-kbd], [Build kbd driver for kdrive (default: auto)]), [KDRIVE_KBD=$enableval], [KDRIVE_KBD=auto])
+AC_ARG_ENABLE(kdrive-mouse, AC_HELP_STRING([--enable-kdrive-mouse], [Build mouse driver for kdrive (default: auto)]), [KDRIVE_MOUSE=$enableval], [KDRIVE_MOUSE=auto])
+AC_ARG_ENABLE(kdrive-evdev, AC_HELP_STRING([--enable-kdrive-evdev], [Build evdev driver for kdrive (default: auto)]), [KDRIVE_EVDEV=$enableval], [KDRIVE_EVDEV=auto])
+
+
+dnl chown/chmod to be setuid root as part of build
+dnl Replaces InstallXserverSetUID in imake
+AC_ARG_ENABLE(install-setuid,
+ AS_HELP_STRING([--enable-install-setuid],
+ [Install Xorg server as owned by root with setuid bit (default: auto)]),
+ [SETUID=$enableval], [SETUID=auto])
+AC_MSG_CHECKING([to see if we can install the Xorg server as root])
+if test "x$SETUID" = "xauto" ; then
+ case $host_os in
+ cygwin*) SETUID="no" ;;
+ darwin*) SETUID="no" ;;
+ *)
+ case $host_cpu in
+ sparc) SETUID="no" ;;
+ *) SETUID="yes" ;;
+ esac
+ esac
+ if test "x$SETUID" = xyes; then
+ touch testfile
+ chown root testfile > /dev/null 2>&1 || SETUID="no"
+ rm -f testfile
+ fi
+fi
+AC_MSG_RESULT([$SETUID])
+AM_CONDITIONAL(INSTALL_SETUID, [test "x$SETUID" = "xyes"])
+
+dnl Issue an error if xtrans.m4 was not found and XTRANS_CONNECTION_FLAGS macro
+dnl was not expanded, since xorg-server with no transport types is rather useless.
+dnl
+dnl If you're seeing an error here, be sure you installed the lib/xtrans module
+dnl first and if it's not in the default location, that you set the ACLOCAL
+dnl environment variable to find it, such as:
+dnl ACLOCAL="aclocal -I ${PREFIX}/share/aclocal"
+m4_pattern_forbid([^XTRANS_CONNECTION_FLAGS$])
+
+# Transport selection macro from xtrans.m4
+XTRANS_CONNECTION_FLAGS
+
+# Secure RPC detection macro from xtrans.m4
+XTRANS_SECURE_RPC_FLAGS
+AM_CONDITIONAL(SECURE_RPC, [test "x$SECURE_RPC" = xyes])
+
+AM_CONDITIONAL(INT10_VM86, [test "x$INT10" = xvm86])
+AM_CONDITIONAL(INT10_X86EMU, [test "x$INT10" = xx86emu])
+AM_CONDITIONAL(INT10_STUB, [test "x$INT10" = xstub])
+if test "x$INT10" = xyes; then
+ dnl VM86 headers
+ AC_CHECK_HEADERS([sys/vm86.h sys/io.h])
+fi
+
+XORG_ENABLE_DOCS
+XORG_ENABLE_DEVEL_DOCS
+XORG_WITH_XMLTO(0.0.20)
+XORG_WITH_FOP
+
+dnl Handle installing libxf86config
+AM_CONDITIONAL(INSTALL_LIBXF86CONFIG, [test "x$INSTALL_LIBXF86CONFIG" = xyes])
+
+dnl DDX Detection... Yes, it's ugly to have it here... but we need to
+dnl handle this early on so that we don't require unsupported extensions
+case $host_os in
+ cygwin*)
+ DGA=no
+ DRI2=no
+ XF86VIDMODE=no
+ XSELINUX=no
+ XV=no
+ ;;
+ darwin*)
+ DRI2=no
+
+ if test x$XQUARTZ = xauto; then
+ AC_CACHE_CHECK([whether to build Xquartz],xorg_cv_Carbon_framework,[
+ save_LDFLAGS=$LDFLAGS
+ LDFLAGS="$LDFLAGS -framework Carbon"
+ AC_LINK_IFELSE([char FSFindFolder(); int main() { FSFindFolder(); return 0;}],
+ [xorg_cv_Carbon_framework=yes],
+ [xorg_cv_Carbon_framework=no])
+ LDFLAGS=$save_LDFLAGS])
+
+ if test "X$xorg_cv_Carbon_framework" = Xyes; then
+ XQUARTZ=yes
+ else
+ XQUARTZ=no
+ fi
+ fi
+
+ if test "x$XQUARTZ" = xyes ; then
+ XQUARTZ=yes
+ XVFB=no
+ XNEST=no
+
+ COMPOSITE=no
+ DGA=no
+ DPMSExtension=no
+ XF86VIDMODE=no
+ fi
+ ;;
+ *) XQUARTZ=no ;;
+esac
+
+dnl ---------------------------------------------------------------------------
+dnl Extension section
+dnl ---------------------------------------------------------------------------
+XEXT_INC='-I$(top_srcdir)/Xext'
+XEXT_LIB='$(top_builddir)/Xext/libXext.la'
+XEXTXORG_LIB='$(top_builddir)/Xext/libXextbuiltin.la'
+
+dnl Optional modules
+VIDEOPROTO="videoproto"
+COMPOSITEPROTO="compositeproto >= 0.4"
+RECORDPROTO="recordproto >= 1.13.99.1"
+SCRNSAVERPROTO="scrnsaverproto >= 1.1"
+RESOURCEPROTO="resourceproto"
+DRIPROTO="xf86driproto >= 2.1.0"
+DRI2PROTO="dri2proto >= 2.3"
+XINERAMAPROTO="xineramaproto"
+BIGFONTPROTO="xf86bigfontproto >= 1.2.0"
+XCALIBRATEPROTO="xcalibrateproto"
+DGAPROTO="xf86dgaproto >= 2.0.99.1"
+GLPROTO="glproto >= 1.4.10"
+DMXPROTO="dmxproto >= 2.2.99.1"
+VIDMODEPROTO="xf86vidmodeproto >= 2.2.99.1"
+WINDOWSWMPROTO="windowswmproto"
+APPLEWMPROTO="applewmproto >= 1.4"
+
+dnl Core modules for most extensions, et al.
+SDK_REQUIRED_MODULES="[xproto >= 7.0.17] [randrproto >= 1.2.99.3] [renderproto >= 0.11] [xextproto >= 7.1.99] [inputproto >= 1.9.99.902] [kbproto >= 1.0.3] fontsproto"
+# Make SDK_REQUIRED_MODULES available for inclusion in xorg-server.pc
+AC_SUBST(SDK_REQUIRED_MODULES)
+
+dnl List of libraries that require a specific version
+LIBAPPLEWM="applewm >= 1.4"
+LIBDMX="dmx >= 1.0.99.1"
+LIBDRI="dri >= 7.8.0"
+LIBDRM="libdrm >= 2.3.0"
+LIBGL="gl >= 7.1.0"
+LIBXEXT="xext >= 1.0.99.4"
+LIBXFONT="xfont >= 1.4.2"
+LIBXI="xi >= 1.2.99.1"
+LIBXTST="xtst >= 1.0.99.2"
+LIBPCIACCESS="pciaccess >= 0.8.0"
+LIBGLIB="glib-2.0 >= 2.16"
+LIBUDEV="libudev >= 143"
+LIBSELINUX="libselinux >= 2.0.86"
+LIBDBUS="dbus-1 >= 1.0"
+LIBPIXMAN="pixman-1 >= 0.15.20"
+
+dnl Pixman is always required, but we separate it out so we can link
+dnl specific modules against it
+PKG_CHECK_MODULES(PIXMAN, $LIBPIXMAN)
+REQUIRED_LIBS="$REQUIRED_LIBS $LIBPIXMAN $LIBXFONT xau"
+
+REQUIRED_MODULES="[fixesproto >= 4.1] [damageproto >= 1.1] [xcmiscproto >= 1.2.0] [xtrans >= 1.2.2] [bigreqsproto >= 1.1.0] $SDK_REQUIRED_MODULES"
+
+if test "x$CONFIG_UDEV" = xyes &&
+ { test "x$CONFIG_DBUS_API" = xyes || test "x$CONFIG_HAL" = xyes; }; then
+ AC_MSG_ERROR([Hotplugging through both libudev and dbus/hal not allowed])
+fi
+
+PKG_CHECK_MODULES(UDEV, $LIBUDEV, [HAVE_LIBUDEV=yes], [HAVE_LIBUDEV=no])
+if test "x$CONFIG_UDEV" = xauto; then
+ CONFIG_UDEV="$HAVE_LIBUDEV"
+fi
+AM_CONDITIONAL(CONFIG_UDEV, [test "x$CONFIG_UDEV" = xyes])
+if test "x$CONFIG_UDEV" = xyes; then
+ CONFIG_DBUS_API=no
+ CONFIG_HAL=no
+ if ! test "x$HAVE_LIBUDEV" = xyes; then
+ AC_MSG_ERROR([udev configuration API requested, but libudev is not installed])
+ fi
+ AC_DEFINE(CONFIG_UDEV, 1, [Use libudev for input hotplug])
+fi
+
+dnl HAVE_DBUS is true if we actually have the D-Bus library, whereas
+dnl CONFIG_DBUS_API is true if we want to enable the D-Bus config
+dnl API.
+PKG_CHECK_MODULES(DBUS, $LIBDBUS, [HAVE_DBUS=yes], [HAVE_DBUS=no])
+if test "x$HAVE_DBUS" = xyes; then
+ AC_DEFINE(HAVE_DBUS, 1, [Have D-Bus support])
+fi
+AM_CONDITIONAL(HAVE_DBUS, [test "x$HAVE_DBUS" = xyes])
+
+if test "x$CONFIG_DBUS_API" = xauto; then
+ CONFIG_DBUS_API="$HAVE_DBUS"
+fi
+if test "x$CONFIG_DBUS_API" = xyes; then
+ if ! test "x$HAVE_DBUS" = xyes; then
+ AC_MSG_ERROR([D-Bus configuration API requested, but D-Bus is not installed.])
+ fi
+
+ AC_DEFINE(CONFIG_DBUS_API, 1, [Use the D-Bus input configuration API])
+ CONFIG_NEED_DBUS="yes"
+fi
+AM_CONDITIONAL(CONFIG_DBUS_API, [test "x$CONFIG_DBUS_API" = xyes])
+
+PKG_CHECK_MODULES(HAL, hal, [HAVE_HAL=yes], [HAVE_HAL=no])
+if test "x$CONFIG_HAL" = xauto; then
+ CONFIG_HAL="$HAVE_HAL"
+fi
+if test "x$CONFIG_HAL" = xyes; then
+ if ! test "x$HAVE_HAL" = xyes; then
+ AC_MSG_ERROR([HAL hotplug API requested, but HAL is not installed.])
+ fi
+
+ AC_DEFINE(CONFIG_HAL, 1, [Use the HAL hotplug API])
+ CONFIG_NEED_DBUS="yes"
+fi
+AM_CONDITIONAL(CONFIG_HAL, [test "x$CONFIG_HAL" = xyes])
+
+if test "x$CONFIG_NEED_DBUS" = xyes; then
+ AC_DEFINE(CONFIG_NEED_DBUS, 1, [Use D-Bus for input hotplug])
+fi
+AM_CONDITIONAL(CONFIG_NEED_DBUS, [test "x$CONFIG_NEED_DBUS" = xyes])
+
+if test "x$USE_SIGIO_BY_DEFAULT" = xyes; then
+ USE_SIGIO_BY_DEFAULT_VALUE=TRUE
+else
+ USE_SIGIO_BY_DEFAULT_VALUE=FALSE
+fi
+AC_DEFINE_UNQUOTED([USE_SIGIO_BY_DEFAULT], [$USE_SIGIO_BY_DEFAULT_VALUE],
+ [Use SIGIO handlers for input device events by default])
+
+AC_MSG_CHECKING([for glibc...])
+AC_PREPROC_IFELSE([
+#include <features.h>
+#ifndef __GLIBC__
+#error
+#endif
+], glibc=yes, glibc=no)
+AC_MSG_RESULT([$glibc])
+
+AC_CHECK_FUNCS([clock_gettime], [have_clock_gettime=yes],
+ [AC_CHECK_LIB([rt], [clock_gettime], [have_clock_gettime=-lrt],
+ [have_clock_gettime=no])])
+
+AC_MSG_CHECKING([for a useful monotonic clock ...])
+
+if ! test "x$have_clock_gettime" = xno; then
+ if ! test "x$have_clock_gettime" = xyes; then
+ CLOCK_LIBS="$have_clock_gettime"
+ else
+ CLOCK_LIBS=""
+ fi
+
+ LIBS_SAVE="$LIBS"
+ LIBS="$CLOCK_LIBS"
+ CPPFLAGS_SAVE="$CPPFLAGS"
+
+ if test x"$glibc" = xyes; then
+ CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L"
+ fi
+
+ AC_RUN_IFELSE([
+#include <time.h>
+
+int main(int argc, char *argv[[]]) {
+ struct timespec tp;
+
+ if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
+ return 0;
+ else
+ return 1;
+}
+ ], [MONOTONIC_CLOCK=yes], [MONOTONIC_CLOCK=no],
+ [MONOTONIC_CLOCK="cross compiling"])
+
+ LIBS="$LIBS_SAVE"
+ CPPFLAGS="$CPPFLAGS_SAVE"
+else
+ MONOTONIC_CLOCK=no
+fi
+
+AC_MSG_RESULT([$MONOTONIC_CLOCK])
+
+if test "x$MONOTONIC_CLOCK" = xyes; then
+ AC_DEFINE(MONOTONIC_CLOCK, 1, [Have monotonic clock from clock_gettime()])
+ LIBS="$LIBS $CLOCK_LIBS"
+fi
+
+AM_CONDITIONAL(XV, [test "x$XV" = xyes])
+if test "x$XV" = xyes; then
+ AC_DEFINE(XV, 1, [Support Xv extension])
+ AC_DEFINE(XvExtension, 1, [Build Xv extension])
+ REQUIRED_MODULES="$REQUIRED_MODULES $VIDEOPROTO"
+ SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $VIDEOPROTO"
+else
+ XVMC=no
+fi
+
+AM_CONDITIONAL(XVMC, [test "x$XVMC" = xyes])
+if test "x$XVMC" = xyes; then
+ AC_DEFINE(XvMCExtension, 1, [Build XvMC extension])
+fi
+
+AM_CONDITIONAL(XREGISTRY, [test "x$XREGISTRY" = xyes])
+if test "x$XREGISTRY" = xyes; then
+ AC_DEFINE(XREGISTRY, 1, [Build registry module])
+fi
+
+AM_CONDITIONAL(COMPOSITE, [test "x$COMPOSITE" = xyes])
+if test "x$COMPOSITE" = xyes; then
+ AC_DEFINE(COMPOSITE, 1, [Support Composite Extension])
+ REQUIRED_MODULES="$REQUIRED_MODULES $COMPOSITEPROTO"
+ COMPOSITE_LIB='$(top_builddir)/composite/libcomposite.la'
+ COMPOSITE_INC='-I$(top_srcdir)/composite'
+fi
+
+AM_CONDITIONAL(MITSHM, [test "x$MITSHM" = xyes])
+if test "x$MITSHM" = xyes; then
+ AC_DEFINE(MITSHM, 1, [Support MIT-SHM extension])
+ AC_DEFINE(HAS_SHM, 1, [Support SHM])
+fi
+
+AM_CONDITIONAL(RECORD, [test "x$RECORD" = xyes])
+if test "x$RECORD" = xyes; then
+ AC_DEFINE(XRECORD, 1, [Support Record extension])
+ REQUIRED_MODULES="$REQUIRED_MODULES $RECORDPROTO"
+ RECORD_LIB='$(top_builddir)/record/librecord.la'
+fi
+
+AM_CONDITIONAL(SCREENSAVER, [test "x$SCREENSAVER" = xyes])
+if test "x$SCREENSAVER" = xyes; then
+ AC_DEFINE(SCREENSAVER, 1, [Support MIT-SCREEN-SAVER extension])
+ REQUIRED_MODULES="$REQUIRED_MODULES $SCRNSAVERPROTO"
+fi
+
+AM_CONDITIONAL(RES, [test "x$RES" = xyes])
+if test "x$RES" = xyes; then
+ AC_DEFINE(RES, 1, [Support X resource extension])
+ REQUIRED_MODULES="$REQUIRED_MODULES $RESOURCEPROTO"
+fi
+
+if test "x$GLX" = xyes; then
+ PKG_CHECK_MODULES([XLIB], [x11])
+ PKG_CHECK_MODULES([GL], $GLPROTO $LIBGL)
+ AC_SUBST(XLIB_CFLAGS)
+ AC_DEFINE(GLXEXT, 1, [Build GLX extension])
+ GLX_LIBS='$(top_builddir)/glx/libglx.la'
+ GLX_SYS_LIBS="$GLX_SYS_LIBS"
+else
+ GLX=no
+fi
+AM_CONDITIONAL(GLX, test "x$GLX" = xyes)
+
+if test "x$AIGLX" = xyes -a "x$GLX" = xyes -a "x$DRI" = xyes; then
+ AC_DEFINE(AIGLX, 1, [Build AIGLX loader])
+else
+ AIGLX=no
+fi
+AM_CONDITIONAL(AIGLX, test "x$AIGLX" = xyes)
+
+if test "x$GLX_USE_TLS" = xyes ; then
+ GLX_DEFINES="-DGLX_USE_TLS -DPTHREADS"
+ GLX_SYS_LIBS="$GLX_SYS_LIBS -lpthread"
+fi
+AC_SUBST([GLX_DEFINES])
+
+AM_CONDITIONAL(DRI, test "x$DRI" = xyes)
+if test "x$DRI" = xyes; then
+ AC_DEFINE(XF86DRI, 1, [Build DRI extension])
+ PKG_CHECK_MODULES([DRIPROTO], [$DRIPROTO])
+ PKG_CHECK_MODULES([DRI], $GLPROTO $LIBDRI)
+ AC_SUBST(DRIPROTO_CFLAGS)
+fi
+
+PKG_CHECK_MODULES([DRI2PROTO], $DRI2PROTO,
+ [HAVE_DRI2PROTO=yes], [HAVE_DRI2PROTO=no])
+case "$DRI2,$HAVE_DRI2PROTO" in
+ yes,no)
+ AC_MSG_ERROR([DRI2 requested, but dri2proto not found.])
+ ;;
+ yes,yes | auto,yes)
+ AC_DEFINE(DRI2, 1, [Build DRI2 extension])
+ DRI2=yes
+ SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $DRI2PROTO"
+ ;;
+esac
+AM_CONDITIONAL(DRI2, test "x$DRI2" = xyes)
+
+if test "x$DRI" = xyes || test "x$DRI2" = xyes; then
+ if test "x$DRM" = xyes; then
+ AC_DEFINE(WITH_LIBDRM, 1, [Building with libdrm support])
+ PKG_CHECK_MODULES([LIBDRM], $LIBDRM)
+ fi
+fi
+
+if test "x$DRI2" = xyes; then
+ save_CFLAGS=$CFLAGS
+ CFLAGS="$GL_CFLAGS $LIBDRM_CFLAGS"
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <GL/gl.h>
+#include <GL/internal/dri_interface.h>
+#ifndef __DRI_DRI2
+#error DRI2 extension not available.
+#endif]])],
+ [HAVE_DRI2EXTENSION=yes],
+ [HAVE_DRI2EXTENSION=no])
+ CFLAGS=$save_CFLAGS
+ if test "x$HAVE_DRI2EXTENSION" = xyes; then
+ AC_DEFINE(DRI2_AIGLX, 1, [Build DRI2 AIGLX loader])
+ DRI2_AIGLX=yes
+ else
+ AC_MSG_NOTICE([DRI2 AIGLX disabled, __DRI_DRI2 not defined in dri_interface.h.])
+ DRI2_AIGLX=no
+ fi
+fi
+AM_CONDITIONAL(DRI2_AIGLX, test "x$DRI2_AIGLX" = xyes)
+
+
+AM_CONDITIONAL(XINERAMA, [test "x$XINERAMA" = xyes])
+if test "x$XINERAMA" = xyes; then
+ AC_DEFINE(XINERAMA, 1, [Support Xinerama extension])
+ AC_DEFINE(PANORAMIX, 1, [Internal define for Xinerama])
+ REQUIRED_MODULES="$REQUIRED_MODULES $XINERAMAPROTO"
+ SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $XINERAMAPROTO"
+fi
+
+AM_CONDITIONAL(XACE, [test "x$XACE" = xyes])
+if test "x$XACE" = xyes; then
+ AC_DEFINE(XACE, 1, [Build X-ACE extension])
+fi
+
+AM_CONDITIONAL(XSELINUX, [test "x$XSELINUX" = xyes])
+if test "x$XSELINUX" = xyes; then
+ if test "x$XACE" != xyes; then
+ AC_MSG_ERROR([cannot build SELinux extension without X-ACE])
+ fi
+ AC_CHECK_HEADERS([libaudit.h], [], AC_MSG_ERROR([SELinux extension requires audit system headers]))
+ AC_CHECK_LIB(audit, audit_open, [], AC_MSG_ERROR([SELinux extension requires audit system library]))
+ PKG_CHECK_MODULES([SELINUX], $LIBSELINUX)
+ SELINUX_LIBS="$SELINUX_LIBS -laudit"
+ AC_DEFINE(XSELINUX, 1, [Build SELinux extension])
+fi
+
+AM_CONDITIONAL(XCSECURITY, [test "x$XCSECURITY" = xyes])
+if test "x$XCSECURITY" = xyes; then
+ if test "x$XACE" != xyes; then
+ AC_MSG_ERROR([cannot build Security extension without X-ACE])
+ fi
+ AC_DEFINE(XCSECURITY, 1, [Build Security extension])
+fi
+
+AM_CONDITIONAL(DBE, [test "x$DBE" = xyes])
+if test "x$DBE" = xyes; then
+ AC_DEFINE(DBE, 1, [Support DBE extension])
+ DBE_LIB='$(top_builddir)/dbe/libdbe.la'
+fi
+
+AM_CONDITIONAL(XF86BIGFONT, [test "x$XF86BIGFONT" = xyes])
+if test "x$XF86BIGFONT" = xyes; then
+ AC_DEFINE(XF86BIGFONT, 1, [Support XF86 Big font extension])
+ REQUIRED_MODULES="$REQUIRED_MODULES $BIGFONTPROTO"
+fi
+
+AM_CONDITIONAL(DPMSExtension, [test "x$DPMSExtension" = xyes])
+if test "x$DPMSExtension" = xyes; then
+ AC_DEFINE(DPMSExtension, 1, [Support DPMS extension])
+fi
+
+if test "x$XCALIBRATE" = xyes && test "$KDRIVE" = yes; then
+ AC_DEFINE(XCALIBRATE, 1, [Build XCalibrate extension])
+ REQUIRED_MODULES="$REQUIRED_MODULES $XCALIBRATEPROTO"
+else
+ XCALIBRATE=no
+fi
+AM_CONDITIONAL(XCALIBRATE, [test "x$XCALIBRATE" = xyes])
+
+AC_DEFINE(RENDER, 1, [Support RENDER extension])
+RENDER_LIB='$(top_builddir)/render/librender.la'
+RENDER_INC='-I$(top_srcdir)/render'
+
+AC_DEFINE(RANDR, 1, [Support RANDR extension])
+RANDR_LIB='$(top_builddir)/randr/librandr.la'
+RANDR_INC='-I$(top_srcdir)/randr'
+
+AC_DEFINE(XFIXES,1,[Support XFixes extension])
+FIXES_LIB='$(top_builddir)/xfixes/libxfixes.la'
+FIXES_INC='-I$(top_srcdir)/xfixes'
+
+AC_DEFINE(DAMAGE,1,[Support Damage extension])
+DAMAGE_LIB='$(top_builddir)/damageext/libdamageext.la'
+DAMAGE_INC='-I$(top_srcdir)/damageext'
+MIEXT_DAMAGE_LIB='$(top_builddir)/miext/damage/libdamage.la'
+MIEXT_DAMAGE_INC='-I$(top_srcdir)/miext/damage'
+
+# XINPUT extension is integral part of the server
+AC_DEFINE(XINPUT, 1, [Support X Input extension])
+XI_LIB='$(top_builddir)/Xi/libXi.la'
+XI_INC='-I$(top_srcdir)/Xi'
+
+AM_CONDITIONAL(XF86UTILS, test "x$XF86UTILS" = xyes)
+AM_CONDITIONAL(XAA, test "x$XAA" = xyes)
+AM_CONDITIONAL(VGAHW, test "x$VGAHW" = xyes)
+AM_CONDITIONAL(VBE, test "x$VBE" = xyes)
+AM_CONDITIONAL(INT10MODULE, test "x$INT10MODULE" = xyes)
+
+AC_DEFINE(SHAPE, 1, [Support SHAPE extension])
+
+AC_DEFINE_DIR(XKB_BASE_DIRECTORY, XKBPATH, [Path to XKB data])
+AC_ARG_WITH(xkb-bin-directory,
+ AS_HELP_STRING([--with-xkb-bin-directory=DIR], [Directory containing xkbcomp program]),
+ [XKB_BIN_DIRECTORY="$withval"],
+ [XKB_BIN_DIRECTORY="$bindir"])
+
+AC_DEFINE_DIR(XKB_BIN_DIRECTORY, XKB_BIN_DIRECTORY, [Path to XKB bin dir])
+
+dnl Make sure XKM_OUTPUT_DIR is an absolute path
+XKBOUTPUT_FIRSTCHAR=`echo $XKBOUTPUT | cut -b 1`
+if [[ x$XKBOUTPUT_FIRSTCHAR != x/ -a x$XKBOUTPUT_FIRSTCHAR != 'x$' ]] ; then
+ XKBOUTPUT="$XKB_BASE_DIRECTORY/$XKBOUTPUT"
+fi
+
+dnl XKM_OUTPUT_DIR (used in code) must end in / or file names get hosed
+dnl XKB_COMPILED_DIR (used in Makefiles) must not or install-sh gets confused
+
+XKBOUTPUT=`echo $XKBOUTPUT/ | $SED 's|/*$|/|'`
+XKB_COMPILED_DIR=`echo $XKBOUTPUT | $SED 's|/*$||'`
+AC_DEFINE_DIR(XKM_OUTPUT_DIR, XKBOUTPUT, [Path to XKB output dir])
+AC_SUBST(XKB_COMPILED_DIR)
+
+if test "x$XKB_DFLT_RULES" = x; then
+ case $host_os in
+ linux*)
+ dnl doesn't take AutoAddDevices into account, but whatever.
+ if test "x$CONFIG_HAL" = xyes; then
+ XKB_DFLT_RULES="evdev"
+ else
+ XKB_DFLT_RULES="base"
+ fi
+ ;;
+ *)
+ XKB_DFLT_RULES="base"
+ ;;
+ esac
+fi
+AC_DEFINE_UNQUOTED(XKB_DFLT_RULES, ["$XKB_DFLT_RULES"], [Default XKB ruleset])
+AC_DEFINE_UNQUOTED(XKB_DFLT_MODEL, ["$XKB_DFLT_MODEL"], [Default XKB model])
+AC_DEFINE_UNQUOTED(XKB_DFLT_LAYOUT, ["$XKB_DFLT_LAYOUT"], [Default XKB layout])
+AC_DEFINE_UNQUOTED(XKB_DFLT_VARIANT, ["$XKB_DFLT_VARIANT"], [Default XKB variant])
+AC_DEFINE_UNQUOTED(XKB_DFLT_OPTIONS, ["$XKB_DFLT_OPTIONS"], [Default XKB options])
+
+XKB_LIB='$(top_builddir)/xkb/libxkb.la'
+XKB_STUB_LIB='$(top_builddir)/xkb/libxkbstubs.la'
+REQUIRED_MODULES="$REQUIRED_MODULES xkbfile"
+
+AC_CHECK_FUNC(strcasecmp, [], AC_DEFINE([NEED_STRCASECMP], 1,
+ [Do not have 'strcasecmp'.]))
+AC_CHECK_FUNC(strncasecmp, [], AC_DEFINE([NEED_STRNCASECMP], 1,
+ [Do not have 'strncasecmp'.]))
+AC_CHECK_FUNC(strcasestr, [], AC_DEFINE([NEED_STRCASESTR], 1,
+ [Do not have 'strcasestr'.]))
+
+PKG_CHECK_MODULES([XDMCP], [xdmcp], [have_libxdmcp="yes"], [have_libxdmcp="no"])
+if test "x$have_libxdmcp" = xyes; then
+ AC_CHECK_LIB(Xdmcp, XdmcpWrap, [have_xdmcpwrap="yes"], [have_xdmcpwrap="no"], [$XDMCP_LIBS])
+fi
+if test "x$XDMCP" = xauto; then
+ if test "x$have_libxdmcp" = xyes; then
+ XDMCP=yes
+ else
+ XDMCP=no
+ fi
+fi
+if test "x$XDMAUTH" = xauto; then
+ if test "x$have_libxdmcp" = xyes && test "x$have_xdmcpwrap" = xyes; then
+ XDMAUTH=yes
+ else
+ XDMAUTH=no
+ fi
+fi
+
+AM_CONDITIONAL(XDMCP, [test "x$XDMCP" = xyes])
+if test "x$XDMCP" = xyes; then
+ AC_DEFINE(XDMCP, 1, [Support XDM Control Protocol])
+ REQUIRED_LIBS="$REQUIRED_LIBS xdmcp"
+ XDMCP_MODULES="xdmcp"
+fi
+
+AM_CONDITIONAL(XDMAUTH, [test "x$XDMAUTH" = xyes])
+if test "x$XDMAUTH" = xyes; then
+ AC_DEFINE(HASXDMAUTH,1,[Support XDM-AUTH*-1])
+ if ! test "x$XDMCP" = xyes; then
+ REQUIRED_LIBS="$REQUIRED_LIBS xdmcp"
+ XDMCP_MODULES="xdmcp"
+ fi
+fi
+
+AC_DEFINE_DIR(COMPILEDDEFAULTFONTPATH, FONTPATH, [Default font path])
+AC_DEFINE_DIR(PCI_TXT_IDS_PATH, PCI_TXT_IDS_DIR, [Default PCI text file ID path])
+AC_DEFINE_DIR(SERVER_MISC_CONFIG_PATH, SERVERCONFIG, [Server miscellaneous config path])
+AC_DEFINE_DIR(BASE_FONT_PATH, FONTROOTDIR, [Default base font path])
+dridriverdir=`$PKG_CONFIG --variable=dridriverdir dri`
+AC_DEFINE_DIR(DRI_DRIVER_PATH, dridriverdir, [Default DRI driver path])
+AC_DEFINE_UNQUOTED(XVENDORNAME, ["$VENDOR_NAME"], [Vendor name])
+AC_DEFINE_UNQUOTED(XVENDORNAMESHORT, ["$VENDOR_NAME_SHORT"], [Short vendor name])
+AC_DEFINE_UNQUOTED(XORG_DATE, ["$RELEASE_DATE"], [Vendor release])
+AC_DEFINE_UNQUOTED(XORG_MAN_VERSION, ["$VENDOR_MAN_VERSION"], [Vendor man version])
+AC_DEFINE_UNQUOTED(BUILDERADDR, ["$BUILDERADDR"], [Builder address])
+
+if test -z "$OSNAME"; then
+ OSNAME="UNKNOWN"
+fi
+
+AC_DEFINE_UNQUOTED(OSNAME, ["$OSNAME"], [Operating System Name])
+AC_DEFINE_UNQUOTED(OSVENDOR, ["$OSVENDOR"], [Operating System Vendor])
+AC_DEFINE_UNQUOTED(BUILDERSTRING, ["$BUILDERSTRING"], [Builder string])
+
+AC_SUBST([VENDOR_NAME_SHORT])
+AC_DEFINE_UNQUOTED(VENDOR_NAME, ["$VENDOR_NAME"], [Vendor name])
+AC_DEFINE_UNQUOTED(VENDOR_NAME_SHORT, ["$VENDOR_NAME_SHORT"], [Vendor name])
+AC_DEFINE_UNQUOTED(VENDOR_RELEASE, [$VENDOR_RELEASE], [Vendor release])
+AC_DEFINE_UNQUOTED(VENDOR_MAN_VERSION, ["$VENDOR_MAN_VERSION"], [Vendor man version])
+
+AC_DEFINE(NO_LIBCWRAPPER, 1, [Define to 1 if modules should avoid the libcwrapper])
+
+if test "x$DEBUGGING" = xyes; then
+ AC_DEFINE(DEBUG, 1, [Enable debugging code])
+fi
+AM_CONDITIONAL(DEBUG, [test "x$DEBUGGING" = xyes])
+
+# If unittests aren't explicitly disabled, check for required support
+if test "x$UNITTESTS" != xno ; then
+ PKG_CHECK_MODULES([GLIB], $LIBGLIB,
+ [HAVE_GLIB=yes], [HAVE_GLIB=no])
+
+ # Check if linker supports -wrap, passed via compiler flags
+ # When cross-compiling, reports no, since unit tests run from
+ # "make check", so would be running on build machine, not target
+ AC_MSG_CHECKING([whether the linker supports -wrap])
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -Wl,-wrap,exit"
+ AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+ void __wrap_exit (int s)
+ {
+ __real_exit (0);
+ }]],
+ [[exit (1);]])],
+ [linker_can_wrap="yes"],
+ [linker_can_wrap="no"],
+ [linker_can_wrap="no"])
+ AC_MSG_RESULT([$linker_can_wrap])
+ LDFLAGS="$save_LDFLAGS"
+fi
+
+if test "x$UNITTESTS" = xauto; then
+ if test "x$HAVE_GLIB" = xyes && test "x$linker_can_wrap" = xyes; then
+ UNITTESTS=yes
+ else
+ UNITTESTS=no
+ fi
+fi
+if test "x$UNITTESTS" = xyes; then
+ if test "x$HAVE_GLIB" = xno; then
+ AC_MSG_ERROR([glib required to build unit tests])
+ fi
+ if test "x$linker_can_wrap" = xno; then
+ AC_MSG_ERROR([ld -wrap support required to build unit tests])
+ fi
+ AC_DEFINE(UNITTESTS, 1, [Enable unit tests])
+ AC_SUBST([GLIB_LIBS])
+ AC_SUBST([GLIB_CFLAGS])
+fi
+AM_CONDITIONAL(UNITTESTS, [test "x$UNITTESTS" = xyes])
+
+AC_DEFINE(XTEST, 1, [Support XTest extension])
+AC_DEFINE(XSYNC, 1, [Support XSync extension])
+AC_DEFINE(XCMISC, 1, [Support XCMisc extension])
+AC_DEFINE(BIGREQS, 1, [Support BigRequests extension])
+
+if test "x$SPECIAL_DTRACE_OBJECTS" = "xyes" ; then
+ DIX_LIB='$(top_builddir)/dix/dix.O'
+ OS_LIB='$(top_builddir)/os/os.O $(SHA1_LIBS) $(DLOPEN_LIBS)'
+else
+ DIX_LIB='$(top_builddir)/dix/libdix.la'
+ OS_LIB='$(top_builddir)/os/libos.la'
+fi
+AC_SUBST([DIX_LIB])
+AC_SUBST([OS_LIB])
+
+MAIN_LIB='$(top_builddir)/dix/libmain.la'
+AC_SUBST([MAIN_LIB])
+
+MI_LIB='$(top_builddir)/mi/libmi.la'
+MI_EXT_LIB='$(top_builddir)/mi/libmiext.la'
+MI_INC='-I$(top_srcdir)/mi'
+FB_LIB='$(top_builddir)/fb/libfb.la'
+FB_INC='-I$(top_srcdir)/fb'
+MIEXT_SHADOW_INC='-I$(top_srcdir)/miext/shadow'
+MIEXT_SHADOW_LIB='$(top_builddir)/miext/shadow/libshadow.la'
+MIEXT_SYNC_INC='-I$(top_srcdir)/miext/sync'
+MIEXT_SYNC_LIB='$(top_builddir)/miext/sync/libsync.la'
+CORE_INCS='-I$(top_srcdir)/include -I$(top_builddir)/include'
+
+# SHA1 hashing
+AC_ARG_WITH([sha1],
+ [AS_HELP_STRING([--with-sha1=libc|libmd|libgcrypt|libcrypto|libsha1|CommonCrypto],
+ [choose SHA1 implementation])])
+AC_CHECK_FUNC([SHA1Init], [HAVE_SHA1_IN_LIBC=yes])
+if test "x$with_sha1" = x && test "x$HAVE_SHA1_IN_LIBC" = xyes; then
+ with_sha1=libc
+fi
+if test "x$with_sha1" = xlibc && test "x$HAVE_SHA1_IN_LIBC" != xyes; then
+ AC_MSG_ERROR([libc requested but not found])
+fi
+if test "x$with_sha1" = xlibc; then
+ AC_DEFINE([HAVE_SHA1_IN_LIBC], [1],
+ [Use libc SHA1 functions])
+ SHA1_LIBS=""
+fi
+AC_CHECK_FUNC([CC_SHA1_Init], [HAVE_SHA1_IN_COMMONCRYPTO=yes])
+if test "x$with_sha1" = x && test "x$HAVE_SHA1_IN_COMMONCRYPTO" = xyes; then
+ with_sha1=CommonCrypto
+fi
+if test "x$with_sha1" = xCommonCrypto && test "x$HAVE_SHA1_IN_COMMONCRYPTO" != xyes; then
+ AC_MSG_ERROR([CommonCrypto requested but not found])
+fi
+if test "x$with_sha1" = xCommonCrypto; then
+ AC_DEFINE([HAVE_SHA1_IN_COMMONCRYPTO], [1],
+ [Use CommonCrypto SHA1 functions])
+ SHA1_LIBS=""
+fi
+AC_CHECK_LIB([md], [SHA1Init], [HAVE_LIBMD=yes])
+if test "x$with_sha1" = x && test "x$HAVE_LIBMD" = xyes; then
+ with_sha1=libmd
+fi
+if test "x$with_sha1" = xlibmd && test "x$HAVE_LIBMD" != xyes; then
+ AC_MSG_ERROR([libmd requested but not found])
+fi
+if test "x$with_sha1" = xlibmd; then
+ AC_DEFINE([HAVE_SHA1_IN_LIBMD], [1],
+ [Use libmd SHA1 functions])
+ SHA1_LIBS=-lmd
+fi
+PKG_CHECK_MODULES([LIBSHA1], [libsha1], [HAVE_LIBSHA1=yes], [HAVE_LIBSHA1=no])
+if test "x$with_sha1" = x && test "x$HAVE_LIBSHA1" = xyes; then
+ with_sha1=libsha1
+fi
+if test "x$with_sha1" = xlibsha1 && test "x$HAVE_LIBSHA1" != xyes; then
+ AC_MSG_ERROR([libsha1 requested but not found])
+fi
+if test "x$with_sha1" = xlibsha1; then
+ AC_DEFINE([HAVE_SHA1_IN_LIBSHA1], [1],
+ [Use libsha1 for SHA1])
+ SHA1_LIBS=-lsha1
+fi
+AC_CHECK_LIB([gcrypt], [gcry_md_open], [HAVE_LIBGCRYPT=yes])
+if test "x$with_sha1" = x && test "x$HAVE_LIBGCRYPT" = xyes; then
+ with_sha1=libgcrypt
+fi
+if test "x$with_sha1" = xlibgcrypt && test "x$HAVE_LIBGCRYPT" != xyes; then
+ AC_MSG_ERROR([libgcrypt requested but not found])
+fi
+if test "x$with_sha1" = xlibgcrypt; then
+ AC_DEFINE([HAVE_SHA1_IN_LIBGCRYPT], [1],
+ [Use libgcrypt SHA1 functions])
+ SHA1_LIBS=-lgcrypt
+fi
+# We don't need all of the OpenSSL libraries, just libcrypto
+AC_CHECK_LIB([crypto], [SHA1_Init], [HAVE_LIBCRYPTO=yes])
+PKG_CHECK_MODULES([OPENSSL], [openssl], [HAVE_OPENSSL_PKC=yes],
+ [HAVE_OPENSSL_PKC=no])
+if test "x$HAVE_LIBCRYPTO" = xyes || test "x$HAVE_OPENSSL_PKC" = xyes; then
+ if test "x$with_sha1" = x; then
+ with_sha1=libcrypto
+ fi
+else
+ if test "x$with_sha1" = xlibcrypto; then
+ AC_MSG_ERROR([OpenSSL libcrypto requested but not found])
+ fi
+fi
+if test "x$with_sha1" = xlibcrypto; then
+ if test "x$HAVE_LIBCRYPTO" = xyes; then
+ SHA1_LIBS=-lcrypto
+ else
+ SHA1_LIBS="$OPENSSL_LIBS"
+ SHA1_CFLAGS="$OPENSSL_CFLAGS"
+ fi
+fi
+AC_MSG_CHECKING([for SHA1 implementation])
+if test "x$with_sha1" = x; then
+ AC_MSG_ERROR([No suitable SHA1 implementation found])
+fi
+AC_MSG_RESULT([$with_sha1])
+AC_SUBST(SHA1_LIBS)
+AC_SUBST(SHA1_CFLAGS)
+
+PKG_CHECK_MODULES([XSERVERCFLAGS], [$REQUIRED_MODULES $REQUIRED_LIBS])
+PKG_CHECK_MODULES([XSERVERLIBS], [$REQUIRED_LIBS])
+
+# Autotools has some unfortunate issues with library handling. In order to
+# get a server to rebuild when a dependency in the tree is changed, it must
+# be listed in SERVERNAME_DEPENDENCIES. However, no system libraries may be
+# listed there, or some versions of autotools will break (especially if a -L
+# is required to find the library). So, we keep two sets of libraries
+# detected: NAMESPACE_LIBS for in-tree libraries to be linked against, which
+# will go into the _DEPENDENCIES and _LDADD of the server, and
+# NAMESPACE_SYS_LIBS which will go into only the _LDADD. The
+# NAMESPACEMODULES_LIBS detected from pkgconfig should always go in
+# NAMESPACE_SYS_LIBS.
+#
+# XSERVER_LIBS is the set of in-tree libraries which all servers require.
+# XSERVER_SYS_LIBS is the set of out-of-tree libraries which all servers
+# require.
+#
+XSERVER_CFLAGS="${XSERVER_CFLAGS} ${XSERVERCFLAGS_CFLAGS}"
+XSERVER_LIBS="$DIX_LIB $MI_LIB $OS_LIB"
+XSERVER_SYS_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} ${LIBS}"
+AC_SUBST([XSERVER_LIBS])
+AC_SUBST([XSERVER_SYS_LIBS])
+
+UTILS_SYS_LIBS="${SYS_LIBS}"
+AC_SUBST([UTILS_SYS_LIBS])
+
+# The Xorg binary needs to export symbols so that they can be used from modules
+# Some platforms require extra flags to do this. libtool should set the
+# necessary flags for each platform when -export-dynamic is passed to it.
+LD_EXPORT_SYMBOLS_FLAG="-export-dynamic"
+AC_SUBST([LD_EXPORT_SYMBOLS_FLAG])
+
+dnl Imake defines SVR4 on SVR4 systems, and many files check for it, so
+dnl we need to replicate that here until those can all be fixed
+AC_MSG_CHECKING([if SVR4 needs to be defined])
+AC_EGREP_CPP([I_AM_SVR4],[
+#if defined(SVR4) || defined(__svr4__) || defined(__SVR4)
+ I_AM_SVR4
+#endif
+],[
+AC_DEFINE([SVR4],1,[Define to 1 on systems derived from System V Release 4])
+AC_MSG_RESULT([yes])], AC_MSG_RESULT([no]))
+
+XSERVER_CFLAGS="$XSERVER_CFLAGS $CORE_INCS $XEXT_INC $COMPOSITE_INC $DAMAGE_INC $FIXES_INC $XI_INC $MI_INC $MIEXT_SYNC_INC $MIEXT_SHADOW_INC $MIEXT_LAYER_INC $MIEXT_DAMAGE_INC $RENDER_INC $RANDR_INC $FB_INC"
+
+dnl ---------------------------------------------------------------------------
+dnl DDX section.
+dnl ---------------------------------------------------------------------------
+
+dnl Xvfb DDX
+
+AC_MSG_CHECKING([whether to build Xvfb DDX])
+AC_MSG_RESULT([$XVFB])
+AM_CONDITIONAL(XVFB, [test "x$XVFB" = xyes])
+
+if test "x$XVFB" = xyes; then
+ XVFB_LIBS="$FB_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB"
+ XVFB_SYS_LIBS="$XVFBMODULES_LIBS $GLX_SYS_LIBS"
+ AC_SUBST([XVFB_LIBS])
+ AC_SUBST([XVFB_SYS_LIBS])
+fi
+
+
+dnl Xnest DDX
+
+PKG_CHECK_MODULES(XNESTMODULES, [$LIBXEXT x11 xau $XDMCP_MODULES], [have_xnest=yes], [have_xnest=no])
+AC_MSG_CHECKING([whether to build Xnest DDX])
+if test "x$XNEST" = xauto; then
+ XNEST="$have_xnest"
+fi
+AC_MSG_RESULT([$XNEST])
+AM_CONDITIONAL(XNEST, [test "x$XNEST" = xyes])
+
+if test "x$XNEST" = xyes; then
+ if test "x$have_xnest" = xno; then
+ AC_MSG_ERROR([Xnest build explicitly requested, but required modules not found.])
+ fi
+ XNEST_LIBS="$FB_LIB $FIXES_LIB $MI_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $DIX_LIB $MAIN_LIB $OS_LIB"
+ XNEST_SYS_LIBS="$XNESTMODULES_LIBS $GLX_SYS_LIBS"
+ AC_SUBST([XNEST_LIBS])
+ AC_SUBST([XNEST_SYS_LIBS])
+fi
+
+
+dnl Xorg DDX
+
+AC_MSG_CHECKING([whether to build Xorg DDX])
+if test "x$XORG" = xauto; then
+ XORG="yes"
+ case $host_os in
+ cygwin*) XORG="no" ;;
+ darwin*) XORG="no" ;;
+ esac
+fi
+AC_MSG_RESULT([$XORG])
+
+xorg_bus_linuxpci=no
+xorg_bus_bsdpci=no
+xorg_bus_sparc=no
+
+if test "x$XORG" = xyes; then
+ XORG_DDXINCS='-I$(top_srcdir)/hw/xfree86 -I$(top_srcdir)/hw/xfree86/include -I$(top_srcdir)/hw/xfree86/common'
+ XORG_OSINCS='-I$(top_srcdir)/hw/xfree86/os-support -I$(top_srcdir)/hw/xfree86/os-support/bus -I$(top_srcdir)/os'
+ XORG_INCS="$XORG_DDXINCS $XORG_OSINCS"
+ XORG_CFLAGS="$XORGSERVER_CFLAGS -DHAVE_XORG_CONFIG_H"
+ XORG_LIBS="$COMPOSITE_LIB $FIXES_LIB $XEXTXORG_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB"
+
+ dnl ==================================================================
+ dnl symbol visibility
+ symbol_visibility=
+ have_visibility=disabled
+ if test x$SYMBOL_VISIBILITY != xno; then
+ AC_MSG_CHECKING(for symbol visibility support)
+ if test x$GCC = xyes; then
+ VISIBILITY_CFLAGS="-fvisibility=hidden"
+ else
+ AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
+ if test x$SUNCC = xyes; then
+ VISIBILITY_CFLAGS="-xldscope=hidden"
+ else
+ have_visibility=no
+ fi
+ fi
+ if test x$have_visibility != xno; then
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $VISIBILITY_CFLAGS"
+ AC_TRY_COMPILE(
+ [#include <X11/Xfuncproto.h>
+ extern _X_HIDDEN int hidden_int;
+ extern _X_EXPORT int public_int;
+ extern _X_HIDDEN int hidden_int_func(void);
+ extern _X_EXPORT int public_int_func(void);],
+ [],
+ have_visibility=yes,
+ have_visibility=no)
+ CFLAGS=$save_CFLAGS
+ fi
+ AC_MSG_RESULT([$have_visibility])
+ if test x$have_visibility != xno; then
+ symbol_visibility=$VISIBILITY_CFLAGS
+ XORG_CFLAGS="$XORG_CFLAGS $VISIBILITY_CFLAGS"
+ XSERVER_CFLAGS="$XSERVER_CFLAGS $VISIBILITY_CFLAGS"
+ fi
+ fi
+ dnl added to xorg-server.pc
+ AC_SUBST([symbol_visibility])
+ dnl ===================================================================
+
+ PKG_CHECK_MODULES([PCIACCESS], $LIBPCIACCESS)
+ SAVE_LIBS=$LIBS
+ SAVE_CFLAGS=$CFLAGS
+ CFLAGS=$PCIACCESS_CFLAGS
+ LIBS=$PCIACCESS_LIBS
+ AC_CHECK_FUNCS([pci_system_init_dev_mem])
+ AC_CHECK_FUNCS([pci_device_enable])
+ AC_CHECK_FUNCS([pci_device_is_boot_vga])
+ AC_CHECK_FUNCS([pci_device_vgaarb_init])
+ LIBS=$SAVE_LIBS
+ CFLAGS=$SAVE_CFLAGS
+ XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $GLX_SYS_LIBS"
+ XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS"
+
+ case $host_os in
+ linux*)
+ if test "x$LNXAPM" = xyes; then
+ XORG_CFLAGS="$XORG_CFLAGS -DXF86PM"
+ fi
+ XORG_OS="linux"
+ XORG_OS_SUBDIR="linux"
+ xorg_bus_linuxpci="yes"
+ linux_acpi="no"
+ case $host_cpu in
+ ia64*)
+ linux_ia64=yes
+ linux_acpi="yes"
+ ;;
+ alpha*)
+ linux_alpha=yes
+ ;;
+ i*86|amd64*|x86_64*)
+ linux_acpi="yes"
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ freebsd* | kfreebsd*-gnu | dragonfly*)
+ XORG_OS="freebsd"
+ XORG_OS_SUBDIR="bsd"
+ xorg_bus_bsdpci="yes"
+ ;;
+ netbsd*)
+ XORG_OS="netbsd"
+ XORG_OS_SUBDIR="bsd"
+ xorg_bus_bsdpci="yes"
+ ;;
+ openbsd*)
+ if test "x$ac_cv_BSD_APM" = xyes \
+ -o "x$ac_cv_BSD_KQUEUE_APM" = xyes; then
+ XORG_CFLAGS="$XORG_CFLAGS -DXF86PM"
+ fi
+ XORG_OS="openbsd"
+ XORG_OS_SUBDIR="bsd"
+ xorg_bus_bsdpci="yes"
+ ;;
+ solaris*)
+ XORG_OS="solaris"
+ XORG_OS_SUBDIR="solaris"
+ XORG_CFLAGS="$XORG_CFLAGS -DXF86PM"
+ # Use the same stubs as BSD for old functions, since we now
+ # use libpciaccess for PCI
+ xorg_bus_bsdpci="yes"
+ AC_CHECK_HEADERS([sys/kd.h])
+ AC_CHECK_HEADERS([sys/vt.h], [solaris_vt=yes], [solaris_vt=no])
+ # Check for minimum supported release
+ AC_MSG_CHECKING([Solaris version])
+ OS_MINOR=`echo ${host_os}|$SED -e 's/^.*solaris2\.//' -e s'/\..*$//'`
+ if test "${OS_MINOR}" -ge 7 ; then
+ AC_MSG_RESULT(Solaris ${OS_MINOR})
+ else
+ AC_MSG_RESULT(Solaris `echo ${host_os}|$SED -e 's/^.*solaris//`)
+ fi
+ if test "${OS_MINOR}" -lt 8 ; then
+ AC_MSG_ERROR([This release no longer supports Solaris versions older than Solaris 8.])
+ fi
+ AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
+ if test "x$SUNCC" = "xyes"; then
+ solaris_asm_inline="yes"
+ fi
+ AC_CHECK_DECL([_LP64], [SOLARIS_64="yes"], [SOLARIS_64="no"])
+
+ case $host_cpu in
+ sparc*)
+ SOLARIS_INOUT_ARCH="sparcv8plus"
+ ;;
+ i*86)
+ if test x$SOLARIS_64 = xyes ; then
+ SOLARIS_INOUT_ARCH="amd64"
+ else
+ SOLARIS_INOUT_ARCH="ia32"
+ fi
+ ;;
+ *)
+ AC_MSG_ERROR([Unsupported Solaris platform. Only SPARC & x86 \
+ are supported on Solaris in this release. If you are \
+ interested in porting Xorg to your platform, please email \
+ xorg@lists.freedesktop.org.]) ;;
+ esac
+ AC_SUBST([SOLARIS_INOUT_ARCH])
+ if test x$solaris_asm_inline = xyes ; then
+ SOLARIS_ASM_CFLAGS='$(top_srcdir)/hw/xfree86/os-support/solaris/solaris-$(SOLARIS_INOUT_ARCH).il'
+ XORG_CFLAGS="${XORG_CFLAGS} "'$(SOLARIS_ASM_CFLAGS)'
+ fi
+ AC_SUBST([SOLARIS_ASM_CFLAGS])
+ if test "x$SUPPORT_PC98" = xauto; then
+ SUPPORT_PC98="no"
+ fi
+ ;;
+ gnu*)
+ XORG_OS="gnu"
+ XORG_OS_SUBDIR="hurd"
+ # Use the same stubs as BSD for old functions, since we now
+ # use libpciaccess for PCI
+ xorg_bus_bsdpci="yes"
+ ;;
+ *)
+ XORG_OS="unknown"
+ XORG_OS_SUBDIR="unknown"
+ AC_MSG_ERROR([m4_text_wrap(m4_join([ ],
+ [Your OS is unknown. Xorg currently only supports Linux,],
+ [Free/Open/Net/DragonFlyBSD, Solaris/OpenSolaris, & GNU Hurd.],
+ [If you are interested in porting Xorg to your platform,],
+ [please email xorg@lists.freedesktop.org.]))])
+ ;;
+ esac
+
+ case $host_cpu in
+ sparc*)
+ xorg_bus_sparc="yes"
+ ;;
+ i*86)
+ if test "x$SUPPORT_PC98" = xauto; then
+ SUPPORT_PC98="yes"
+ fi
+ ;;
+ esac
+
+ if test "x$SUPPORT_PC98" = xauto; then
+ SUPPORT_PC98="no"
+ fi
+ if test "x$SUPPORT_PC98" = xyes; then
+ AC_DEFINE(SUPPORT_PC98, 1, [Support PC98])
+ fi
+ if test "x$XORG_OS_PCI" = x ; then
+ XORG_OS_PCI=$XORG_OS
+ fi
+ if test "x$DGA" = xauto; then
+ PKG_CHECK_MODULES(DGA, $DGAPROTO, [DGA=yes], [DGA=no])
+ fi
+ if test "x$DGA" = xyes; then
+ XORG_MODULES="$XORG_MODULES $DGAPROTO"
+ PKG_CHECK_MODULES(DGA, $DGAPROTO)
+ AC_DEFINE(DGA, 1, [Support DGA extension])
+ AC_DEFINE(XFreeXDGA, 1, [Build XDGA support])
+ fi
+
+ if test "x$XF86VIDMODE" = xauto; then
+ PKG_CHECK_MODULES(XF86VIDMODE, $VIDMODEPROTO, [XF86VIDMODE=yes], [XF86VIDMODE=no])
+ fi
+ if test "x$XF86VIDMODE" = xyes; then
+ XORG_MODULES="$XORG_MODULES $VIDMODEPROTO"
+ PKG_CHECK_MODULES(XF86VIDMODE, $VIDMODEPROTO)
+ AC_DEFINE(XF86VIDMODE, 1, [Support XFree86 Video Mode extension])
+ fi
+
+ if test -n "$XORG_MODULES"; then
+ PKG_CHECK_MODULES(XORG_MODULES, [$XORG_MODULES])
+ XORG_CFLAGS="$XORG_CFLAGS $XORG_MODULES_CFLAGS"
+ XORG_SYS_LIBS="$XORG_SYS_LIBS $XORG_MODULES_LIBS"
+ fi
+
+ AC_SUBST([XORG_LIBS])
+ AC_SUBST([XORG_SYS_LIBS])
+ AC_SUBST([XORG_INCS])
+ AC_SUBST([XORG_OS])
+ AC_SUBST([XORG_OS_SUBDIR])
+
+ AC_PATH_PROG(PERL, perl, no)
+ dnl unlikely as this may be ...
+ if test "x$PERL" = xno; then
+ AC_MSG_ERROR([Perl is required to build the XFree86/Xorg DDX.])
+ fi
+ AC_SUBST(PERL)
+
+ AC_SUBST([XORG_CFLAGS])
+
+ dnl these only go in xorg-config.h
+ XF86CONFIGFILE="xorg.conf"
+ XF86CONFIGDIR="xorg.conf.d"
+ AC_SUBST(XF86CONFIGDIR)
+ CONFIGFILE="$sysconfdir/$XF86CONFIGFILE"
+ LOGPREFIX="$logdir/Xorg."
+ AC_DEFINE(XORG_SERVER, 1, [Building Xorg server])
+ AC_DEFINE(XORGSERVER, 1, [Building Xorg server])
+ AC_DEFINE(XFree86Server, 1, [Building XFree86 server])
+ AC_DEFINE(XFree86LOADER, 1, [Building loadable XFree86 server])
+ AC_DEFINE_UNQUOTED(XORG_VERSION_CURRENT, [$VENDOR_RELEASE], [Current Xorg version])
+ AC_DEFINE(NEED_XF86_TYPES, 1, [Need XFree86 typedefs])
+ AC_DEFINE(NEED_XF86_PROTOTYPES, 1, [Need XFree86 helper functions])
+ AC_DEFINE(__XSERVERNAME__, "Xorg", [Name of X server])
+ AC_DEFINE_DIR(__XCONFIGFILE__, XF86CONFIGFILE, [Name of configuration file])
+ AC_DEFINE_DIR(XF86CONFIGFILE, XF86CONFIGFILE, [Name of configuration file])
+ AC_DEFINE_DIR(__XCONFIGDIR__, XF86CONFIGDIR, [Name of configuration directory])
+ AC_DEFINE_DIR(DEFAULT_MODULE_PATH, moduledir, [Default module search path])
+ AC_DEFINE_DIR(DEFAULT_LIBRARY_PATH, libdir, [Default library install path])
+ AC_DEFINE_DIR(DEFAULT_LOGPREFIX, LOGPREFIX, [Default log location])
+ AC_DEFINE_UNQUOTED(__VENDORDWEBSUPPORT__, ["$VENDOR_WEB"], [Vendor web address for support])
+ AC_DEFINE(XSERVER_LIBPCIACCESS, 1, [Use libpciaccess for all pci manipulation])
+ if test "x$VGAHW" = xyes; then
+ AC_DEFINE(WITH_VGAHW, 1, [Building vgahw module])
+ fi
+
+ driverdir="$moduledir/drivers"
+ AC_SUBST([moduledir])
+ AC_SUBST([driverdir])
+ sdkdir="$includedir/xorg"
+ extdir="$includedir/X11/extensions"
+ sysconfigdir="$datadir/X11/$XF86CONFIGDIR"
+ AC_SUBST([sdkdir])
+ AC_SUBST([extdir])
+ AC_SUBST([sysconfigdir])
+ AC_SUBST([logdir])
+
+ # stuff the ABI versions into the pc file too
+ extract_abi() {
+ grep ^.define.*${1}_VERSION ${srcdir}/hw/xfree86/common/xf86Module.h | tr '(),' ' .' | awk '{ print $4$5 }'
+ }
+ abi_ansic=`extract_abi ANSIC`
+ abi_videodrv=`extract_abi VIDEODRV`
+ abi_xinput=`extract_abi XINPUT`
+ abi_extension=`extract_abi EXTENSION`
+ AC_SUBST([abi_ansic])
+ AC_SUBST([abi_videodrv])
+ AC_SUBST([abi_xinput])
+ AC_SUBST([abi_extension])
+fi
+AM_CONDITIONAL([XORG], [test "x$XORG" = xyes])
+AM_CONDITIONAL([XORG_BUS_LINUXPCI], [test "x$xorg_bus_linuxpci" = xyes])
+AM_CONDITIONAL([XORG_BUS_BSDPCI], [test "x$xorg_bus_bsdpci" = xyes])
+AM_CONDITIONAL([XORG_BUS_SPARC], [test "x$xorg_bus_sparc" = xyes])
+AM_CONDITIONAL([LINUX_IA64], [test "x$linux_ia64" = xyes])
+AM_CONDITIONAL([LINUX_ALPHA], [test "x$linux_alpha" = xyes])
+AM_CONDITIONAL([LNXACPI], [test "x$linux_acpi" = xyes])
+AM_CONDITIONAL([SOLARIS_ASM_INLINE], [test "x$solaris_asm_inline" = xyes])
+AM_CONDITIONAL([SOLARIS_VT], [test "x$solaris_vt" = xyes])
+AM_CONDITIONAL([DGA], [test "x$DGA" = xyes])
+AM_CONDITIONAL([XF86VIDMODE], [test "x$XF86VIDMODE" = xyes])
+
+dnl XWin DDX
+
+AC_MSG_CHECKING([whether to build XWin DDX])
+if test "x$XWIN" = xauto; then
+ case $host_os in
+ cygwin*) XWIN="yes" ;;
+ mingw*) XWIN="yes" ;;
+ *) XWIN="no" ;;
+ esac
+fi
+AC_MSG_RESULT([$XWIN])
+
+if test "x$XWIN" = xyes; then
+ AC_DEFINE_DIR(SYSCONFDIR, sysconfdir, [Location of system.XWinrc])
+ AC_DEFINE_DIR(DEFAULT_LOGDIR, logdir, [Default log location])
+ AC_DEFINE_UNQUOTED(XORG_VERSION_CURRENT, [$VENDOR_RELEASE], [Current Xorg version])
+ AC_DEFINE_UNQUOTED(__VENDORDWEBSUPPORT__, ["$VENDOR_WEB"], [Vendor web address for support])
+ AC_CHECK_TOOL(WINDRES, windres)
+
+ PKG_CHECK_MODULES([XWINMODULES],[x11 xdmcp xau])
+
+ if test "x$WINDOWSWM" = xauto; then
+ PKG_CHECK_EXISTS($WINDOWSWMPROTO, [WINDOWSWM=yes], [WINDOWSWM=no])
+ fi
+ if test "x$WINDOWSWM" = xyes ; then
+ PKG_CHECK_MODULES(WINDOWSWM, $WINDOWSWMPROTO)
+ XWINMODULES_CFLAGS="$XWINMODULES_CFLAGS $WINDOWSWM_CFLAGS"
+ AC_DEFINE(ROOTLESS,1,[Build Rootless code])
+ fi
+
+ case $host_os in
+ cygwin*)
+ XWIN_SERVER_NAME=XWin
+ AC_DEFINE(HAS_DEVWINDOWS,1,[Cygwin has /dev/windows for signaling new win32 messages])
+ ;;
+ mingw*)
+ XWIN_SERVER_NAME=Xming
+ AC_DEFINE(RELOCATE_PROJECTROOT,1,[Make PROJECT_ROOT relative to the xserver location])
+ AC_DEFINE(HAS_WINSOCK,1,[Use Windows sockets])
+ XWIN_SYS_LIBS=-lwinsock2
+ ;;
+ esac
+ XWIN_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $RANDR_LIB $RENDER_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $DAMAGE_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $OS_LIB"
+ XWIN_SYS_LIBS="$XWIN_SYS_LIBS $XWINMODULES_LIBS"
+ AC_SUBST(XWIN_LIBS)
+ AC_SUBST(XWIN_SERVER_NAME)
+ AC_SUBST(XWIN_SYS_LIBS)
+
+ if test "x$DEBUGGING" = xyes; then
+ AC_DEFINE(CYGDEBUG, 1, [Simple debug messages])
+ AC_DEFINE(CYGWINDOWING_DEBUG, 1, [Debug messages for window handling])
+ AC_DEFINE(CYGMULTIWINDOW_DEBUG, 1, [Debug window manager])
+ fi
+
+ AC_DEFINE(DDXOSVERRORF, 1, [Use OsVendorVErrorF])
+ AC_DEFINE(DDXBEFORERESET, 1, [Use ddxBeforeReset ])
+fi
+AM_CONDITIONAL(XWIN, [test "x$XWIN" = xyes])
+AM_CONDITIONAL(XWIN_MULTIWINDOW, [test "x$XWIN" = xyes])
+AM_CONDITIONAL(XWIN_MULTIWINDOWEXTWM, [test "x$XWIN" = xyes && test "x$WINDOWSWM" = xyes])
+AM_CONDITIONAL(XWIN_CLIPBOARD, [test "x$XWIN" = xyes])
+AM_CONDITIONAL(XWIN_GLX_WINDOWS, [test "x$XWIN" = xyes && false])
+AM_CONDITIONAL(XWIN_NATIVEGDI, [test "x$XWIN" = xyes])
+AM_CONDITIONAL(XWIN_PRIMARYFB, [test "x$XWIN" = xyes])
+AM_CONDITIONAL(XWIN_RANDR, [test "x$XWIN" = xyes])
+AM_CONDITIONAL(XWIN_XV, [test "x$XWIN" = xyes && test "x$XV" = xyes])
+
+dnl Darwin / OS X DDX
+if test "x$XQUARTZ" = xyes; then
+ AC_DEFINE(XQUARTZ,1,[Have Quartz])
+ AC_DEFINE(ROOTLESS,1,[Build Rootless code])
+
+ DARWIN_LIBS="$MI_LIB $OS_LIB $DIX_LIB $MAIN_LIB $FB_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $XPSTUBS_LIB"
+ AC_SUBST([DARWIN_LIBS])
+
+ AC_CHECK_LIB([Xplugin],[xp_init],[:])
+
+ CFLAGS="${CFLAGS} -DROOTLESS_SAFEALPHA -DNO_ALLOCA"
+
+ PKG_CHECK_MODULES(XPBPROXY, $APPLEWMPROTO $LIBAPPLEWM xfixes x11)
+
+ if test "x$XQUARTZ_SPARKLE" = xyes ; then
+ AC_DEFINE(XQUARTZ_SPARKLE,1,[Support application updating through sparkle.])
+ fi
+
+ if test "x$STANDALONE_XPBPROXY" = xyes ; then
+ AC_DEFINE(STANDALONE_XPBPROXY,1,[Build a standalone xpbproxy])
+ fi
+fi
+
+# Support for objc in autotools is minimal and not documented.
+OBJC='$(CC)'
+OBJCLD='$(CCLD)'
+OBJCLINK='$(LINK)'
+OBJCFLAGS='$(CFLAGS)'
+AC_SUBST([OBJC])
+AC_SUBST([OBJCCLD])
+AC_SUBST([OBJCLINK])
+AC_SUBST([OBJCFLAGS])
+# internal, undocumented automake func follows :(
+_AM_DEPENDENCIES([OBJC])
+AM_CONDITIONAL(XQUARTZ, [test "x$XQUARTZ" = xyes])
+AM_CONDITIONAL(XQUARTZ_SPARKLE, [test "x$XQUARTZ_SPARKLE" != "xno"])
+AM_CONDITIONAL(STANDALONE_XPBPROXY, [test "x$STANDALONE_XPBPROXY" = xyes])
+
+dnl DMX DDX
+PKG_CHECK_MODULES(
+ [DMXMODULES],
+ [xmuu $LIBXEXT x11 xrender xfixes $LIBXI $DMXPROTO xau $XDMCP_MODULES],
+ [PKG_CHECK_MODULES(
+ [XDMXCONFIG_DEP],
+ [xaw7 xmu xt xpm x11],
+ [have_dmx=yes],
+ [have_dmx=no])],
+ [have_dmx=no])
+AC_MSG_CHECKING([whether to build Xdmx DDX])
+if test "x$DMX" = xauto; then
+ DMX="$have_dmx"
+ case $host_os in
+ cygwin*) DMX="no" ;;
+ darwin*) DMX="no" ;;
+ esac
+fi
+AC_MSG_RESULT([$DMX])
+AM_CONDITIONAL(DMX, [test "x$DMX" = xyes])
+
+if test "x$DMX" = xyes; then
+ if test "x$have_dmx" = xno; then
+ AC_MSG_ERROR([Xdmx build explicitly requested, but required
+ modules not found.])
+ fi
+ DMX_INCLUDES="$XEXT_INC $RENDER_INC $RECORD_INC"
+ XDMX_CFLAGS="$DMXMODULES_CFLAGS"
+ XDMX_LIBS="$FB_LIB $MI_LIB $XEXT_LIB $RENDER_LIB $RECORD_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $MIEXT_SYNC_LIB $MIEXT_SHADOW_LIB $MIEXT_DAMAGE_LIB $COMPOSITE_LIB $DAMAGE_LIB $MAIN_LIB $DIX_LIB $CONFIG_LIB $OS_LIB $FIXES_LIB"
+ XDMX_SYS_LIBS="$DMXMODULES_LIBS"
+ AC_SUBST([XDMX_CFLAGS])
+ AC_SUBST([XDMX_LIBS])
+ AC_SUBST([XDMX_SYS_LIBS])
+
+dnl USB sources in DMX require <linux/input.h>
+ AC_CHECK_HEADER([linux/input.h], DMX_BUILD_USB="yes",
+ DMX_BUILD_USB="no")
+dnl Linux sources in DMX require <linux/keyboard.h>
+ AC_CHECK_HEADER([linux/keyboard.h], DMX_BUILD_LNX="yes",
+ DMX_BUILD_LNX="no")
+ AC_SUBST(XDMXCONFIG_DEP_CFLAGS)
+ AC_SUBST(XDMXCONFIG_DEP_LIBS)
+ PKG_CHECK_MODULES([DMXEXAMPLES_DEP], [$LIBDMX $LIBXEXT x11])
+ AC_SUBST(DMXEXAMPLES_DEP_LIBS)
+ PKG_CHECK_MODULES([DMXXMUEXAMPLES_DEP], [$LIBDMX xmu $LIBXEXT x11])
+ AC_SUBST(DMXXMUEXAMPLES_DEP_LIBS)
+ PKG_CHECK_MODULES([DMXXIEXAMPLES_DEP], [$LIBDMX $LIBXI $LIBXEXT x11])
+ AC_SUBST(DMXXIEXAMPLES_DEP_LIBS)
+ PKG_CHECK_MODULES([XTSTEXAMPLES_DEP], [$LIBXTST $LIBXEXT x11])
+ AC_SUBST(XTSTEXAMPLES_DEP_LIBS)
+ PKG_CHECK_MODULES([XRESEXAMPLES_DEP], [xres $LIBXEXT x11])
+ AC_SUBST(XRESEXAMPLES_DEP_LIBS)
+ PKG_CHECK_MODULES([X11EXAMPLES_DEP], [$LIBXEXT x11])
+ AC_SUBST(X11EXAMPLES_DEP_LIBS)
+
+fi
+AM_CONDITIONAL([DMX_BUILD_LNX], [test "x$DMX_BUILD_LNX" = xyes])
+AM_CONDITIONAL([DMX_BUILD_USB], [test "x$DMX_BUILD_USB" = xyes])
+
+dnl kdrive DDX
+
+XEPHYR_LIBS=
+XEPHYR_INCS=
+
+AM_CONDITIONAL(KDRIVE, [test x$KDRIVE = xyes])
+
+if test "$KDRIVE" = yes; then
+ AC_DEFINE(KDRIVESERVER,1,[Build Kdrive X server])
+ AC_DEFINE(KDRIVEDDXACTIONS,,[Build kdrive ddx])
+
+ AC_CHECK_HEADERS([linux/fb.h])
+ if test "$ac_cv_header_linux_fb_h" = yes && test "x$XFBDEV" = xauto; then
+ XFBDEV=yes
+ fi
+
+ if test "x$XFBDEV" = xyes; then
+ KDRIVEFBDEVLIB=yes
+ AC_DEFINE(KDRIVEFBDEV, 1, [Build fbdev-based kdrive server])
+ fi
+
+
+ PKG_CHECK_MODULES([TSLIB], [tslib-0.0], [HAVE_TSLIB="yes"], [HAVE_TSLIB="no"])
+ if test "x$HAVE_TSLIB" = xno; then
+ AC_CHECK_LIB(ts, ts_open, [
+ HAVE_TSLIB="yes"
+ TSLIB_LIBS="-lts"
+ ])
+ fi
+
+ if test "xTSLIB" = xauto; then
+ TSLIB="$HAVE_TSLIB"
+ fi
+
+ if test "x$TSLIB" = xyes; then
+ if ! test "x$HAVE_TSLIB" = xyes; then
+ AC_MSG_ERROR([tslib must be installed to build the tslib driver. See http://tslib.berlios.de/])
+ else
+ AC_DEFINE(TSLIB, 1, [Have tslib support])
+ fi
+ fi
+
+ if test "x$KDRIVE_KBD" = xyes; then
+ AC_DEFINE(KDRIVE_KBD, 1, [Enable KDrive kbd driver])
+ fi
+ if test "x$KDRIVE_EVDEV" = xyes; then
+ AC_DEFINE(KDRIVE_EVDEV, 1, [Enable KDrive evdev driver])
+ fi
+ if test "x$KDRIVE_MOUSE" = xyes; then
+ AC_DEFINE(KDRIVE_MOUSE, 1, [Enable KDrive mouse driver])
+ fi
+
+ XEPHYR_REQUIRED_LIBS="x11 $LIBXEXT xau xdmcp"
+ if test "x$XV" = xyes; then
+ XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS xv"
+ fi
+ if test "x$DRI" = xyes && test "x$GLX" = xyes; then
+ XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS $LIBGL libdrm"
+ fi
+
+ PKG_CHECK_MODULES(XEPHYR, $XEPHYR_REQUIRED_LIBS, [xephyr="yes"], [xephyr="no"])
+ if test "x$XEPHYR" = xauto; then
+ XEPHYR=$xephyr
+ fi
+ if test "x$XEPHYR" = xyes && test "x$xephyr" = xno; then
+ AC_MSG_ERROR([Xephyr dependencies missing])
+ fi
+
+ # Xephyr needs nanosleep() which is in librt on Solaris
+ AC_CHECK_FUNC([nanosleep], [],
+ AC_CHECK_LIB([rt], [nanosleep], XEPHYR_LIBS="$XEPHYR_LIBS -lrt"))
+
+ # damage shadow extension glx (NOTYET) fb mi
+ KDRIVE_INC='-I$(top_srcdir)/hw/kdrive/src'
+ KDRIVE_PURE_INCS="$KDRIVE_INC $MIEXT_SYNC_INC $MIEXT_DAMAGE_INC $MIEXT_SHADOW_INC $XEXT_INC $FB_INC $MI_INC"
+ KDRIVE_OS_INC='-I$(top_srcdir)/hw/kdrive/linux'
+ KDRIVE_INCS="$KDRIVE_PURE_INCS $KDRIVE_OS_INC"
+
+ KDRIVE_CFLAGS="$XSERVER_CFLAGS -DHAVE_KDRIVE_CONFIG_H $TSLIB_CFLAGS"
+
+ KDRIVE_PURE_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $OS_LIB"
+ KDRIVE_LIB='$(top_builddir)/hw/kdrive/src/libkdrive.la'
+ case $host_os in
+ *linux*)
+ KDRIVE_OS_LIB='$(top_builddir)/hw/kdrive/linux/liblinux.la'
+ KDRIVELINUX=yes
+ if test "x$KDRIVE_EVDEV" = xauto; then
+ KDRIVE_EVDEV=yes
+ fi
+ if test "x$KDRIVE_KBD" = xauto; then
+ KDRIVE_KBD=yes
+ fi
+ if test "x$KDRIVE_MOUSE" = xauto; then
+ KDRIVE_MOUSE=yes
+ fi
+ ;;
+ *)
+ if test "x$KDRIVE_EVDEV" = xauto; then
+ KDRIVE_EVDEV=no
+ fi
+ if test "x$KDRIVE_KBD" = xauto; then
+ KDRIVE_KBD=no
+ fi
+ if test "x$KDRIVE_MOUSE" = xauto; then
+ KDRIVE_MOUSE=no
+ fi
+ ;;
+ esac
+ KDRIVE_STUB_LIB='$(top_builddir)/hw/kdrive/src/libkdrivestubs.la'
+ KDRIVE_LOCAL_LIBS="$MAIN_LIB $DIX_LIB $KDRIVE_LIB $KDRIVE_STUB_LIB"
+ KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $FB_LIB $MI_LIB $KDRIVE_PURE_LIBS"
+ KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $KDRIVE_OS_LIB"
+ KDRIVE_LIBS="$KDRIVE_LOCAL_LIBS $XSERVER_SYS_LIBS $GLX_SYS_LIBS $DLOPEN_LIBS $TSLIB_LIBS"
+
+ AC_SUBST([XEPHYR_LIBS])
+ AC_SUBST([XEPHYR_INCS])
+fi
+AC_SUBST([KDRIVE_INCS])
+AC_SUBST([KDRIVE_PURE_INCS])
+AC_SUBST([KDRIVE_CFLAGS])
+AC_SUBST([KDRIVE_PURE_LIBS])
+AC_SUBST([KDRIVE_LOCAL_LIBS])
+AC_SUBST([KDRIVE_LIBS])
+AM_CONDITIONAL(KDRIVELINUX, [test "x$KDRIVELINUX" = xyes])
+AM_CONDITIONAL(KDRIVE_EVDEV, [test "x$KDRIVE_EVDEV" = xyes])
+AM_CONDITIONAL(KDRIVE_KBD, [test "x$KDRIVE_KBD" = xyes])
+AM_CONDITIONAL(KDRIVE_MOUSE, [test "x$KDRIVE_MOUSE" = xyes])
+AM_CONDITIONAL(TSLIB, [test "x$HAVE_TSLIB" = xyes])
+AM_CONDITIONAL(KDRIVEFBDEV, [test "x$XFBDEV" = xyes])
+AM_CONDITIONAL(XEPHYR, [test "x$KDRIVE" = xyes && test "x$XEPHYR" = xyes])
+AM_CONDITIONAL(BUILD_KDRIVEFBDEVLIB, [test "x$KDRIVE" = xyes && test "x$KDRIVEFBDEVLIB" = xyes])
+AM_CONDITIONAL(XFAKESERVER, [test "x$KDRIVE" = xyes && test "x$XFAKE" = xyes])
+
+dnl and the rest of these are generic, so they're in config.h
+dnl
+dnl though, thanks to the passing of some significant amount of time, the
+dnl above is probably a complete fallacy, and you should not rely on it.
+dnl but this is still actually better than imake, honest. -daniels
+
+AC_TRY_COMPILE([
+#include <features.h>
+#ifndef __GLIBC__
+#error not glibc
+#endif
+], [], [AC_DEFINE(_GNU_SOURCE, 1,
+ [ Enable GNU and other extensions to the C environment for glibc])])
+
+AC_DEFINE_DIR(PROJECTROOT, prefix, [Overall prefix])
+
+AC_SUBST([RELEASE_DATE])
+BUILD_DATE="`date +'%Y%m%d'`"
+AC_SUBST([BUILD_DATE])
+BUILD_TIME="`date +'1%H%M%S'`"
+AC_SUBST([BUILD_TIME])
+
+DIX_CFLAGS="-DHAVE_DIX_CONFIG_H $XSERVER_CFLAGS"
+
+AC_SUBST([DIX_CFLAGS])
+
+AC_SUBST([libdir])
+AC_SUBST([exec_prefix])
+AC_SUBST([prefix])
+
+AC_OUTPUT([
+Makefile
+glx/Makefile
+include/Makefile
+composite/Makefile
+damageext/Makefile
+dbe/Makefile
+dix/Makefile
+doc/Makefile
+doc/man/Makefile
+doc/xml/Makefile
+doc/xml/dtrace/Makefile
+doc/xml/xserver.ent
+fb/Makefile
+record/Makefile
+config/Makefile
+mi/Makefile
+miext/Makefile
+miext/sync/Makefile
+miext/damage/Makefile
+miext/shadow/Makefile
+miext/cw/Makefile
+miext/rootless/Makefile
+os/Makefile
+randr/Makefile
+render/Makefile
+xkb/Makefile
+Xext/Makefile
+Xi/Makefile
+xfixes/Makefile
+exa/Makefile
+hw/Makefile
+hw/xfree86/Makefile
+hw/xfree86/common/Makefile
+hw/xfree86/common/xf86Build.h
+hw/xfree86/ddc/Makefile
+hw/xfree86/dixmods/Makefile
+hw/xfree86/dixmods/extmod/Makefile
+hw/xfree86/doc/Makefile
+hw/xfree86/doc/devel/Makefile
+hw/xfree86/doc/man/Makefile
+hw/xfree86/doc/sgml/Makefile
+hw/xfree86/dri/Makefile
+hw/xfree86/dri2/Makefile
+hw/xfree86/exa/Makefile
+hw/xfree86/exa/man/Makefile
+hw/xfree86/fbdevhw/Makefile
+hw/xfree86/fbdevhw/man/Makefile
+hw/xfree86/i2c/Makefile
+hw/xfree86/int10/Makefile
+hw/xfree86/loader/Makefile
+hw/xfree86/modes/Makefile
+hw/xfree86/os-support/Makefile
+hw/xfree86/os-support/bsd/Makefile
+hw/xfree86/os-support/bus/Makefile
+hw/xfree86/os-support/hurd/Makefile
+hw/xfree86/os-support/misc/Makefile
+hw/xfree86/os-support/linux/Makefile
+hw/xfree86/os-support/solaris/Makefile
+hw/xfree86/parser/Makefile
+hw/xfree86/ramdac/Makefile
+hw/xfree86/shadowfb/Makefile
+hw/xfree86/vbe/Makefile
+hw/xfree86/vgahw/Makefile
+hw/xfree86/x86emu/Makefile
+hw/xfree86/xaa/Makefile
+hw/xfree86/utils/Makefile
+hw/xfree86/utils/man/Makefile
+hw/xfree86/utils/cvt/Makefile
+hw/xfree86/utils/gtf/Makefile
+hw/dmx/config/Makefile
+hw/dmx/config/man/Makefile
+hw/dmx/doc/Makefile
+hw/dmx/examples/Makefile
+hw/dmx/input/Makefile
+hw/dmx/glxProxy/Makefile
+hw/dmx/Makefile
+hw/dmx/man/Makefile
+hw/vfb/Makefile
+hw/vfb/man/Makefile
+hw/xnest/Makefile
+hw/xnest/man/Makefile
+hw/xwin/Makefile
+hw/xwin/glx/Makefile
+hw/xwin/man/Makefile
+hw/xquartz/Makefile
+hw/xquartz/GL/Makefile
+hw/xquartz/bundle/Makefile
+hw/xquartz/man/Makefile
+hw/xquartz/mach-startup/Makefile
+hw/xquartz/pbproxy/Makefile
+hw/xquartz/xpr/Makefile
+hw/kdrive/Makefile
+hw/kdrive/ephyr/Makefile
+hw/kdrive/ephyr/man/Makefile
+hw/kdrive/fake/Makefile
+hw/kdrive/fbdev/Makefile
+hw/kdrive/linux/Makefile
+hw/kdrive/src/Makefile
+test/Makefile
+test/xi2/Makefile
+xorg-server.pc
+])
diff --git a/xorg-server/exa/exa_mixed.c b/xorg-server/exa/exa_mixed.c
index 9ab9c0dcf..fd1afb246 100644
--- a/xorg-server/exa/exa_mixed.c
+++ b/xorg-server/exa/exa_mixed.c
@@ -1,289 +1,290 @@
-/*
- * Copyright © 2009 Maarten Maathuis
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * 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_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <string.h>
-
-#include "exa_priv.h"
-#include "exa.h"
-
-/* This file holds the driver allocated pixmaps + better initial placement code.
- */
-
-static _X_INLINE void*
-ExaGetPixmapAddress(PixmapPtr p)
-{
- ExaPixmapPriv(p);
-
- return pExaPixmap->sys_ptr;
-}
-
-/**
- * exaCreatePixmap() creates a new pixmap.
- */
-PixmapPtr
-exaCreatePixmap_mixed(ScreenPtr pScreen, int w, int h, int depth,
- unsigned usage_hint)
-{
- PixmapPtr pPixmap;
- ExaPixmapPrivPtr pExaPixmap;
- int bpp;
- size_t paddedWidth;
- ExaScreenPriv(pScreen);
-
- if (w > 32767 || h > 32767)
- return NullPixmap;
-
- swap(pExaScr, pScreen, CreatePixmap);
- pPixmap = pScreen->CreatePixmap(pScreen, 0, 0, depth, usage_hint);
- swap(pExaScr, pScreen, CreatePixmap);
-
- if (!pPixmap)
- return NULL;
-
- pExaPixmap = ExaGetPixmapPriv(pPixmap);
- pExaPixmap->driverPriv = NULL;
-
- bpp = pPixmap->drawable.bitsPerPixel;
-
- paddedWidth = ((w * bpp + FB_MASK) >> FB_SHIFT) * sizeof(FbBits);
- if (paddedWidth / 4 > 32767 || h > 32767)
- return NullPixmap;
-
- /* We will allocate the system pixmap later if needed. */
- pPixmap->devPrivate.ptr = NULL;
- pExaPixmap->sys_ptr = NULL;
- pExaPixmap->sys_pitch = paddedWidth;
-
- pExaPixmap->area = NULL;
- pExaPixmap->fb_ptr = NULL;
- pExaPixmap->pDamage = NULL;
-
- exaSetFbPitch(pExaScr, pExaPixmap, w, h, bpp);
- exaSetAccelBlock(pExaScr, pExaPixmap,
- w, h, bpp);
-
- (*pScreen->ModifyPixmapHeader)(pPixmap, w, h, 0, 0,
- paddedWidth, NULL);
-
- /* A scratch pixmap will become a driver pixmap right away. */
- if (!w || !h) {
- exaCreateDriverPixmap_mixed(pPixmap);
- pExaPixmap->use_gpu_copy = exaPixmapHasGpuCopy(pPixmap);
- } else {
- pExaPixmap->use_gpu_copy = FALSE;
-
- if (w == 1 && h == 1) {
- pExaPixmap->sys_ptr = malloc(paddedWidth);
-
- /* Set up damage tracking */
- pExaPixmap->pDamage = DamageCreate(exaDamageReport_mixed, NULL,
- DamageReportNonEmpty, TRUE,
- pPixmap->drawable.pScreen,
- pPixmap);
-
- DamageRegister(&pPixmap->drawable, pExaPixmap->pDamage);
- /* This ensures that pending damage reflects the current operation. */
- /* This is used by exa to optimize migration. */
- DamageSetReportAfterOp(pExaPixmap->pDamage, TRUE);
- }
- }
-
- /* During a fallback we must prepare access. */
- if (pExaScr->fallback_counter)
- exaPrepareAccess(&pPixmap->drawable, EXA_PREPARE_AUX_DEST);
-
- return pPixmap;
-}
-
-Bool
-exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth,
- int bitsPerPixel, int devKind, pointer pPixData)
-{
- ScreenPtr pScreen;
- ExaScreenPrivPtr pExaScr;
- ExaPixmapPrivPtr pExaPixmap;
- Bool ret, has_gpu_copy;
-
- if (!pPixmap)
- return FALSE;
-
- pScreen = pPixmap->drawable.pScreen;
- pExaScr = ExaGetScreenPriv(pScreen);
- pExaPixmap = ExaGetPixmapPriv(pPixmap);
-
- if (pPixData) {
- if (pExaPixmap->driverPriv) {
- if (pExaPixmap->pDamage) {
- DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage);
- DamageDestroy(pExaPixmap->pDamage);
- pExaPixmap->pDamage = NULL;
- }
-
- pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv);
- pExaPixmap->driverPriv = NULL;
- }
-
- pExaPixmap->use_gpu_copy = FALSE;
- pExaPixmap->score = EXA_PIXMAP_SCORE_PINNED;
- }
-
- has_gpu_copy = exaPixmapHasGpuCopy(pPixmap);
-
- if (width <= 0)
- width = pPixmap->drawable.width;
-
- if (height <= 0)
- height = pPixmap->drawable.height;
-
- if (bitsPerPixel <= 0) {
- if (depth <= 0)
- bitsPerPixel = pPixmap->drawable.bitsPerPixel;
- else
- bitsPerPixel = BitsPerPixel(depth);
- }
-
- if (depth <= 0)
- depth = pPixmap->drawable.depth;
-
- if (width != pPixmap->drawable.width ||
- height != pPixmap->drawable.height ||
- depth != pPixmap->drawable.depth ||
- bitsPerPixel != pPixmap->drawable.bitsPerPixel) {
- if (pExaPixmap->driverPriv) {
- exaSetFbPitch(pExaScr, pExaPixmap,
- width, height, bitsPerPixel);
-
- exaSetAccelBlock(pExaScr, pExaPixmap,
- width, height, bitsPerPixel);
- RegionEmpty(&pExaPixmap->validFB);
- }
-
- /* Need to re-create system copy if there's also a GPU copy */
- if (has_gpu_copy && pExaPixmap->sys_ptr) {
- free(pExaPixmap->sys_ptr);
- pExaPixmap->sys_ptr = NULL;
- pExaPixmap->sys_pitch = devKind > 0 ? devKind :
- PixmapBytePad(width, depth);
- DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage);
- DamageDestroy(pExaPixmap->pDamage);
- pExaPixmap->pDamage = NULL;
- RegionEmpty(&pExaPixmap->validSys);
-
- if (pExaScr->deferred_mixed_pixmap == pPixmap)
- pExaScr->deferred_mixed_pixmap = NULL;
- }
- }
-
- if (has_gpu_copy) {
- pPixmap->devPrivate.ptr = pExaPixmap->fb_ptr;
- pPixmap->devKind = pExaPixmap->fb_pitch;
- } else {
- pPixmap->devPrivate.ptr = pExaPixmap->sys_ptr;
- pPixmap->devKind = pExaPixmap->sys_pitch;
- }
-
- /* Only pass driver pixmaps to the driver. */
- if (pExaScr->info->ModifyPixmapHeader && pExaPixmap->driverPriv) {
- ret = pExaScr->info->ModifyPixmapHeader(pPixmap, width, height, depth,
- bitsPerPixel, devKind, pPixData);
- if (ret == TRUE)
- goto out;
- }
-
- swap(pExaScr, pScreen, ModifyPixmapHeader);
- ret = pScreen->ModifyPixmapHeader(pPixmap, width, height, depth,
- bitsPerPixel, devKind, pPixData);
- swap(pExaScr, pScreen, ModifyPixmapHeader);
-
-out:
- if (has_gpu_copy) {
- pExaPixmap->fb_ptr = pPixmap->devPrivate.ptr;
- pExaPixmap->fb_pitch = pPixmap->devKind;
- } else {
- pExaPixmap->sys_ptr = pPixmap->devPrivate.ptr;
- pExaPixmap->sys_pitch = pPixmap->devKind;
- }
- /* Always NULL this, we don't want lingering pointers. */
- pPixmap->devPrivate.ptr = NULL;
-
- return ret;
-}
-
-Bool
-exaDestroyPixmap_mixed(PixmapPtr pPixmap)
-{
- ScreenPtr pScreen = pPixmap->drawable.pScreen;
- ExaScreenPriv(pScreen);
- Bool ret;
-
- if (pPixmap->refcnt == 1)
- {
- ExaPixmapPriv (pPixmap);
-
- exaDestroyPixmap(pPixmap);
-
- if (pExaScr->deferred_mixed_pixmap == pPixmap)
- pExaScr->deferred_mixed_pixmap = NULL;
-
- if (pExaPixmap->driverPriv)
- pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv);
- pExaPixmap->driverPriv = NULL;
-
- if (pExaPixmap->pDamage) {
- free(pExaPixmap->sys_ptr);
- pExaPixmap->sys_ptr = NULL;
- pExaPixmap->pDamage = NULL;
- }
- }
-
- swap(pExaScr, pScreen, DestroyPixmap);
- ret = pScreen->DestroyPixmap (pPixmap);
- swap(pExaScr, pScreen, DestroyPixmap);
-
- return ret;
-}
-
-Bool
-exaPixmapHasGpuCopy_mixed(PixmapPtr pPixmap)
-{
- ScreenPtr pScreen = pPixmap->drawable.pScreen;
- ExaScreenPriv(pScreen);
- ExaPixmapPriv(pPixmap);
- pointer saved_ptr;
- Bool ret;
-
- if (!pExaPixmap->driverPriv)
- return FALSE;
-
- saved_ptr = pPixmap->devPrivate.ptr;
- pPixmap->devPrivate.ptr = ExaGetPixmapAddress(pPixmap);
- ret = pExaScr->info->PixmapIsOffscreen(pPixmap);
- pPixmap->devPrivate.ptr = saved_ptr;
-
- return ret;
-}
+/*
+ * Copyright © 2009 Maarten Maathuis
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * 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_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <string.h>
+
+#include "exa_priv.h"
+#include "exa.h"
+
+/* This file holds the driver allocated pixmaps + better initial placement code.
+ */
+
+static _X_INLINE void*
+ExaGetPixmapAddress(PixmapPtr p)
+{
+ ExaPixmapPriv(p);
+
+ return pExaPixmap->sys_ptr;
+}
+
+/**
+ * exaCreatePixmap() creates a new pixmap.
+ */
+PixmapPtr
+exaCreatePixmap_mixed(ScreenPtr pScreen, int w, int h, int depth,
+ unsigned usage_hint)
+{
+ PixmapPtr pPixmap;
+ ExaPixmapPrivPtr pExaPixmap;
+ int bpp;
+ size_t paddedWidth;
+ ExaScreenPriv(pScreen);
+
+ if (w > 32767 || h > 32767)
+ return NullPixmap;
+
+ swap(pExaScr, pScreen, CreatePixmap);
+ pPixmap = pScreen->CreatePixmap(pScreen, 0, 0, depth, usage_hint);
+ swap(pExaScr, pScreen, CreatePixmap);
+
+ if (!pPixmap)
+ return NULL;
+
+ pExaPixmap = ExaGetPixmapPriv(pPixmap);
+ pExaPixmap->driverPriv = NULL;
+
+ bpp = pPixmap->drawable.bitsPerPixel;
+
+ paddedWidth = ((w * bpp + FB_MASK) >> FB_SHIFT) * sizeof(FbBits);
+ if (paddedWidth / 4 > 32767 || h > 32767)
+ return NullPixmap;
+
+ /* We will allocate the system pixmap later if needed. */
+ pPixmap->devPrivate.ptr = NULL;
+ pExaPixmap->sys_ptr = NULL;
+ pExaPixmap->sys_pitch = paddedWidth;
+
+ pExaPixmap->area = NULL;
+ pExaPixmap->fb_ptr = NULL;
+ pExaPixmap->pDamage = NULL;
+
+ exaSetFbPitch(pExaScr, pExaPixmap, w, h, bpp);
+ exaSetAccelBlock(pExaScr, pExaPixmap,
+ w, h, bpp);
+
+ (*pScreen->ModifyPixmapHeader)(pPixmap, w, h, 0, 0,
+ paddedWidth, NULL);
+
+ /* A scratch pixmap will become a driver pixmap right away. */
+ if (!w || !h) {
+ exaCreateDriverPixmap_mixed(pPixmap);
+ pExaPixmap->use_gpu_copy = exaPixmapHasGpuCopy(pPixmap);
+ } else {
+ pExaPixmap->use_gpu_copy = FALSE;
+
+ if (w == 1 && h == 1) {
+ pExaPixmap->sys_ptr = malloc(paddedWidth);
+
+ /* Set up damage tracking */
+ pExaPixmap->pDamage = DamageCreate(exaDamageReport_mixed, NULL,
+ DamageReportNonEmpty, TRUE,
+ pPixmap->drawable.pScreen,
+ pPixmap);
+
+ DamageRegister(&pPixmap->drawable, pExaPixmap->pDamage);
+ /* This ensures that pending damage reflects the current operation. */
+ /* This is used by exa to optimize migration. */
+ DamageSetReportAfterOp(pExaPixmap->pDamage, TRUE);
+ }
+ }
+
+ /* During a fallback we must prepare access. */
+ if (pExaScr->fallback_counter)
+ exaPrepareAccess(&pPixmap->drawable, EXA_PREPARE_AUX_DEST);
+
+ return pPixmap;
+}
+
+Bool
+exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth,
+ int bitsPerPixel, int devKind, pointer pPixData)
+{
+ ScreenPtr pScreen;
+ ExaScreenPrivPtr pExaScr;
+ ExaPixmapPrivPtr pExaPixmap;
+ Bool ret, has_gpu_copy;
+
+ if (!pPixmap)
+ return FALSE;
+
+ pScreen = pPixmap->drawable.pScreen;
+ pExaScr = ExaGetScreenPriv(pScreen);
+ pExaPixmap = ExaGetPixmapPriv(pPixmap);
+
+ if (pPixData) {
+ if (pExaPixmap->driverPriv) {
+ if (pExaPixmap->pDamage) {
+ DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage);
+ DamageDestroy(pExaPixmap->pDamage);
+ pExaPixmap->pDamage = NULL;
+ }
+
+ pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv);
+ pExaPixmap->driverPriv = NULL;
+ }
+
+ pExaPixmap->use_gpu_copy = FALSE;
+ pExaPixmap->score = EXA_PIXMAP_SCORE_PINNED;
+ }
+
+ has_gpu_copy = exaPixmapHasGpuCopy(pPixmap);
+
+ if (width <= 0)
+ width = pPixmap->drawable.width;
+
+ if (height <= 0)
+ height = pPixmap->drawable.height;
+
+ if (bitsPerPixel <= 0) {
+ if (depth <= 0)
+ bitsPerPixel = pPixmap->drawable.bitsPerPixel;
+ else
+ bitsPerPixel = BitsPerPixel(depth);
+ }
+
+ if (depth <= 0)
+ depth = pPixmap->drawable.depth;
+
+ if (width != pPixmap->drawable.width ||
+ height != pPixmap->drawable.height ||
+ depth != pPixmap->drawable.depth ||
+ bitsPerPixel != pPixmap->drawable.bitsPerPixel) {
+ if (pExaPixmap->driverPriv) {
+ if (devKind > 0)
+ pExaPixmap->fb_pitch = devKind;
+ else
+ exaSetFbPitch(pExaScr, pExaPixmap, width, height, bitsPerPixel);
+
+ exaSetAccelBlock(pExaScr, pExaPixmap,
+ width, height, bitsPerPixel);
+ RegionEmpty(&pExaPixmap->validFB);
+ }
+
+ /* Need to re-create system copy if there's also a GPU copy */
+ if (has_gpu_copy && pExaPixmap->sys_ptr) {
+ free(pExaPixmap->sys_ptr);
+ pExaPixmap->sys_ptr = NULL;
+ pExaPixmap->sys_pitch = PixmapBytePad(width, depth);
+ DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage);
+ DamageDestroy(pExaPixmap->pDamage);
+ pExaPixmap->pDamage = NULL;
+ RegionEmpty(&pExaPixmap->validSys);
+
+ if (pExaScr->deferred_mixed_pixmap == pPixmap)
+ pExaScr->deferred_mixed_pixmap = NULL;
+ }
+ }
+
+ if (has_gpu_copy) {
+ pPixmap->devPrivate.ptr = pExaPixmap->fb_ptr;
+ pPixmap->devKind = pExaPixmap->fb_pitch;
+ } else {
+ pPixmap->devPrivate.ptr = pExaPixmap->sys_ptr;
+ pPixmap->devKind = pExaPixmap->sys_pitch;
+ }
+
+ /* Only pass driver pixmaps to the driver. */
+ if (pExaScr->info->ModifyPixmapHeader && pExaPixmap->driverPriv) {
+ ret = pExaScr->info->ModifyPixmapHeader(pPixmap, width, height, depth,
+ bitsPerPixel, devKind, pPixData);
+ if (ret == TRUE)
+ goto out;
+ }
+
+ swap(pExaScr, pScreen, ModifyPixmapHeader);
+ ret = pScreen->ModifyPixmapHeader(pPixmap, width, height, depth,
+ bitsPerPixel, devKind, pPixData);
+ swap(pExaScr, pScreen, ModifyPixmapHeader);
+
+out:
+ if (has_gpu_copy) {
+ pExaPixmap->fb_ptr = pPixmap->devPrivate.ptr;
+ pExaPixmap->fb_pitch = pPixmap->devKind;
+ } else {
+ pExaPixmap->sys_ptr = pPixmap->devPrivate.ptr;
+ pExaPixmap->sys_pitch = pPixmap->devKind;
+ }
+ /* Always NULL this, we don't want lingering pointers. */
+ pPixmap->devPrivate.ptr = NULL;
+
+ return ret;
+}
+
+Bool
+exaDestroyPixmap_mixed(PixmapPtr pPixmap)
+{
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ ExaScreenPriv(pScreen);
+ Bool ret;
+
+ if (pPixmap->refcnt == 1)
+ {
+ ExaPixmapPriv (pPixmap);
+
+ exaDestroyPixmap(pPixmap);
+
+ if (pExaScr->deferred_mixed_pixmap == pPixmap)
+ pExaScr->deferred_mixed_pixmap = NULL;
+
+ if (pExaPixmap->driverPriv)
+ pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv);
+ pExaPixmap->driverPriv = NULL;
+
+ if (pExaPixmap->pDamage) {
+ free(pExaPixmap->sys_ptr);
+ pExaPixmap->sys_ptr = NULL;
+ pExaPixmap->pDamage = NULL;
+ }
+ }
+
+ swap(pExaScr, pScreen, DestroyPixmap);
+ ret = pScreen->DestroyPixmap (pPixmap);
+ swap(pExaScr, pScreen, DestroyPixmap);
+
+ return ret;
+}
+
+Bool
+exaPixmapHasGpuCopy_mixed(PixmapPtr pPixmap)
+{
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ ExaScreenPriv(pScreen);
+ ExaPixmapPriv(pPixmap);
+ pointer saved_ptr;
+ Bool ret;
+
+ if (!pExaPixmap->driverPriv)
+ return FALSE;
+
+ saved_ptr = pPixmap->devPrivate.ptr;
+ pPixmap->devPrivate.ptr = ExaGetPixmapAddress(pPixmap);
+ ret = pExaScr->info->PixmapIsOffscreen(pPixmap);
+ pPixmap->devPrivate.ptr = saved_ptr;
+
+ return ret;
+}
diff --git a/xorg-server/hw/dmx/glxProxy/glxcmds.c b/xorg-server/hw/dmx/glxProxy/glxcmds.c
index 74af631ad..f79264ea9 100644
--- a/xorg-server/hw/dmx/glxProxy/glxcmds.c
+++ b/xorg-server/hw/dmx/glxProxy/glxcmds.c
@@ -1,3657 +1,3645 @@
-/*
- * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
- * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice including the dates of first publication and
- * either this permission notice or a reference to
- * http://oss.sgi.com/projects/FreeB/
- * 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
- * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of Silicon Graphics, Inc.
- * shall not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization from
- * Silicon Graphics, Inc.
- */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include "dmx.h"
-#include "dmxwindow.h"
-#include "dmxpixmap.h"
-#include "dmxfont.h"
-#include "dmxsync.h"
-
-#include "glxserver.h"
-#include <GL/glxtokens.h>
-#include "g_disptab.h"
-#include <pixmapstr.h>
-#include <windowstr.h>
-#include "glxutil.h"
-#include "glxext.h"
-#include "unpack.h"
-
-#include "GL/glxproto.h"
-#include "glxvendor.h"
-#include "glxvisuals.h"
-#include "glxswap.h"
-
-#ifdef PANORAMIX
-#include "panoramiXsrv.h"
-#endif
-
-extern __GLXFBConfig **__glXFBConfigs;
-extern int __glXNumFBConfigs;
-
-extern __GLXFBConfig *glxLookupFBConfig( GLXFBConfigID id );
-extern __GLXFBConfig *glxLookupFBConfigByVID( VisualID vid );
-extern __GLXFBConfig *glxLookupBackEndFBConfig( GLXFBConfigID id, int screen );
-extern int glxIsExtensionSupported( char *ext );
-extern int __glXGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc);
-
-#define BE_TO_CLIENT_ERROR(x) \
- ( (x) >= __glXerrorBase ? \
- (x) - dmxScreen->glxErrorBase + __glXerrorBase \
- : (x) )
-
-Display *GetBackEndDisplay( __GLXclientState *cl, int s )
-{
- if (! cl->be_displays[s] ) {
- cl->be_displays[s] = XOpenDisplay( DisplayString(dmxScreens[s].beDisplay) );
- }
- return cl->be_displays[s];
-}
-
-/*
-** Create a GL context with the given properties.
-*/
-static int CreateContext(__GLXclientState *cl,
- GLXContextID gcId,
- VisualID vid, GLXFBConfigID fbconfigId,
- int screen,
- GLXContextID shareList,
- int isDirect )
-{
- ClientPtr client = cl->client;
- xGLXCreateContextReq *be_req;
- xGLXCreateNewContextReq *be_new_req;
- VisualPtr pVisual;
- ScreenPtr pScreen;
- __GLXcontext *glxc, *shareglxc;
- __GLXvisualConfig *pGlxVisual;
- __GLXscreenInfo *pGlxScreen;
- VisualID visual = vid;
- GLint i;
- int from_screen = screen;
- int to_screen = screen;
- DMXScreenInfo *dmxScreen;
- VisualID be_vid;
- GLXFBConfigID be_fbconfigId;
- int num_be_screens;
- Display *dpy;
-
- /*
- ** Check if screen exists.
- */
- if (screen >= screenInfo.numScreens) {
- client->errorValue = screen;
- return BadValue;
- }
-
-
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
- }
-#endif
-
- /*
- ** Find the display list space that we want to share.
- **
- */
- if (shareList == None) {
- shareglxc = NULL;
- } else {
- dixLookupResourceByType((pointer*) &shareglxc, shareList,
- __glXContextRes, NullClient, DixUnknownAccess);
- if (!shareglxc) {
- client->errorValue = shareList;
- return __glXBadContext;
- }
- }
-
- /*
- ** Allocate memory for the new context
- */
- glxc = calloc(1, sizeof(__GLXcontext));
- if (!glxc) {
- return BadAlloc;
- }
-
- pScreen = screenInfo.screens[screen];
- pGlxScreen = &__glXActiveScreens[screen];
-
- if (fbconfigId != None) {
- glxc->pFBConfig = glxLookupFBConfig( fbconfigId );
- if (!glxc->pFBConfig) {
- client->errorValue = fbconfigId;
- free( glxc );
- return BadValue;
- }
- visual = glxc->pFBConfig->associatedVisualId;
- }
- else {
- glxc->pFBConfig = NULL;
- }
-
- if (visual != None) {
- /*
- ** Check if the visual ID is valid for this screen.
- */
- pVisual = pScreen->visuals;
- for (i = 0; i < pScreen->numVisuals; i++, pVisual++) {
- if (pVisual->vid == visual) {
- break;
- }
- }
- if (i == pScreen->numVisuals) {
- client->errorValue = visual;
- free( glxc );
- return BadValue;
- }
-
- pGlxVisual = pGlxScreen->pGlxVisual;
- for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) {
- if (pGlxVisual->vid == visual) {
- break;
- }
- }
- if (i == pGlxScreen->numVisuals) {
- /*
- ** Visual not support on this screen by this OpenGL implementation.
- */
- client->errorValue = visual;
- free( glxc );
- return BadValue;
- }
-
- if ( glxc->pFBConfig == NULL ) {
- glxc->pFBConfig = glxLookupFBConfigByVID( visual );
-
- if ( glxc->pFBConfig == NULL ) {
- /*
- * visual does not have an FBConfig ???
- client->errorValue = visual;
- free( glxc );
- return BadValue;
- */
- }
- }
- }
- else {
- pVisual = NULL;
- pGlxVisual = NULL;
- }
-
- glxc->pScreen = pScreen;
- glxc->pGlxScreen = pGlxScreen;
- glxc->pVisual = pVisual;
- glxc->pGlxVisual = pGlxVisual;
-
- /*
- * allocate memory for back-end servers info
- */
- num_be_screens = to_screen - from_screen + 1;
- glxc->real_ids = (XID *)malloc(sizeof(XID) * num_be_screens);
- if (!glxc->real_ids) {
- return BadAlloc;
- }
- glxc->real_vids = (XID *)malloc(sizeof(XID) * num_be_screens);
- if (!glxc->real_vids) {
- return BadAlloc;
- }
-
- for (screen = from_screen; screen <= to_screen; screen++) {
- int sent = 0;
- pScreen = screenInfo.screens[screen];
- pGlxScreen = &__glXActiveScreens[screen];
- dmxScreen = &dmxScreens[screen];
-
- if (glxc->pFBConfig) {
- __GLXFBConfig *beFBConfig = glxLookupBackEndFBConfig( glxc->pFBConfig->id,
- screen );
- be_fbconfigId = beFBConfig->id;
- }
-
- if (pGlxVisual) {
-
- be_vid = glxMatchGLXVisualInConfigList( pGlxVisual,
- dmxScreen->glxVisuals,
- dmxScreen->numGlxVisuals );
-
- if (!be_vid) {
- /* visual is not supported on the back-end server */
- free( glxc->real_ids );
- free( glxc->real_vids );
- free( glxc );
- return BadValue;
- }
- }
-
- glxc->real_ids[screen-from_screen] = XAllocID(GetBackEndDisplay(cl,screen));
-
- /* send the create context request to the back-end server */
- dpy = GetBackEndDisplay(cl,screen);
- if (glxc->pFBConfig) {
- /*Since for a certain visual both RGB and COLOR INDEX
- *can be on then the only parmeter to choose the renderType
- * should be the class of the colormap since all 4 first
- * classes does not support RGB mode only COLOR INDEX ,
- * and so TrueColor and DirectColor does not support COLOR INDEX*/
- int renderType = glxc->pFBConfig->renderType;
- if ( pVisual ) {
- switch ( pVisual->class ){
- case PseudoColor:
- case StaticColor:
- case GrayScale:
- case StaticGray:
- renderType = GLX_COLOR_INDEX_TYPE;
- break;
- case TrueColor:
- case DirectColor:
- default:
- renderType = GLX_RGBA_TYPE;
- break;
- }
- }
- if ( __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- LockDisplay(dpy);
- GetReq(GLXCreateNewContext,be_new_req);
- be_new_req->reqType = dmxScreen->glxMajorOpcode;
- be_new_req->glxCode = X_GLXCreateNewContext;
- be_new_req->context = (unsigned int)glxc->real_ids[screen-from_screen];
- be_new_req->fbconfig = (unsigned int)be_fbconfigId;
- be_new_req->screen = DefaultScreen(dpy);
- be_new_req->renderType = renderType;
-
- be_new_req->shareList = (shareglxc ? shareglxc->real_ids[screen-from_screen] : 0);
- be_new_req->isDirect = 0;
- UnlockDisplay(dpy);
- glxc->real_vids[screen-from_screen] = be_fbconfigId;
- sent = 1;
- }
- else if (glxIsExtensionSupported("GLX_SGIX_fbconfig")) {
-
- xGLXCreateContextWithConfigSGIXReq *ext_req;
- xGLXVendorPrivateReq *vpreq;
- LockDisplay(dpy);
- GetReqExtra(GLXVendorPrivate,
- sz_xGLXCreateContextWithConfigSGIXReq - sz_xGLXVendorPrivateReq,
- vpreq);
- ext_req = (xGLXCreateContextWithConfigSGIXReq *)vpreq;
- ext_req->reqType = dmxScreen->glxMajorOpcode;
- ext_req->glxCode = X_GLXVendorPrivate;
- ext_req->vendorCode = X_GLXvop_CreateContextWithConfigSGIX;
- ext_req->context = (unsigned int)glxc->real_ids[screen-from_screen];
- ext_req->fbconfig = (unsigned int)be_fbconfigId;
- ext_req->screen = DefaultScreen(dpy);
- ext_req->renderType = renderType;
- ext_req->shareList = (shareglxc ? shareglxc->real_ids[screen-from_screen] : 0);
- ext_req->isDirect = 0;
- UnlockDisplay(dpy);
- glxc->real_vids[screen-from_screen] = be_fbconfigId;
- sent = 1;
- }
- }
-
- if (!sent) {
- LockDisplay(dpy);
- GetReq(GLXCreateContext,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXCreateContext;
- be_req->context = (unsigned int)glxc->real_ids[screen-from_screen];
- be_req->visual = (unsigned int)be_vid;
- be_req->screen = DefaultScreen(dpy);
- be_req->shareList = (shareglxc ? shareglxc->real_ids[screen-from_screen] : 0);
- be_req->isDirect = 0;
- UnlockDisplay(dpy);
- glxc->real_vids[screen-from_screen] = be_vid;
- }
- SyncHandle();
-
- }
-
- /*
- ** Register this context as a resource.
- */
- if (!AddResource(gcId, __glXContextRes, (pointer)glxc)) {
- free( glxc->real_ids );
- free( glxc->real_vids );
- free( glxc );
- client->errorValue = gcId;
- return BadAlloc;
- }
-
- /*
- ** Finally, now that everything is working, setup the rest of the
- ** context.
- */
- glxc->id = gcId;
- glxc->share_id = shareList;
- glxc->idExists = GL_TRUE;
- glxc->isCurrent = GL_FALSE;
-
- return Success;
-}
-
-int __glXCreateContext(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc;
-
- return( CreateContext(cl, req->context,req->visual, None,
- req->screen, req->shareList, req->isDirect) );
-
-}
-
-int __glXCreateNewContext(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc;
-
- return( CreateContext(cl, req->context,None, req->fbconfig,
- req->screen, req->shareList, req->isDirect) );
-
-}
-
-int __glXCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXCreateContextWithConfigSGIXReq *req = (xGLXCreateContextWithConfigSGIXReq *) pc;
-
- return( CreateContext(cl, req->context, None, req->fbconfig,
- req->screen, req->shareList, req->isDirect) );
-
-}
-
-int __glXQueryMaxSwapBarriersSGIX(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXQueryMaxSwapBarriersSGIXReq *req =
- (xGLXQueryMaxSwapBarriersSGIXReq *)pc;
- xGLXQueryMaxSwapBarriersSGIXReply reply;
-
- reply.type = X_Reply;
- reply.sequenceNumber = client->sequence;
- reply.length = 0;
- reply.max = QueryMaxSwapBarriersSGIX(req->screen);
-
- if (client->swapped) {
- __glXSwapQueryMaxSwapBarriersSGIXReply(client, &reply);
- } else {
- WriteToClient(client, sz_xGLXQueryMaxSwapBarriersSGIXReply,
- (char *)&reply);
- }
-
- return Success;
-}
-
-int __glXBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXBindSwapBarrierSGIXReq *req = (xGLXBindSwapBarrierSGIXReq *)pc;
- DrawablePtr pDraw;
- __GLXpixmap *pGlxPixmap = NULL;
- __glXWindow *pGlxWindow = NULL;
- int rc;
-
- rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixGetAttrAccess);
- if (rc != Success) {
- dixLookupResourceByType((pointer*) &pGlxPixmap, req->drawable,
- __glXPixmapRes, NullClient, DixUnknownAccess);
- if (pGlxPixmap) pDraw = pGlxPixmap->pDraw;
- }
-
- if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- dixLookupResourceByType((pointer*) &pGlxWindow, req->drawable,
- __glXWindowRes, NullClient, DixUnknownAccess);
- if (pGlxWindow) pDraw = pGlxWindow->pDraw;
- }
-
- if (!pDraw) {
- client->errorValue = req->drawable;
- return __glXBadDrawable;
- }
-
- return BindSwapBarrierSGIX(pDraw, req->barrier);
-}
-
-int __glXJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXJoinSwapGroupSGIXReq *req = (xGLXJoinSwapGroupSGIXReq *)pc;
- DrawablePtr pDraw, pMember = NULL;
- __GLXpixmap *pGlxPixmap = NULL;
- __glXWindow *pGlxWindow = NULL;
- int rc;
-
- rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixManageAccess);
- if (rc != Success) {
- dixLookupResourceByType((pointer*) &pGlxPixmap, req->drawable,
- __glXPixmapRes, NullClient, DixUnknownAccess);
- if (pGlxPixmap) pDraw = pGlxPixmap->pDraw;
- }
-
- if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- dixLookupResourceByType((pointer*) &pGlxWindow, req->drawable,
- __glXWindowRes, NullClient, DixUnknownAccess);
- if (pGlxWindow) pDraw = pGlxWindow->pDraw;
- }
-
- if (!pDraw) {
- client->errorValue = req->drawable;
- return __glXBadDrawable;
- }
-
- if (req->member != None) {
- rc = dixLookupDrawable(&pMember, req->member, client, 0,
- DixGetAttrAccess);
- if (rc != Success) {
- dixLookupResourceByType((pointer*) &pGlxPixmap, req->member,
- __glXPixmapRes, NullClient,
- DixUnknownAccess);
- if (pGlxPixmap) pMember = pGlxPixmap->pDraw;
- }
-
- if (!pMember && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- dixLookupResourceByType((pointer*) &pGlxWindow, req->member,
- __glXWindowRes, NullClient,
- DixUnknownAccess);
- if (pGlxWindow) pMember = pGlxWindow->pDraw;
- }
-
- if (!pMember) {
- client->errorValue = req->member;
- return __glXBadDrawable;
- }
- }
-
- return JoinSwapGroupSGIX(pDraw, pMember);
-}
-
-
-/*
-** Destroy a GL context as an X resource.
-*/
-int __glXDestroyContext(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc;
- xGLXDestroyContextReq *be_req;
- GLXContextID gcId = req->context;
- __GLXcontext *glxc;
- int from_screen = 0;
- int to_screen = 0;
- int s;
-
- dixLookupResourceByType((pointer*) &glxc, gcId, __glXContextRes,
- NullClient, DixUnknownAccess);
- if (glxc) {
- /*
- ** Just free the resource; don't actually destroy the context,
- ** because it might be in use. The
- ** destroy method will be called by the resource destruction routine
- ** if necessary.
- */
- FreeResourceByType(gcId, __glXContextRes, FALSE);
-
- from_screen = to_screen = glxc->pScreen->myNum;
-
- } else {
- client->errorValue = gcId;
- return __glXBadContext;
- }
-
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
- }
-#endif
-
- /*
- * send DestroyContext request to all back-end servers
- */
- for (s=from_screen; s<=to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
-
- LockDisplay(dpy);
- GetReq(GLXDestroyContext,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXDestroyContext;
- be_req->context = glxc->real_ids[s-from_screen];
- UnlockDisplay(dpy);
- SyncHandle();
- }
-
- return Success;
-}
-
-/*****************************************************************************/
-
-/*
-** For each client, the server keeps a table of all the contexts that are
-** current for that client (each thread of a client may have its own current
-** context). These routines add, change, and lookup contexts in the table.
-*/
-
-/*
-** Add a current context, and return the tag that will be used to refer to it.
-*/
-static int AddCurrentContext(__GLXclientState *cl, __GLXcontext *glxc, DrawablePtr pDraw)
-{
- int i;
- int num = cl->numCurrentContexts;
- __GLXcontext **table = cl->currentContexts;
-
- if (!glxc) return -1;
-
- /*
- ** Try to find an empty slot and use it.
- */
- for (i=0; i < num; i++) {
- if (!table[i]) {
- table[i] = glxc;
- return i+1;
- }
- }
- /*
- ** Didn't find a free slot, so we'll have to grow the table.
- */
- if (!num) {
- table = (__GLXcontext **) malloc(sizeof(__GLXcontext *));
- cl->currentDrawables = (DrawablePtr *) malloc(sizeof(DrawablePtr));
- cl->be_currentCTag = (GLXContextTag *) malloc(screenInfo.numScreens *sizeof(GLXContextTag));
- } else {
- table = (__GLXcontext **) realloc(table,
- (num+1)*sizeof(__GLXcontext *));
- cl->currentDrawables = (DrawablePtr *) realloc(
- cl->currentDrawables ,
- (num+1)*sizeof(DrawablePtr));
- cl->be_currentCTag = (GLXContextTag *) realloc(cl->be_currentCTag,
- (num+1)*screenInfo.numScreens*sizeof(GLXContextTag));
- }
- table[num] = glxc;
- cl->currentDrawables[num] = pDraw;
- cl->currentContexts = table;
- cl->numCurrentContexts++;
-
- memset(cl->be_currentCTag + num*screenInfo.numScreens, 0,
- screenInfo.numScreens * sizeof(GLXContextTag));
-
- return num+1;
-}
-
-/*
-** Given a tag, change the current context for the corresponding entry.
-*/
-static void ChangeCurrentContext(__GLXclientState *cl, __GLXcontext *glxc,
- GLXContextTag tag)
-{
- __GLXcontext **table = cl->currentContexts;
- table[tag-1] = glxc;
-}
-
-/*
-** Given a tag, and back-end screen number, retrives the current back-end
-** tag.
-*/
-int GetCurrentBackEndTag(__GLXclientState *cl, GLXContextTag tag, int s)
-{
- if (tag >0) {
- return( cl->be_currentCTag[ (tag-1)*screenInfo.numScreens + s ] );
- }
- else {
- return 0;
- }
-}
-
-/*
-** Given a tag, and back-end screen number, sets the current back-end
-** tag.
-*/
-static void SetCurrentBackEndTag(__GLXclientState *cl, GLXContextTag tag, int s, GLXContextTag be_tag)
-{
- if (tag >0) {
- cl->be_currentCTag[ (tag-1)*screenInfo.numScreens + s ] = be_tag;
- }
-}
-
-/*
-** For this implementation we have chosen to simply use the index of the
-** context's entry in the table as the context tag. A tag must be greater
-** than 0.
-*/
-__GLXcontext *__glXLookupContextByTag(__GLXclientState *cl, GLXContextTag tag)
-{
- int num = cl->numCurrentContexts;
-
- if (tag < 1 || tag > num) {
- return 0;
- } else {
- return cl->currentContexts[tag-1];
- }
-}
-
-DrawablePtr __glXLookupDrawableByTag(__GLXclientState *cl, GLXContextTag tag)
-{
- int num = cl->numCurrentContexts;
-
- if (tag < 1 || tag > num) {
- return 0;
- } else {
- return cl->currentDrawables[tag-1];
- }
-}
-
-/*****************************************************************************/
-
-static void StopUsingContext(__GLXcontext *glxc)
-{
- if (glxc) {
- if (glxc == __glXLastContext) {
- /* Tell server GL library */
- __glXLastContext = 0;
- }
- glxc->isCurrent = GL_FALSE;
- if (!glxc->idExists) {
- __glXFreeContext(glxc);
- }
- }
-}
-
-static void StartUsingContext(__GLXclientState *cl, __GLXcontext *glxc)
-{
- glxc->isCurrent = GL_TRUE;
-}
-
-/*****************************************************************************/
-/*
-** Make an OpenGL context and drawable current.
-*/
-static int MakeCurrent(__GLXclientState *cl,
- GLXDrawable drawable,
- GLXDrawable readdrawable,
- GLXContextID context,
- GLXContextTag oldContextTag)
-{
- ClientPtr client = cl->client;
- DrawablePtr pDraw = NULL;
- DrawablePtr pReadDraw = NULL;
- xGLXMakeCurrentReadSGIReply new_reply;
- xGLXMakeCurrentReq *be_req;
- xGLXMakeCurrentReply be_reply;
- xGLXMakeContextCurrentReq *be_new_req;
- xGLXMakeContextCurrentReply be_new_reply;
- GLXDrawable drawId = drawable;
- GLXDrawable readId = readdrawable;
- GLXContextID contextId = context;
- __GLXpixmap *pGlxPixmap = 0;
- __GLXpixmap *pReadGlxPixmap = 0;
- __GLXcontext *glxc, *prevglxc;
- GLXContextTag tag = oldContextTag;
- WindowPtr pWin = NULL;
- WindowPtr pReadWin = NULL;
- __glXWindow *pGlxWindow = NULL;
- __glXWindow *pGlxReadWindow = NULL;
- __glXPbuffer *pGlxPbuffer = NULL;
- __glXPbuffer *pGlxReadPbuffer = NULL;
-#ifdef PANORAMIX
- PanoramiXRes *pXinDraw = NULL;
- PanoramiXRes *pXinReadDraw = NULL;
-#endif
- int from_screen = 0;
- int to_screen = 0;
- int s, rc;
-
- /*
- ** If one is None and the other isn't, it's a bad match.
- */
- if ((drawId == None && contextId != None) ||
- (drawId != None && contextId == None)) {
- return BadMatch;
- }
-
- /*
- ** Lookup old context. If we have one, it must be in a usable state.
- */
- if (tag != 0) {
- prevglxc = __glXLookupContextByTag(cl, tag);
- if (!prevglxc) {
- /*
- ** Tag for previous context is invalid.
- */
- return __glXBadContextTag;
- }
- } else {
- prevglxc = 0;
- }
-
- /*
- ** Lookup new context. It must not be current for someone else.
- */
- if (contextId != None) {
- dixLookupResourceByType((pointer*) &glxc, contextId, __glXContextRes,
- NullClient, DixUnknownAccess);
- if (!glxc) {
- client->errorValue = contextId;
- return __glXBadContext;
- }
- if ((glxc != prevglxc) && glxc->isCurrent) {
- /* Context is current to somebody else */
- return BadAccess;
- }
- } else {
- /* Switching to no context. Ignore new drawable. */
- glxc = 0;
- }
-
- if (drawId != None) {
- rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixWriteAccess);
- if (rc == Success) {
- if (pDraw->type == DRAWABLE_WINDOW) {
- /*
- ** Drawable is an X Window.
- */
- VisualID vid;
- pWin = (WindowPtr)pDraw;
- vid = wVisual(pWin);
-
- new_reply.writeVid = (glxc->pFBConfig ? glxc->pFBConfig->id : vid);
- new_reply.writeType = GLX_WINDOW_TYPE;
-
- /*
- ** Check if window and context are similar.
- */
- if ((vid != glxc->pVisual->vid) ||
- (pWin->drawable.pScreen != glxc->pScreen)) {
- client->errorValue = drawId;
- return BadMatch;
- }
-
- from_screen = to_screen = pWin->drawable.pScreen->myNum;
-
- } else {
- /*
- ** An X Pixmap is not allowed as a parameter (a GLX Pixmap
- ** is, but it must first be created with glxCreateGLXPixmap).
- */
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
- }
-
- if (!pDraw) {
- dixLookupResourceByType((pointer*) &pGlxPixmap, drawId,
- __glXPixmapRes, NullClient,
- DixUnknownAccess);
- if (pGlxPixmap) {
- /*
- ** Check if pixmap and context are similar.
- */
- if (pGlxPixmap->pScreen != glxc->pScreen ||
- pGlxPixmap->pGlxVisual != glxc->pGlxVisual) {
- client->errorValue = drawId;
- return BadMatch;
- }
- pDraw = pGlxPixmap->pDraw;
-
- new_reply.writeVid = (glxc->pFBConfig ? glxc->pFBConfig->id :
- pGlxPixmap->pGlxVisual->vid);
-
- new_reply.writeType = GLX_PIXMAP_TYPE;
-
- from_screen = to_screen = pGlxPixmap->pScreen->myNum;
-
- }
- }
-
- if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- dixLookupResourceByType((pointer*) &pGlxWindow, drawId,
- __glXWindowRes, NullClient,
- DixUnknownAccess);
- if (pGlxWindow) {
- /*
- ** Drawable is a GLXWindow.
- **
- ** Check if GLX window and context are similar.
- */
- if (pGlxWindow->pScreen != glxc->pScreen ||
- pGlxWindow->pGlxFBConfig != glxc->pFBConfig) {
- client->errorValue = drawId;
- return BadMatch;
- }
-
- pDraw = pGlxWindow->pDraw;
- new_reply.writeVid = pGlxWindow->pGlxFBConfig->id;
- new_reply.writeType = GLX_GLXWINDOW_TYPE;
- }
-
- }
-
- if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- dixLookupResourceByType((pointer*) &pGlxPbuffer, drawId,
- __glXPbufferRes, NullClient,
- DixUnknownAccess);
- if (pGlxPbuffer) {
- if (pGlxPbuffer->pScreen != glxc->pScreen ||
- pGlxPbuffer->pFBConfig != glxc->pFBConfig) {
- client->errorValue = drawId;
- return BadMatch;
- }
-
- pDraw = (DrawablePtr)pGlxPbuffer;
- new_reply.writeVid = pGlxPbuffer->pFBConfig->id;
- new_reply.writeType = GLX_PBUFFER_TYPE;
- }
- }
-
- if (!pDraw) {
- /*
- ** Drawable is not a Window , GLXWindow or a GLXPixmap.
- */
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
-
- } else {
- pDraw = 0;
- }
-
- if (readId != None && readId != drawId ) {
- rc = dixLookupDrawable(&pReadDraw, readId, client, 0, DixReadAccess);
- if (rc == Success) {
- if (pReadDraw->type == DRAWABLE_WINDOW) {
- /*
- ** Drawable is an X Window.
- */
- VisualID vid;
- pReadWin = (WindowPtr)pDraw;
- vid = wVisual(pReadWin);
-
- new_reply.readVid = (glxc->pFBConfig ? glxc->pFBConfig->id : vid);
- new_reply.readType = GLX_WINDOW_TYPE;
-
- /*
- ** Check if window and context are similar.
- */
- if ((vid != glxc->pVisual->vid) ||
- (pReadWin->drawable.pScreen != glxc->pScreen)) {
- client->errorValue = readId;
- return BadMatch;
- }
-
- } else {
-
- /*
- ** An X Pixmap is not allowed as a parameter (a GLX Pixmap
- ** is, but it must first be created with glxCreateGLXPixmap).
- */
- client->errorValue = readId;
- return __glXBadDrawable;
- }
- }
-
- if (!pReadDraw) {
- dixLookupResourceByType((pointer*) &pReadGlxPixmap, readId,
- __glXPixmapRes, NullClient,
- DixUnknownAccess);
- if (pReadGlxPixmap) {
- /*
- ** Check if pixmap and context are similar.
- */
- if (pReadGlxPixmap->pScreen != glxc->pScreen ||
- pReadGlxPixmap->pGlxVisual != glxc->pGlxVisual) {
- client->errorValue = readId;
- return BadMatch;
- }
- pReadDraw = pReadGlxPixmap->pDraw;
-
- new_reply.readVid = (glxc->pFBConfig ? glxc->pFBConfig->id :
- pReadGlxPixmap->pGlxVisual->vid );
- new_reply.readType = GLX_PIXMAP_TYPE;
-
- }
- }
-
- if (!pReadDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- dixLookupResourceByType((pointer*) &pGlxReadWindow, readId,
- __glXWindowRes, NullClient,
- DixUnknownAccess);
- if (pGlxReadWindow) {
- /*
- ** Drawable is a GLXWindow.
- **
- ** Check if GLX window and context are similar.
- */
- if (pGlxReadWindow->pScreen != glxc->pScreen ||
- pGlxReadWindow->pGlxFBConfig != glxc->pFBConfig) {
- client->errorValue = readId;
- return BadMatch;
- }
-
- pReadDraw = pGlxReadWindow->pDraw;
- new_reply.readVid = pGlxReadWindow->pGlxFBConfig->id;
- new_reply.readType = GLX_GLXWINDOW_TYPE;
- }
- }
-
- if (!pReadDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- dixLookupResourceByType((pointer*) &pGlxReadPbuffer, readId,
- __glXPbufferRes, NullClient,
- DixUnknownAccess);
- if (pGlxReadPbuffer) {
- if (pGlxReadPbuffer->pScreen != glxc->pScreen ||
- pGlxReadPbuffer->pFBConfig != glxc->pFBConfig) {
- client->errorValue = drawId;
- return BadMatch;
- }
-
- pReadDraw = (DrawablePtr)pGlxReadPbuffer;
- new_reply.readVid = pGlxReadPbuffer->pFBConfig->id;
- new_reply.readType = GLX_PBUFFER_TYPE;
- }
- }
-
- if (!pReadDraw) {
- /*
- ** Drawable is neither a Window nor a GLXPixmap.
- */
- client->errorValue = readId;
- return __glXBadDrawable;
- }
-
- } else {
- pReadDraw = pDraw;
- pReadGlxPixmap = pGlxPixmap;
- pReadWin = pWin;
- new_reply.readVid = new_reply.writeVid;
- new_reply.readType = new_reply.writeType;
- }
-
- if (prevglxc) {
-
- if (prevglxc->pGlxPixmap) {
- /*
- ** The previous drawable was a glx pixmap, release it.
- */
- prevglxc->pGlxPixmap->refcnt--;
- __glXFreeGLXPixmap( prevglxc->pGlxPixmap );
- prevglxc->pGlxPixmap = 0;
- }
-
- if (prevglxc->pGlxReadPixmap) {
- /*
- ** The previous drawable was a glx pixmap, release it.
- */
- prevglxc->pGlxReadPixmap->refcnt--;
- __glXFreeGLXPixmap( prevglxc->pGlxReadPixmap );
- prevglxc->pGlxReadPixmap = 0;
- }
-
- if (prevglxc->pGlxWindow) {
- /*
- ** The previous drawable was a glx window, release it.
- */
- prevglxc->pGlxWindow->refcnt--;
- __glXFreeGLXWindow( prevglxc->pGlxWindow );
- prevglxc->pGlxWindow = 0;
- }
-
- if (prevglxc->pGlxReadWindow) {
- /*
- ** The previous drawable was a glx window, release it.
- */
- prevglxc->pGlxReadWindow->refcnt--;
- __glXFreeGLXWindow( prevglxc->pGlxReadWindow );
- prevglxc->pGlxReadWindow = 0;
- }
-
- if (prevglxc->pGlxPbuffer) {
- /*
- ** The previous drawable was a glx Pbuffer, release it.
- */
- prevglxc->pGlxPbuffer->refcnt--;
- __glXFreeGLXPbuffer( prevglxc->pGlxPbuffer );
- prevglxc->pGlxPbuffer = 0;
- }
-
- if (prevglxc->pGlxReadPbuffer) {
- /*
- ** The previous drawable was a glx Pbuffer, release it.
- */
- prevglxc->pGlxReadPbuffer->refcnt--;
- __glXFreeGLXPbuffer( prevglxc->pGlxReadPbuffer );
- prevglxc->pGlxReadPbuffer = 0;
- }
-
- ChangeCurrentContext(cl, glxc, tag);
- ChangeCurrentContext(cl, glxc, tag);
- StopUsingContext(prevglxc);
- } else {
- tag = AddCurrentContext(cl, glxc, pDraw);
- }
- if (glxc) {
-
- glxc->pGlxPixmap = pGlxPixmap;
- glxc->pGlxReadPixmap = pReadGlxPixmap;
- glxc->pGlxWindow = pGlxWindow;
- glxc->pGlxReadWindow = pGlxReadWindow;
- glxc->pGlxPbuffer = pGlxPbuffer;
- glxc->pGlxReadPbuffer = pGlxReadPbuffer;
-
- if (pGlxPixmap) {
- pGlxPixmap->refcnt++;
- }
-
- if (pReadGlxPixmap) {
- pReadGlxPixmap->refcnt++;
- }
-
- if (pGlxWindow) {
- pGlxWindow->refcnt++;
- }
-
- if (pGlxReadWindow) {
- pGlxReadWindow->refcnt++;
- }
-
- if (pGlxPbuffer) {
- pGlxPbuffer->refcnt++;
- }
-
- if (pGlxReadPbuffer) {
- pGlxReadPbuffer->refcnt++;
- }
-
- StartUsingContext(cl, glxc);
- new_reply.contextTag = tag;
- } else {
- new_reply.contextTag = 0;
- }
- new_reply.length = 0;
- new_reply.type = X_Reply;
- new_reply.sequenceNumber = client->sequence;
-
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
-
- if (pDraw && new_reply.writeType != GLX_PBUFFER_TYPE) {
- dixLookupResourceByClass((pointer*) &pXinDraw,
- pDraw->id, XRC_DRAWABLE,
- client, DixReadAccess);
- }
-
- if (pReadDraw && pReadDraw != pDraw &&
- new_reply.readType != GLX_PBUFFER_TYPE) {
- dixLookupResourceByClass((pointer*) &pXinReadDraw,
- pReadDraw->id, XRC_DRAWABLE,
- client, DixReadAccess);
- }
- else {
- pXinReadDraw = pXinDraw;
- }
- }
-#endif
-
-
- /* send the MakeCurrent request to all required
- * back-end servers.
- */
- for (s = from_screen; s<=to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
- unsigned int be_draw = None;
- unsigned int be_read_draw = None;
-
- if (pGlxPixmap) {
- be_draw = pGlxPixmap->be_xids[s];
- }
- else if (pGlxPbuffer) {
- be_draw = pGlxPbuffer->be_xids[s];
- }
-#ifdef PANORAMIX
- else if (pXinDraw) {
- dixLookupWindow(&pWin, pXinDraw->info[s].id, client, DixReadAccess);
- }
-#endif
- else if (pGlxWindow) {
- pWin = (WindowPtr)pGlxWindow->pDraw;
- }
-
- if (pWin && be_draw == None) {
- be_draw = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
- if (!be_draw) {
- /* it might be that the window did not created yet on the */
- /* back-end server (lazy window creation option), force */
- /* creation of the window */
- dmxCreateAndRealizeWindow( pWin, TRUE );
- be_draw = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
- }
- }
-
- /*
- * Before sending the MakeCurrent request - sync the
- * X11 connection to the back-end servers to make sure
- * that drawable is already created
- */
- dmxSync( dmxScreen, 1 );
-
- if (drawId == readId) {
- LockDisplay(dpy);
- GetReq(GLXMakeCurrent, be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXMakeCurrent;
- be_req->drawable = be_draw;
- be_req->context = (unsigned int)(glxc ? glxc->real_ids[s-from_screen] : 0);
- be_req->oldContextTag = GetCurrentBackEndTag(cl, tag, s);
- if (!_XReply(dpy, (xReply *) &be_reply, 0, False)) {
-
- /* The make current failed */
- UnlockDisplay(dpy);
- SyncHandle();
- return( BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code) );
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- SetCurrentBackEndTag( cl, tag, s, be_reply.contextTag );
- }
- else {
-
- if (pReadGlxPixmap) {
- be_read_draw = pReadGlxPixmap->be_xids[s];
- }
- else if (pGlxReadPbuffer) {
- be_read_draw = pGlxReadPbuffer->be_xids[s];
- }
-#ifdef PANORAMIX
- else if (pXinReadDraw) {
- dixLookupWindow(&pReadWin, pXinReadDraw->info[s].id, client,
- DixReadAccess);
- }
-#endif
- else if (pGlxReadWindow) {
- pReadWin = (WindowPtr)pGlxReadWindow->pDraw;
- }
-
- if (pReadWin && be_read_draw == None) {
- be_read_draw = (unsigned int)(DMX_GET_WINDOW_PRIV(pReadWin))->window;
- if (!be_read_draw) {
- /* it might be that the window did not created yet on the */
- /* back-end server (lazy window creation option), force */
- /* creation of the window */
- dmxCreateAndRealizeWindow( pReadWin, TRUE );
- be_read_draw = (unsigned int)(DMX_GET_WINDOW_PRIV(pReadWin))->window;
- dmxSync( dmxScreen, 1 );
- }
- }
-
- if ( __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- LockDisplay(dpy);
- GetReq(GLXMakeContextCurrent, be_new_req);
- be_new_req->reqType = dmxScreen->glxMajorOpcode;
- be_new_req->glxCode = X_GLXMakeContextCurrent;
- be_new_req->drawable = be_draw;
- be_new_req->readdrawable = be_read_draw;
- be_new_req->context = (unsigned int)(glxc ? glxc->real_ids[s-from_screen] : 0);
- be_new_req->oldContextTag = GetCurrentBackEndTag(cl, tag, s);
- if (!_XReply(dpy, (xReply *) &be_new_reply, 0, False)) {
-
- /* The make current failed */
- UnlockDisplay(dpy);
- SyncHandle();
- return( BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code) );
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- SetCurrentBackEndTag( cl, tag, s, be_new_reply.contextTag );
- }
- else if (glxIsExtensionSupported("GLX_SGI_make_current_read")) {
- xGLXMakeCurrentReadSGIReq *ext_req;
- xGLXVendorPrivateWithReplyReq *vpreq;
- xGLXMakeCurrentReadSGIReply ext_reply;
-
- LockDisplay(dpy);
- GetReqExtra(GLXVendorPrivateWithReply,
- sz_xGLXMakeCurrentReadSGIReq - sz_xGLXVendorPrivateWithReplyReq,
- vpreq);
- ext_req = (xGLXMakeCurrentReadSGIReq *)vpreq;
- ext_req->reqType = dmxScreen->glxMajorOpcode;
- ext_req->glxCode = X_GLXVendorPrivateWithReply;
- ext_req->vendorCode = X_GLXvop_MakeCurrentReadSGI;
- ext_req->drawable = be_draw;
- ext_req->readable = be_read_draw;
- ext_req->context = (unsigned int)(glxc ? glxc->real_ids[s-from_screen] : 0);
- ext_req->oldContextTag = GetCurrentBackEndTag(cl, tag, s);
- if (!_XReply(dpy, (xReply *) &ext_reply, 0, False)) {
-
- /* The make current failed */
- UnlockDisplay(dpy);
- SyncHandle();
- return( BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code) );
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- SetCurrentBackEndTag( cl, tag, s, ext_reply.contextTag );
-
- }
- else {
- return BadMatch;
- }
- }
-
- XFlush( dpy );
- }
-
- if (client->swapped) {
- __glXSwapMakeCurrentReply(client, &new_reply);
- } else {
- WriteToClient(client, sz_xGLXMakeContextCurrentReply, (char *)&new_reply);
- }
-
- return Success;
-}
-
-int __glXMakeCurrent(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc;
-
- return( MakeCurrent(cl, req->drawable, req->drawable,
- req->context, req->oldContextTag ) );
-}
-
-int __glXMakeContextCurrent(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc;
-
- return( MakeCurrent(cl, req->drawable, req->readdrawable,
- req->context, req->oldContextTag ) );
-}
-
-int __glXMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc;
-
- return( MakeCurrent(cl, req->drawable, req->readable,
- req->context, req->oldContextTag ) );
-}
-
-int __glXIsDirect(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc;
- xGLXIsDirectReply reply;
- __GLXcontext *glxc;
-
- /*
- ** Find the GL context.
- */
- dixLookupResourceByType((pointer*) &glxc, req->context, __glXContextRes,
- NullClient, DixUnknownAccess);
- if (!glxc) {
- client->errorValue = req->context;
- return __glXBadContext;
- }
-
- reply.isDirect = 0;
- reply.length = 0;
- reply.type = X_Reply;
- reply.sequenceNumber = client->sequence;
-
- if (client->swapped) {
- __glXSwapIsDirectReply(client, &reply);
- } else {
- WriteToClient(client, sz_xGLXIsDirectReply, (char *)&reply);
- }
-
- return Success;
-}
-
-int __glXQueryVersion(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
-/* xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc; */
- xGLXQueryVersionReply reply;
-
- /*
- ** Server should take into consideration the version numbers sent by the
- ** client if it wants to work with older clients; however, in this
- ** implementation the server just returns its version number.
- */
- reply.majorVersion = __glXVersionMajor;
- reply.minorVersion = __glXVersionMinor;
- reply.length = 0;
- reply.type = X_Reply;
- reply.sequenceNumber = client->sequence;
-
- if (client->swapped) {
- __glXSwapQueryVersionReply(client, &reply);
- } else {
- WriteToClient(client, sz_xGLXQueryVersionReply, (char *)&reply);
- }
- return Success;
-}
-
-int __glXWaitGL(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXWaitGLReq *req = (xGLXWaitGLReq *)pc;
- xGLXWaitGLReq *be_req = (xGLXWaitGLReq *)pc;
- int from_screen = 0;
- int to_screen = 0;
- int s;
- __GLXcontext *glxc = NULL;
-
- if (req->contextTag != 0) {
- glxc = __glXLookupContextByTag(cl, req->contextTag);
- if (glxc) {
- from_screen = to_screen = glxc->pScreen->myNum;
- }
- }
-
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
- }
-#endif
-
- for (s=from_screen; s<=to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
-
- LockDisplay(dpy);
- GetReq(GLXWaitGL,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXWaitGL;
- be_req->contextTag = (glxc ? GetCurrentBackEndTag(cl,req->contextTag,s) : 0);
- UnlockDisplay(dpy);
- SyncHandle();
-
- XSync(dpy, False);
- }
-
- return Success;
-}
-
-int __glXWaitX(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXWaitXReq *req = (xGLXWaitXReq *)pc;
- xGLXWaitXReq *be_req;
- int from_screen = 0;
- int to_screen = 0;
- int s;
- __GLXcontext *glxc = NULL;
-
- if (req->contextTag != 0) {
- glxc = __glXLookupContextByTag(cl, req->contextTag);
- if (glxc) {
- from_screen = to_screen = glxc->pScreen->myNum;
- }
- }
-
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
- }
-#endif
-
- for (s=from_screen; s<=to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
-
- dmxSync( dmxScreen, 1 );
-
- LockDisplay(dpy);
- GetReq(GLXWaitX,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXWaitX;
- be_req->contextTag = (glxc ? GetCurrentBackEndTag(cl,req->contextTag,s) : 0);
- UnlockDisplay(dpy);
- SyncHandle();
-
- XFlush( dpy );
- }
-
- return Success;
-}
-
-int __glXCopyContext(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXCopyContextReq *be_req;
- xGLXCopyContextReq *req = (xGLXCopyContextReq *) pc;
- GLXContextID source = req->source;
- GLXContextID dest = req->dest;
- GLXContextTag tag = req->contextTag;
- unsigned long mask = req->mask;
- __GLXcontext *src, *dst;
- int s;
- int from_screen = 0;
- int to_screen = 0;
-
- /*
- ** Check that each context exists.
- */
- dixLookupResourceByType((pointer*) &src, source, __glXContextRes,
- NullClient, DixUnknownAccess);
- if (!src) {
- client->errorValue = source;
- return __glXBadContext;
- }
- dixLookupResourceByType((pointer*) &dst, dest, __glXContextRes,
- NullClient, DixUnknownAccess);
- if (!dst) {
- client->errorValue = dest;
- return __glXBadContext;
- }
-
- /*
- ** They must be in the same address space, and same screen.
- */
- if (src->pGlxScreen != dst->pGlxScreen) {
- client->errorValue = source;
- return BadMatch;
- }
-
- /*
- ** The destination context must not be current for any client.
- */
- if (dst->isCurrent) {
- client->errorValue = dest;
- return BadAccess;
- }
-
- if (tag) {
- __GLXcontext *tagcx = __glXLookupContextByTag(cl, tag);
-
- if (!tagcx) {
- return __glXBadContextTag;
- }
- if (tagcx != src) {
- /*
- ** This would be caused by a faulty implementation of the client
- ** library.
- */
- return BadMatch;
- }
- }
-
- from_screen = to_screen = src->pScreen->myNum;
-
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
- }
-#endif
-
- for (s=from_screen; s<=to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
-
- LockDisplay(dpy);
- GetReq(GLXCopyContext,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXCopyContext;
- be_req->source = (unsigned int)src->real_ids[s-from_screen];
- be_req->dest = (unsigned int)dst->real_ids[s-from_screen];
- be_req->mask = mask;
- be_req->contextTag = (tag ? GetCurrentBackEndTag(cl,req->contextTag,s) : 0);
- UnlockDisplay(dpy);
- SyncHandle();
- }
-
- return Success;
-}
-
-int __glXGetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc;
- xGLXGetVisualConfigsReply reply;
- __GLXscreenInfo *pGlxScreen;
- __GLXvisualConfig *pGlxVisual;
- CARD32 buf[__GLX_TOTAL_CONFIG];
- unsigned int screen;
- int i, p;
-
- screen = req->screen;
- if (screen >= screenInfo.numScreens) {
- /* The client library must send a valid screen number. */
- client->errorValue = screen;
- return BadValue;
- }
- pGlxScreen = &__glXActiveScreens[screen];
-
- reply.numVisuals = pGlxScreen->numGLXVisuals;
- reply.numProps = __GLX_TOTAL_CONFIG;
- reply.length = (pGlxScreen->numGLXVisuals * __GLX_SIZE_CARD32 *
- __GLX_TOTAL_CONFIG) >> 2;
- reply.type = X_Reply;
- reply.sequenceNumber = client->sequence;
-
- WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *)&reply);
-
- for (i=0; i < pGlxScreen->numVisuals; i++) {
- pGlxVisual = &pGlxScreen->pGlxVisual[i];
- if (!pGlxScreen->isGLXvis[i] || pGlxVisual->vid == 0) {
- /* not a usable visual */
- continue;
- }
- p = 0;
- buf[p++] = pGlxVisual->vid;
- buf[p++] = pGlxVisual->class;
- buf[p++] = pGlxVisual->rgba;
-
- buf[p++] = pGlxVisual->redSize;
- buf[p++] = pGlxVisual->greenSize;
- buf[p++] = pGlxVisual->blueSize;
- buf[p++] = pGlxVisual->alphaSize;
- buf[p++] = pGlxVisual->accumRedSize;
- buf[p++] = pGlxVisual->accumGreenSize;
- buf[p++] = pGlxVisual->accumBlueSize;
- buf[p++] = pGlxVisual->accumAlphaSize;
-
- buf[p++] = pGlxVisual->doubleBuffer;
- buf[p++] = pGlxVisual->stereo;
-
- buf[p++] = pGlxVisual->bufferSize;
- buf[p++] = pGlxVisual->depthSize;
- buf[p++] = pGlxVisual->stencilSize;
- buf[p++] = pGlxVisual->auxBuffers;
- buf[p++] = pGlxVisual->level;
- /*
- ** Add token/value pairs for extensions.
- */
- buf[p++] = GLX_VISUAL_CAVEAT_EXT;
- buf[p++] = pGlxVisual->visualRating;
- buf[p++] = GLX_TRANSPARENT_TYPE_EXT;
- buf[p++] = pGlxVisual->transparentPixel;
- buf[p++] = GLX_TRANSPARENT_RED_VALUE_EXT;
- buf[p++] = pGlxVisual->transparentRed;
- buf[p++] = GLX_TRANSPARENT_GREEN_VALUE_EXT;
- buf[p++] = pGlxVisual->transparentGreen;
- buf[p++] = GLX_TRANSPARENT_BLUE_VALUE_EXT;
- buf[p++] = pGlxVisual->transparentBlue;
- buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE_EXT;
- buf[p++] = pGlxVisual->transparentAlpha;
- buf[p++] = GLX_TRANSPARENT_INDEX_VALUE_EXT;
- buf[p++] = pGlxVisual->transparentIndex;
- buf[p++] = GLX_SAMPLES_SGIS;
- buf[p++] = pGlxVisual->multiSampleSize;
- buf[p++] = GLX_SAMPLE_BUFFERS_SGIS;
- buf[p++] = pGlxVisual->nMultiSampleBuffers;
- buf[p++] = GLX_VISUAL_SELECT_GROUP_SGIX;
- buf[p++] = pGlxVisual->visualSelectGroup;
-
- WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG,
- (char *)buf);
- }
- return Success;
-}
-
-/*
-** Create a GLX Pixmap from an X Pixmap.
-*/
-static int CreateGLXPixmap(__GLXclientState *cl,
- VisualID visual, GLXFBConfigID fbconfigId,
- int screenNum, XID pixmapId, XID glxpixmapId )
-{
- ClientPtr client = cl->client;
- xGLXCreateGLXPixmapReq *be_req;
- xGLXCreatePixmapReq *be_new_req;
- DrawablePtr pDraw;
- ScreenPtr pScreen;
- VisualPtr pVisual;
- __GLXpixmap *pGlxPixmap;
- __GLXscreenInfo *pGlxScreen;
- __GLXvisualConfig *pGlxVisual;
- __GLXFBConfig *pFBConfig;
- int i, s, rc;
- int from_screen, to_screen;
-#ifdef PANORAMIX
- PanoramiXRes *pXinDraw = NULL;
-#endif
-
- rc = dixLookupDrawable(&pDraw, pixmapId, client, M_DRAWABLE_PIXMAP,
- DixAddAccess);
- if (rc != Success)
- return rc;
-
- /*
- ** Check if screen of visual matches screen of pixmap.
- */
- pScreen = pDraw->pScreen;
- if (screenNum != pScreen->myNum) {
- return BadMatch;
- }
-
- if (fbconfigId == NULL && visual == NULL) {
- return BadValue;
- }
-
- if (fbconfigId != None) {
- pFBConfig = glxLookupFBConfig( fbconfigId );
- if (!pFBConfig) {
- client->errorValue = fbconfigId;
- return BadValue;
- }
- visual = pFBConfig->associatedVisualId;
- }
- else {
- pFBConfig = NULL;
- }
-
- if (visual != None) {
- /*
- ** Find the VisualRec for this visual.
- */
- pVisual = pScreen->visuals;
- for (i=0; i < pScreen->numVisuals; i++, pVisual++) {
- if (pVisual->vid == visual) {
- break;
- }
- }
- if (i == pScreen->numVisuals) {
- client->errorValue = visual;
- return BadValue;
- }
- /*
- ** Check if depth of visual matches depth of pixmap.
- */
- if (pVisual->nplanes != pDraw->depth) {
- client->errorValue = visual;
- return BadMatch;
- }
-
- /*
- ** Get configuration of the visual.
- */
- pGlxScreen = &__glXActiveScreens[screenNum];
- pGlxVisual = pGlxScreen->pGlxVisual;
- for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) {
- if (pGlxVisual->vid == visual) {
- break;
- }
- }
- if (i == pGlxScreen->numVisuals) {
- /*
- ** Visual not support on this screen by this OpenGL implementation.
- */
- client->errorValue = visual;
- return BadValue;
- }
-
-
- /* find the FBConfig for that visual (if any) */
- if ( pFBConfig == NULL ) {
- pFBConfig = glxLookupFBConfigByVID( visual );
-
- if ( pFBConfig == NULL ) {
- /*
- * visual does not have an FBConfig ???
- client->errorValue = visual;
- return BadValue;
- */
- }
- }
- }
- else {
- pVisual = NULL;
- pGlxVisual = NULL;
- }
-
- pGlxPixmap = (__GLXpixmap *) malloc(sizeof(__GLXpixmap));
- if (!pGlxPixmap) {
- return BadAlloc;
- }
- pGlxPixmap->be_xids = (XID *) malloc(sizeof(XID) * screenInfo.numScreens);
- if (!pGlxPixmap->be_xids) {
- free( pGlxPixmap );
- return BadAlloc;
- }
-
- pGlxPixmap->pDraw = pDraw;
- pGlxPixmap->pGlxScreen = pGlxScreen;
- pGlxPixmap->pGlxVisual = pGlxVisual;
- pGlxPixmap->pFBConfig = pFBConfig;
- pGlxPixmap->pScreen = pScreen;
- pGlxPixmap->idExists = True;
- pGlxPixmap->refcnt = 0;
-
- /*
- ** Bump the ref count on the X pixmap so it won't disappear.
- */
- ((PixmapPtr) pDraw)->refcnt++;
-
- /*
- * send the request to the back-end server(s)
- */
- from_screen = to_screen = screenNum;
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
-
- dixLookupResourceByClass((pointer*) &pXinDraw,
- pDraw->id, XRC_DRAWABLE,
- client, DixReadAccess);
- }
-#endif
-
- for (s=from_screen; s<=to_screen; s++) {
-
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
- Pixmap be_pixmap;
- DrawablePtr pRealDraw = pDraw;
-
-#ifdef PANORAMIX
- if (pXinDraw) {
- dixLookupDrawable(&pRealDraw, pXinDraw->info[s].id, client, 0,
- DixAddAccess);
- }
-#endif
-
- be_pixmap = (DMX_GET_PIXMAP_PRIV((PixmapPtr)pRealDraw))->pixmap;
-
- /* make sure pixmap already created on back-end */
- dmxSync( dmxScreen, 1 );
-
- if ( pFBConfig && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- __GLXFBConfig *be_FBConfig = glxLookupBackEndFBConfig( pFBConfig->id, s );
-
- LockDisplay(dpy);
- pGlxPixmap->be_xids[s] = XAllocID(dpy);
- GetReq(GLXCreatePixmap,be_new_req);
- be_new_req->reqType = dmxScreen->glxMajorOpcode;
- be_new_req->glxCode = X_GLXCreatePixmap;
- be_new_req->screen = DefaultScreen(dpy);
- be_new_req->fbconfig = be_FBConfig->id;
- be_new_req->pixmap = (unsigned int)be_pixmap;
- be_new_req->glxpixmap = (unsigned int)pGlxPixmap->be_xids[s];
- be_new_req->numAttribs = 0;
- UnlockDisplay(dpy);
- SyncHandle();
- }
- else if (pFBConfig && glxIsExtensionSupported("GLX_SGIX_fbconfig")) {
- __GLXFBConfig *be_FBConfig = glxLookupBackEndFBConfig( pFBConfig->id, s );
- xGLXCreateGLXPixmapWithConfigSGIXReq *ext_req;
- xGLXVendorPrivateReq *vpreq;
-
- LockDisplay(dpy);
- pGlxPixmap->be_xids[s] = XAllocID(dpy);
- GetReqExtra(GLXVendorPrivate,
- sz_xGLXCreateGLXPixmapWithConfigSGIXReq-sz_xGLXVendorPrivateReq,
- vpreq);
- ext_req = (xGLXCreateGLXPixmapWithConfigSGIXReq *)vpreq;
- ext_req->reqType = dmxScreen->glxMajorOpcode;
- ext_req->glxCode = X_GLXVendorPrivate;
- ext_req->vendorCode = X_GLXvop_CreateGLXPixmapWithConfigSGIX;
- ext_req->screen = DefaultScreen(dpy);
- ext_req->fbconfig = be_FBConfig->id;
- ext_req->pixmap = (unsigned int)be_pixmap;
- ext_req->glxpixmap = (unsigned int)pGlxPixmap->be_xids[s];
- UnlockDisplay(dpy);
- SyncHandle();
- }
- else if (pGlxVisual) {
- LockDisplay(dpy);
- pGlxPixmap->be_xids[s] = XAllocID(dpy);
- GetReq(GLXCreateGLXPixmap,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXCreateGLXPixmap;
- be_req->screen = DefaultScreen(dpy);
- be_req->visual = (unsigned int)glxMatchGLXVisualInConfigList(
- pGlxVisual,
- dmxScreen->glxVisuals,
- dmxScreen->numGlxVisuals );
- be_req->pixmap = (unsigned int)be_pixmap;
- be_req->glxpixmap = (unsigned int)pGlxPixmap->be_xids[s];
- UnlockDisplay(dpy);
- SyncHandle();
- }
- else {
- client->errorValue = ( visual ? visual : fbconfigId );
- free( pGlxPixmap );
- return BadValue;
- }
-
- XFlush( dpy );
- }
-
- if (!(AddResource(glxpixmapId, __glXPixmapRes, pGlxPixmap))) {
- free( pGlxPixmap );
- return BadAlloc;
- }
-
- return Success;
-}
-
-int __glXCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc;
-
- return( CreateGLXPixmap(cl, req->visual, None,
- req->screen, req->pixmap, req->glxpixmap) );
-}
-
-int __glXCreatePixmap(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc;
-
- return( CreateGLXPixmap(cl, None, req->fbconfig,
- req->screen, req->pixmap, req->glxpixmap) );
-}
-
-int __glXDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc;
- XID glxpixmap = req->glxpixmap;
- __GLXpixmap *pGlxPixmap;
- int s;
- int from_screen, to_screen;
-
- /*
- ** Check if it's a valid GLX pixmap.
- */
- dixLookupResourceByType((pointer*) &pGlxPixmap, glxpixmap,
- __glXPixmapRes, NullClient, DixUnknownAccess);
- if (!pGlxPixmap) {
- client->errorValue = glxpixmap;
- return __glXBadPixmap;
- }
- FreeResource(glxpixmap, FALSE);
-
- /*
- * destroy the pixmap on the back-end server(s).
- */
- from_screen = to_screen = pGlxPixmap->pDraw->pScreen->myNum;
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
- }
-#endif
-
- for (s=from_screen; s<=to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
-
- /* make sure pixmap exist in back-end */
- dmxSync( dmxScreen, 1 );
-
- LockDisplay(dpy);
- GetReq(GLXDestroyGLXPixmap,req);
- req->reqType = dmxScreen->glxMajorOpcode;
- req->glxCode = X_GLXDestroyGLXPixmap;
- req->glxpixmap = (unsigned int)pGlxPixmap->be_xids[s];
- UnlockDisplay(dpy);
- SyncHandle();
- }
-
-
- return Success;
-}
-
-/*****************************************************************************/
-
-/*
-** NOTE: There is no portable implementation for swap buffers as of
-** this time that is of value. Consequently, this code must be
-** implemented by somebody other than SGI.
-*/
-int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag)
-{
- ClientPtr client = cl->client;
- DrawablePtr pDraw;
- xGLXSwapBuffersReq *be_req;
- WindowPtr pWin = NULL;
- __GLXpixmap *pGlxPixmap = NULL;
- __GLXcontext *glxc = NULL;
-#ifdef PANORAMIX
- PanoramiXRes *pXinDraw = NULL;
-#endif
- __glXWindow *pGlxWindow = NULL;
- int from_screen = 0;
- int to_screen = 0;
- int s, rc;
-
- /*
- ** Check that the GLX drawable is valid.
- */
- rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixWriteAccess);
- if (rc == Success) {
- from_screen = to_screen = pDraw->pScreen->myNum;
-
- if (pDraw->type == DRAWABLE_WINDOW) {
- /*
- ** Drawable is an X window.
- */
- pWin = (WindowPtr)pDraw;
- } else {
- /*
- ** Drawable is an X pixmap, which is not allowed.
- */
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
- }
-
- if (!pDraw) {
- dixLookupResourceByType((pointer*) &pGlxPixmap, drawId,
- __glXPixmapRes, NullClient, DixUnknownAccess);
- if (pGlxPixmap) {
- /*
- ** Drawable is a GLX pixmap.
- */
- pDraw = pGlxPixmap->pDraw;
- from_screen = to_screen = pGlxPixmap->pScreen->myNum;
- }
- }
-
- if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- dixLookupResourceByType((pointer*) &pGlxWindow, drawId,
- __glXWindowRes, NullClient, DixUnknownAccess);
- if (pGlxWindow) {
- /*
- ** Drawable is a GLXWindow.
- */
- pDraw = pGlxWindow->pDraw;
- from_screen = to_screen = pGlxWindow->pScreen->myNum;
- }
- }
-
- if (!pDraw) {
- /*
- ** Drawable is neither a X window nor a GLX pixmap.
- */
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
-
- if (tag) {
- glxc = __glXLookupContextByTag(cl, tag);
- if (!glxc) {
- return __glXBadContextTag;
- }
- }
-
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
- dixLookupResourceByClass((pointer*) &pXinDraw,
- pDraw->id, XRC_DRAWABLE,
- client, DixReadAccess);
- }
-#endif
-
- /* If requested, send a glFinish to all back-end servers before swapping. */
- if (dmxGLXFinishSwap) {
- for (s=from_screen; s<=to_screen; s++) {
- Display *dpy = GetBackEndDisplay(cl,s);
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- xGLXSingleReq *finishReq;
- xGLXSingleReply reply;
-
-#define X_GLXSingle 0 /* needed by GetReq below */
-
- LockDisplay(dpy);
- GetReq(GLXSingle,finishReq);
- finishReq->reqType = dmxScreen->glxMajorOpcode;
- finishReq->glxCode = X_GLsop_Finish;
- finishReq->contextTag = (tag ? GetCurrentBackEndTag(cl,tag,s) : 0);
- (void) _XReply(dpy, (xReply*) &reply, 0, False);
- UnlockDisplay(dpy);
- SyncHandle();
- }
- }
-
- /* If requested, send an XSync to all back-end servers before swapping. */
- if (dmxGLXSyncSwap) {
- for (s=from_screen; s<=to_screen; s++)
- XSync(GetBackEndDisplay(cl,s), False);
- }
-
-
- /* send the SwapBuffers request to all back-end servers */
-
- for (s=from_screen; s<=to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
- unsigned int be_draw = 0;
-
- if (pGlxPixmap) {
- be_draw = (unsigned int)pGlxPixmap->be_xids[s];
- }
-#ifdef PANORAMIX
- else if (pXinDraw) {
- dixLookupWindow(&pWin, pXinDraw->info[s].id, client, DixReadAccess);
- }
-#endif
- else if (pGlxWindow) {
- pWin = (WindowPtr)pGlxWindow->pDraw;
- }
-
- if (pWin && !be_draw) {
- be_draw = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
- if (!be_draw) {
- /* it might be that the window did not created yet on the */
- /* back-end server (lazy window creation option), force */
- /* creation of the window */
- dmxCreateAndRealizeWindow( pWin, TRUE );
- be_draw = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
- }
- }
-
- dmxSync( dmxScreen, 1 );
-
- LockDisplay(dpy);
- GetReq(GLXSwapBuffers,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXSwapBuffers;
- be_req->drawable = be_draw;
- be_req->contextTag = ( tag ? GetCurrentBackEndTag(cl,tag,s) : 0 );
- UnlockDisplay(dpy);
- SyncHandle();
- XFlush(dpy);
- }
-
- return Success;
-}
-
-int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- DrawablePtr pDraw;
- xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc;
- GLXContextTag tag = req->contextTag;
- XID drawId = req->drawable;
- __GLXpixmap *pGlxPixmap = NULL;
- __GLXcontext *glxc = NULL;
- __glXWindow *pGlxWindow = NULL;
- int rc;
-
- /*
- ** Check that the GLX drawable is valid.
- */
- rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixWriteAccess);
- if (rc == Success) {
- if (pDraw->type != DRAWABLE_WINDOW) {
- /*
- ** Drawable is an X pixmap, which is not allowed.
- */
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
- }
-
- if (!pDraw) {
- dixLookupResourceByType((pointer*) &pGlxPixmap, drawId,
- __glXPixmapRes, NullClient, DixUnknownAccess);
- if (pGlxPixmap) {
- /*
- ** Drawable is a GLX pixmap.
- */
- pDraw = pGlxPixmap->pDraw;
- }
- }
-
- if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- dixLookupResourceByType((pointer*) &pGlxWindow, drawId,
- __glXWindowRes, NullClient, DixUnknownAccess);
- if (pGlxWindow) {
- /*
- ** Drawable is a GLXWindow.
- */
- pDraw = pGlxWindow->pDraw;
- }
- }
-
- if (!pDraw) {
- /*
- ** Drawable is neither a X window nor a GLX pixmap.
- */
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
-
- if (tag) {
- glxc = __glXLookupContextByTag(cl, tag);
- if (!glxc) {
- return __glXBadContextTag;
- }
- }
-
- if (pDraw &&
- pDraw->type == DRAWABLE_WINDOW &&
- DMX_GET_WINDOW_PRIV((WindowPtr)pDraw)->swapGroup) {
- return SGSwapBuffers(cl, drawId, tag, pDraw);
- }
-
- return __glXDoSwapBuffers(cl, drawId, tag);
-}
-
-
-/************************************************************************/
-
-/*
-** Render and Renderlarge are not in the GLX API. They are used by the GLX
-** client library to send batches of GL rendering commands.
-*/
-
-/*
-** Execute all the drawing commands in a request.
-*/
-int __glXRender(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXRenderReq *req;
- xGLXRenderReq *be_req;
- int size;
- __GLXcontext *glxc;
- int from_screen = 0;
- int to_screen = 0;
- int s;
-
- /*
- ** NOTE: much of this code also appears in the byteswapping version of this
- ** routine, __glXSwapRender(). Any changes made here should also be
- ** duplicated there.
- */
-
- req = (xGLXRenderReq *) pc;
-
- glxc = __glXLookupContextByTag(cl, req->contextTag);
- if (!glxc) {
- return 0;
- }
- from_screen = to_screen = glxc->pScreen->myNum;
-
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
- }
-#endif
-
- pc += sz_xGLXRenderReq;
- size = (req->length << 2) - sz_xGLXRenderReq;
-
- /*
- * just forward the request to back-end server(s)
- */
- for (s=from_screen; s<=to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
-
- LockDisplay(dpy);
- GetReq(GLXRender,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXRender;
- be_req->length = req->length;
- be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s);
- _XSend(dpy, (const char *)pc, size);
- UnlockDisplay(dpy);
- SyncHandle();
- }
-
- return Success;
-}
-
-/*
-** Execute a large rendering request (one that spans multiple X requests).
-*/
-int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXRenderLargeReq *req;
- xGLXRenderLargeReq *be_req;
- __GLXcontext *glxc;
- int from_screen = 0;
- int to_screen = 0;
- int s;
-
- /*
- ** NOTE: much of this code also appears in the byteswapping version of this
- ** routine, __glXSwapRenderLarge(). Any changes made here should also be
- ** duplicated there.
- */
-
- req = (xGLXRenderLargeReq *) pc;
- glxc = __glXLookupContextByTag(cl, req->contextTag);
- if (!glxc) {
- return 0;
- }
- from_screen = to_screen = glxc->pScreen->myNum;
-
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
- }
-#endif
-
- pc += sz_xGLXRenderLargeReq;
-
- /*
- * just forward the request to back-end server(s)
- */
- for (s=from_screen; s<=to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
-
- GetReq(GLXRenderLarge,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXRenderLarge;
- be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s);
- be_req->length = req->length;
- be_req->requestNumber = req->requestNumber;
- be_req->requestTotal = req->requestTotal;
- be_req->dataBytes = req->dataBytes;
- Data(dpy, (const char *)pc, req->dataBytes);
- UnlockDisplay(dpy);
- SyncHandle();
-
- }
-
- return Success;
-}
-
-
-/************************************************************************/
-
-int __glXVendorPrivate(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateReq *req;
-
- req = (xGLXVendorPrivateReq *) pc;
-
- switch( req->vendorCode ) {
-
- case X_GLvop_DeleteTexturesEXT:
- return __glXVForwardSingleReq( cl, pc );
- break;
-
- case X_GLXvop_SwapIntervalSGI:
- if (glxIsExtensionSupported("SGI_swap_control")) {
- return __glXVForwardSingleReq( cl, pc );
- }
- else {
- return Success;
- }
- break;
-
-#if 0 /* glx 1.3 */
- case X_GLXvop_CreateGLXVideoSourceSGIX:
- break;
- case X_GLXvop_DestroyGLXVideoSourceSGIX:
- break;
- case X_GLXvop_CreateGLXPixmapWithConfigSGIX:
- break;
- case X_GLXvop_DestroyGLXPbufferSGIX:
- break;
- case X_GLXvop_ChangeDrawableAttributesSGIX:
- break;
-#endif
-
- case X_GLXvop_BindSwapBarrierSGIX:
- return __glXBindSwapBarrierSGIX( cl, pc );
- break;
-
- case X_GLXvop_JoinSwapGroupSGIX:
- return __glXJoinSwapGroupSGIX( cl, pc );
- break;
-
- case X_GLXvop_CreateContextWithConfigSGIX:
- return __glXCreateContextWithConfigSGIX( cl, pc );
- break;
-
- default:
- /*
- ** unsupported private request
- */
- cl->client->errorValue = req->vendorCode;
- return __glXUnsupportedPrivateRequest;
- }
-
- cl->client->errorValue = req->vendorCode;
- return __glXUnsupportedPrivateRequest;
-
-}
-
-int __glXVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXVendorPrivateWithReplyReq *req;
-
- req = (xGLXVendorPrivateWithReplyReq *) pc;
-
- switch( req->vendorCode ) {
-
- case X_GLvop_GetConvolutionFilterEXT:
- case X_GLvop_GetConvolutionParameterfvEXT:
- case X_GLvop_GetConvolutionParameterivEXT:
- case X_GLvop_GetSeparableFilterEXT:
- case X_GLvop_GetHistogramEXT:
- case X_GLvop_GetHistogramParameterivEXT:
- case X_GLvop_GetMinmaxEXT:
- case X_GLvop_GetMinmaxParameterfvEXT:
- case X_GLvop_GetMinmaxParameterivEXT:
- case X_GLvop_AreTexturesResidentEXT:
- case X_GLvop_IsTextureEXT:
- return( __glXVForwardPipe0WithReply(cl, pc) );
- break;
-
- case X_GLvop_GenTexturesEXT:
- return( __glXVForwardAllWithReply(cl, pc) );
- break;
-
-
-#if 0 /* glx1.3 */
- case X_GLvop_GetDetailTexFuncSGIS:
- case X_GLvop_GetSharpenTexFuncSGIS:
- case X_GLvop_GetColorTableSGI:
- case X_GLvop_GetColorTableParameterfvSGI:
- case X_GLvop_GetColorTableParameterivSGI:
- case X_GLvop_GetTexFilterFuncSGIS:
- case X_GLvop_GetInstrumentsSGIX:
- case X_GLvop_InstrumentsBufferSGIX:
- case X_GLvop_PollInstrumentsSGIX:
- case X_GLvop_FlushRasterSGIX:
- case X_GLXvop_CreateGLXPbufferSGIX:
- case X_GLXvop_GetDrawableAttributesSGIX:
- case X_GLXvop_QueryHyperpipeNetworkSGIX:
- case X_GLXvop_QueryHyperpipeConfigSGIX:
- case X_GLXvop_HyperpipeConfigSGIX:
- case X_GLXvop_DestroyHyperpipeConfigSGIX:
-#endif
- case X_GLXvop_QueryMaxSwapBarriersSGIX:
- return( __glXQueryMaxSwapBarriersSGIX(cl, pc) );
- break;
-
- case X_GLXvop_GetFBConfigsSGIX:
- return( __glXGetFBConfigsSGIX(cl, pc) );
- break;
-
- case X_GLXvop_MakeCurrentReadSGI:
- return( __glXMakeCurrentReadSGI(cl, pc) );
- break;
-
- case X_GLXvop_QueryContextInfoEXT:
- return( __glXQueryContextInfoEXT(cl,pc) );
- break;
-
- default:
- /*
- ** unsupported private request
- */
- cl->client->errorValue = req->vendorCode;
- return __glXUnsupportedPrivateRequest;
- }
-
-}
-
-int __glXQueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXQueryExtensionsStringReq *req = (xGLXQueryExtensionsStringReq *) pc;
- xGLXQueryExtensionsStringReply reply;
- GLint screen;
- size_t length;
- int len, numbytes;
- char *be_buf;
-
-#ifdef FWD_QUERY_REQ
- xGLXQueryExtensionsStringReq *be_req;
- xGLXQueryExtensionsStringReply be_reply;
- DMXScreenInfo *dmxScreen;
- Display *dpy;
- int slop;
-#endif
-
- screen = req->screen;
-
- /*
- ** Check if screen exists.
- */
- if ((screen < 0) || (screen >= screenInfo.numScreens)) {
- client->errorValue = screen;
- return BadValue;
- }
-
-#ifdef FWD_QUERY_REQ
- dmxScreen = &dmxScreens[screen];
-
- /* Send the glXQueryServerString request */
- dpy = GetBackEndDisplay(cl,screen);
- LockDisplay(dpy);
- GetReq(GLXQueryExtensionsString,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXQueryServerString;
- be_req->screen = DefaultScreen(dpy);
- _XReply(dpy, (xReply*) &be_reply, 0, False);
- len = (int)be_reply.length;
- numbytes = (int)be_reply.n;
- slop = numbytes * __GLX_SIZE_INT8 & 3;
- be_buf = (char *)malloc(numbytes);
- if (!be_buf) {
- /* Throw data on the floor */
- _XEatData(dpy, len);
- } else {
- _XRead(dpy, (char *)be_buf, numbytes);
- if (slop) _XEatData(dpy,4-slop);
- }
- UnlockDisplay(dpy);
- SyncHandle();
-
-#else
-
- be_buf = __glXGetServerString(GLX_EXTENSIONS);
- numbytes = strlen(be_buf) + 1;
- len = __GLX_PAD(numbytes) >> 2;
-
-#endif
-
- length = len;
- reply.type = X_Reply;
- reply.sequenceNumber = client->sequence;
- reply.length = len;
- reply.n = numbytes;
-
- if (client->swapped) {
- glxSwapQueryExtensionsStringReply(client, &reply, be_buf);
- } else {
- WriteToClient(client, sz_xGLXQueryExtensionsStringReply,(char *)&reply);
- WriteToClient(client, (int)(length << 2), (char *)be_buf);
- }
-
- return Success;
-}
-
-int __glXQueryServerString(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) pc;
- xGLXQueryServerStringReply reply;
- int name;
- GLint screen;
- size_t length;
- int len, numbytes;
- char *be_buf;
-#ifdef FWD_QUERY_REQ
- xGLXQueryServerStringReq *be_req;
- xGLXQueryServerStringReply be_reply;
- DMXScreenInfo *dmxScreen;
- Display *dpy;
- int slop;
-#endif
-
- name = req->name;
- screen = req->screen;
- /*
- ** Check if screen exists.
- */
- if ((screen < 0) || (screen >= screenInfo.numScreens)) {
- client->errorValue = screen;
- return BadValue;
- }
-
-#ifdef FWD_QUERY_REQ
- dmxScreen = &dmxScreens[screen];
-
- /* Send the glXQueryServerString request */
- dpy = GetBackEndDisplay(cl,screen);
- LockDisplay(dpy);
- GetReq(GLXQueryServerString,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXQueryServerString;
- be_req->screen = DefaultScreen(dpy);
- be_req->name = name;
- _XReply(dpy, (xReply*) &be_reply, 0, False);
- len = (int)be_reply.length;
- numbytes = (int)be_reply.n;
- slop = numbytes * __GLX_SIZE_INT8 & 3;
- be_buf = (char *)malloc(numbytes);
- if (!be_buf) {
- /* Throw data on the floor */
- _XEatData(dpy, len);
- } else {
- _XRead(dpy, (char *)be_buf, numbytes);
- if (slop) _XEatData(dpy,4-slop);
- }
- UnlockDisplay(dpy);
- SyncHandle();
-
-#else
- be_buf = __glXGetServerString(name);
- numbytes = strlen(be_buf) + 1;
- len = __GLX_PAD(numbytes) >> 2;
-#endif
-
- length = len;
- reply.type = X_Reply;
- reply.sequenceNumber = client->sequence;
- reply.length = length;
- reply.n = numbytes;
-
- if (client->swapped) {
- glxSwapQueryServerStringReply(client, &reply, be_buf);
- } else {
- WriteToClient(client, sz_xGLXQueryServerStringReply, (char *)&reply);
- WriteToClient(client, (int)(length << 2), be_buf);
- }
-
- return Success;
-}
-
-int __glXClientInfo(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXClientInfoReq *req = (xGLXClientInfoReq *) pc;
- xGLXClientInfoReq *be_req;
- const char *buf;
- int from_screen = 0;
- int to_screen = 0;
- int s;
-
- cl->GLClientmajorVersion = req->major;
- cl->GLClientminorVersion = req->minor;
- free(cl->GLClientextensions);
- buf = (const char *)(req+1);
- cl->GLClientextensions = strdup(buf);
-
- to_screen = screenInfo.numScreens - 1;
-
- for (s=from_screen; s<=to_screen; s++)
- {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
-
- LockDisplay(dpy);
- GetReq(GLXClientInfo,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXClientInfo;
- be_req->major = req->major;
- be_req->minor = req->minor;
- be_req->length = req->length;
- be_req->numbytes = req->numbytes;
- Data(dpy, buf, req->numbytes);
-
- UnlockDisplay(dpy);
- SyncHandle();
- }
-
- return Success;
-}
-
-int __glXUseXFont(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXUseXFontReq *req;
- xGLXUseXFontReq *be_req;
- FontPtr pFont;
- __GLXcontext *glxc = NULL;
- int from_screen = 0;
- int to_screen = 0;
- int s;
- dmxFontPrivPtr pFontPriv;
- DMXScreenInfo *dmxScreen;
- Display *dpy;
-
- req = (xGLXUseXFontReq *) pc;
-
- if (req->contextTag != 0) {
- glxc = __glXLookupContextByTag(cl, req->contextTag);
- if (glxc) {
- from_screen = to_screen = glxc->pScreen->myNum;
- }
- }
-
- /*
- ** Font can actually be either the ID of a font or the ID of a GC
- ** containing a font.
- */
- dixLookupResourceByType((pointer*) &pFont, req->font, RT_FONT,
- NullClient, DixUnknownAccess);
- if (!pFont) {
- GC *pGC;
- dixLookupResourceByType((pointer*) &pGC, req->font,
- RT_GC, NullClient,
- DixUnknownAccess);
- if (!pGC) {
- client->errorValue = req->font;
- return BadFont;
- }
- pFont = pGC->font;
- }
-
- pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex);
-
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
- }
-#endif
-
-
- for (s=from_screen; s<=to_screen; s++) {
- dmxScreen = &dmxScreens[s];
- dpy = GetBackEndDisplay(cl,s);
-
- dmxSync( dmxScreen, 1 );
-
- LockDisplay(dpy);
- GetReq(GLXUseXFont,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXUseXFont;
- be_req->contextTag = (glxc ? GetCurrentBackEndTag(cl,req->contextTag,s) : 0);
- be_req->font = pFontPriv->font[s]->fid;
- be_req->first = req->first;
- be_req->count = req->count;
- be_req->listBase = req->listBase;
- UnlockDisplay(dpy);
- SyncHandle();
-
- XSync( dpy, False );
- }
-
- return Success;
-}
-
-/*
- * start GLX 1.3 here
- */
-
-int __glXGetFBConfigs(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc;
- xGLXGetFBConfigsReply reply;
- __GLXFBConfig *pFBConfig;
- CARD32 buf[2 * __GLX_TOTAL_FBCONFIG_PROPS];
- int numAttribs = __GLX_TOTAL_FBCONFIG_PROPS;
- unsigned int screen = req->screen;
- int numFBConfigs, i, p;
- __GLXscreenInfo *pGlxScreen;
-
- if (screen >= screenInfo.numScreens) {
- /* The client library must send a valid screen number. */
- client->errorValue = screen;
- return BadValue;
- }
-
- pGlxScreen = &__glXActiveScreens[screen];
- numFBConfigs = __glXNumFBConfigs;
-
- reply.numFBConfigs = numFBConfigs;
- reply.numAttribs = numAttribs;
- reply.length = (numFBConfigs * 2 * numAttribs * __GLX_SIZE_CARD32) >> 2;
- reply.type = X_Reply;
- reply.sequenceNumber = client->sequence;
-
- if (client->swapped) {
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_SHORT(&reply.sequenceNumber);
- __GLX_SWAP_INT(&reply.length);
- __GLX_SWAP_INT(&reply.numFBConfigs);
- __GLX_SWAP_INT(&reply.numAttribs);
- }
- WriteToClient(client, sz_xGLXGetFBConfigsReply, (char *)&reply);
-
- for (i=0; i < numFBConfigs; i++) {
- int associatedVisualId = 0;
- int drawableTypeIndex;
- pFBConfig = __glXFBConfigs[ i * (screenInfo.numScreens+1) ];
-
- p = 0;
- /* core attributes */
- buf[p++] = GLX_FBCONFIG_ID;
- buf[p++] = pFBConfig->id;
- buf[p++] = GLX_BUFFER_SIZE;
- buf[p++] = pFBConfig->indexBits;
- buf[p++] = GLX_LEVEL;
- buf[p++] = pFBConfig->level;
- buf[p++] = GLX_DOUBLEBUFFER;
- buf[p++] = pFBConfig->doubleBufferMode;
- buf[p++] = GLX_STEREO;
- buf[p++] = pFBConfig->stereoMode;
- buf[p++] = GLX_AUX_BUFFERS;
- buf[p++] = pFBConfig->maxAuxBuffers;
- buf[p++] = GLX_RED_SIZE;
- buf[p++] = pFBConfig->redBits;
- buf[p++] = GLX_GREEN_SIZE;
- buf[p++] = pFBConfig->greenBits;
- buf[p++] = GLX_BLUE_SIZE;
- buf[p++] = pFBConfig->blueBits;
- buf[p++] = GLX_ALPHA_SIZE;
- buf[p++] = pFBConfig->alphaBits;
- buf[p++] = GLX_DEPTH_SIZE;
- buf[p++] = pFBConfig->depthBits;
- buf[p++] = GLX_STENCIL_SIZE;
- buf[p++] = pFBConfig->stencilBits;
- buf[p++] = GLX_ACCUM_RED_SIZE;
- buf[p++] = pFBConfig->accumRedBits;
- buf[p++] = GLX_ACCUM_GREEN_SIZE;
- buf[p++] = pFBConfig->accumGreenBits;
- buf[p++] = GLX_ACCUM_BLUE_SIZE;
- buf[p++] = pFBConfig->accumBlueBits;
- buf[p++] = GLX_ACCUM_ALPHA_SIZE;
- buf[p++] = pFBConfig->accumAlphaBits;
- buf[p++] = GLX_RENDER_TYPE;
- buf[p++] = pFBConfig->renderType;
- buf[p++] = GLX_DRAWABLE_TYPE;
- drawableTypeIndex = p;
- buf[p++] = pFBConfig->drawableType;
- buf[p++] = GLX_X_VISUAL_TYPE;
- buf[p++] = pFBConfig->visualType;
- buf[p++] = GLX_CONFIG_CAVEAT;
- buf[p++] = pFBConfig->visualCaveat;
- buf[p++] = GLX_TRANSPARENT_TYPE;
- buf[p++] = pFBConfig->transparentType;
- buf[p++] = GLX_TRANSPARENT_RED_VALUE;
- buf[p++] = pFBConfig->transparentRed;
- buf[p++] = GLX_TRANSPARENT_GREEN_VALUE;
- buf[p++] = pFBConfig->transparentGreen;
- buf[p++] = GLX_TRANSPARENT_BLUE_VALUE;
- buf[p++] = pFBConfig->transparentBlue;
- buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE;
- buf[p++] = pFBConfig->transparentAlpha;
- buf[p++] = GLX_TRANSPARENT_INDEX_VALUE;
- buf[p++] = pFBConfig->transparentIndex;
- buf[p++] = GLX_MAX_PBUFFER_WIDTH;
- buf[p++] = pFBConfig->maxPbufferWidth;
- buf[p++] = GLX_MAX_PBUFFER_HEIGHT;
- buf[p++] = pFBConfig->maxPbufferHeight;
- buf[p++] = GLX_MAX_PBUFFER_PIXELS;
- buf[p++] = pFBConfig->maxPbufferPixels;
-
- /*
- * find the visual of the back-end server and match a visual
- * on the proxy.
- * do only once - if a visual is not yet associated.
- */
- if (pFBConfig->associatedVisualId == (unsigned int)-1) {
- DMXScreenInfo *dmxScreen = &dmxScreens[screen];
- __GLXFBConfig *be_pFBConfig = __glXFBConfigs[ i * (screenInfo.numScreens+1)+screen+1 ];
- __GLXvisualConfig *pGlxVisual = NULL;
- int v;
- int found = 0;
- for (v=0; v<dmxScreen->numGlxVisuals; v++) {
- if (dmxScreen->glxVisuals[v].vid == be_pFBConfig->associatedVisualId) {
- pGlxVisual = &dmxScreen->glxVisuals[v];
- break;
- }
- }
-
- if (pGlxVisual) {
- for (v=0; v<pGlxScreen->numVisuals; v++) {
- if (glxVisualsMatch(&pGlxScreen->pGlxVisual[v], pGlxVisual)) {
- associatedVisualId = pGlxScreen->pGlxVisual[v].vid;
- found = 1;
- break;
- }
- }
- }
-
- if (!found) {
- associatedVisualId = 0;
- pFBConfig->drawableType &= ~(GLX_WINDOW_BIT);
- buf[drawableTypeIndex] = pFBConfig->drawableType;
- }
-#ifdef PANORAMIX
- else if (!noPanoramiXExtension) {
- /* convert the associated visualId to the panoramix one */
- pFBConfig->associatedVisualId =
- PanoramiXTranslateVisualID(screen, v);
- }
-#endif
- }
- else {
- associatedVisualId = pFBConfig->associatedVisualId;
- }
-
- buf[p++] = GLX_VISUAL_ID;
- buf[p++] = associatedVisualId;
-
- /* SGIS_multisample attributes */
- buf[p++] = GLX_SAMPLES_SGIS;
- buf[p++] = pFBConfig->multiSampleSize;
- buf[p++] = GLX_SAMPLE_BUFFERS_SGIS;
- buf[p++] = pFBConfig->nMultiSampleBuffers;
-
- /* SGIX_pbuffer specific attributes */
- buf[p++] = GLX_OPTIMAL_PBUFFER_WIDTH_SGIX;
- buf[p++] = pFBConfig->optimalPbufferWidth;
- buf[p++] = GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX;
- buf[p++] = pFBConfig->optimalPbufferHeight;
-
- buf[p++] = GLX_VISUAL_SELECT_GROUP_SGIX;
- buf[p++] = pFBConfig->visualSelectGroup;
-
- if (client->swapped) {
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT_ARRAY((int *)buf, 2*numAttribs);
- }
- WriteToClient(client, 2*numAttribs * __GLX_SIZE_CARD32, (char *)buf);
- }
- return Success;
-}
-
-int __glXGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *)pc;
- xGLXGetFBConfigsReq new_req;
-
- new_req.reqType = req->reqType;
- new_req.glxCode = req->glxCode;
- new_req.length = req->length;
- new_req.screen = req->screen;
-
- return( __glXGetFBConfigs( cl, (GLbyte *)&new_req ) );
-}
-
-
-int __glXCreateWindow(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc;
- int screen = req->screen;
- GLXFBConfigID fbconfigId = req->fbconfig;
- XID windowId = req->window;
- XID glxwindowId = req->glxwindow;
- DrawablePtr pDraw;
- ScreenPtr pScreen;
- __glXWindow *pGlxWindow;
- __GLXFBConfig *pGlxFBConfig = NULL;
- VisualPtr pVisual;
- VisualID visId;
- int i, rc;
- pointer val;
-
- /*
- ** Check if windowId is valid
- */
- rc = dixLookupDrawable(&pDraw, windowId, client, M_DRAWABLE_WINDOW,
- DixAddAccess);
- if (rc != Success)
- return rc;
-
- /*
- ** Check if screen of window matches screen of fbconfig.
- */
- pScreen = pDraw->pScreen;
- if (screen != pScreen->myNum) {
- return BadMatch;
- }
-
- /*
- ** Find the FBConfigRec for this fbconfigid.
- */
- if (!(pGlxFBConfig = glxLookupFBConfig(fbconfigId))) {
- client->errorValue = fbconfigId;
- return __glXBadFBConfig;
- }
- visId = pGlxFBConfig->associatedVisualId;
-
- /*
- ** Check if the fbconfig supports rendering to windows
- */
- if( !(pGlxFBConfig->drawableType & GLX_WINDOW_BIT) ) {
- return BadMatch;
- }
-
- if (visId != None) {
- /*
- ** Check if the visual ID is valid for this screen.
- */
- pVisual = pScreen->visuals;
- for (i = 0; i < pScreen->numVisuals; i++, pVisual++) {
- if (pVisual->vid == visId) {
- break;
- }
- }
- if (i == pScreen->numVisuals) {
- client->errorValue = visId;
- return BadValue;
- }
-
- /*
- ** Check if color buffer depth of fbconfig matches depth
- ** of window.
- */
- if (pVisual->nplanes != pDraw->depth) {
- return BadMatch;
- }
- } else
- /*
- ** The window was created with no visual that corresponds
- ** to fbconfig
- */
- return BadMatch;
-
- /*
- ** Check if there is already a fbconfig associated with this window
- */
- if (Success == dixLookupResourceByType(&val,
- glxwindowId, __glXWindowRes,
- NullClient, DixUnknownAccess)) {
- client->errorValue = glxwindowId;
- return BadAlloc;
- }
-
- pGlxWindow = (__glXWindow *) malloc(sizeof(__glXWindow));
- if (!pGlxWindow) {
- return BadAlloc;
- }
-
- /*
- ** Register this GLX window as a resource
- */
- if (!(AddResource(glxwindowId, __glXWindowRes, pGlxWindow))) {
- return BadAlloc;
- }
-
- pGlxWindow->pDraw = pDraw;
- pGlxWindow->type = GLX_GLXWINDOW_TYPE;
- pGlxWindow->idExists = True;
- pGlxWindow->refcnt = 0;
- pGlxWindow->pGlxFBConfig = pGlxFBConfig;
- pGlxWindow->pScreen = pScreen;
-
- return Success;
-}
-
-int __glXDestroyWindow(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc;
- XID glxwindow = req->glxwindow;
- pointer val;
-
- /*
- ** Check if it's a valid GLX window.
- */
- if (Success != dixLookupResourceByType(&val,
- glxwindow, __glXWindowRes,
- NullClient, DixUnknownAccess)) {
- client->errorValue = glxwindow;
- return __glXBadDrawable;
- }
- /*
- ** The glx window destructor will check whether it's current before
- ** freeing anything.
- */
- FreeResource(glxwindow, RT_NONE);
-
- return Success;
-}
-
-int __glXQueryContext(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- __GLXcontext *ctx;
- xGLXQueryContextReq *req;
- xGLXQueryContextReply reply;
- int nProps;
- int *sendBuf, *pSendBuf;
- int nReplyBytes;
-
- req = (xGLXQueryContextReq *)pc;
- dixLookupResourceByType((pointer*) &ctx, req->context, __glXContextRes,
- NullClient, DixUnknownAccess);
- if (!ctx) {
- client->errorValue = req->context;
- return __glXBadContext;
- }
-
- nProps = 3;
-
- reply.length = nProps << 1;
- reply.type = X_Reply;
- reply.sequenceNumber = client->sequence;
- reply.n = nProps;
-
- nReplyBytes = reply.length << 2;
- sendBuf = (int *)malloc(nReplyBytes);
- pSendBuf = sendBuf;
- *pSendBuf++ = GLX_FBCONFIG_ID;
- *pSendBuf++ = (int)(ctx->pFBConfig->id);
- *pSendBuf++ = GLX_RENDER_TYPE;
- *pSendBuf++ = (int)(ctx->pFBConfig->renderType);
- *pSendBuf++ = GLX_SCREEN;
- *pSendBuf++ = (int)(ctx->pScreen->myNum);
-
- if (client->swapped) {
- __glXSwapQueryContextReply(client, &reply, sendBuf);
- } else {
- WriteToClient(client, sz_xGLXQueryContextReply, (char *)&reply);
- WriteToClient(client, nReplyBytes, (char *)sendBuf);
- }
- free((char *)sendBuf);
-
- return Success;
-}
-
-int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- __GLXcontext *ctx;
- xGLXQueryContextInfoEXTReq *req;
- xGLXQueryContextInfoEXTReply reply;
- int nProps;
- int *sendBuf, *pSendBuf;
- int nReplyBytes;
-
- req = (xGLXQueryContextInfoEXTReq *)pc;
- dixLookupResourceByType((pointer*) &ctx,
- req->context, __glXContextRes,
- client, DixReadAccess);
-
- if (!ctx) {
- client->errorValue = req->context;
- return __glXBadContext;
- }
-
- nProps = 4;
-
- reply.length = nProps << 1;
- reply.type = X_Reply;
- reply.sequenceNumber = client->sequence;
- reply.n = nProps;
-
- nReplyBytes = reply.length << 2;
- sendBuf = (int *)malloc(nReplyBytes);
- pSendBuf = sendBuf;
- *pSendBuf++ = GLX_SHARE_CONTEXT_EXT;
- *pSendBuf++ = (int)(ctx->share_id);
- *pSendBuf++ = GLX_VISUAL_ID_EXT;
- *pSendBuf++ = (int)(ctx->pVisual ? ctx->pVisual->vid : 0);
- *pSendBuf++ = GLX_SCREEN_EXT;
- *pSendBuf++ = (int)(ctx->pScreen->myNum);
- *pSendBuf++ = GLX_FBCONFIG_ID;
- *pSendBuf++ = (int)(ctx->pFBConfig ? ctx->pFBConfig->id : 0);
-
- if (client->swapped) {
- __glXSwapQueryContextInfoEXTReply(client, &reply, sendBuf);
- } else {
- WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *)&reply);
- WriteToClient(client, nReplyBytes, (char *)sendBuf);
- }
- free((char *)sendBuf);
-
- return Success;
-}
-
-int __glXCreatePbuffer(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *)pc;
- xGLXCreatePbufferReq *be_req;
- int screen = req->screen;
- GLXFBConfigID fbconfigId = req->fbconfig;
- GLXPbuffer pbuffer = req->pbuffer;
- __glXPbuffer *pGlxPbuffer;
- int numAttribs = req->numAttribs;
- int *attr;
- ScreenPtr pScreen;
- __GLXFBConfig *pGlxFBConfig;
- __GLXFBConfig *be_pGlxFBConfig;
- XID be_xid;
- Display *dpy;
- DMXScreenInfo *dmxScreen;
- int s;
- int from_screen, to_screen;
-
- /*
- ** Look up screen and FBConfig.
- */
- if (screen >= screenInfo.numScreens) {
- /* The client library must send a valid screen number. */
- client->errorValue = screen;
- return BadValue;
- }
- pScreen = screenInfo.screens[screen];
-
- /*
- ** Find the FBConfigRec for this fbconfigid.
- */
- if (!(pGlxFBConfig = glxLookupFBConfig(fbconfigId))) {
- client->errorValue = fbconfigId;
- return __glXBadFBConfig;
- }
-
- /*
- ** Create the GLX part of the Pbuffer.
- */
- pGlxPbuffer = (__glXPbuffer *) malloc(sizeof(__glXPbuffer));
- if (!pGlxPbuffer) {
- return BadAlloc;
- }
-
- pGlxPbuffer->be_xids = (XID *) malloc( sizeof(XID) * screenInfo.numScreens );
- if (!pGlxPbuffer->be_xids) {
- free(pGlxPbuffer);
- return BadAlloc;
- }
-
- /*
- * Allocate an XID on the back-end server(s) and send him the request
- */
- from_screen = to_screen = screen;
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
- }
-#endif
-
- for (s=from_screen; s<=to_screen; s++) {
- dpy = GetBackEndDisplay(cl,s);
- be_xid = XAllocID(dpy);
- dmxScreen = &dmxScreens[s];
- be_pGlxFBConfig = glxLookupBackEndFBConfig( pGlxFBConfig->id, s );
-
- attr = (int *)( req+1 );
-
- LockDisplay(dpy);
- GetReqExtra(GLXCreatePbuffer, 2 * numAttribs * __GLX_SIZE_CARD32, be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXCreatePbuffer;
- be_req->screen = be_pGlxFBConfig->screen;
- be_req->fbconfig = be_pGlxFBConfig->id;
- be_req->pbuffer = be_xid;
- be_req->numAttribs = numAttribs;
-
- /* Send attributes */
- if ( attr != NULL ) {
- CARD32 *pc = (CARD32 *)(be_req + 1);
-
- while (numAttribs-- > 0) {
- *pc++ = *attr++; /* token */
- *pc++ = *attr++; /* value */
- }
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- pGlxPbuffer->be_xids[s] = be_xid;
- }
-
-
- pGlxPbuffer->idExists = True;
- pGlxPbuffer->refcnt = 0;
- pGlxPbuffer->pFBConfig = pGlxFBConfig;
- pGlxPbuffer->pScreen = pScreen;
-
- /*
- ** Register the resource.
- */
- if (!(AddResource(pbuffer, __glXPbufferRes, pGlxPbuffer))) {
- return BadAlloc;
- }
-
- return Success;
-
-}
-
-int __glXDestroyPbuffer(__GLXclientState *cl, GLbyte *pc)
-{
- ClientPtr client = cl->client;
- xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) pc;
- xGLXDestroyPbufferReq *be_req;
- GLXPbuffer pbuffer = req->pbuffer;
- Display *dpy;
- int screen;
- DMXScreenInfo *dmxScreen;
- __glXPbuffer *pGlxPbuffer;
- int s;
- int from_screen, to_screen;
-
- /*
- ** Check if it's a valid Pbuffer
- */
- dixLookupResourceByType((pointer*) &pGlxPbuffer, pbuffer,
- __glXPbufferRes, NullClient, DixUnknownAccess);
- if (!pGlxPbuffer) {
- client->errorValue = pbuffer;
- return __glXBadPbuffer;
- }
-
- screen = pGlxPbuffer->pScreen->myNum;
-
- from_screen = to_screen = screen;
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
- }
-#endif
-
- for (s=from_screen; s<=to_screen; s++) {
- dpy = GetBackEndDisplay(cl,s);
- dmxScreen = &dmxScreens[s];
-
- /* send the destroy request to the back-end server */
- LockDisplay(dpy);
- GetReq(GLXDestroyPbuffer, be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXDestroyPbuffer;
- be_req->pbuffer = pGlxPbuffer->be_xids[s];
- UnlockDisplay(dpy);
- SyncHandle();
- }
-
- FreeResource(pbuffer, RT_NONE);
-
- return Success;
-}
-
-int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc;
- xGLXGetDrawableAttributesReq *be_req;
- xGLXGetDrawableAttributesReply reply;
- ClientPtr client = cl->client;
- GLXDrawable drawId = req->drawable;
- GLXDrawable be_drawable = 0;
- DrawablePtr pDraw = NULL;
- Display *dpy;
- int screen, rc;
- DMXScreenInfo *dmxScreen;
- CARD32 *attribs = NULL;
- int attribs_size;
-#ifdef PANORAMIX
- PanoramiXRes *pXinDraw = NULL;
-#endif
-
- if (drawId != None) {
- rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixGetAttrAccess);
- if (rc == Success) {
- if (pDraw->type == DRAWABLE_WINDOW) {
- WindowPtr pWin = (WindowPtr)pDraw;
- be_drawable = 0;
- screen = pWin->drawable.pScreen->myNum;
-
- }
- else {
- /*
- ** Drawable is not a Window , GLXWindow or a GLXPixmap.
- */
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
- }
-
- if (!pDraw) {
- __GLXpixmap *pGlxPixmap;
- dixLookupResourceByType((pointer*) &pGlxPixmap,
- drawId, __glXPixmapRes,
- NullClient, DixUnknownAccess);
- if (pGlxPixmap) {
- pDraw = pGlxPixmap->pDraw;
- screen = pGlxPixmap->pScreen->myNum;
- be_drawable = pGlxPixmap->be_xids[screen];
- }
- }
-
- if (!pDraw) {
- __glXWindow *pGlxWindow;
- dixLookupResourceByType((pointer*) &pGlxWindow,
- drawId, __glXWindowRes,
- NullClient, DixUnknownAccess);
- if (pGlxWindow) {
- pDraw = pGlxWindow->pDraw;
- screen = pGlxWindow->pScreen->myNum;
- be_drawable = 0;
- }
- }
-
- if (!pDraw) {
- __glXPbuffer *pGlxPbuffer;
- dixLookupResourceByType((pointer*) &pGlxPbuffer,
- drawId, __glXPbufferRes,
- NullClient, DixUnknownAccess);
- if (pGlxPbuffer) {
- pDraw = (DrawablePtr)pGlxPbuffer;
- screen = pGlxPbuffer->pScreen->myNum;
- be_drawable = pGlxPbuffer->be_xids[screen];
- }
- }
-
-
- if (!pDraw) {
- /*
- ** Drawable is not a Window , GLXWindow or a GLXPixmap.
- */
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
- }
-
-
- /* if the drawable is a window or GLXWindow -
- * we need to find the base id on the back-end server
- */
- if (!be_drawable) {
- WindowPtr pWin = (WindowPtr)pDraw;
-
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- if (Success != dixLookupResourceByClass((pointer*) &pXinDraw,
- pDraw->id, XRC_DRAWABLE,
- client, DixReadAccess)) {
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
-
- dixLookupWindow(&pWin, pXinDraw->info[screen].id, client,
- DixReadAccess);
- }
-#endif
-
- if (pWin) {
- be_drawable = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
- if (!be_drawable) {
- /* it might be that the window did not created yet on the */
- /* back-end server (lazy window creation option), force */
- /* creation of the window */
- dmxCreateAndRealizeWindow( pWin, TRUE );
- be_drawable = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
- }
- }
- else {
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
- }
-
-
- /* send the request to the back-end server */
- dpy = GetBackEndDisplay(cl,screen);
- dmxScreen = &dmxScreens[screen];
-
- /* make sure drawable exists on back-end */
- dmxSync( dmxScreen, 1 );
-
- LockDisplay(dpy);
- GetReq(GLXGetDrawableAttributes, be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXGetDrawableAttributes;
- be_req->drawable = be_drawable;
- be_req->length = req->length;
- if (!_XReply(dpy, (xReply *) &reply, 0, False)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return( BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code) );
- }
-
- if (reply.numAttribs) {
- attribs_size = 2 * reply.numAttribs * __GLX_SIZE_CARD32;
- attribs = (CARD32 *) malloc(attribs_size);
- if (attribs == NULL) {
- UnlockDisplay(dpy);
- SyncHandle();
- return BadAlloc;
- }
-
- _XRead(dpy, (char *) attribs, attribs_size);
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
-
-
- /* send the reply back to the client */
- reply.sequenceNumber = client->sequence;
- if (client->swapped) {
- __glXSwapGetDrawableAttributesReply(client, &reply, (int *)attribs);
- }
- else {
- WriteToClient(client, sz_xGLXGetDrawableAttributesReply, (char *)&reply);
- WriteToClient(client, attribs_size, (char *)attribs);
- }
-
- free(attribs);
-
- return Success;
-}
-
-int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXChangeDrawableAttributesReq *req = (xGLXChangeDrawableAttributesReq *)pc;
- xGLXChangeDrawableAttributesReq *be_req;
- ClientPtr client = cl->client;
- GLXDrawable drawId = req->drawable;
- GLXDrawable be_drawable = 0;
- DrawablePtr pDraw = NULL;
- Display *dpy;
- int screen, rc;
- DMXScreenInfo *dmxScreen;
-
- if (drawId != None) {
- rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixSetAttrAccess);
- if (rc == Success) {
- if (pDraw->type == DRAWABLE_WINDOW) {
- WindowPtr pWin = (WindowPtr)pDraw;
- be_drawable = 0;
- screen = pWin->drawable.pScreen->myNum;
-
- }
- else {
- /*
- ** Drawable is not a Window , GLXWindow or a GLXPixmap.
- */
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
- }
-
- if (!pDraw) {
- __GLXpixmap *pGlxPixmap;
- dixLookupResourceByType((pointer*) &pGlxPixmap,
- drawId, __glXPixmapRes,
- NullClient, DixUnknownAccess);
- if (pGlxPixmap) {
- pDraw = pGlxPixmap->pDraw;
- screen = pGlxPixmap->pScreen->myNum;
- be_drawable = pGlxPixmap->be_xids[screen];
- }
- }
-
- if (!pDraw) {
- __glXWindow *pGlxWindow;
- dixLookupResourceByType((pointer*) &pGlxWindow,
- drawId, __glXWindowRes,
- NullClient, DixUnknownAccess);
- if (pGlxWindow) {
- pDraw = pGlxWindow->pDraw;
- screen = pGlxWindow->pScreen->myNum;
- be_drawable = 0;
- }
- }
-
- if (!pDraw) {
- __glXPbuffer *pGlxPbuffer;
- dixLookupResourceByType((pointer*) &pGlxPbuffer,
- drawId, __glXPbufferRes,
- NullClient, DixUnknownAccess);
- if (pGlxPbuffer) {
- pDraw = (DrawablePtr)pGlxPbuffer;
- screen = pGlxPbuffer->pScreen->myNum;
- be_drawable = pGlxPbuffer->be_xids[screen];
- }
- }
-
-
- if (!pDraw) {
- /*
- ** Drawable is not a Window , GLXWindow or a GLXPixmap.
- */
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
- }
-
-
- /* if the drawable is a window or GLXWindow -
- * we need to find the base id on the back-end server
- */
- if (!be_drawable) {
- WindowPtr pWin = (WindowPtr)pDraw;
-
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- PanoramiXRes *pXinDraw;
- if (Success != dixLookupResourceByClass((pointer*) &pXinDraw,
- pDraw->id, XRC_DRAWABLE,
- client, DixReadAccess)) {
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
-
- dixLookupWindow(&pWin, pXinDraw->info[screen].id, client,
- DixReadAccess);
- }
-#endif
-
- if (pWin) {
- be_drawable = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
- if (!be_drawable) {
- /* it might be that the window did not created yet on the */
- /* back-end server (lazy window creation option), force */
- /* creation of the window */
- dmxCreateAndRealizeWindow( pWin, TRUE );
- be_drawable = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
- }
- }
- else {
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
- }
-
-
- /* send the request to the back-end server */
- dpy = GetBackEndDisplay(cl,screen);
- dmxScreen = &dmxScreens[screen];
-
- /* make sure drawable exists on back-end */
- dmxSync( dmxScreen, 1 );
-
- LockDisplay(dpy);
- GetReqExtra(GLXChangeDrawableAttributes,
- 2 * req->numAttribs * __GLX_SIZE_CARD32, be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXChangeDrawableAttributes;
- be_req->drawable = be_drawable;
- be_req->numAttribs = req->numAttribs;
- be_req->length = req->length;
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- return Success;
-}
-
-int __glXSendLargeCommand(__GLXclientState *cl, GLXContextTag contextTag)
-{
- ClientPtr client = cl->client;
- xGLXRenderLargeReq *req;
- GLint maxSize, amount;
- GLint totalRequests, requestNumber;
- GLint dataLen;
- GLbyte *data;
- __GLXcontext *glxc;
- int s;
- int from_screen, to_screen;
-
- maxSize = cl->largeCmdMaxReqDataSize - (GLint)sizeof(xGLXRenderLargeReq);
- dataLen = cl->largeCmdBytesTotal;
- totalRequests = (dataLen / maxSize);
- if (dataLen % maxSize) totalRequests++;
-
- glxc = __glXLookupContextByTag(cl, contextTag);
- if (!glxc) {
- client->errorValue = contextTag;
- return __glXBadContext;
- }
- from_screen = to_screen = glxc->pScreen->myNum;
-
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
- }
-#endif
-
- /*
- ** Send enough requests until the whole array is sent.
- */
- requestNumber = 1;
- data = cl->largeCmdBuf;
- while (dataLen > 0) {
- amount = dataLen;
- if (amount > maxSize) {
- amount = maxSize;
- }
-
- for (s=from_screen; s<=to_screen; s++) {
-
- Display *dpy = GetBackEndDisplay(cl,s);
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
-
- LockDisplay(dpy);
- GetReq(GLXRenderLarge,req);
- req->reqType = dmxScreen->glxMajorOpcode;
- req->glxCode = X_GLXRenderLarge;
- req->contextTag = GetCurrentBackEndTag(cl,contextTag,s);
- req->length += (amount + 3) >> 2;
- req->requestNumber = requestNumber++;
- req->requestTotal = totalRequests;
- req->dataBytes = amount;
- Data(dpy, ((const char*)data), amount);
- dataLen -= amount;
- data = ((GLbyte *) data) + amount;
- UnlockDisplay(dpy);
- SyncHandle();
- }
- }
-
- return Success;
-}
+/*
+ * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
+ * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice including the dates of first publication and
+ * either this permission notice or a reference to
+ * http://oss.sgi.com/projects/FreeB/
+ * 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
+ * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Silicon Graphics, Inc.
+ * shall not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization from
+ * Silicon Graphics, Inc.
+ */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxwindow.h"
+#include "dmxpixmap.h"
+#include "dmxfont.h"
+#include "dmxsync.h"
+
+#include "glxserver.h"
+#include <GL/glxtokens.h>
+#include "g_disptab.h"
+#include <pixmapstr.h>
+#include <windowstr.h>
+#include "glxutil.h"
+#include "glxext.h"
+#include "unpack.h"
+
+#include "GL/glxproto.h"
+#include "glxvendor.h"
+#include "glxvisuals.h"
+#include "glxswap.h"
+
+#ifdef PANORAMIX
+#include "panoramiXsrv.h"
+#endif
+
+extern __GLXFBConfig **__glXFBConfigs;
+extern int __glXNumFBConfigs;
+
+extern __GLXFBConfig *glxLookupFBConfig( GLXFBConfigID id );
+extern __GLXFBConfig *glxLookupFBConfigByVID( VisualID vid );
+extern __GLXFBConfig *glxLookupBackEndFBConfig( GLXFBConfigID id, int screen );
+extern int glxIsExtensionSupported( char *ext );
+extern int __glXGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc);
+
+#define BE_TO_CLIENT_ERROR(x) \
+ ( (x) >= __glXerrorBase ? \
+ (x) - dmxScreen->glxErrorBase + __glXerrorBase \
+ : (x) )
+
+Display *GetBackEndDisplay( __GLXclientState *cl, int s )
+{
+ if (! cl->be_displays[s] ) {
+ cl->be_displays[s] = XOpenDisplay( DisplayString(dmxScreens[s].beDisplay) );
+ }
+ return cl->be_displays[s];
+}
+
+/*
+** Create a GL context with the given properties.
+*/
+static int CreateContext(__GLXclientState *cl,
+ GLXContextID gcId,
+ VisualID vid, GLXFBConfigID fbconfigId,
+ int screen,
+ GLXContextID shareList,
+ int isDirect )
+{
+ ClientPtr client = cl->client;
+ xGLXCreateContextReq *be_req;
+ xGLXCreateNewContextReq *be_new_req;
+ VisualPtr pVisual;
+ ScreenPtr pScreen;
+ __GLXcontext *glxc, *shareglxc;
+ __GLXvisualConfig *pGlxVisual;
+ __GLXscreenInfo *pGlxScreen;
+ VisualID visual = vid;
+ GLint i;
+ int from_screen = screen;
+ int to_screen = screen;
+ DMXScreenInfo *dmxScreen;
+ VisualID be_vid = 0;
+ GLXFBConfigID be_fbconfigId = 0;
+ int num_be_screens;
+ Display *dpy;
+
+ /*
+ ** Check if screen exists.
+ */
+ if (screen >= screenInfo.numScreens) {
+ client->errorValue = screen;
+ return BadValue;
+ }
+
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ }
+#endif
+
+ /*
+ ** Find the display list space that we want to share.
+ **
+ */
+ if (shareList == None) {
+ shareglxc = NULL;
+ } else {
+ dixLookupResourceByType((pointer*) &shareglxc, shareList,
+ __glXContextRes, NullClient, DixUnknownAccess);
+ if (!shareglxc) {
+ client->errorValue = shareList;
+ return __glXBadContext;
+ }
+ }
+
+ /*
+ ** Allocate memory for the new context
+ */
+ glxc = calloc(1, sizeof(__GLXcontext));
+ if (!glxc) {
+ return BadAlloc;
+ }
+
+ pScreen = screenInfo.screens[screen];
+ pGlxScreen = &__glXActiveScreens[screen];
+
+ if (fbconfigId != None) {
+ glxc->pFBConfig = glxLookupFBConfig( fbconfigId );
+ if (!glxc->pFBConfig) {
+ client->errorValue = fbconfigId;
+ free( glxc );
+ return BadValue;
+ }
+ visual = glxc->pFBConfig->associatedVisualId;
+ }
+ else {
+ glxc->pFBConfig = NULL;
+ }
+
+ if (visual != None) {
+ /*
+ ** Check if the visual ID is valid for this screen.
+ */
+ pVisual = pScreen->visuals;
+ for (i = 0; i < pScreen->numVisuals; i++, pVisual++) {
+ if (pVisual->vid == visual) {
+ break;
+ }
+ }
+ if (i == pScreen->numVisuals) {
+ client->errorValue = visual;
+ free( glxc );
+ return BadValue;
+ }
+
+ pGlxVisual = pGlxScreen->pGlxVisual;
+ for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) {
+ if (pGlxVisual->vid == visual) {
+ break;
+ }
+ }
+ if (i == pGlxScreen->numVisuals) {
+ /*
+ ** Visual not support on this screen by this OpenGL implementation.
+ */
+ client->errorValue = visual;
+ free( glxc );
+ return BadValue;
+ }
+
+ if ( glxc->pFBConfig == NULL ) {
+ glxc->pFBConfig = glxLookupFBConfigByVID( visual );
+
+ if ( glxc->pFBConfig == NULL ) {
+ /*
+ * visual does not have an FBConfig ???
+ client->errorValue = visual;
+ free( glxc );
+ return BadValue;
+ */
+ }
+ }
+ }
+ else {
+ pVisual = NULL;
+ pGlxVisual = NULL;
+ }
+
+ glxc->pScreen = pScreen;
+ glxc->pGlxScreen = pGlxScreen;
+ glxc->pVisual = pVisual;
+ glxc->pGlxVisual = pGlxVisual;
+
+ /*
+ * allocate memory for back-end servers info
+ */
+ num_be_screens = to_screen - from_screen + 1;
+ glxc->real_ids = (XID *)malloc(sizeof(XID) * num_be_screens);
+ if (!glxc->real_ids) {
+ return BadAlloc;
+ }
+ glxc->real_vids = (XID *)malloc(sizeof(XID) * num_be_screens);
+ if (!glxc->real_vids) {
+ return BadAlloc;
+ }
+
+ for (screen = from_screen; screen <= to_screen; screen++) {
+ int sent = 0;
+ pScreen = screenInfo.screens[screen];
+ pGlxScreen = &__glXActiveScreens[screen];
+ dmxScreen = &dmxScreens[screen];
+
+ if (glxc->pFBConfig) {
+ __GLXFBConfig *beFBConfig = glxLookupBackEndFBConfig( glxc->pFBConfig->id,
+ screen );
+ be_fbconfigId = beFBConfig->id;
+ }
+
+ if (pGlxVisual) {
+
+ be_vid = glxMatchGLXVisualInConfigList( pGlxVisual,
+ dmxScreen->glxVisuals,
+ dmxScreen->numGlxVisuals );
+
+ if (!be_vid) {
+ /* visual is not supported on the back-end server */
+ free( glxc->real_ids );
+ free( glxc->real_vids );
+ free( glxc );
+ return BadValue;
+ }
+ }
+
+ glxc->real_ids[screen-from_screen] = XAllocID(GetBackEndDisplay(cl,screen));
+
+ /* send the create context request to the back-end server */
+ dpy = GetBackEndDisplay(cl,screen);
+ if (glxc->pFBConfig) {
+ /*Since for a certain visual both RGB and COLOR INDEX
+ *can be on then the only parmeter to choose the renderType
+ * should be the class of the colormap since all 4 first
+ * classes does not support RGB mode only COLOR INDEX ,
+ * and so TrueColor and DirectColor does not support COLOR INDEX*/
+ int renderType = glxc->pFBConfig->renderType;
+ if ( pVisual ) {
+ switch ( pVisual->class ){
+ case PseudoColor:
+ case StaticColor:
+ case GrayScale:
+ case StaticGray:
+ renderType = GLX_COLOR_INDEX_TYPE;
+ break;
+ case TrueColor:
+ case DirectColor:
+ default:
+ renderType = GLX_RGBA_TYPE;
+ break;
+ }
+ }
+ if ( __GLX_IS_VERSION_SUPPORTED(1,3) ) {
+ LockDisplay(dpy);
+ GetReq(GLXCreateNewContext,be_new_req);
+ be_new_req->reqType = dmxScreen->glxMajorOpcode;
+ be_new_req->glxCode = X_GLXCreateNewContext;
+ be_new_req->context = (unsigned int)glxc->real_ids[screen-from_screen];
+ be_new_req->fbconfig = (unsigned int)be_fbconfigId;
+ be_new_req->screen = DefaultScreen(dpy);
+ be_new_req->renderType = renderType;
+
+ be_new_req->shareList = (shareglxc ? shareglxc->real_ids[screen-from_screen] : 0);
+ be_new_req->isDirect = 0;
+ UnlockDisplay(dpy);
+ glxc->real_vids[screen-from_screen] = be_fbconfigId;
+ sent = 1;
+ }
+ else if (glxIsExtensionSupported("GLX_SGIX_fbconfig")) {
+
+ xGLXCreateContextWithConfigSGIXReq *ext_req;
+ xGLXVendorPrivateReq *vpreq;
+ LockDisplay(dpy);
+ GetReqExtra(GLXVendorPrivate,
+ sz_xGLXCreateContextWithConfigSGIXReq - sz_xGLXVendorPrivateReq,
+ vpreq);
+ ext_req = (xGLXCreateContextWithConfigSGIXReq *)vpreq;
+ ext_req->reqType = dmxScreen->glxMajorOpcode;
+ ext_req->glxCode = X_GLXVendorPrivate;
+ ext_req->vendorCode = X_GLXvop_CreateContextWithConfigSGIX;
+ ext_req->context = (unsigned int)glxc->real_ids[screen-from_screen];
+ ext_req->fbconfig = (unsigned int)be_fbconfigId;
+ ext_req->screen = DefaultScreen(dpy);
+ ext_req->renderType = renderType;
+ ext_req->shareList = (shareglxc ? shareglxc->real_ids[screen-from_screen] : 0);
+ ext_req->isDirect = 0;
+ UnlockDisplay(dpy);
+ glxc->real_vids[screen-from_screen] = be_fbconfigId;
+ sent = 1;
+ }
+ }
+
+ if (!sent) {
+ LockDisplay(dpy);
+ GetReq(GLXCreateContext,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXCreateContext;
+ be_req->context = (unsigned int)glxc->real_ids[screen-from_screen];
+ be_req->visual = (unsigned int)be_vid;
+ be_req->screen = DefaultScreen(dpy);
+ be_req->shareList = (shareglxc ? shareglxc->real_ids[screen-from_screen] : 0);
+ be_req->isDirect = 0;
+ UnlockDisplay(dpy);
+ glxc->real_vids[screen-from_screen] = be_vid;
+ }
+ SyncHandle();
+
+ }
+
+ /*
+ ** Register this context as a resource.
+ */
+ if (!AddResource(gcId, __glXContextRes, (pointer)glxc)) {
+ free( glxc->real_ids );
+ free( glxc->real_vids );
+ free( glxc );
+ client->errorValue = gcId;
+ return BadAlloc;
+ }
+
+ /*
+ ** Finally, now that everything is working, setup the rest of the
+ ** context.
+ */
+ glxc->id = gcId;
+ glxc->share_id = shareList;
+ glxc->idExists = GL_TRUE;
+ glxc->isCurrent = GL_FALSE;
+
+ return Success;
+}
+
+int __glXCreateContext(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc;
+
+ return( CreateContext(cl, req->context,req->visual, None,
+ req->screen, req->shareList, req->isDirect) );
+
+}
+
+int __glXCreateNewContext(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc;
+
+ return( CreateContext(cl, req->context,None, req->fbconfig,
+ req->screen, req->shareList, req->isDirect) );
+
+}
+
+int __glXCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXCreateContextWithConfigSGIXReq *req = (xGLXCreateContextWithConfigSGIXReq *) pc;
+
+ return( CreateContext(cl, req->context, None, req->fbconfig,
+ req->screen, req->shareList, req->isDirect) );
+
+}
+
+int __glXQueryMaxSwapBarriersSGIX(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXQueryMaxSwapBarriersSGIXReq *req =
+ (xGLXQueryMaxSwapBarriersSGIXReq *)pc;
+ xGLXQueryMaxSwapBarriersSGIXReply reply;
+
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ reply.length = 0;
+ reply.max = QueryMaxSwapBarriersSGIX(req->screen);
+
+ if (client->swapped) {
+ __glXSwapQueryMaxSwapBarriersSGIXReply(client, &reply);
+ } else {
+ WriteToClient(client, sz_xGLXQueryMaxSwapBarriersSGIXReply,
+ (char *)&reply);
+ }
+
+ return Success;
+}
+
+int __glXBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXBindSwapBarrierSGIXReq *req = (xGLXBindSwapBarrierSGIXReq *)pc;
+ DrawablePtr pDraw;
+ __GLXpixmap *pGlxPixmap = NULL;
+ __glXWindow *pGlxWindow = NULL;
+ int rc;
+
+ rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixGetAttrAccess);
+ if (rc != Success) {
+ dixLookupResourceByType((pointer*) &pGlxPixmap, req->drawable,
+ __glXPixmapRes, NullClient, DixUnknownAccess);
+ if (pGlxPixmap) pDraw = pGlxPixmap->pDraw;
+ }
+
+ if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
+ dixLookupResourceByType((pointer*) &pGlxWindow, req->drawable,
+ __glXWindowRes, NullClient, DixUnknownAccess);
+ if (pGlxWindow) pDraw = pGlxWindow->pDraw;
+ }
+
+ if (!pDraw) {
+ client->errorValue = req->drawable;
+ return __glXBadDrawable;
+ }
+
+ return BindSwapBarrierSGIX(pDraw, req->barrier);
+}
+
+int __glXJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXJoinSwapGroupSGIXReq *req = (xGLXJoinSwapGroupSGIXReq *)pc;
+ DrawablePtr pDraw, pMember = NULL;
+ __GLXpixmap *pGlxPixmap = NULL;
+ __glXWindow *pGlxWindow = NULL;
+ int rc;
+
+ rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixManageAccess);
+ if (rc != Success) {
+ dixLookupResourceByType((pointer*) &pGlxPixmap, req->drawable,
+ __glXPixmapRes, NullClient, DixUnknownAccess);
+ if (pGlxPixmap) pDraw = pGlxPixmap->pDraw;
+ }
+
+ if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
+ dixLookupResourceByType((pointer*) &pGlxWindow, req->drawable,
+ __glXWindowRes, NullClient, DixUnknownAccess);
+ if (pGlxWindow) pDraw = pGlxWindow->pDraw;
+ }
+
+ if (!pDraw) {
+ client->errorValue = req->drawable;
+ return __glXBadDrawable;
+ }
+
+ if (req->member != None) {
+ rc = dixLookupDrawable(&pMember, req->member, client, 0,
+ DixGetAttrAccess);
+ if (rc != Success) {
+ dixLookupResourceByType((pointer*) &pGlxPixmap, req->member,
+ __glXPixmapRes, NullClient,
+ DixUnknownAccess);
+ if (pGlxPixmap) pMember = pGlxPixmap->pDraw;
+ }
+
+ if (!pMember && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
+ dixLookupResourceByType((pointer*) &pGlxWindow, req->member,
+ __glXWindowRes, NullClient,
+ DixUnknownAccess);
+ if (pGlxWindow) pMember = pGlxWindow->pDraw;
+ }
+
+ if (!pMember) {
+ client->errorValue = req->member;
+ return __glXBadDrawable;
+ }
+ }
+
+ return JoinSwapGroupSGIX(pDraw, pMember);
+}
+
+
+/*
+** Destroy a GL context as an X resource.
+*/
+int __glXDestroyContext(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc;
+ xGLXDestroyContextReq *be_req;
+ GLXContextID gcId = req->context;
+ __GLXcontext *glxc;
+ int from_screen = 0;
+ int to_screen = 0;
+ int s;
+
+ dixLookupResourceByType((pointer*) &glxc, gcId, __glXContextRes,
+ NullClient, DixUnknownAccess);
+ if (glxc) {
+ /*
+ ** Just free the resource; don't actually destroy the context,
+ ** because it might be in use. The
+ ** destroy method will be called by the resource destruction routine
+ ** if necessary.
+ */
+ FreeResourceByType(gcId, __glXContextRes, FALSE);
+
+ from_screen = to_screen = glxc->pScreen->myNum;
+
+ } else {
+ client->errorValue = gcId;
+ return __glXBadContext;
+ }
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ }
+#endif
+
+ /*
+ * send DestroyContext request to all back-end servers
+ */
+ for (s=from_screen; s<=to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl,s);
+
+ LockDisplay(dpy);
+ GetReq(GLXDestroyContext,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXDestroyContext;
+ be_req->context = glxc->real_ids[s-from_screen];
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
+
+ return Success;
+}
+
+/*****************************************************************************/
+
+/*
+** For each client, the server keeps a table of all the contexts that are
+** current for that client (each thread of a client may have its own current
+** context). These routines add, change, and lookup contexts in the table.
+*/
+
+/*
+** Add a current context, and return the tag that will be used to refer to it.
+*/
+static int AddCurrentContext(__GLXclientState *cl, __GLXcontext *glxc, DrawablePtr pDraw)
+{
+ int i;
+ int num = cl->numCurrentContexts;
+ __GLXcontext **table = cl->currentContexts;
+
+ if (!glxc) return -1;
+
+ /*
+ ** Try to find an empty slot and use it.
+ */
+ for (i=0; i < num; i++) {
+ if (!table[i]) {
+ table[i] = glxc;
+ return i+1;
+ }
+ }
+ /*
+ ** Didn't find a free slot, so we'll have to grow the table.
+ */
+ if (!num) {
+ table = (__GLXcontext **) malloc(sizeof(__GLXcontext *));
+ cl->currentDrawables = (DrawablePtr *) malloc(sizeof(DrawablePtr));
+ cl->be_currentCTag = (GLXContextTag *) malloc(screenInfo.numScreens *sizeof(GLXContextTag));
+ } else {
+ table = (__GLXcontext **) realloc(table,
+ (num+1)*sizeof(__GLXcontext *));
+ cl->currentDrawables = (DrawablePtr *) realloc(
+ cl->currentDrawables ,
+ (num+1)*sizeof(DrawablePtr));
+ cl->be_currentCTag = (GLXContextTag *) realloc(cl->be_currentCTag,
+ (num+1)*screenInfo.numScreens*sizeof(GLXContextTag));
+ }
+ table[num] = glxc;
+ cl->currentDrawables[num] = pDraw;
+ cl->currentContexts = table;
+ cl->numCurrentContexts++;
+
+ memset(cl->be_currentCTag + num*screenInfo.numScreens, 0,
+ screenInfo.numScreens * sizeof(GLXContextTag));
+
+ return num+1;
+}
+
+/*
+** Given a tag, change the current context for the corresponding entry.
+*/
+static void ChangeCurrentContext(__GLXclientState *cl, __GLXcontext *glxc,
+ GLXContextTag tag)
+{
+ __GLXcontext **table = cl->currentContexts;
+ table[tag-1] = glxc;
+}
+
+/*
+** Given a tag, and back-end screen number, retrives the current back-end
+** tag.
+*/
+int GetCurrentBackEndTag(__GLXclientState *cl, GLXContextTag tag, int s)
+{
+ if (tag >0) {
+ return( cl->be_currentCTag[ (tag-1)*screenInfo.numScreens + s ] );
+ }
+ else {
+ return 0;
+ }
+}
+
+/*
+** Given a tag, and back-end screen number, sets the current back-end
+** tag.
+*/
+static void SetCurrentBackEndTag(__GLXclientState *cl, GLXContextTag tag, int s, GLXContextTag be_tag)
+{
+ if (tag >0) {
+ cl->be_currentCTag[ (tag-1)*screenInfo.numScreens + s ] = be_tag;
+ }
+}
+
+/*
+** For this implementation we have chosen to simply use the index of the
+** context's entry in the table as the context tag. A tag must be greater
+** than 0.
+*/
+__GLXcontext *__glXLookupContextByTag(__GLXclientState *cl, GLXContextTag tag)
+{
+ int num = cl->numCurrentContexts;
+
+ if (tag < 1 || tag > num) {
+ return 0;
+ } else {
+ return cl->currentContexts[tag-1];
+ }
+}
+
+DrawablePtr __glXLookupDrawableByTag(__GLXclientState *cl, GLXContextTag tag)
+{
+ int num = cl->numCurrentContexts;
+
+ if (tag < 1 || tag > num) {
+ return 0;
+ } else {
+ return cl->currentDrawables[tag-1];
+ }
+}
+
+/*****************************************************************************/
+
+static void StopUsingContext(__GLXcontext *glxc)
+{
+ if (glxc) {
+ if (glxc == __glXLastContext) {
+ /* Tell server GL library */
+ __glXLastContext = 0;
+ }
+ glxc->isCurrent = GL_FALSE;
+ if (!glxc->idExists) {
+ __glXFreeContext(glxc);
+ }
+ }
+}
+
+static void StartUsingContext(__GLXclientState *cl, __GLXcontext *glxc)
+{
+ glxc->isCurrent = GL_TRUE;
+}
+
+/*****************************************************************************/
+/*
+** Make an OpenGL context and drawable current.
+*/
+static int MakeCurrent(__GLXclientState *cl,
+ GLXDrawable drawable,
+ GLXDrawable readdrawable,
+ GLXContextID context,
+ GLXContextTag oldContextTag)
+{
+ ClientPtr client = cl->client;
+ DrawablePtr pDraw = NULL;
+ DrawablePtr pReadDraw = NULL;
+ xGLXMakeCurrentReadSGIReply new_reply;
+ xGLXMakeCurrentReq *be_req;
+ xGLXMakeCurrentReply be_reply;
+ xGLXMakeContextCurrentReq *be_new_req;
+ xGLXMakeContextCurrentReply be_new_reply;
+ GLXDrawable drawId = drawable;
+ GLXDrawable readId = readdrawable;
+ GLXContextID contextId = context;
+ __GLXpixmap *pGlxPixmap = 0;
+ __GLXpixmap *pReadGlxPixmap = 0;
+ __GLXcontext *glxc, *prevglxc;
+ GLXContextTag tag = oldContextTag;
+ WindowPtr pWin = NULL;
+ WindowPtr pReadWin = NULL;
+ __glXWindow *pGlxWindow = NULL;
+ __glXWindow *pGlxReadWindow = NULL;
+ __glXPbuffer *pGlxPbuffer = NULL;
+ __glXPbuffer *pGlxReadPbuffer = NULL;
+#ifdef PANORAMIX
+ PanoramiXRes *pXinDraw = NULL;
+ PanoramiXRes *pXinReadDraw = NULL;
+#endif
+ int from_screen = 0;
+ int to_screen = 0;
+ int s, rc;
+
+ /*
+ ** If one is None and the other isn't, it's a bad match.
+ */
+ if ((drawId == None && contextId != None) ||
+ (drawId != None && contextId == None)) {
+ return BadMatch;
+ }
+
+ /*
+ ** Lookup old context. If we have one, it must be in a usable state.
+ */
+ if (tag != 0) {
+ prevglxc = __glXLookupContextByTag(cl, tag);
+ if (!prevglxc) {
+ /*
+ ** Tag for previous context is invalid.
+ */
+ return __glXBadContextTag;
+ }
+ } else {
+ prevglxc = 0;
+ }
+
+ /*
+ ** Lookup new context. It must not be current for someone else.
+ */
+ if (contextId != None) {
+ dixLookupResourceByType((pointer*) &glxc, contextId, __glXContextRes,
+ NullClient, DixUnknownAccess);
+ if (!glxc) {
+ client->errorValue = contextId;
+ return __glXBadContext;
+ }
+ if ((glxc != prevglxc) && glxc->isCurrent) {
+ /* Context is current to somebody else */
+ return BadAccess;
+ }
+ } else {
+ /* Switching to no context. Ignore new drawable. */
+ glxc = 0;
+ }
+
+ if (drawId != None) {
+ rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixWriteAccess);
+ if (rc == Success) {
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ /*
+ ** Drawable is an X Window.
+ */
+ VisualID vid;
+ pWin = (WindowPtr)pDraw;
+ vid = wVisual(pWin);
+
+ new_reply.writeVid = (glxc->pFBConfig ? glxc->pFBConfig->id : vid);
+ new_reply.writeType = GLX_WINDOW_TYPE;
+
+ /*
+ ** Check if window and context are similar.
+ */
+ if ((vid != glxc->pVisual->vid) ||
+ (pWin->drawable.pScreen != glxc->pScreen)) {
+ client->errorValue = drawId;
+ return BadMatch;
+ }
+
+ from_screen = to_screen = pWin->drawable.pScreen->myNum;
+
+ } else {
+ /*
+ ** An X Pixmap is not allowed as a parameter (a GLX Pixmap
+ ** is, but it must first be created with glxCreateGLXPixmap).
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+ }
+
+ if (!pDraw) {
+ dixLookupResourceByType((pointer*) &pGlxPixmap, drawId,
+ __glXPixmapRes, NullClient,
+ DixUnknownAccess);
+ if (pGlxPixmap) {
+ /*
+ ** Check if pixmap and context are similar.
+ */
+ if (pGlxPixmap->pScreen != glxc->pScreen ||
+ pGlxPixmap->pGlxVisual != glxc->pGlxVisual) {
+ client->errorValue = drawId;
+ return BadMatch;
+ }
+ pDraw = pGlxPixmap->pDraw;
+
+ new_reply.writeVid = (glxc->pFBConfig ? glxc->pFBConfig->id :
+ pGlxPixmap->pGlxVisual->vid);
+
+ new_reply.writeType = GLX_PIXMAP_TYPE;
+
+ from_screen = to_screen = pGlxPixmap->pScreen->myNum;
+
+ }
+ }
+
+ if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
+ dixLookupResourceByType((pointer*) &pGlxWindow, drawId,
+ __glXWindowRes, NullClient,
+ DixUnknownAccess);
+ if (pGlxWindow) {
+ /*
+ ** Drawable is a GLXWindow.
+ **
+ ** Check if GLX window and context are similar.
+ */
+ if (pGlxWindow->pScreen != glxc->pScreen ||
+ pGlxWindow->pGlxFBConfig != glxc->pFBConfig) {
+ client->errorValue = drawId;
+ return BadMatch;
+ }
+
+ pDraw = pGlxWindow->pDraw;
+ new_reply.writeVid = pGlxWindow->pGlxFBConfig->id;
+ new_reply.writeType = GLX_GLXWINDOW_TYPE;
+ }
+
+ }
+
+ if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
+ dixLookupResourceByType((pointer*) &pGlxPbuffer, drawId,
+ __glXPbufferRes, NullClient,
+ DixUnknownAccess);
+ if (pGlxPbuffer) {
+ if (pGlxPbuffer->pScreen != glxc->pScreen ||
+ pGlxPbuffer->pFBConfig != glxc->pFBConfig) {
+ client->errorValue = drawId;
+ return BadMatch;
+ }
+
+ pDraw = (DrawablePtr)pGlxPbuffer;
+ new_reply.writeVid = pGlxPbuffer->pFBConfig->id;
+ new_reply.writeType = GLX_PBUFFER_TYPE;
+ }
+ }
+
+ if (!pDraw) {
+ /*
+ ** Drawable is not a Window , GLXWindow or a GLXPixmap.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+
+ } else {
+ pDraw = 0;
+ }
+
+ if (readId != None && readId != drawId ) {
+ rc = dixLookupDrawable(&pReadDraw, readId, client, 0, DixReadAccess);
+ if (rc == Success) {
+ if (pReadDraw->type == DRAWABLE_WINDOW) {
+ /*
+ ** Drawable is an X Window.
+ */
+ VisualID vid;
+ pReadWin = (WindowPtr)pDraw;
+ vid = wVisual(pReadWin);
+
+ new_reply.readVid = (glxc->pFBConfig ? glxc->pFBConfig->id : vid);
+ new_reply.readType = GLX_WINDOW_TYPE;
+
+ /*
+ ** Check if window and context are similar.
+ */
+ if ((vid != glxc->pVisual->vid) ||
+ (pReadWin->drawable.pScreen != glxc->pScreen)) {
+ client->errorValue = readId;
+ return BadMatch;
+ }
+
+ } else {
+
+ /*
+ ** An X Pixmap is not allowed as a parameter (a GLX Pixmap
+ ** is, but it must first be created with glxCreateGLXPixmap).
+ */
+ client->errorValue = readId;
+ return __glXBadDrawable;
+ }
+ }
+
+ if (!pReadDraw) {
+ dixLookupResourceByType((pointer*) &pReadGlxPixmap, readId,
+ __glXPixmapRes, NullClient,
+ DixUnknownAccess);
+ if (pReadGlxPixmap) {
+ /*
+ ** Check if pixmap and context are similar.
+ */
+ if (pReadGlxPixmap->pScreen != glxc->pScreen ||
+ pReadGlxPixmap->pGlxVisual != glxc->pGlxVisual) {
+ client->errorValue = readId;
+ return BadMatch;
+ }
+ pReadDraw = pReadGlxPixmap->pDraw;
+
+ new_reply.readVid = (glxc->pFBConfig ? glxc->pFBConfig->id :
+ pReadGlxPixmap->pGlxVisual->vid );
+ new_reply.readType = GLX_PIXMAP_TYPE;
+
+ }
+ }
+
+ if (!pReadDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
+ dixLookupResourceByType((pointer*) &pGlxReadWindow, readId,
+ __glXWindowRes, NullClient,
+ DixUnknownAccess);
+ if (pGlxReadWindow) {
+ /*
+ ** Drawable is a GLXWindow.
+ **
+ ** Check if GLX window and context are similar.
+ */
+ if (pGlxReadWindow->pScreen != glxc->pScreen ||
+ pGlxReadWindow->pGlxFBConfig != glxc->pFBConfig) {
+ client->errorValue = readId;
+ return BadMatch;
+ }
+
+ pReadDraw = pGlxReadWindow->pDraw;
+ new_reply.readVid = pGlxReadWindow->pGlxFBConfig->id;
+ new_reply.readType = GLX_GLXWINDOW_TYPE;
+ }
+ }
+
+ if (!pReadDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
+ dixLookupResourceByType((pointer*) &pGlxReadPbuffer, readId,
+ __glXPbufferRes, NullClient,
+ DixUnknownAccess);
+ if (pGlxReadPbuffer) {
+ if (pGlxReadPbuffer->pScreen != glxc->pScreen ||
+ pGlxReadPbuffer->pFBConfig != glxc->pFBConfig) {
+ client->errorValue = drawId;
+ return BadMatch;
+ }
+
+ pReadDraw = (DrawablePtr)pGlxReadPbuffer;
+ new_reply.readVid = pGlxReadPbuffer->pFBConfig->id;
+ new_reply.readType = GLX_PBUFFER_TYPE;
+ }
+ }
+
+ if (!pReadDraw) {
+ /*
+ ** Drawable is neither a Window nor a GLXPixmap.
+ */
+ client->errorValue = readId;
+ return __glXBadDrawable;
+ }
+
+ } else {
+ pReadDraw = pDraw;
+ pReadGlxPixmap = pGlxPixmap;
+ pReadWin = pWin;
+ new_reply.readVid = new_reply.writeVid;
+ new_reply.readType = new_reply.writeType;
+ }
+
+ if (prevglxc) {
+
+ if (prevglxc->pGlxPixmap) {
+ /*
+ ** The previous drawable was a glx pixmap, release it.
+ */
+ prevglxc->pGlxPixmap->refcnt--;
+ __glXFreeGLXPixmap( prevglxc->pGlxPixmap );
+ prevglxc->pGlxPixmap = 0;
+ }
+
+ if (prevglxc->pGlxReadPixmap) {
+ /*
+ ** The previous drawable was a glx pixmap, release it.
+ */
+ prevglxc->pGlxReadPixmap->refcnt--;
+ __glXFreeGLXPixmap( prevglxc->pGlxReadPixmap );
+ prevglxc->pGlxReadPixmap = 0;
+ }
+
+ if (prevglxc->pGlxWindow) {
+ /*
+ ** The previous drawable was a glx window, release it.
+ */
+ prevglxc->pGlxWindow->refcnt--;
+ __glXFreeGLXWindow( prevglxc->pGlxWindow );
+ prevglxc->pGlxWindow = 0;
+ }
+
+ if (prevglxc->pGlxReadWindow) {
+ /*
+ ** The previous drawable was a glx window, release it.
+ */
+ prevglxc->pGlxReadWindow->refcnt--;
+ __glXFreeGLXWindow( prevglxc->pGlxReadWindow );
+ prevglxc->pGlxReadWindow = 0;
+ }
+
+ if (prevglxc->pGlxPbuffer) {
+ /*
+ ** The previous drawable was a glx Pbuffer, release it.
+ */
+ prevglxc->pGlxPbuffer->refcnt--;
+ __glXFreeGLXPbuffer( prevglxc->pGlxPbuffer );
+ prevglxc->pGlxPbuffer = 0;
+ }
+
+ if (prevglxc->pGlxReadPbuffer) {
+ /*
+ ** The previous drawable was a glx Pbuffer, release it.
+ */
+ prevglxc->pGlxReadPbuffer->refcnt--;
+ __glXFreeGLXPbuffer( prevglxc->pGlxReadPbuffer );
+ prevglxc->pGlxReadPbuffer = 0;
+ }
+
+ ChangeCurrentContext(cl, glxc, tag);
+ ChangeCurrentContext(cl, glxc, tag);
+ StopUsingContext(prevglxc);
+ } else {
+ tag = AddCurrentContext(cl, glxc, pDraw);
+ }
+ if (glxc) {
+
+ glxc->pGlxPixmap = pGlxPixmap;
+ glxc->pGlxReadPixmap = pReadGlxPixmap;
+ glxc->pGlxWindow = pGlxWindow;
+ glxc->pGlxReadWindow = pGlxReadWindow;
+ glxc->pGlxPbuffer = pGlxPbuffer;
+ glxc->pGlxReadPbuffer = pGlxReadPbuffer;
+
+ if (pGlxPixmap) {
+ pGlxPixmap->refcnt++;
+ }
+
+ if (pReadGlxPixmap) {
+ pReadGlxPixmap->refcnt++;
+ }
+
+ if (pGlxWindow) {
+ pGlxWindow->refcnt++;
+ }
+
+ if (pGlxReadWindow) {
+ pGlxReadWindow->refcnt++;
+ }
+
+ if (pGlxPbuffer) {
+ pGlxPbuffer->refcnt++;
+ }
+
+ if (pGlxReadPbuffer) {
+ pGlxReadPbuffer->refcnt++;
+ }
+
+ StartUsingContext(cl, glxc);
+ new_reply.contextTag = tag;
+ } else {
+ new_reply.contextTag = 0;
+ }
+ new_reply.length = 0;
+ new_reply.type = X_Reply;
+ new_reply.sequenceNumber = client->sequence;
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+
+ if (pDraw && new_reply.writeType != GLX_PBUFFER_TYPE) {
+ dixLookupResourceByClass((pointer*) &pXinDraw,
+ pDraw->id, XRC_DRAWABLE,
+ client, DixReadAccess);
+ }
+
+ if (pReadDraw && pReadDraw != pDraw &&
+ new_reply.readType != GLX_PBUFFER_TYPE) {
+ dixLookupResourceByClass((pointer*) &pXinReadDraw,
+ pReadDraw->id, XRC_DRAWABLE,
+ client, DixReadAccess);
+ }
+ else {
+ pXinReadDraw = pXinDraw;
+ }
+ }
+#endif
+
+
+ /* send the MakeCurrent request to all required
+ * back-end servers.
+ */
+ for (s = from_screen; s<=to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl,s);
+ unsigned int be_draw = None;
+ unsigned int be_read_draw = None;
+
+ if (pGlxPixmap) {
+ be_draw = pGlxPixmap->be_xids[s];
+ }
+ else if (pGlxPbuffer) {
+ be_draw = pGlxPbuffer->be_xids[s];
+ }
+#ifdef PANORAMIX
+ else if (pXinDraw) {
+ dixLookupWindow(&pWin, pXinDraw->info[s].id, client, DixReadAccess);
+ }
+#endif
+ else if (pGlxWindow) {
+ pWin = (WindowPtr)pGlxWindow->pDraw;
+ }
+
+ if (pWin && be_draw == None) {
+ be_draw = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
+ if (!be_draw) {
+ /* it might be that the window did not created yet on the */
+ /* back-end server (lazy window creation option), force */
+ /* creation of the window */
+ dmxCreateAndRealizeWindow( pWin, TRUE );
+ be_draw = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
+ }
+ }
+
+ /*
+ * Before sending the MakeCurrent request - sync the
+ * X11 connection to the back-end servers to make sure
+ * that drawable is already created
+ */
+ dmxSync( dmxScreen, 1 );
+
+ if (drawId == readId) {
+ LockDisplay(dpy);
+ GetReq(GLXMakeCurrent, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXMakeCurrent;
+ be_req->drawable = be_draw;
+ be_req->context = (unsigned int)(glxc ? glxc->real_ids[s-from_screen] : 0);
+ be_req->oldContextTag = GetCurrentBackEndTag(cl, tag, s);
+ if (!_XReply(dpy, (xReply *) &be_reply, 0, False)) {
+
+ /* The make current failed */
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return( BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code) );
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ SetCurrentBackEndTag( cl, tag, s, be_reply.contextTag );
+ }
+ else {
+
+ if (pReadGlxPixmap) {
+ be_read_draw = pReadGlxPixmap->be_xids[s];
+ }
+ else if (pGlxReadPbuffer) {
+ be_read_draw = pGlxReadPbuffer->be_xids[s];
+ }
+#ifdef PANORAMIX
+ else if (pXinReadDraw) {
+ dixLookupWindow(&pReadWin, pXinReadDraw->info[s].id, client,
+ DixReadAccess);
+ }
+#endif
+ else if (pGlxReadWindow) {
+ pReadWin = (WindowPtr)pGlxReadWindow->pDraw;
+ }
+
+ if (pReadWin && be_read_draw == None) {
+ be_read_draw = (unsigned int)(DMX_GET_WINDOW_PRIV(pReadWin))->window;
+ if (!be_read_draw) {
+ /* it might be that the window did not created yet on the */
+ /* back-end server (lazy window creation option), force */
+ /* creation of the window */
+ dmxCreateAndRealizeWindow( pReadWin, TRUE );
+ be_read_draw = (unsigned int)(DMX_GET_WINDOW_PRIV(pReadWin))->window;
+ dmxSync( dmxScreen, 1 );
+ }
+ }
+
+ if ( __GLX_IS_VERSION_SUPPORTED(1,3) ) {
+ LockDisplay(dpy);
+ GetReq(GLXMakeContextCurrent, be_new_req);
+ be_new_req->reqType = dmxScreen->glxMajorOpcode;
+ be_new_req->glxCode = X_GLXMakeContextCurrent;
+ be_new_req->drawable = be_draw;
+ be_new_req->readdrawable = be_read_draw;
+ be_new_req->context = (unsigned int)(glxc ? glxc->real_ids[s-from_screen] : 0);
+ be_new_req->oldContextTag = GetCurrentBackEndTag(cl, tag, s);
+ if (!_XReply(dpy, (xReply *) &be_new_reply, 0, False)) {
+
+ /* The make current failed */
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return( BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code) );
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ SetCurrentBackEndTag( cl, tag, s, be_new_reply.contextTag );
+ }
+ else if (glxIsExtensionSupported("GLX_SGI_make_current_read")) {
+ xGLXMakeCurrentReadSGIReq *ext_req;
+ xGLXVendorPrivateWithReplyReq *vpreq;
+ xGLXMakeCurrentReadSGIReply ext_reply;
+
+ LockDisplay(dpy);
+ GetReqExtra(GLXVendorPrivateWithReply,
+ sz_xGLXMakeCurrentReadSGIReq - sz_xGLXVendorPrivateWithReplyReq,
+ vpreq);
+ ext_req = (xGLXMakeCurrentReadSGIReq *)vpreq;
+ ext_req->reqType = dmxScreen->glxMajorOpcode;
+ ext_req->glxCode = X_GLXVendorPrivateWithReply;
+ ext_req->vendorCode = X_GLXvop_MakeCurrentReadSGI;
+ ext_req->drawable = be_draw;
+ ext_req->readable = be_read_draw;
+ ext_req->context = (unsigned int)(glxc ? glxc->real_ids[s-from_screen] : 0);
+ ext_req->oldContextTag = GetCurrentBackEndTag(cl, tag, s);
+ if (!_XReply(dpy, (xReply *) &ext_reply, 0, False)) {
+
+ /* The make current failed */
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return( BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code) );
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ SetCurrentBackEndTag( cl, tag, s, ext_reply.contextTag );
+
+ }
+ else {
+ return BadMatch;
+ }
+ }
+
+ XFlush( dpy );
+ }
+
+ if (client->swapped) {
+ __glXSwapMakeCurrentReply(client, &new_reply);
+ } else {
+ WriteToClient(client, sz_xGLXMakeContextCurrentReply, (char *)&new_reply);
+ }
+
+ return Success;
+}
+
+int __glXMakeCurrent(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc;
+
+ return( MakeCurrent(cl, req->drawable, req->drawable,
+ req->context, req->oldContextTag ) );
+}
+
+int __glXMakeContextCurrent(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc;
+
+ return( MakeCurrent(cl, req->drawable, req->readdrawable,
+ req->context, req->oldContextTag ) );
+}
+
+int __glXMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc;
+
+ return( MakeCurrent(cl, req->drawable, req->readable,
+ req->context, req->oldContextTag ) );
+}
+
+int __glXIsDirect(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc;
+ xGLXIsDirectReply reply;
+ __GLXcontext *glxc;
+
+ /*
+ ** Find the GL context.
+ */
+ dixLookupResourceByType((pointer*) &glxc, req->context, __glXContextRes,
+ NullClient, DixUnknownAccess);
+ if (!glxc) {
+ client->errorValue = req->context;
+ return __glXBadContext;
+ }
+
+ reply.isDirect = 0;
+ reply.length = 0;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+
+ if (client->swapped) {
+ __glXSwapIsDirectReply(client, &reply);
+ } else {
+ WriteToClient(client, sz_xGLXIsDirectReply, (char *)&reply);
+ }
+
+ return Success;
+}
+
+int __glXQueryVersion(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+/* xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc; */
+ xGLXQueryVersionReply reply;
+
+ /*
+ ** Server should take into consideration the version numbers sent by the
+ ** client if it wants to work with older clients; however, in this
+ ** implementation the server just returns its version number.
+ */
+ reply.majorVersion = __glXVersionMajor;
+ reply.minorVersion = __glXVersionMinor;
+ reply.length = 0;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+
+ if (client->swapped) {
+ __glXSwapQueryVersionReply(client, &reply);
+ } else {
+ WriteToClient(client, sz_xGLXQueryVersionReply, (char *)&reply);
+ }
+ return Success;
+}
+
+int __glXWaitGL(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXWaitGLReq *req = (xGLXWaitGLReq *)pc;
+ xGLXWaitGLReq *be_req = (xGLXWaitGLReq *)pc;
+ int from_screen = 0;
+ int to_screen = 0;
+ int s;
+ __GLXcontext *glxc = NULL;
+
+ if (req->contextTag != 0) {
+ glxc = __glXLookupContextByTag(cl, req->contextTag);
+ if (glxc) {
+ from_screen = to_screen = glxc->pScreen->myNum;
+ }
+ }
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ }
+#endif
+
+ for (s=from_screen; s<=to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl,s);
+
+ LockDisplay(dpy);
+ GetReq(GLXWaitGL,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXWaitGL;
+ be_req->contextTag = (glxc ? GetCurrentBackEndTag(cl,req->contextTag,s) : 0);
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ XSync(dpy, False);
+ }
+
+ return Success;
+}
+
+int __glXWaitX(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXWaitXReq *req = (xGLXWaitXReq *)pc;
+ xGLXWaitXReq *be_req;
+ int from_screen = 0;
+ int to_screen = 0;
+ int s;
+ __GLXcontext *glxc = NULL;
+
+ if (req->contextTag != 0) {
+ glxc = __glXLookupContextByTag(cl, req->contextTag);
+ if (glxc) {
+ from_screen = to_screen = glxc->pScreen->myNum;
+ }
+ }
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ }
+#endif
+
+ for (s=from_screen; s<=to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl,s);
+
+ dmxSync( dmxScreen, 1 );
+
+ LockDisplay(dpy);
+ GetReq(GLXWaitX,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXWaitX;
+ be_req->contextTag = (glxc ? GetCurrentBackEndTag(cl,req->contextTag,s) : 0);
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ XFlush( dpy );
+ }
+
+ return Success;
+}
+
+int __glXCopyContext(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXCopyContextReq *be_req;
+ xGLXCopyContextReq *req = (xGLXCopyContextReq *) pc;
+ GLXContextID source = req->source;
+ GLXContextID dest = req->dest;
+ GLXContextTag tag = req->contextTag;
+ unsigned long mask = req->mask;
+ __GLXcontext *src, *dst;
+ int s;
+ int from_screen = 0;
+ int to_screen = 0;
+
+ /*
+ ** Check that each context exists.
+ */
+ dixLookupResourceByType((pointer*) &src, source, __glXContextRes,
+ NullClient, DixUnknownAccess);
+ if (!src) {
+ client->errorValue = source;
+ return __glXBadContext;
+ }
+ dixLookupResourceByType((pointer*) &dst, dest, __glXContextRes,
+ NullClient, DixUnknownAccess);
+ if (!dst) {
+ client->errorValue = dest;
+ return __glXBadContext;
+ }
+
+ /*
+ ** They must be in the same address space, and same screen.
+ */
+ if (src->pGlxScreen != dst->pGlxScreen) {
+ client->errorValue = source;
+ return BadMatch;
+ }
+
+ /*
+ ** The destination context must not be current for any client.
+ */
+ if (dst->isCurrent) {
+ client->errorValue = dest;
+ return BadAccess;
+ }
+
+ if (tag) {
+ __GLXcontext *tagcx = __glXLookupContextByTag(cl, tag);
+
+ if (!tagcx) {
+ return __glXBadContextTag;
+ }
+ if (tagcx != src) {
+ /*
+ ** This would be caused by a faulty implementation of the client
+ ** library.
+ */
+ return BadMatch;
+ }
+ }
+
+ from_screen = to_screen = src->pScreen->myNum;
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ }
+#endif
+
+ for (s=from_screen; s<=to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl,s);
+
+ LockDisplay(dpy);
+ GetReq(GLXCopyContext,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXCopyContext;
+ be_req->source = (unsigned int)src->real_ids[s-from_screen];
+ be_req->dest = (unsigned int)dst->real_ids[s-from_screen];
+ be_req->mask = mask;
+ be_req->contextTag = (tag ? GetCurrentBackEndTag(cl,req->contextTag,s) : 0);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
+
+ return Success;
+}
+
+int __glXGetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc;
+ xGLXGetVisualConfigsReply reply;
+ __GLXscreenInfo *pGlxScreen;
+ __GLXvisualConfig *pGlxVisual;
+ CARD32 buf[__GLX_TOTAL_CONFIG];
+ unsigned int screen;
+ int i, p;
+
+ screen = req->screen;
+ if (screen >= screenInfo.numScreens) {
+ /* The client library must send a valid screen number. */
+ client->errorValue = screen;
+ return BadValue;
+ }
+ pGlxScreen = &__glXActiveScreens[screen];
+
+ reply.numVisuals = pGlxScreen->numGLXVisuals;
+ reply.numProps = __GLX_TOTAL_CONFIG;
+ reply.length = (pGlxScreen->numGLXVisuals * __GLX_SIZE_CARD32 *
+ __GLX_TOTAL_CONFIG) >> 2;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+
+ WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *)&reply);
+
+ for (i=0; i < pGlxScreen->numVisuals; i++) {
+ pGlxVisual = &pGlxScreen->pGlxVisual[i];
+ if (!pGlxScreen->isGLXvis[i] || pGlxVisual->vid == 0) {
+ /* not a usable visual */
+ continue;
+ }
+ p = 0;
+ buf[p++] = pGlxVisual->vid;
+ buf[p++] = pGlxVisual->class;
+ buf[p++] = pGlxVisual->rgba;
+
+ buf[p++] = pGlxVisual->redSize;
+ buf[p++] = pGlxVisual->greenSize;
+ buf[p++] = pGlxVisual->blueSize;
+ buf[p++] = pGlxVisual->alphaSize;
+ buf[p++] = pGlxVisual->accumRedSize;
+ buf[p++] = pGlxVisual->accumGreenSize;
+ buf[p++] = pGlxVisual->accumBlueSize;
+ buf[p++] = pGlxVisual->accumAlphaSize;
+
+ buf[p++] = pGlxVisual->doubleBuffer;
+ buf[p++] = pGlxVisual->stereo;
+
+ buf[p++] = pGlxVisual->bufferSize;
+ buf[p++] = pGlxVisual->depthSize;
+ buf[p++] = pGlxVisual->stencilSize;
+ buf[p++] = pGlxVisual->auxBuffers;
+ buf[p++] = pGlxVisual->level;
+ /*
+ ** Add token/value pairs for extensions.
+ */
+ buf[p++] = GLX_VISUAL_CAVEAT_EXT;
+ buf[p++] = pGlxVisual->visualRating;
+ buf[p++] = GLX_TRANSPARENT_TYPE_EXT;
+ buf[p++] = pGlxVisual->transparentPixel;
+ buf[p++] = GLX_TRANSPARENT_RED_VALUE_EXT;
+ buf[p++] = pGlxVisual->transparentRed;
+ buf[p++] = GLX_TRANSPARENT_GREEN_VALUE_EXT;
+ buf[p++] = pGlxVisual->transparentGreen;
+ buf[p++] = GLX_TRANSPARENT_BLUE_VALUE_EXT;
+ buf[p++] = pGlxVisual->transparentBlue;
+ buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE_EXT;
+ buf[p++] = pGlxVisual->transparentAlpha;
+ buf[p++] = GLX_TRANSPARENT_INDEX_VALUE_EXT;
+ buf[p++] = pGlxVisual->transparentIndex;
+ buf[p++] = GLX_SAMPLES_SGIS;
+ buf[p++] = pGlxVisual->multiSampleSize;
+ buf[p++] = GLX_SAMPLE_BUFFERS_SGIS;
+ buf[p++] = pGlxVisual->nMultiSampleBuffers;
+ buf[p++] = GLX_VISUAL_SELECT_GROUP_SGIX;
+ buf[p++] = pGlxVisual->visualSelectGroup;
+
+ WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG,
+ (char *)buf);
+ }
+ return Success;
+}
+
+/*
+** Create a GLX Pixmap from an X Pixmap.
+*/
+static int CreateGLXPixmap(__GLXclientState *cl,
+ VisualID visual, GLXFBConfigID fbconfigId,
+ int screenNum, XID pixmapId, XID glxpixmapId )
+{
+ ClientPtr client = cl->client;
+ xGLXCreateGLXPixmapReq *be_req;
+ xGLXCreatePixmapReq *be_new_req;
+ DrawablePtr pDraw;
+ ScreenPtr pScreen;
+ VisualPtr pVisual;
+ __GLXpixmap *pGlxPixmap;
+ __GLXscreenInfo *pGlxScreen;
+ __GLXvisualConfig *pGlxVisual;
+ __GLXFBConfig *pFBConfig;
+ int i, s, rc;
+ int from_screen, to_screen;
+#ifdef PANORAMIX
+ PanoramiXRes *pXinDraw = NULL;
+#endif
+
+ rc = dixLookupDrawable(&pDraw, pixmapId, client, M_DRAWABLE_PIXMAP,
+ DixAddAccess);
+ if (rc != Success)
+ return rc;
+
+ /*
+ ** Check if screen of visual matches screen of pixmap.
+ */
+ pScreen = pDraw->pScreen;
+ if (screenNum != pScreen->myNum) {
+ return BadMatch;
+ }
+
+ if (fbconfigId == 0 && visual == 0) {
+ return BadValue;
+ }
+
+ if (fbconfigId != None) {
+ pFBConfig = glxLookupFBConfig( fbconfigId );
+ if (!pFBConfig) {
+ client->errorValue = fbconfigId;
+ return BadValue;
+ }
+ visual = pFBConfig->associatedVisualId;
+ }
+ else {
+ pFBConfig = NULL;
+ }
+
+ if (visual != None) {
+ /*
+ ** Find the VisualRec for this visual.
+ */
+ pVisual = pScreen->visuals;
+ for (i=0; i < pScreen->numVisuals; i++, pVisual++) {
+ if (pVisual->vid == visual) {
+ break;
+ }
+ }
+ if (i == pScreen->numVisuals) {
+ client->errorValue = visual;
+ return BadValue;
+ }
+ /*
+ ** Check if depth of visual matches depth of pixmap.
+ */
+ if (pVisual->nplanes != pDraw->depth) {
+ client->errorValue = visual;
+ return BadMatch;
+ }
+
+ /*
+ ** Get configuration of the visual.
+ */
+ pGlxScreen = &__glXActiveScreens[screenNum];
+ pGlxVisual = pGlxScreen->pGlxVisual;
+ for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) {
+ if (pGlxVisual->vid == visual) {
+ break;
+ }
+ }
+ if (i == pGlxScreen->numVisuals) {
+ /*
+ ** Visual not support on this screen by this OpenGL implementation.
+ */
+ client->errorValue = visual;
+ return BadValue;
+ }
+
+
+ /* find the FBConfig for that visual (if any) */
+ if ( pFBConfig == NULL ) {
+ pFBConfig = glxLookupFBConfigByVID( visual );
+
+ if ( pFBConfig == NULL ) {
+ /*
+ * visual does not have an FBConfig ???
+ client->errorValue = visual;
+ return BadValue;
+ */
+ }
+ }
+ }
+ else {
+ pVisual = NULL;
+ pGlxVisual = NULL;
+ pGlxScreen = &__glXActiveScreens[pDraw->pScreen->myNum];
+ }
+
+ pGlxPixmap = (__GLXpixmap *) malloc(sizeof(__GLXpixmap));
+ if (!pGlxPixmap) {
+ return BadAlloc;
+ }
+ pGlxPixmap->be_xids = (XID *) malloc(sizeof(XID) * screenInfo.numScreens);
+ if (!pGlxPixmap->be_xids) {
+ free( pGlxPixmap );
+ return BadAlloc;
+ }
+
+ pGlxPixmap->pDraw = pDraw;
+ pGlxPixmap->pGlxScreen = pGlxScreen;
+ pGlxPixmap->pGlxVisual = pGlxVisual;
+ pGlxPixmap->pFBConfig = pFBConfig;
+ pGlxPixmap->pScreen = pScreen;
+ pGlxPixmap->idExists = True;
+ pGlxPixmap->refcnt = 0;
+
+ /*
+ ** Bump the ref count on the X pixmap so it won't disappear.
+ */
+ ((PixmapPtr) pDraw)->refcnt++;
+
+ /*
+ * send the request to the back-end server(s)
+ */
+ from_screen = to_screen = screenNum;
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+
+ dixLookupResourceByClass((pointer*) &pXinDraw,
+ pDraw->id, XRC_DRAWABLE,
+ client, DixReadAccess);
+ }
+#endif
+
+ for (s=from_screen; s<=to_screen; s++) {
+
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl,s);
+ Pixmap be_pixmap;
+ DrawablePtr pRealDraw = pDraw;
+
+#ifdef PANORAMIX
+ if (pXinDraw) {
+ dixLookupDrawable(&pRealDraw, pXinDraw->info[s].id, client, 0,
+ DixAddAccess);
+ }
+#endif
+
+ be_pixmap = (DMX_GET_PIXMAP_PRIV((PixmapPtr)pRealDraw))->pixmap;
+
+ /* make sure pixmap already created on back-end */
+ dmxSync( dmxScreen, 1 );
+
+ if ( pFBConfig && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
+ __GLXFBConfig *be_FBConfig = glxLookupBackEndFBConfig( pFBConfig->id, s );
+
+ LockDisplay(dpy);
+ pGlxPixmap->be_xids[s] = XAllocID(dpy);
+ GetReq(GLXCreatePixmap,be_new_req);
+ be_new_req->reqType = dmxScreen->glxMajorOpcode;
+ be_new_req->glxCode = X_GLXCreatePixmap;
+ be_new_req->screen = DefaultScreen(dpy);
+ be_new_req->fbconfig = be_FBConfig->id;
+ be_new_req->pixmap = (unsigned int)be_pixmap;
+ be_new_req->glxpixmap = (unsigned int)pGlxPixmap->be_xids[s];
+ be_new_req->numAttribs = 0;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
+ else if (pFBConfig && glxIsExtensionSupported("GLX_SGIX_fbconfig")) {
+ __GLXFBConfig *be_FBConfig = glxLookupBackEndFBConfig( pFBConfig->id, s );
+ xGLXCreateGLXPixmapWithConfigSGIXReq *ext_req;
+ xGLXVendorPrivateReq *vpreq;
+
+ LockDisplay(dpy);
+ pGlxPixmap->be_xids[s] = XAllocID(dpy);
+ GetReqExtra(GLXVendorPrivate,
+ sz_xGLXCreateGLXPixmapWithConfigSGIXReq-sz_xGLXVendorPrivateReq,
+ vpreq);
+ ext_req = (xGLXCreateGLXPixmapWithConfigSGIXReq *)vpreq;
+ ext_req->reqType = dmxScreen->glxMajorOpcode;
+ ext_req->glxCode = X_GLXVendorPrivate;
+ ext_req->vendorCode = X_GLXvop_CreateGLXPixmapWithConfigSGIX;
+ ext_req->screen = DefaultScreen(dpy);
+ ext_req->fbconfig = be_FBConfig->id;
+ ext_req->pixmap = (unsigned int)be_pixmap;
+ ext_req->glxpixmap = (unsigned int)pGlxPixmap->be_xids[s];
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
+ else if (pGlxVisual) {
+ LockDisplay(dpy);
+ pGlxPixmap->be_xids[s] = XAllocID(dpy);
+ GetReq(GLXCreateGLXPixmap,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXCreateGLXPixmap;
+ be_req->screen = DefaultScreen(dpy);
+ be_req->visual = (unsigned int)glxMatchGLXVisualInConfigList(
+ pGlxVisual,
+ dmxScreen->glxVisuals,
+ dmxScreen->numGlxVisuals );
+ be_req->pixmap = (unsigned int)be_pixmap;
+ be_req->glxpixmap = (unsigned int)pGlxPixmap->be_xids[s];
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
+ else {
+ client->errorValue = ( visual ? visual : fbconfigId );
+ free( pGlxPixmap );
+ return BadValue;
+ }
+
+ XFlush( dpy );
+ }
+
+ if (!(AddResource(glxpixmapId, __glXPixmapRes, pGlxPixmap))) {
+ free( pGlxPixmap );
+ return BadAlloc;
+ }
+
+ return Success;
+}
+
+int __glXCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc;
+
+ return( CreateGLXPixmap(cl, req->visual, None,
+ req->screen, req->pixmap, req->glxpixmap) );
+}
+
+int __glXCreatePixmap(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc;
+
+ return( CreateGLXPixmap(cl, None, req->fbconfig,
+ req->screen, req->pixmap, req->glxpixmap) );
+}
+
+int __glXDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc;
+ XID glxpixmap = req->glxpixmap;
+ __GLXpixmap *pGlxPixmap;
+ int s;
+ int from_screen, to_screen;
+
+ /*
+ ** Check if it's a valid GLX pixmap.
+ */
+ dixLookupResourceByType((pointer*) &pGlxPixmap, glxpixmap,
+ __glXPixmapRes, NullClient, DixUnknownAccess);
+ if (!pGlxPixmap) {
+ client->errorValue = glxpixmap;
+ return __glXBadPixmap;
+ }
+ FreeResource(glxpixmap, FALSE);
+
+ /*
+ * destroy the pixmap on the back-end server(s).
+ */
+ from_screen = to_screen = pGlxPixmap->pDraw->pScreen->myNum;
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ }
+#endif
+
+ for (s=from_screen; s<=to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl,s);
+
+ /* make sure pixmap exist in back-end */
+ dmxSync( dmxScreen, 1 );
+
+ LockDisplay(dpy);
+ GetReq(GLXDestroyGLXPixmap,req);
+ req->reqType = dmxScreen->glxMajorOpcode;
+ req->glxCode = X_GLXDestroyGLXPixmap;
+ req->glxpixmap = (unsigned int)pGlxPixmap->be_xids[s];
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
+
+
+ return Success;
+}
+
+/*****************************************************************************/
+
+/*
+** NOTE: There is no portable implementation for swap buffers as of
+** this time that is of value. Consequently, this code must be
+** implemented by somebody other than SGI.
+*/
+int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag)
+{
+ ClientPtr client = cl->client;
+ DrawablePtr pDraw;
+ xGLXSwapBuffersReq *be_req;
+ WindowPtr pWin = NULL;
+ __GLXpixmap *pGlxPixmap = NULL;
+ __GLXcontext *glxc = NULL;
+#ifdef PANORAMIX
+ PanoramiXRes *pXinDraw = NULL;
+#endif
+ __glXWindow *pGlxWindow = NULL;
+ int from_screen = 0;
+ int to_screen = 0;
+ int s, rc;
+
+ /*
+ ** Check that the GLX drawable is valid.
+ */
+ rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixWriteAccess);
+ if (rc == Success) {
+ from_screen = to_screen = pDraw->pScreen->myNum;
+
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ /*
+ ** Drawable is an X window.
+ */
+ pWin = (WindowPtr)pDraw;
+ } else {
+ /*
+ ** Drawable is an X pixmap, which is not allowed.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+ }
+
+ if (!pDraw) {
+ dixLookupResourceByType((pointer*) &pGlxPixmap, drawId,
+ __glXPixmapRes, NullClient, DixUnknownAccess);
+ if (pGlxPixmap) {
+ /*
+ ** Drawable is a GLX pixmap.
+ */
+ pDraw = pGlxPixmap->pDraw;
+ from_screen = to_screen = pGlxPixmap->pScreen->myNum;
+ }
+ }
+
+ if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
+ dixLookupResourceByType((pointer*) &pGlxWindow, drawId,
+ __glXWindowRes, NullClient, DixUnknownAccess);
+ if (pGlxWindow) {
+ /*
+ ** Drawable is a GLXWindow.
+ */
+ pDraw = pGlxWindow->pDraw;
+ from_screen = to_screen = pGlxWindow->pScreen->myNum;
+ }
+ }
+
+ if (!pDraw) {
+ /*
+ ** Drawable is neither a X window nor a GLX pixmap.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+
+ if (tag) {
+ glxc = __glXLookupContextByTag(cl, tag);
+ if (!glxc) {
+ return __glXBadContextTag;
+ }
+ }
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ dixLookupResourceByClass((pointer*) &pXinDraw,
+ pDraw->id, XRC_DRAWABLE,
+ client, DixReadAccess);
+ }
+#endif
+
+ /* If requested, send a glFinish to all back-end servers before swapping. */
+ if (dmxGLXFinishSwap) {
+ for (s=from_screen; s<=to_screen; s++) {
+ Display *dpy = GetBackEndDisplay(cl,s);
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ xGLXSingleReq *finishReq;
+ xGLXSingleReply reply;
+
+#define X_GLXSingle 0 /* needed by GetReq below */
+
+ LockDisplay(dpy);
+ GetReq(GLXSingle,finishReq);
+ finishReq->reqType = dmxScreen->glxMajorOpcode;
+ finishReq->glxCode = X_GLsop_Finish;
+ finishReq->contextTag = (tag ? GetCurrentBackEndTag(cl,tag,s) : 0);
+ (void) _XReply(dpy, (xReply*) &reply, 0, False);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
+ }
+
+ /* If requested, send an XSync to all back-end servers before swapping. */
+ if (dmxGLXSyncSwap) {
+ for (s=from_screen; s<=to_screen; s++)
+ XSync(GetBackEndDisplay(cl,s), False);
+ }
+
+
+ /* send the SwapBuffers request to all back-end servers */
+
+ for (s=from_screen; s<=to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl,s);
+ unsigned int be_draw = 0;
+
+ if (pGlxPixmap) {
+ be_draw = (unsigned int)pGlxPixmap->be_xids[s];
+ }
+#ifdef PANORAMIX
+ else if (pXinDraw) {
+ dixLookupWindow(&pWin, pXinDraw->info[s].id, client, DixReadAccess);
+ }
+#endif
+ else if (pGlxWindow) {
+ pWin = (WindowPtr)pGlxWindow->pDraw;
+ }
+
+ if (pWin && !be_draw) {
+ be_draw = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
+ if (!be_draw) {
+ /* it might be that the window did not created yet on the */
+ /* back-end server (lazy window creation option), force */
+ /* creation of the window */
+ dmxCreateAndRealizeWindow( pWin, TRUE );
+ be_draw = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
+ }
+ }
+
+ dmxSync( dmxScreen, 1 );
+
+ LockDisplay(dpy);
+ GetReq(GLXSwapBuffers,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXSwapBuffers;
+ be_req->drawable = be_draw;
+ be_req->contextTag = ( tag ? GetCurrentBackEndTag(cl,tag,s) : 0 );
+ UnlockDisplay(dpy);
+ SyncHandle();
+ XFlush(dpy);
+ }
+
+ return Success;
+}
+
+int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ DrawablePtr pDraw;
+ xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc;
+ GLXContextTag tag = req->contextTag;
+ XID drawId = req->drawable;
+ __GLXpixmap *pGlxPixmap = NULL;
+ __GLXcontext *glxc = NULL;
+ __glXWindow *pGlxWindow = NULL;
+ int rc;
+
+ /*
+ ** Check that the GLX drawable is valid.
+ */
+ rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixWriteAccess);
+ if (rc == Success) {
+ if (pDraw->type != DRAWABLE_WINDOW) {
+ /*
+ ** Drawable is an X pixmap, which is not allowed.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+ }
+
+ if (!pDraw) {
+ dixLookupResourceByType((pointer*) &pGlxPixmap, drawId,
+ __glXPixmapRes, NullClient, DixUnknownAccess);
+ if (pGlxPixmap) {
+ /*
+ ** Drawable is a GLX pixmap.
+ */
+ pDraw = pGlxPixmap->pDraw;
+ }
+ }
+
+ if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
+ dixLookupResourceByType((pointer*) &pGlxWindow, drawId,
+ __glXWindowRes, NullClient, DixUnknownAccess);
+ if (pGlxWindow) {
+ /*
+ ** Drawable is a GLXWindow.
+ */
+ pDraw = pGlxWindow->pDraw;
+ }
+ }
+
+ if (!pDraw) {
+ /*
+ ** Drawable is neither a X window nor a GLX pixmap.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+
+ if (tag) {
+ glxc = __glXLookupContextByTag(cl, tag);
+ if (!glxc) {
+ return __glXBadContextTag;
+ }
+ }
+
+ if (pDraw &&
+ pDraw->type == DRAWABLE_WINDOW &&
+ DMX_GET_WINDOW_PRIV((WindowPtr)pDraw)->swapGroup) {
+ return SGSwapBuffers(cl, drawId, tag, pDraw);
+ }
+
+ return __glXDoSwapBuffers(cl, drawId, tag);
+}
+
+
+/************************************************************************/
+
+/*
+** Render and Renderlarge are not in the GLX API. They are used by the GLX
+** client library to send batches of GL rendering commands.
+*/
+
+/*
+** Execute all the drawing commands in a request.
+*/
+int __glXRender(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXRenderReq *req;
+ xGLXRenderReq *be_req;
+ int size;
+ __GLXcontext *glxc;
+ int from_screen = 0;
+ int to_screen = 0;
+ int s;
+
+ /*
+ ** NOTE: much of this code also appears in the byteswapping version of this
+ ** routine, __glXSwapRender(). Any changes made here should also be
+ ** duplicated there.
+ */
+
+ req = (xGLXRenderReq *) pc;
+
+ glxc = __glXLookupContextByTag(cl, req->contextTag);
+ if (!glxc) {
+ return 0;
+ }
+ from_screen = to_screen = glxc->pScreen->myNum;
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ }
+#endif
+
+ pc += sz_xGLXRenderReq;
+ size = (req->length << 2) - sz_xGLXRenderReq;
+
+ /*
+ * just forward the request to back-end server(s)
+ */
+ for (s=from_screen; s<=to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl,s);
+
+ LockDisplay(dpy);
+ GetReq(GLXRender,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXRender;
+ be_req->length = req->length;
+ be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s);
+ _XSend(dpy, (const char *)pc, size);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
+
+ return Success;
+}
+
+/*
+** Execute a large rendering request (one that spans multiple X requests).
+*/
+int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXRenderLargeReq *req;
+ xGLXRenderLargeReq *be_req;
+ __GLXcontext *glxc;
+ int from_screen = 0;
+ int to_screen = 0;
+ int s;
+
+ /*
+ ** NOTE: much of this code also appears in the byteswapping version of this
+ ** routine, __glXSwapRenderLarge(). Any changes made here should also be
+ ** duplicated there.
+ */
+
+ req = (xGLXRenderLargeReq *) pc;
+ glxc = __glXLookupContextByTag(cl, req->contextTag);
+ if (!glxc) {
+ return 0;
+ }
+ from_screen = to_screen = glxc->pScreen->myNum;
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ }
+#endif
+
+ pc += sz_xGLXRenderLargeReq;
+
+ /*
+ * just forward the request to back-end server(s)
+ */
+ for (s=from_screen; s<=to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl,s);
+
+ GetReq(GLXRenderLarge,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXRenderLarge;
+ be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s);
+ be_req->length = req->length;
+ be_req->requestNumber = req->requestNumber;
+ be_req->requestTotal = req->requestTotal;
+ be_req->dataBytes = req->dataBytes;
+ Data(dpy, (const char *)pc, req->dataBytes);
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ }
+
+ return Success;
+}
+
+
+/************************************************************************/
+
+int __glXVendorPrivate(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq *req;
+
+ req = (xGLXVendorPrivateReq *) pc;
+
+ switch( req->vendorCode ) {
+
+ case X_GLvop_DeleteTexturesEXT:
+ return __glXVForwardSingleReq( cl, pc );
+ break;
+
+ case X_GLXvop_SwapIntervalSGI:
+ if (glxIsExtensionSupported("SGI_swap_control")) {
+ return __glXVForwardSingleReq( cl, pc );
+ }
+ else {
+ return Success;
+ }
+ break;
+
+#if 0 /* glx 1.3 */
+ case X_GLXvop_CreateGLXVideoSourceSGIX:
+ break;
+ case X_GLXvop_DestroyGLXVideoSourceSGIX:
+ break;
+ case X_GLXvop_CreateGLXPixmapWithConfigSGIX:
+ break;
+ case X_GLXvop_DestroyGLXPbufferSGIX:
+ break;
+ case X_GLXvop_ChangeDrawableAttributesSGIX:
+ break;
+#endif
+
+ case X_GLXvop_BindSwapBarrierSGIX:
+ return __glXBindSwapBarrierSGIX( cl, pc );
+ break;
+
+ case X_GLXvop_JoinSwapGroupSGIX:
+ return __glXJoinSwapGroupSGIX( cl, pc );
+ break;
+
+ case X_GLXvop_CreateContextWithConfigSGIX:
+ return __glXCreateContextWithConfigSGIX( cl, pc );
+ break;
+
+ default:
+ /*
+ ** unsupported private request
+ */
+ cl->client->errorValue = req->vendorCode;
+ return __glXUnsupportedPrivateRequest;
+ }
+
+ cl->client->errorValue = req->vendorCode;
+ return __glXUnsupportedPrivateRequest;
+
+}
+
+int __glXVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateWithReplyReq *req;
+
+ req = (xGLXVendorPrivateWithReplyReq *) pc;
+
+ switch( req->vendorCode ) {
+
+ case X_GLvop_GetConvolutionFilterEXT:
+ case X_GLvop_GetConvolutionParameterfvEXT:
+ case X_GLvop_GetConvolutionParameterivEXT:
+ case X_GLvop_GetSeparableFilterEXT:
+ case X_GLvop_GetHistogramEXT:
+ case X_GLvop_GetHistogramParameterivEXT:
+ case X_GLvop_GetMinmaxEXT:
+ case X_GLvop_GetMinmaxParameterfvEXT:
+ case X_GLvop_GetMinmaxParameterivEXT:
+ case X_GLvop_AreTexturesResidentEXT:
+ case X_GLvop_IsTextureEXT:
+ return( __glXVForwardPipe0WithReply(cl, pc) );
+ break;
+
+ case X_GLvop_GenTexturesEXT:
+ return( __glXVForwardAllWithReply(cl, pc) );
+ break;
+
+
+#if 0 /* glx1.3 */
+ case X_GLvop_GetDetailTexFuncSGIS:
+ case X_GLvop_GetSharpenTexFuncSGIS:
+ case X_GLvop_GetColorTableSGI:
+ case X_GLvop_GetColorTableParameterfvSGI:
+ case X_GLvop_GetColorTableParameterivSGI:
+ case X_GLvop_GetTexFilterFuncSGIS:
+ case X_GLvop_GetInstrumentsSGIX:
+ case X_GLvop_InstrumentsBufferSGIX:
+ case X_GLvop_PollInstrumentsSGIX:
+ case X_GLvop_FlushRasterSGIX:
+ case X_GLXvop_CreateGLXPbufferSGIX:
+ case X_GLXvop_GetDrawableAttributesSGIX:
+ case X_GLXvop_QueryHyperpipeNetworkSGIX:
+ case X_GLXvop_QueryHyperpipeConfigSGIX:
+ case X_GLXvop_HyperpipeConfigSGIX:
+ case X_GLXvop_DestroyHyperpipeConfigSGIX:
+#endif
+ case X_GLXvop_QueryMaxSwapBarriersSGIX:
+ return( __glXQueryMaxSwapBarriersSGIX(cl, pc) );
+ break;
+
+ case X_GLXvop_GetFBConfigsSGIX:
+ return( __glXGetFBConfigsSGIX(cl, pc) );
+ break;
+
+ case X_GLXvop_MakeCurrentReadSGI:
+ return( __glXMakeCurrentReadSGI(cl, pc) );
+ break;
+
+ case X_GLXvop_QueryContextInfoEXT:
+ return( __glXQueryContextInfoEXT(cl,pc) );
+ break;
+
+ default:
+ /*
+ ** unsupported private request
+ */
+ cl->client->errorValue = req->vendorCode;
+ return __glXUnsupportedPrivateRequest;
+ }
+
+}
+
+int __glXQueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXQueryExtensionsStringReq *req = (xGLXQueryExtensionsStringReq *) pc;
+ xGLXQueryExtensionsStringReply reply;
+ GLint screen;
+ size_t length;
+ int len, numbytes;
+ char *be_buf;
+
+#ifdef FWD_QUERY_REQ
+ xGLXQueryExtensionsStringReq *be_req;
+ xGLXQueryExtensionsStringReply be_reply;
+ DMXScreenInfo *dmxScreen;
+ Display *dpy;
+ int slop;
+#endif
+
+ screen = req->screen;
+
+ /*
+ ** Check if screen exists.
+ */
+ if ((screen < 0) || (screen >= screenInfo.numScreens)) {
+ client->errorValue = screen;
+ return BadValue;
+ }
+
+#ifdef FWD_QUERY_REQ
+ dmxScreen = &dmxScreens[screen];
+
+ /* Send the glXQueryServerString request */
+ dpy = GetBackEndDisplay(cl,screen);
+ LockDisplay(dpy);
+ GetReq(GLXQueryExtensionsString,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXQueryServerString;
+ be_req->screen = DefaultScreen(dpy);
+ _XReply(dpy, (xReply*) &be_reply, 0, False);
+ len = (int)be_reply.length;
+ numbytes = (int)be_reply.n;
+ slop = numbytes * __GLX_SIZE_INT8 & 3;
+ be_buf = (char *)malloc(numbytes);
+ if (!be_buf) {
+ /* Throw data on the floor */
+ _XEatData(dpy, len);
+ } else {
+ _XRead(dpy, (char *)be_buf, numbytes);
+ if (slop) _XEatData(dpy,4-slop);
+ }
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+#else
+
+ be_buf = __glXGetServerString(GLX_EXTENSIONS);
+ numbytes = strlen(be_buf) + 1;
+ len = __GLX_PAD(numbytes) >> 2;
+
+#endif
+
+ length = len;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ reply.length = len;
+ reply.n = numbytes;
+
+ if (client->swapped) {
+ glxSwapQueryExtensionsStringReply(client, &reply, be_buf);
+ } else {
+ WriteToClient(client, sz_xGLXQueryExtensionsStringReply,(char *)&reply);
+ WriteToClient(client, (int)(length << 2), (char *)be_buf);
+ }
+
+ return Success;
+}
+
+int __glXQueryServerString(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) pc;
+ xGLXQueryServerStringReply reply;
+ int name;
+ GLint screen;
+ size_t length;
+ int len, numbytes;
+ char *be_buf;
+#ifdef FWD_QUERY_REQ
+ xGLXQueryServerStringReq *be_req;
+ xGLXQueryServerStringReply be_reply;
+ DMXScreenInfo *dmxScreen;
+ Display *dpy;
+ int slop;
+#endif
+
+ name = req->name;
+ screen = req->screen;
+ /*
+ ** Check if screen exists.
+ */
+ if ((screen < 0) || (screen >= screenInfo.numScreens)) {
+ client->errorValue = screen;
+ return BadValue;
+ }
+
+#ifdef FWD_QUERY_REQ
+ dmxScreen = &dmxScreens[screen];
+
+ /* Send the glXQueryServerString request */
+ dpy = GetBackEndDisplay(cl,screen);
+ LockDisplay(dpy);
+ GetReq(GLXQueryServerString,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXQueryServerString;
+ be_req->screen = DefaultScreen(dpy);
+ be_req->name = name;
+ _XReply(dpy, (xReply*) &be_reply, 0, False);
+ len = (int)be_reply.length;
+ numbytes = (int)be_reply.n;
+ slop = numbytes * __GLX_SIZE_INT8 & 3;
+ be_buf = (char *)malloc(numbytes);
+ if (!be_buf) {
+ /* Throw data on the floor */
+ _XEatData(dpy, len);
+ } else {
+ _XRead(dpy, (char *)be_buf, numbytes);
+ if (slop) _XEatData(dpy,4-slop);
+ }
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+#else
+ be_buf = __glXGetServerString(name);
+ numbytes = strlen(be_buf) + 1;
+ len = __GLX_PAD(numbytes) >> 2;
+#endif
+
+ length = len;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ reply.length = length;
+ reply.n = numbytes;
+
+ if (client->swapped) {
+ glxSwapQueryServerStringReply(client, &reply, be_buf);
+ } else {
+ WriteToClient(client, sz_xGLXQueryServerStringReply, (char *)&reply);
+ WriteToClient(client, (int)(length << 2), be_buf);
+ }
+
+ return Success;
+}
+
+int __glXClientInfo(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXClientInfoReq *req = (xGLXClientInfoReq *) pc;
+ xGLXClientInfoReq *be_req;
+ const char *buf;
+ int from_screen = 0;
+ int to_screen = 0;
+ int s;
+
+ cl->GLClientmajorVersion = req->major;
+ cl->GLClientminorVersion = req->minor;
+ free(cl->GLClientextensions);
+ buf = (const char *)(req+1);
+ cl->GLClientextensions = strdup(buf);
+
+ to_screen = screenInfo.numScreens - 1;
+
+ for (s=from_screen; s<=to_screen; s++)
+ {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl,s);
+
+ LockDisplay(dpy);
+ GetReq(GLXClientInfo,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXClientInfo;
+ be_req->major = req->major;
+ be_req->minor = req->minor;
+ be_req->length = req->length;
+ be_req->numbytes = req->numbytes;
+ Data(dpy, buf, req->numbytes);
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
+
+ return Success;
+}
+
+int __glXUseXFont(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXUseXFontReq *req;
+ xGLXUseXFontReq *be_req;
+ FontPtr pFont;
+ __GLXcontext *glxc = NULL;
+ int from_screen = 0;
+ int to_screen = 0;
+ int s;
+ dmxFontPrivPtr pFontPriv;
+ DMXScreenInfo *dmxScreen;
+ Display *dpy;
+
+ req = (xGLXUseXFontReq *) pc;
+
+ if (req->contextTag != 0) {
+ glxc = __glXLookupContextByTag(cl, req->contextTag);
+ if (glxc) {
+ from_screen = to_screen = glxc->pScreen->myNum;
+ }
+ }
+
+ /*
+ ** Font can actually be either the ID of a font or the ID of a GC
+ ** containing a font.
+ */
+ dixLookupResourceByType((pointer*) &pFont, req->font, RT_FONT,
+ NullClient, DixUnknownAccess);
+ if (!pFont) {
+ GC *pGC;
+ dixLookupResourceByType((pointer*) &pGC, req->font,
+ RT_GC, NullClient,
+ DixUnknownAccess);
+ if (!pGC) {
+ client->errorValue = req->font;
+ return BadFont;
+ }
+ pFont = pGC->font;
+ }
+
+ pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex);
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ }
+#endif
+
+
+ for (s=from_screen; s<=to_screen; s++) {
+ dmxScreen = &dmxScreens[s];
+ dpy = GetBackEndDisplay(cl,s);
+
+ dmxSync( dmxScreen, 1 );
+
+ LockDisplay(dpy);
+ GetReq(GLXUseXFont,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXUseXFont;
+ be_req->contextTag = (glxc ? GetCurrentBackEndTag(cl,req->contextTag,s) : 0);
+ be_req->font = pFontPriv->font[s]->fid;
+ be_req->first = req->first;
+ be_req->count = req->count;
+ be_req->listBase = req->listBase;
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ XSync( dpy, False );
+ }
+
+ return Success;
+}
+
+/*
+ * start GLX 1.3 here
+ */
+
+int __glXGetFBConfigs(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc;
+ xGLXGetFBConfigsReply reply;
+ __GLXFBConfig *pFBConfig;
+ CARD32 buf[2 * __GLX_TOTAL_FBCONFIG_PROPS];
+ int numAttribs = __GLX_TOTAL_FBCONFIG_PROPS;
+ unsigned int screen = req->screen;
+ int numFBConfigs, i, p;
+ __GLXscreenInfo *pGlxScreen;
+
+ if (screen >= screenInfo.numScreens) {
+ /* The client library must send a valid screen number. */
+ client->errorValue = screen;
+ return BadValue;
+ }
+
+ pGlxScreen = &__glXActiveScreens[screen];
+ numFBConfigs = __glXNumFBConfigs;
+
+ reply.numFBConfigs = numFBConfigs;
+ reply.numAttribs = numAttribs;
+ reply.length = (numFBConfigs * 2 * numAttribs * __GLX_SIZE_CARD32) >> 2;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+
+ if (client->swapped) {
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_SWAP_SHORT(&reply.sequenceNumber);
+ __GLX_SWAP_INT(&reply.length);
+ __GLX_SWAP_INT(&reply.numFBConfigs);
+ __GLX_SWAP_INT(&reply.numAttribs);
+ }
+ WriteToClient(client, sz_xGLXGetFBConfigsReply, (char *)&reply);
+
+ for (i=0; i < numFBConfigs; i++) {
+ int associatedVisualId = 0;
+ int drawableTypeIndex;
+ pFBConfig = __glXFBConfigs[ i * (screenInfo.numScreens+1) ];
+
+ p = 0;
+ /* core attributes */
+ buf[p++] = GLX_FBCONFIG_ID;
+ buf[p++] = pFBConfig->id;
+ buf[p++] = GLX_BUFFER_SIZE;
+ buf[p++] = pFBConfig->indexBits;
+ buf[p++] = GLX_LEVEL;
+ buf[p++] = pFBConfig->level;
+ buf[p++] = GLX_DOUBLEBUFFER;
+ buf[p++] = pFBConfig->doubleBufferMode;
+ buf[p++] = GLX_STEREO;
+ buf[p++] = pFBConfig->stereoMode;
+ buf[p++] = GLX_AUX_BUFFERS;
+ buf[p++] = pFBConfig->maxAuxBuffers;
+ buf[p++] = GLX_RED_SIZE;
+ buf[p++] = pFBConfig->redBits;
+ buf[p++] = GLX_GREEN_SIZE;
+ buf[p++] = pFBConfig->greenBits;
+ buf[p++] = GLX_BLUE_SIZE;
+ buf[p++] = pFBConfig->blueBits;
+ buf[p++] = GLX_ALPHA_SIZE;
+ buf[p++] = pFBConfig->alphaBits;
+ buf[p++] = GLX_DEPTH_SIZE;
+ buf[p++] = pFBConfig->depthBits;
+ buf[p++] = GLX_STENCIL_SIZE;
+ buf[p++] = pFBConfig->stencilBits;
+ buf[p++] = GLX_ACCUM_RED_SIZE;
+ buf[p++] = pFBConfig->accumRedBits;
+ buf[p++] = GLX_ACCUM_GREEN_SIZE;
+ buf[p++] = pFBConfig->accumGreenBits;
+ buf[p++] = GLX_ACCUM_BLUE_SIZE;
+ buf[p++] = pFBConfig->accumBlueBits;
+ buf[p++] = GLX_ACCUM_ALPHA_SIZE;
+ buf[p++] = pFBConfig->accumAlphaBits;
+ buf[p++] = GLX_RENDER_TYPE;
+ buf[p++] = pFBConfig->renderType;
+ buf[p++] = GLX_DRAWABLE_TYPE;
+ drawableTypeIndex = p;
+ buf[p++] = pFBConfig->drawableType;
+ buf[p++] = GLX_X_VISUAL_TYPE;
+ buf[p++] = pFBConfig->visualType;
+ buf[p++] = GLX_CONFIG_CAVEAT;
+ buf[p++] = pFBConfig->visualCaveat;
+ buf[p++] = GLX_TRANSPARENT_TYPE;
+ buf[p++] = pFBConfig->transparentType;
+ buf[p++] = GLX_TRANSPARENT_RED_VALUE;
+ buf[p++] = pFBConfig->transparentRed;
+ buf[p++] = GLX_TRANSPARENT_GREEN_VALUE;
+ buf[p++] = pFBConfig->transparentGreen;
+ buf[p++] = GLX_TRANSPARENT_BLUE_VALUE;
+ buf[p++] = pFBConfig->transparentBlue;
+ buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE;
+ buf[p++] = pFBConfig->transparentAlpha;
+ buf[p++] = GLX_TRANSPARENT_INDEX_VALUE;
+ buf[p++] = pFBConfig->transparentIndex;
+ buf[p++] = GLX_MAX_PBUFFER_WIDTH;
+ buf[p++] = pFBConfig->maxPbufferWidth;
+ buf[p++] = GLX_MAX_PBUFFER_HEIGHT;
+ buf[p++] = pFBConfig->maxPbufferHeight;
+ buf[p++] = GLX_MAX_PBUFFER_PIXELS;
+ buf[p++] = pFBConfig->maxPbufferPixels;
+
+ /*
+ * find the visual of the back-end server and match a visual
+ * on the proxy.
+ * do only once - if a visual is not yet associated.
+ */
+ if (pFBConfig->associatedVisualId == (unsigned int)-1) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[screen];
+ __GLXFBConfig *be_pFBConfig = __glXFBConfigs[ i * (screenInfo.numScreens+1)+screen+1 ];
+ __GLXvisualConfig *pGlxVisual = NULL;
+ int v;
+ int found = 0;
+ for (v=0; v<dmxScreen->numGlxVisuals; v++) {
+ if (dmxScreen->glxVisuals[v].vid == be_pFBConfig->associatedVisualId) {
+ pGlxVisual = &dmxScreen->glxVisuals[v];
+ break;
+ }
+ }
+
+ if (pGlxVisual) {
+ for (v=0; v<pGlxScreen->numVisuals; v++) {
+ if (glxVisualsMatch(&pGlxScreen->pGlxVisual[v], pGlxVisual)) {
+ associatedVisualId = pGlxScreen->pGlxVisual[v].vid;
+ found = 1;
+ break;
+ }
+ }
+ }
+
+ if (!found) {
+ associatedVisualId = 0;
+ pFBConfig->drawableType &= ~(GLX_WINDOW_BIT);
+ buf[drawableTypeIndex] = pFBConfig->drawableType;
+ }
+#ifdef PANORAMIX
+ else if (!noPanoramiXExtension) {
+ /* convert the associated visualId to the panoramix one */
+ pFBConfig->associatedVisualId =
+ PanoramiXTranslateVisualID(screen, v);
+ }
+#endif
+ }
+ else {
+ associatedVisualId = pFBConfig->associatedVisualId;
+ }
+
+ buf[p++] = GLX_VISUAL_ID;
+ buf[p++] = associatedVisualId;
+
+ /* SGIS_multisample attributes */
+ buf[p++] = GLX_SAMPLES_SGIS;
+ buf[p++] = pFBConfig->multiSampleSize;
+ buf[p++] = GLX_SAMPLE_BUFFERS_SGIS;
+ buf[p++] = pFBConfig->nMultiSampleBuffers;
+
+ /* SGIX_pbuffer specific attributes */
+ buf[p++] = GLX_OPTIMAL_PBUFFER_WIDTH_SGIX;
+ buf[p++] = pFBConfig->optimalPbufferWidth;
+ buf[p++] = GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX;
+ buf[p++] = pFBConfig->optimalPbufferHeight;
+
+ buf[p++] = GLX_VISUAL_SELECT_GROUP_SGIX;
+ buf[p++] = pFBConfig->visualSelectGroup;
+
+ if (client->swapped) {
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_SWAP_INT_ARRAY((int *)buf, 2*numAttribs);
+ }
+ WriteToClient(client, 2*numAttribs * __GLX_SIZE_CARD32, (char *)buf);
+ }
+ return Success;
+}
+
+int __glXGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *)pc;
+ xGLXGetFBConfigsReq new_req;
+
+ new_req.reqType = req->reqType;
+ new_req.glxCode = req->glxCode;
+ new_req.length = req->length;
+ new_req.screen = req->screen;
+
+ return( __glXGetFBConfigs( cl, (GLbyte *)&new_req ) );
+}
+
+
+int __glXCreateWindow(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc;
+ int screen = req->screen;
+ GLXFBConfigID fbconfigId = req->fbconfig;
+ XID windowId = req->window;
+ XID glxwindowId = req->glxwindow;
+ DrawablePtr pDraw;
+ ScreenPtr pScreen;
+ __glXWindow *pGlxWindow;
+ __GLXFBConfig *pGlxFBConfig = NULL;
+ VisualPtr pVisual;
+ VisualID visId;
+ int i, rc;
+ pointer val;
+
+ /*
+ ** Check if windowId is valid
+ */
+ rc = dixLookupDrawable(&pDraw, windowId, client, M_DRAWABLE_WINDOW,
+ DixAddAccess);
+ if (rc != Success)
+ return rc;
+
+ /*
+ ** Check if screen of window matches screen of fbconfig.
+ */
+ pScreen = pDraw->pScreen;
+ if (screen != pScreen->myNum) {
+ return BadMatch;
+ }
+
+ /*
+ ** Find the FBConfigRec for this fbconfigid.
+ */
+ if (!(pGlxFBConfig = glxLookupFBConfig(fbconfigId))) {
+ client->errorValue = fbconfigId;
+ return __glXBadFBConfig;
+ }
+ visId = pGlxFBConfig->associatedVisualId;
+
+ /*
+ ** Check if the fbconfig supports rendering to windows
+ */
+ if( !(pGlxFBConfig->drawableType & GLX_WINDOW_BIT) ) {
+ return BadMatch;
+ }
+
+ if (visId != None) {
+ /*
+ ** Check if the visual ID is valid for this screen.
+ */
+ pVisual = pScreen->visuals;
+ for (i = 0; i < pScreen->numVisuals; i++, pVisual++) {
+ if (pVisual->vid == visId) {
+ break;
+ }
+ }
+ if (i == pScreen->numVisuals) {
+ client->errorValue = visId;
+ return BadValue;
+ }
+
+ /*
+ ** Check if color buffer depth of fbconfig matches depth
+ ** of window.
+ */
+ if (pVisual->nplanes != pDraw->depth) {
+ return BadMatch;
+ }
+ } else
+ /*
+ ** The window was created with no visual that corresponds
+ ** to fbconfig
+ */
+ return BadMatch;
+
+ /*
+ ** Check if there is already a fbconfig associated with this window
+ */
+ if (Success == dixLookupResourceByType(&val,
+ glxwindowId, __glXWindowRes,
+ NullClient, DixUnknownAccess)) {
+ client->errorValue = glxwindowId;
+ return BadAlloc;
+ }
+
+ pGlxWindow = (__glXWindow *) malloc(sizeof(__glXWindow));
+ if (!pGlxWindow) {
+ return BadAlloc;
+ }
+
+ /*
+ ** Register this GLX window as a resource
+ */
+ if (!(AddResource(glxwindowId, __glXWindowRes, pGlxWindow))) {
+ return BadAlloc;
+ }
+
+ pGlxWindow->pDraw = pDraw;
+ pGlxWindow->type = GLX_GLXWINDOW_TYPE;
+ pGlxWindow->idExists = True;
+ pGlxWindow->refcnt = 0;
+ pGlxWindow->pGlxFBConfig = pGlxFBConfig;
+ pGlxWindow->pScreen = pScreen;
+
+ return Success;
+}
+
+int __glXDestroyWindow(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc;
+ XID glxwindow = req->glxwindow;
+ pointer val;
+
+ /*
+ ** Check if it's a valid GLX window.
+ */
+ if (Success != dixLookupResourceByType(&val,
+ glxwindow, __glXWindowRes,
+ NullClient, DixUnknownAccess)) {
+ client->errorValue = glxwindow;
+ return __glXBadDrawable;
+ }
+ /*
+ ** The glx window destructor will check whether it's current before
+ ** freeing anything.
+ */
+ FreeResource(glxwindow, RT_NONE);
+
+ return Success;
+}
+
+int __glXQueryContext(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ __GLXcontext *ctx;
+ xGLXQueryContextReq *req;
+ xGLXQueryContextReply reply;
+ int nProps;
+ int *sendBuf, *pSendBuf;
+ int nReplyBytes;
+
+ req = (xGLXQueryContextReq *)pc;
+ dixLookupResourceByType((pointer*) &ctx, req->context, __glXContextRes,
+ NullClient, DixUnknownAccess);
+ if (!ctx) {
+ client->errorValue = req->context;
+ return __glXBadContext;
+ }
+
+ nProps = 3;
+
+ reply.length = nProps << 1;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ reply.n = nProps;
+
+ nReplyBytes = reply.length << 2;
+ sendBuf = (int *)malloc(nReplyBytes);
+ pSendBuf = sendBuf;
+ *pSendBuf++ = GLX_FBCONFIG_ID;
+ *pSendBuf++ = (int)(ctx->pFBConfig->id);
+ *pSendBuf++ = GLX_RENDER_TYPE;
+ *pSendBuf++ = (int)(ctx->pFBConfig->renderType);
+ *pSendBuf++ = GLX_SCREEN;
+ *pSendBuf++ = (int)(ctx->pScreen->myNum);
+
+ if (client->swapped) {
+ __glXSwapQueryContextReply(client, &reply, sendBuf);
+ } else {
+ WriteToClient(client, sz_xGLXQueryContextReply, (char *)&reply);
+ WriteToClient(client, nReplyBytes, (char *)sendBuf);
+ }
+ free((char *)sendBuf);
+
+ return Success;
+}
+
+int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ __GLXcontext *ctx;
+ xGLXQueryContextInfoEXTReq *req;
+ xGLXQueryContextInfoEXTReply reply;
+ int nProps;
+ int *sendBuf, *pSendBuf;
+ int nReplyBytes;
+
+ req = (xGLXQueryContextInfoEXTReq *)pc;
+ dixLookupResourceByType((pointer*) &ctx,
+ req->context, __glXContextRes,
+ client, DixReadAccess);
+
+ if (!ctx) {
+ client->errorValue = req->context;
+ return __glXBadContext;
+ }
+
+ nProps = 4;
+
+ reply.length = nProps << 1;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ reply.n = nProps;
+
+ nReplyBytes = reply.length << 2;
+ sendBuf = (int *)malloc(nReplyBytes);
+ pSendBuf = sendBuf;
+ *pSendBuf++ = GLX_SHARE_CONTEXT_EXT;
+ *pSendBuf++ = (int)(ctx->share_id);
+ *pSendBuf++ = GLX_VISUAL_ID_EXT;
+ *pSendBuf++ = (int)(ctx->pVisual ? ctx->pVisual->vid : 0);
+ *pSendBuf++ = GLX_SCREEN_EXT;
+ *pSendBuf++ = (int)(ctx->pScreen->myNum);
+ *pSendBuf++ = GLX_FBCONFIG_ID;
+ *pSendBuf++ = (int)(ctx->pFBConfig ? ctx->pFBConfig->id : 0);
+
+ if (client->swapped) {
+ __glXSwapQueryContextInfoEXTReply(client, &reply, sendBuf);
+ } else {
+ WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *)&reply);
+ WriteToClient(client, nReplyBytes, (char *)sendBuf);
+ }
+ free((char *)sendBuf);
+
+ return Success;
+}
+
+int __glXCreatePbuffer(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *)pc;
+ xGLXCreatePbufferReq *be_req;
+ int screen = req->screen;
+ GLXFBConfigID fbconfigId = req->fbconfig;
+ GLXPbuffer pbuffer = req->pbuffer;
+ __glXPbuffer *pGlxPbuffer;
+ int numAttribs = req->numAttribs;
+ int *attr;
+ ScreenPtr pScreen;
+ __GLXFBConfig *pGlxFBConfig;
+ __GLXFBConfig *be_pGlxFBConfig;
+ XID be_xid;
+ Display *dpy;
+ DMXScreenInfo *dmxScreen;
+ int s;
+ int from_screen, to_screen;
+
+ /*
+ ** Look up screen and FBConfig.
+ */
+ if (screen >= screenInfo.numScreens) {
+ /* The client library must send a valid screen number. */
+ client->errorValue = screen;
+ return BadValue;
+ }
+ pScreen = screenInfo.screens[screen];
+
+ /*
+ ** Find the FBConfigRec for this fbconfigid.
+ */
+ if (!(pGlxFBConfig = glxLookupFBConfig(fbconfigId))) {
+ client->errorValue = fbconfigId;
+ return __glXBadFBConfig;
+ }
+
+ /*
+ ** Create the GLX part of the Pbuffer.
+ */
+ pGlxPbuffer = (__glXPbuffer *) malloc(sizeof(__glXPbuffer));
+ if (!pGlxPbuffer) {
+ return BadAlloc;
+ }
+
+ pGlxPbuffer->be_xids = (XID *) malloc( sizeof(XID) * screenInfo.numScreens );
+ if (!pGlxPbuffer->be_xids) {
+ free(pGlxPbuffer);
+ return BadAlloc;
+ }
+
+ /*
+ * Allocate an XID on the back-end server(s) and send him the request
+ */
+ from_screen = to_screen = screen;
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ }
+#endif
+
+ for (s=from_screen; s<=to_screen; s++) {
+ dpy = GetBackEndDisplay(cl,s);
+ be_xid = XAllocID(dpy);
+ dmxScreen = &dmxScreens[s];
+ be_pGlxFBConfig = glxLookupBackEndFBConfig( pGlxFBConfig->id, s );
+
+ attr = (int *)( req+1 );
+
+ LockDisplay(dpy);
+ GetReqExtra(GLXCreatePbuffer, 2 * numAttribs * __GLX_SIZE_CARD32, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXCreatePbuffer;
+ be_req->screen = be_pGlxFBConfig->screen;
+ be_req->fbconfig = be_pGlxFBConfig->id;
+ be_req->pbuffer = be_xid;
+ be_req->numAttribs = numAttribs;
+
+ /* Send attributes */
+ if ( attr != NULL ) {
+ CARD32 *pc = (CARD32 *)(be_req + 1);
+
+ while (numAttribs-- > 0) {
+ *pc++ = *attr++; /* token */
+ *pc++ = *attr++; /* value */
+ }
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ pGlxPbuffer->be_xids[s] = be_xid;
+ }
+
+
+ pGlxPbuffer->idExists = True;
+ pGlxPbuffer->refcnt = 0;
+ pGlxPbuffer->pFBConfig = pGlxFBConfig;
+ pGlxPbuffer->pScreen = pScreen;
+
+ /*
+ ** Register the resource.
+ */
+ if (!(AddResource(pbuffer, __glXPbufferRes, pGlxPbuffer))) {
+ return BadAlloc;
+ }
+
+ return Success;
+
+}
+
+int __glXDestroyPbuffer(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) pc;
+ xGLXDestroyPbufferReq *be_req;
+ GLXPbuffer pbuffer = req->pbuffer;
+ Display *dpy;
+ int screen;
+ DMXScreenInfo *dmxScreen;
+ __glXPbuffer *pGlxPbuffer;
+ int s;
+ int from_screen, to_screen;
+
+ /*
+ ** Check if it's a valid Pbuffer
+ */
+ dixLookupResourceByType((pointer*) &pGlxPbuffer, pbuffer,
+ __glXPbufferRes, NullClient, DixUnknownAccess);
+ if (!pGlxPbuffer) {
+ client->errorValue = pbuffer;
+ return __glXBadPbuffer;
+ }
+
+ screen = pGlxPbuffer->pScreen->myNum;
+
+ from_screen = to_screen = screen;
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ }
+#endif
+
+ for (s=from_screen; s<=to_screen; s++) {
+ dpy = GetBackEndDisplay(cl,s);
+ dmxScreen = &dmxScreens[s];
+
+ /* send the destroy request to the back-end server */
+ LockDisplay(dpy);
+ GetReq(GLXDestroyPbuffer, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXDestroyPbuffer;
+ be_req->pbuffer = pGlxPbuffer->be_xids[s];
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
+
+ FreeResource(pbuffer, RT_NONE);
+
+ return Success;
+}
+
+int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc;
+ xGLXGetDrawableAttributesReq *be_req;
+ xGLXGetDrawableAttributesReply reply;
+ ClientPtr client = cl->client;
+ GLXDrawable drawId = req->drawable;
+ GLXDrawable be_drawable = 0;
+ DrawablePtr pDraw = NULL;
+ Display *dpy;
+ int screen, rc;
+ DMXScreenInfo *dmxScreen;
+ CARD32 *attribs = NULL;
+ int attribs_size = 0;
+#ifdef PANORAMIX
+ PanoramiXRes *pXinDraw = NULL;
+#endif
+
+ if (drawId != None) {
+ rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixGetAttrAccess);
+ if (rc == Success && pDraw->type == DRAWABLE_WINDOW) {
+ WindowPtr pWin = (WindowPtr)pDraw;
+ be_drawable = 0;
+ screen = pWin->drawable.pScreen->myNum;
+ } else {
+ /*
+ ** Drawable is not a Window , GLXWindow or a GLXPixmap.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+
+ if (!pDraw) {
+ __GLXpixmap *pGlxPixmap;
+ dixLookupResourceByType((pointer*) &pGlxPixmap,
+ drawId, __glXPixmapRes,
+ NullClient, DixUnknownAccess);
+ if (pGlxPixmap) {
+ pDraw = pGlxPixmap->pDraw;
+ screen = pGlxPixmap->pScreen->myNum;
+ be_drawable = pGlxPixmap->be_xids[screen];
+ }
+ }
+
+ if (!pDraw) {
+ __glXWindow *pGlxWindow;
+ dixLookupResourceByType((pointer*) &pGlxWindow,
+ drawId, __glXWindowRes,
+ NullClient, DixUnknownAccess);
+ if (pGlxWindow) {
+ pDraw = pGlxWindow->pDraw;
+ screen = pGlxWindow->pScreen->myNum;
+ be_drawable = 0;
+ }
+ }
+
+ if (!pDraw) {
+ __glXPbuffer *pGlxPbuffer;
+ dixLookupResourceByType((pointer*) &pGlxPbuffer,
+ drawId, __glXPbufferRes,
+ NullClient, DixUnknownAccess);
+ if (pGlxPbuffer) {
+ pDraw = (DrawablePtr)pGlxPbuffer;
+ screen = pGlxPbuffer->pScreen->myNum;
+ be_drawable = pGlxPbuffer->be_xids[screen];
+ }
+ }
+ }
+
+ if (!pDraw) {
+ /*
+ ** Drawable is not a Window , GLXWindow or a GLXPixmap.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+
+ /* if the drawable is a window or GLXWindow -
+ * we need to find the base id on the back-end server
+ */
+ if (!be_drawable) {
+ WindowPtr pWin = (WindowPtr)pDraw;
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ if (Success != dixLookupResourceByClass((pointer*) &pXinDraw,
+ pDraw->id, XRC_DRAWABLE,
+ client, DixReadAccess)) {
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+
+ dixLookupWindow(&pWin, pXinDraw->info[screen].id, client,
+ DixReadAccess);
+ }
+#endif
+
+ if (pWin) {
+ be_drawable = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
+ if (!be_drawable) {
+ /* it might be that the window did not created yet on the */
+ /* back-end server (lazy window creation option), force */
+ /* creation of the window */
+ dmxCreateAndRealizeWindow( pWin, TRUE );
+ be_drawable = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
+ }
+ }
+ else {
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+ }
+
+
+ /* send the request to the back-end server */
+ dpy = GetBackEndDisplay(cl,screen);
+ dmxScreen = &dmxScreens[screen];
+
+ /* make sure drawable exists on back-end */
+ dmxSync( dmxScreen, 1 );
+
+ LockDisplay(dpy);
+ GetReq(GLXGetDrawableAttributes, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXGetDrawableAttributes;
+ be_req->drawable = be_drawable;
+ be_req->length = req->length;
+ if (!_XReply(dpy, (xReply *) &reply, 0, False)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return( BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code) );
+ }
+
+ if (reply.numAttribs) {
+ attribs_size = 2 * reply.numAttribs * __GLX_SIZE_CARD32;
+ attribs = (CARD32 *) malloc(attribs_size);
+ if (attribs == NULL) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return BadAlloc;
+ }
+
+ _XRead(dpy, (char *) attribs, attribs_size);
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+
+ /* send the reply back to the client */
+ reply.sequenceNumber = client->sequence;
+ if (client->swapped) {
+ __glXSwapGetDrawableAttributesReply(client, &reply, (int *)attribs);
+ }
+ else {
+ WriteToClient(client, sz_xGLXGetDrawableAttributesReply, (char *)&reply);
+ WriteToClient(client, attribs_size, (char *)attribs);
+ }
+
+ free(attribs);
+
+ return Success;
+}
+
+int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXChangeDrawableAttributesReq *req = (xGLXChangeDrawableAttributesReq *)pc;
+ xGLXChangeDrawableAttributesReq *be_req;
+ ClientPtr client = cl->client;
+ GLXDrawable drawId = req->drawable;
+ GLXDrawable be_drawable = 0;
+ DrawablePtr pDraw = NULL;
+ Display *dpy;
+ int screen, rc;
+ DMXScreenInfo *dmxScreen;
+
+ if (drawId != None) {
+ rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixSetAttrAccess);
+ if (rc == Success && pDraw->type == DRAWABLE_WINDOW) {
+ be_drawable = 0;
+ screen = pDraw->pScreen->myNum;
+ } else {
+ /*
+ ** Drawable is not a Window , GLXWindow or a GLXPixmap.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+
+ if (!pDraw) {
+ __GLXpixmap *pGlxPixmap;
+ dixLookupResourceByType((pointer*) &pGlxPixmap,
+ drawId, __glXPixmapRes,
+ NullClient, DixUnknownAccess);
+ if (pGlxPixmap) {
+ pDraw = pGlxPixmap->pDraw;
+ screen = pGlxPixmap->pScreen->myNum;
+ be_drawable = pGlxPixmap->be_xids[screen];
+ }
+ }
+
+ if (!pDraw) {
+ __glXWindow *pGlxWindow;
+ dixLookupResourceByType((pointer*) &pGlxWindow,
+ drawId, __glXWindowRes,
+ NullClient, DixUnknownAccess);
+ if (pGlxWindow) {
+ pDraw = pGlxWindow->pDraw;
+ screen = pGlxWindow->pScreen->myNum;
+ be_drawable = 0;
+ }
+ }
+
+ if (!pDraw) {
+ __glXPbuffer *pGlxPbuffer;
+ dixLookupResourceByType((pointer*) &pGlxPbuffer,
+ drawId, __glXPbufferRes,
+ NullClient, DixUnknownAccess);
+ if (pGlxPbuffer) {
+ pDraw = (DrawablePtr)pGlxPbuffer;
+ screen = pGlxPbuffer->pScreen->myNum;
+ be_drawable = pGlxPbuffer->be_xids[screen];
+ }
+ }
+ }
+
+ if (!pDraw) {
+ /*
+ ** Drawable is not a Window , GLXWindow or a GLXPixmap.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+
+ /* if the drawable is a window or GLXWindow -
+ * we need to find the base id on the back-end server
+ */
+ if (!be_drawable) {
+ WindowPtr pWin = (WindowPtr)pDraw;
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ PanoramiXRes *pXinDraw;
+ if (Success != dixLookupResourceByClass((pointer*) &pXinDraw,
+ pDraw->id, XRC_DRAWABLE,
+ client, DixReadAccess)) {
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+
+ dixLookupWindow(&pWin, pXinDraw->info[screen].id, client,
+ DixReadAccess);
+ }
+#endif
+
+ if (pWin) {
+ be_drawable = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
+ if (!be_drawable) {
+ /* it might be that the window did not created yet on the */
+ /* back-end server (lazy window creation option), force */
+ /* creation of the window */
+ dmxCreateAndRealizeWindow( pWin, TRUE );
+ be_drawable = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
+ }
+ }
+ else {
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+ }
+
+
+ /* send the request to the back-end server */
+ dpy = GetBackEndDisplay(cl,screen);
+ dmxScreen = &dmxScreens[screen];
+
+ /* make sure drawable exists on back-end */
+ dmxSync( dmxScreen, 1 );
+
+ LockDisplay(dpy);
+ GetReqExtra(GLXChangeDrawableAttributes,
+ 2 * req->numAttribs * __GLX_SIZE_CARD32, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXChangeDrawableAttributes;
+ be_req->drawable = be_drawable;
+ be_req->numAttribs = req->numAttribs;
+ be_req->length = req->length;
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ return Success;
+}
+
+int __glXSendLargeCommand(__GLXclientState *cl, GLXContextTag contextTag)
+{
+ ClientPtr client = cl->client;
+ xGLXRenderLargeReq *req;
+ GLint maxSize, amount;
+ GLint totalRequests, requestNumber;
+ GLint dataLen;
+ GLbyte *data;
+ __GLXcontext *glxc;
+ int s;
+ int from_screen, to_screen;
+
+ maxSize = cl->largeCmdMaxReqDataSize - (GLint)sizeof(xGLXRenderLargeReq);
+ dataLen = cl->largeCmdBytesTotal;
+ totalRequests = (dataLen / maxSize);
+ if (dataLen % maxSize) totalRequests++;
+
+ glxc = __glXLookupContextByTag(cl, contextTag);
+ if (!glxc) {
+ client->errorValue = contextTag;
+ return __glXBadContext;
+ }
+ from_screen = to_screen = glxc->pScreen->myNum;
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ }
+#endif
+
+ /*
+ ** Send enough requests until the whole array is sent.
+ */
+ requestNumber = 1;
+ data = cl->largeCmdBuf;
+ while (dataLen > 0) {
+ amount = dataLen;
+ if (amount > maxSize) {
+ amount = maxSize;
+ }
+
+ for (s=from_screen; s<=to_screen; s++) {
+
+ Display *dpy = GetBackEndDisplay(cl,s);
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+
+ LockDisplay(dpy);
+ GetReq(GLXRenderLarge,req);
+ req->reqType = dmxScreen->glxMajorOpcode;
+ req->glxCode = X_GLXRenderLarge;
+ req->contextTag = GetCurrentBackEndTag(cl,contextTag,s);
+ req->length += (amount + 3) >> 2;
+ req->requestNumber = requestNumber++;
+ req->requestTotal = totalRequests;
+ req->dataBytes = amount;
+ Data(dpy, ((const char*)data), amount);
+ dataLen -= amount;
+ data = ((GLbyte *) data) + amount;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
+ }
+
+ return Success;
+}
diff --git a/xorg-server/hw/dmx/glxProxy/glxsingle.c b/xorg-server/hw/dmx/glxProxy/glxsingle.c
index 7856f5884..33cc612a7 100644
--- a/xorg-server/hw/dmx/glxProxy/glxsingle.c
+++ b/xorg-server/hw/dmx/glxProxy/glxsingle.c
@@ -1,1015 +1,1016 @@
-/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */
-/*
- * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
- * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice including the dates of first publication and
- * either this permission notice or a reference to
- * http://oss.sgi.com/projects/FreeB/
- * 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
- * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of Silicon Graphics, Inc.
- * shall not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization from
- * Silicon Graphics, Inc.
- */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include "dmx.h"
-#include "dmxwindow.h"
-#include "dmxpixmap.h"
-#include "dmxfont.h"
-#include "dmxcb.h"
-
-#include "glxserver.h"
-#include "glxext.h"
-#include "g_disptab.h"
-/* #include "g_disptab_EXT.h" */
-#include "unpack.h"
-#include "glxutil.h"
-
-#include "GL/glxproto.h"
-
-#ifdef PANORAMIX
-#include "panoramiXsrv.h"
-#endif
-
-/*
- * GetReqSingle - this is the equivalent of GetReq macro
- * from Xlibint.h but it does not set the reqType field (the opcode).
- * this is because the GL single opcodes has different naming convension
- * the other X opcodes (ie. X_GLsop_GetFloatv).
- */
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
-#define GetReqSingle(name, req) \
- WORD64ALIGN\
- if ((dpy->bufptr + SIZEOF(x##name##Req)) > dpy->bufmax)\
- _XFlush(dpy);\
- req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\
- req->length = (SIZEOF(x##name##Req))>>2;\
- dpy->bufptr += SIZEOF(x##name##Req);\
- dpy->request++
-
-#else /* non-ANSI C uses empty comment instead of "##" for token concatenation */
-#define GetReqSingle(name, req) \
- WORD64ALIGN\
- if ((dpy->bufptr + SIZEOF(x/**/name/**/Req)) > dpy->bufmax)\
- _XFlush(dpy);\
- req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\
- req->length = (SIZEOF(x/**/name/**/Req))>>2;\
- dpy->bufptr += SIZEOF(x/**/name/**/Req);\
- dpy->request++
-#endif
-
-#define X_GLXSingle 0 /* needed by GetReqExtra */
-
-extern Display *GetBackEndDisplay( __GLXclientState *cl, int s );
-extern int GetCurrentBackEndTag(__GLXclientState *cl, GLXContextTag tag, int s);
-
-static int swap_vec_element_size = 0;
-
-static void SendSwappedReply( ClientPtr client,
- xGLXSingleReply *reply,
- char *buf,
- int buf_size )
-{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_SHORT(&reply->sequenceNumber);
- __GLX_SWAP_INT(&reply->length);
- __GLX_SWAP_INT(&reply->retval);
- __GLX_SWAP_INT(&reply->size);
-
- if ( (buf_size == 0) && (swap_vec_element_size > 0) ) {
- /*
- * the reply has single component - need to swap pad3
- */
- if (swap_vec_element_size == 2) {
- __GLX_SWAP_SHORT(&reply->pad3);
- }
- else if (swap_vec_element_size == 4) {
- __GLX_SWAP_INT(&reply->pad3);
- __GLX_SWAP_INT(&reply->pad4); /* some requests use also pad4
- * i.e GetConvolutionFilter
- */
- }
- else if (swap_vec_element_size == 8) {
- __GLX_SWAP_DOUBLE(&reply->pad3);
- }
- }
- else if ( (buf_size > 0) && (swap_vec_element_size > 0) ) {
- /*
- * the reply has vector of elements which needs to be swapped
- */
- int vsize = buf_size / swap_vec_element_size;
- char *p = buf;
- int i;
-
- for (i=0; i<vsize; i++) {
- if (swap_vec_element_size == 2) {
- __GLX_SWAP_SHORT(p);
- }
- else if (swap_vec_element_size == 4) {
- __GLX_SWAP_INT(p);
- }
- else if (swap_vec_element_size == 8) {
- __GLX_SWAP_DOUBLE(p);
- }
-
- p += swap_vec_element_size;
- }
-
- /*
- * swap pad words as well - for case that some single reply uses
- * them as well
- */
- __GLX_SWAP_INT(&reply->pad3);
- __GLX_SWAP_INT(&reply->pad4);
- __GLX_SWAP_INT(&reply->pad5);
- __GLX_SWAP_INT(&reply->pad6);
-
- }
-
- WriteToClient(client, sizeof(xGLXSingleReply),(char *)reply);
- if (buf_size > 0)
- WriteToClient(client, buf_size, (char *)buf);
-
-}
-
-int __glXForwardSingleReq( __GLXclientState *cl, GLbyte *pc )
-{
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
- xGLXSingleReq *be_req;
- __GLXcontext *glxc;
- int from_screen = 0;
- int to_screen = 0;
- int buf_size;
- int s;
-
- glxc = __glXLookupContextByTag(cl, req->contextTag);
- if (!glxc) {
- return 0;
- }
- from_screen = to_screen = glxc->pScreen->myNum;
-
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
- }
-#endif
-
- pc += sz_xGLXSingleReq;
- buf_size = (req->length << 2) - sz_xGLXSingleReq;
-
- /*
- * just forward the request to back-end server(s)
- */
- for (s=from_screen; s<=to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
-
- LockDisplay(dpy);
- GetReqSingle(GLXSingle,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = req->glxCode;
- be_req->length = req->length;
- be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s);
- if (buf_size > 0)
- _XSend(dpy, (const char *)pc, buf_size);
- UnlockDisplay(dpy);
- SyncHandle();
-
- if (req->glxCode == X_GLsop_Flush) {
- XFlush(dpy);
- }
-
- }
-
- return Success;
-}
-
-int __glXForwardPipe0WithReply( __GLXclientState *cl, GLbyte *pc )
-{
- ClientPtr client = cl->client;
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
- xGLXSingleReq *be_req;
- xGLXSingleReply reply;
- xGLXSingleReply be_reply;
- __GLXcontext *glxc;
- int buf_size;
- char *be_buf;
- int be_buf_size;
- DMXScreenInfo *dmxScreen;
- Display *dpy;
-
- glxc = __glXLookupContextByTag(cl, req->contextTag);
- if (!glxc) {
- return __glXBadContext;
- }
-
- pc += sz_xGLXSingleReq;
- buf_size = (req->length << 2) - sz_xGLXSingleReq;
-
- dmxScreen = &dmxScreens[glxc->pScreen->myNum];
- dpy = GetBackEndDisplay(cl, glxc->pScreen->myNum);
-
- /*
- * send the request to the first back-end server
- */
- LockDisplay(dpy);
- GetReqSingle(GLXSingle,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = req->glxCode;
- be_req->length = req->length;
- be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,glxc->pScreen->myNum);
- if (buf_size > 0)
- _XSend(dpy, (const char *)pc, buf_size);
-
- /*
- * get the reply from the back-end server
- */
- _XReply(dpy, (xReply*) &be_reply, 0, False);
- be_buf_size = be_reply.length << 2;
- if (be_buf_size > 0) {
- be_buf = (char *)malloc( be_buf_size );
- if (be_buf) {
- _XRead(dpy, be_buf, be_buf_size);
- }
- else {
- /* Throw data on the floor */
- _XEatData(dpy, be_buf_size);
- return BadAlloc;
- }
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- /*
- * send the reply to the client
- */
- reply.type = X_Reply;
- reply.sequenceNumber = client->sequence;
- reply.length = be_reply.length;
- reply.retval = be_reply.retval;
- reply.size = be_reply.size;
- reply.pad3 = be_reply.pad3;
- reply.pad4 = be_reply.pad4;
-
- if (client->swapped) {
- SendSwappedReply( client, &reply, be_buf, be_buf_size );
- }
- else {
- WriteToClient(client, sizeof(xGLXSingleReply),(char *)&reply);
- if (be_buf_size > 0)
- WriteToClient(client, be_buf_size, (char *)be_buf);
- }
-
- if (be_buf_size > 0) free(be_buf);
-
- return Success;
-}
-
-int __glXForwardAllWithReply( __GLXclientState *cl, GLbyte *pc )
-{
- ClientPtr client = cl->client;
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
- xGLXSingleReq *be_req;
- xGLXSingleReply reply;
- xGLXSingleReply be_reply;
- __GLXcontext *glxc;
- int buf_size;
- char *be_buf;
- int be_buf_size;
- int from_screen = 0;
- int to_screen = 0;
- int s;
-
- DMXScreenInfo *dmxScreen;
- Display *dpy;
-
- glxc = __glXLookupContextByTag(cl, req->contextTag);
- if (!glxc) {
- return 0;
- }
- from_screen = to_screen = glxc->pScreen->myNum;
-
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
- }
-#endif
-
- pc += sz_xGLXSingleReq;
- buf_size = (req->length << 2) - sz_xGLXSingleReq;
-
- /*
- * send the request to the first back-end server(s)
- */
- for (s=to_screen; s>=from_screen; s--) {
- dmxScreen = &dmxScreens[s];
- dpy = GetBackEndDisplay(cl,s);
-
- LockDisplay(dpy);
- GetReqSingle(GLXSingle,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = req->glxCode;
- be_req->length = req->length;
- be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s);
- if (buf_size > 0)
- _XSend(dpy, (const char *)pc, buf_size);
-
- /*
- * get the reply from the back-end server
- */
- _XReply(dpy, (xReply*) &be_reply, 0, False);
- be_buf_size = be_reply.length << 2;
- if (be_buf_size > 0) {
- be_buf = (char *)malloc( be_buf_size );
- if (be_buf) {
- _XRead(dpy, be_buf, be_buf_size);
- }
- else {
- /* Throw data on the floor */
- _XEatData(dpy, be_buf_size);
- return BadAlloc;
- }
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- if (s > from_screen && be_buf_size > 0) {
- free(be_buf);
- }
- }
-
- /*
- * send the reply to the client
- */
- reply.type = X_Reply;
- reply.sequenceNumber = client->sequence;
- reply.length = be_reply.length;
- reply.retval = be_reply.retval;
- reply.size = be_reply.size;
- reply.pad3 = be_reply.pad3;
- reply.pad4 = be_reply.pad4;
-
- if (client->swapped) {
- SendSwappedReply( client, &reply, be_buf, be_buf_size );
- }
- else {
- WriteToClient(client, sizeof(xGLXSingleReply),(char *)&reply);
- if (be_buf_size > 0)
- WriteToClient(client, be_buf_size, (char *)be_buf);
- }
-
- if (be_buf_size > 0) free(be_buf);
-
- return Success;
-}
-
-int __glXForwardSingleReqSwap( __GLXclientState *cl, GLbyte *pc )
-{
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 0;
-
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXSingleReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXSingleReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
-
- return( __glXForwardSingleReq( cl, pc ) );
-}
-
-int __glXForwardPipe0WithReplySwap( __GLXclientState *cl, GLbyte *pc )
-{
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 0;
-
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXSingleReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXSingleReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
-
- return( __glXForwardPipe0WithReply( cl, pc ) );
-}
-
-int __glXForwardPipe0WithReplySwapsv( __GLXclientState *cl, GLbyte *pc )
-{
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 2;
-
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXSingleReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXSingleReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
-
-
- return( __glXForwardPipe0WithReply( cl, pc ) );
-}
-
-int __glXForwardPipe0WithReplySwapiv( __GLXclientState *cl, GLbyte *pc )
-{
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 4;
-
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXSingleReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXSingleReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
-
-
- return( __glXForwardPipe0WithReply( cl, pc ) );
-}
-
-int __glXForwardPipe0WithReplySwapdv( __GLXclientState *cl, GLbyte *pc )
-{
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 8;
-
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXSingleReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXSingleReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
-
-
- return( __glXForwardPipe0WithReply( cl, pc ) );
-}
-
-int __glXForwardAllWithReplySwap( __GLXclientState *cl, GLbyte *pc )
-{
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 0;
-
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXSingleReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXSingleReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
-
-
- return( __glXForwardAllWithReply( cl, pc ) );
-}
-
-int __glXForwardAllWithReplySwapsv( __GLXclientState *cl, GLbyte *pc )
-{
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 2;
-
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXSingleReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXSingleReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
-
-
- return( __glXForwardAllWithReply( cl, pc ) );
-}
-
-int __glXForwardAllWithReplySwapiv( __GLXclientState *cl, GLbyte *pc )
-{
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 4;
-
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXSingleReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXSingleReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
-
-
- return( __glXForwardAllWithReply( cl, pc ) );
-}
-
-int __glXForwardAllWithReplySwapdv( __GLXclientState *cl, GLbyte *pc )
-{
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 8;
-
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXSingleReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXSingleReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
-
-
- return( __glXForwardAllWithReply( cl, pc ) );
-}
-
-static GLint __glReadPixels_size(GLenum format, GLenum type, GLint w, GLint h,
- int *elementbits_return, int *rowbytes_return )
-{
- GLint elements, esize;
- GLint rowsize, padding;
-
- if (w < 0 || h < 0) {
- return -1;
- }
- switch (format) {
- case GL_COLOR_INDEX:
- case GL_STENCIL_INDEX:
- case GL_DEPTH_COMPONENT:
- elements = 1;
- break;
- case GL_RED:
- case GL_GREEN:
- case GL_BLUE:
- case GL_ALPHA:
- case GL_LUMINANCE:
- elements = 1;
- break;
- case GL_LUMINANCE_ALPHA:
- elements = 2;
- break;
- case GL_RGB:
- case GL_BGR:
- elements = 3;
- break;
- case GL_RGBA:
- case GL_BGRA:
- case GL_ABGR_EXT:
- elements = 4;
- break;
- default:
- return -1;
- }
- /*
- ** According to the GLX protocol, each row must be padded to a multiple of
- ** 4 bytes. 4 bytes also happens to be the default alignment in the pixel
- ** store modes of the GL.
- */
- switch (type) {
- case GL_BITMAP:
- if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) {
- rowsize = ((w * elements)+7)/8;
- padding = rowsize % 4;
- if (padding) {
- rowsize += 4 - padding;
- }
- if (elementbits_return) *elementbits_return = elements;
- if (rowbytes_return) *rowbytes_return = rowsize;
- return rowsize * h;
- } else {
- return -1;
- }
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- esize = 1;
- break;
- case GL_UNSIGNED_BYTE_3_3_2:
- case GL_UNSIGNED_BYTE_2_3_3_REV:
- esize = 1;
- elements = 1;
- break;
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- esize = 2;
- break;
- case GL_UNSIGNED_SHORT_5_6_5:
- case GL_UNSIGNED_SHORT_5_6_5_REV:
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- esize = 2;
- elements = 1;
- break;
- case GL_INT:
- case GL_UNSIGNED_INT:
- case GL_FLOAT:
- esize = 4;
- break;
- case GL_UNSIGNED_INT_8_8_8_8:
- case GL_UNSIGNED_INT_8_8_8_8_REV:
- case GL_UNSIGNED_INT_10_10_10_2:
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- esize = 4;
- elements = 1;
- break;
- default:
- return -1;
- }
- rowsize = w * elements * esize;
- padding = rowsize % 4;
- if (padding) {
- rowsize += 4 - padding;
- }
-
- if (elementbits_return) *elementbits_return = esize*elements*8;
- if (rowbytes_return) *rowbytes_return = rowsize;
-
- return rowsize * h;
-}
-
-static int intersectRect( int x1, int x2, int y1, int y2,
- int X1, int X2, int Y1, int Y2,
- int *ix1, int *ix2, int *iy1, int *iy2 )
-{
- int right = (x2 < X2 ? x2 : X2);
- int bottom = (y2 < Y2 ? y2 : Y2);
- int left = (x1 > X1 ? x1 : X1);
- int top = (y1 > Y1 ? y1 : Y1);
- int width = right - left + 1;
- int height = bottom - top + 1;
-
- if ( (width <= 0) || (height <= 0) ) {
- *ix1 = *ix2 = *iy1 = *iy2 = 0;
- return 0;
- }
- else {
- *ix1 = left;
- *ix2 = right;
- *iy1 = top;
- *iy2 = bottom;
- return width * height;
- }
-
-}
-
-int __glXDisp_ReadPixels(__GLXclientState *cl, GLbyte *pc)
-{
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
- xGLXSingleReq *be_req;
- xGLXReadPixelsReply reply;
- xGLXReadPixelsReply be_reply;
- GLbyte *be_pc;
- GLint x,y;
- GLsizei width, height;
- GLenum format, type;
- GLboolean swapBytes, lsbFirst;
- ClientPtr client = cl->client;
- DrawablePtr pDraw;
- __GLXcontext *glxc;
- int from_screen = 0;
- int to_screen = 0;
- char *buf;
- int buf_size;
- int s;
- int win_x1, win_x2;
- int win_y1, win_y2;
- int ebits, rowsize;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- if (client->swapped) {
- __GLX_SWAP_INT(&req->contextTag);
- }
-
- glxc = __glXLookupContextByTag(cl, req->contextTag);
- if (!glxc) {
- return 0;
- }
- from_screen = to_screen = glxc->pScreen->myNum;
-
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
- }
-#endif
-
- pc += sz_xGLXSingleReq;
- x = *(GLint *)(pc + 0);
- y = *(GLint *)(pc + 4);
- width = *(GLsizei *)(pc + 8);
- height = *(GLsizei *)(pc + 12);
- format = *(GLenum *)(pc + 16);
- type = *(GLenum *)(pc + 20);
- swapBytes = *(GLboolean *)(pc + 24);
- lsbFirst = *(GLboolean *)(pc + 25);
-
- if (client->swapped) {
- __GLX_SWAP_INT(&x);
- __GLX_SWAP_INT(&y);
- __GLX_SWAP_INT(&width);
- __GLX_SWAP_INT(&height);
- __GLX_SWAP_INT(&format);
- __GLX_SWAP_INT(&type);
- swapBytes = !swapBytes;
- }
-
- buf_size = __glReadPixels_size(format,type,width,height, &ebits, &rowsize);
- if (buf_size > 0) {
- buf = (char *) malloc( buf_size );
- if ( !buf ) {
- return BadAlloc;
- }
- }
- else {
- buf_size = 0;
- }
-
- if (buf_size > 0) {
- /*
- * Get the current drawable this context is bound to
- */
- pDraw = __glXLookupDrawableByTag( cl, req->contextTag );
- win_x1 = pDraw->x + x;
- win_x2 = win_x1 + width - 1;
- win_y1 = (dmxGlobalHeight - pDraw->y - pDraw->height) + y;
- win_y2 = win_y1 + height - 1;
- if (pDraw->type != DRAWABLE_WINDOW) {
- from_screen = to_screen = 0;
- }
-
- for (s=from_screen; s<=to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
- int scr_x1 = dmxScreen->rootXOrigin;
- int scr_x2 = dmxScreen->rootXOrigin + dmxScreen->scrnWidth - 1;
- int scr_y1 = dmxScreen->rootYOrigin;
- int scr_y2 = dmxScreen->rootYOrigin + dmxScreen->scrnHeight - 1;
- int wx1, wx2, wy1, wy2;
- int sx, sy, sw, sh;
- int npixels;
-
- /*
- * find the window portion that is on the current screen
- */
- if (pDraw->type == DRAWABLE_WINDOW) {
- npixels = intersectRect( scr_x1, scr_x2, scr_y1, scr_y2,
- win_x1, win_x2, win_y1, win_y2,
- &wx1, &wx2, &wy1, &wy2 );
- }
- else {
- wx1 = win_x1;
- wx2 = win_x2;
- wy1 = win_y1;
- wy2 = win_y2;
- npixels = (wx2-wx1+1) * (wy2-wy1+1);
- }
-
- if (npixels > 0) {
-
- /* send the request to the back-end server */
- LockDisplay(dpy);
- GetReqExtra(GLXSingle,__GLX_PAD(26),be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLsop_ReadPixels;
- be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s);
- be_pc = ((GLbyte *)(be_req) + sz_xGLXSingleReq);
-
- sx = wx1 - pDraw->x;
- sy = wy1 - (dmxGlobalHeight - pDraw->y - pDraw->height);
- sw = (wx2-wx1+1);
- sh = (wy2-wy1+1);
-
- *(GLint *)(be_pc + 0) = sx; /* x */
- *(GLint *)(be_pc + 4) = sy; /* y */
- *(GLsizei *)(be_pc + 8) = sw; /* width */
- *(GLsizei *)(be_pc + 12) = sh; /* height */
- *(GLenum *)(be_pc + 16) = format;
- *(GLenum *)(be_pc + 20) = type;
- *(GLboolean *)(be_pc + 24) = swapBytes;
- *(GLboolean *)(be_pc + 25) = lsbFirst;
-
- _XReply(dpy, (xReply*) &be_reply, 0, False);
-
- if (be_reply.length > 0) {
- char *be_buf;
- int be_buf_size = be_reply.length << 2;
-
- be_buf = (char *) malloc( be_buf_size );
- if (be_buf) {
- _XRead(dpy, be_buf, be_buf_size);
-
- /* copy pixels data to the right location of the */
- /* reply buffer */
- if ( type != GL_BITMAP ) {
- int pbytes = ebits / 8;
- char *dst = buf + (sy-y)*rowsize + (sx-x)*pbytes;
- char *src = be_buf;
- int pad = (pbytes * sw) % 4;
- int r;
-
- for (r=0; r<sh; r++) {
- memcpy( dst, src, pbytes*sw );
- dst += rowsize;
- src += (pbytes*sw + (pad ? 4-pad : 0) );
- }
- }
- else {
- /* this is a GL_BITMAP pixel type, should copy bits */
- int r;
- int src_rowsize = bits_to_bytes(sw * ebits);
- int src_pad = src_rowsize % 4;
- if ( src_pad ) {
- src_rowsize += (4 - src_pad);
- }
-
- for (r=0; r<sh; r++) {
- unsigned char dst_mask = 0x80 >> (sx % 8);
- unsigned char src_mask = 0x80;
- char *dst = buf + (sy-y+r)*rowsize + (sx-x)/8;
- char *src = be_buf + r*src_rowsize;
- int b;
-
- for (b=0; b<sw*ebits; b++) {
- if ( *src & src_mask ) {
- *dst |= dst_mask;
- }
- else {
- *dst &= ~dst_mask;
- }
-
- if (dst_mask > 1) dst_mask >>= 1;
- else {
- dst_mask = 0x80;
- dst++;
- }
-
- if (src_mask > 1) src_mask >>= 1;
- else {
- src_mask = 0x80;
- src++;
- }
- }
- }
-
- }
-
- free( be_buf );
- }
- else {
- /* Throw data on the floor */
- _XEatData(dpy, be_buf_size);
- free( buf );
- return BadAlloc;
- }
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- } /* of npixels > 0 */
-
- } /* of for loop */
-
- } /* of if buf_size > 0 */
-
- reply.type = X_Reply;
- reply.sequenceNumber = client->sequence;
- reply.length = buf_size >> 2;
-
- if (client->swapped) {
- __GLX_SWAP_SHORT(&reply.sequenceNumber);
- __GLX_SWAP_INT(&reply.length);
- }
-
- WriteToClient(client, sizeof(xGLXReadPixelsReply),(char *)&reply);
- if (buf_size > 0) {
- WriteToClient(client, buf_size, (char *)buf);
- free( buf );
- }
-
- return Success;
-}
-
-int __glXDispSwap_GetTexImage(__GLXclientState *cl, GLbyte *pc)
-{
- __GLX_DECLARE_SWAP_VARIABLES;
- GLbyte *lpc = pc;
-
- lpc += sz_xGLXSingleReq;
- __GLX_SWAP_INT(lpc+0);
- __GLX_SWAP_INT(lpc+4);
- __GLX_SWAP_INT(lpc+8);
- __GLX_SWAP_INT(lpc+12);
-
- /* reverse swapBytes */
- *(GLboolean *)(lpc + 16) = ! *(GLboolean *)(lpc + 16);
-
- return( __glXForwardPipe0WithReplySwap( cl, pc ) );
-}
-
-int __glXDispSwap_GetColorTable(__GLXclientState *cl, GLbyte *pc)
-{
- __GLX_DECLARE_SWAP_VARIABLES;
- GLbyte *lpc = pc;
-
- lpc += sz_xGLXSingleReq;
- __GLX_SWAP_INT(lpc+0);
- __GLX_SWAP_INT(lpc+4);
- __GLX_SWAP_INT(lpc+8);
-
- /* reverse swapBytes */
- *(GLboolean *)(lpc + 12) = ! *(GLboolean *)(lpc + 12);
-
- return( __glXForwardPipe0WithReplySwap( cl, pc ) );
-}
-
-
+/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */
+/*
+ * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
+ * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice including the dates of first publication and
+ * either this permission notice or a reference to
+ * http://oss.sgi.com/projects/FreeB/
+ * 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
+ * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Silicon Graphics, Inc.
+ * shall not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization from
+ * Silicon Graphics, Inc.
+ */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxwindow.h"
+#include "dmxpixmap.h"
+#include "dmxfont.h"
+#include "dmxcb.h"
+
+#include "glxserver.h"
+#include "glxext.h"
+#include "g_disptab.h"
+/* #include "g_disptab_EXT.h" */
+#include "unpack.h"
+#include "glxutil.h"
+
+#include "GL/glxproto.h"
+
+#ifdef PANORAMIX
+#include "panoramiXsrv.h"
+#endif
+
+/*
+ * GetReqSingle - this is the equivalent of GetReq macro
+ * from Xlibint.h but it does not set the reqType field (the opcode).
+ * this is because the GL single opcodes has different naming convension
+ * the other X opcodes (ie. X_GLsop_GetFloatv).
+ */
+#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
+#define GetReqSingle(name, req) \
+ WORD64ALIGN\
+ if ((dpy->bufptr + SIZEOF(x##name##Req)) > dpy->bufmax)\
+ _XFlush(dpy);\
+ req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\
+ req->length = (SIZEOF(x##name##Req))>>2;\
+ dpy->bufptr += SIZEOF(x##name##Req);\
+ dpy->request++
+
+#else /* non-ANSI C uses empty comment instead of "##" for token concatenation */
+#define GetReqSingle(name, req) \
+ WORD64ALIGN\
+ if ((dpy->bufptr + SIZEOF(x/**/name/**/Req)) > dpy->bufmax)\
+ _XFlush(dpy);\
+ req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\
+ req->length = (SIZEOF(x/**/name/**/Req))>>2;\
+ dpy->bufptr += SIZEOF(x/**/name/**/Req);\
+ dpy->request++
+#endif
+
+#define X_GLXSingle 0 /* needed by GetReqExtra */
+
+extern Display *GetBackEndDisplay( __GLXclientState *cl, int s );
+extern int GetCurrentBackEndTag(__GLXclientState *cl, GLXContextTag tag, int s);
+
+static int swap_vec_element_size = 0;
+
+static void SendSwappedReply( ClientPtr client,
+ xGLXSingleReply *reply,
+ char *buf,
+ int buf_size )
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_SWAP_SHORT(&reply->sequenceNumber);
+ __GLX_SWAP_INT(&reply->length);
+ __GLX_SWAP_INT(&reply->retval);
+ __GLX_SWAP_INT(&reply->size);
+
+ if ( (buf_size == 0) && (swap_vec_element_size > 0) ) {
+ /*
+ * the reply has single component - need to swap pad3
+ */
+ if (swap_vec_element_size == 2) {
+ __GLX_SWAP_SHORT(&reply->pad3);
+ }
+ else if (swap_vec_element_size == 4) {
+ __GLX_SWAP_INT(&reply->pad3);
+ __GLX_SWAP_INT(&reply->pad4); /* some requests use also pad4
+ * i.e GetConvolutionFilter
+ */
+ }
+ else if (swap_vec_element_size == 8) {
+ __GLX_SWAP_DOUBLE(&reply->pad3);
+ }
+ }
+ else if ( (buf_size > 0) && (swap_vec_element_size > 0) ) {
+ /*
+ * the reply has vector of elements which needs to be swapped
+ */
+ int vsize = buf_size / swap_vec_element_size;
+ char *p = buf;
+ int i;
+
+ for (i=0; i<vsize; i++) {
+ if (swap_vec_element_size == 2) {
+ __GLX_SWAP_SHORT(p);
+ }
+ else if (swap_vec_element_size == 4) {
+ __GLX_SWAP_INT(p);
+ }
+ else if (swap_vec_element_size == 8) {
+ __GLX_SWAP_DOUBLE(p);
+ }
+
+ p += swap_vec_element_size;
+ }
+
+ /*
+ * swap pad words as well - for case that some single reply uses
+ * them as well
+ */
+ __GLX_SWAP_INT(&reply->pad3);
+ __GLX_SWAP_INT(&reply->pad4);
+ __GLX_SWAP_INT(&reply->pad5);
+ __GLX_SWAP_INT(&reply->pad6);
+
+ }
+
+ WriteToClient(client, sizeof(xGLXSingleReply),(char *)reply);
+ if (buf_size > 0)
+ WriteToClient(client, buf_size, (char *)buf);
+
+}
+
+int __glXForwardSingleReq( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXSingleReq *req = (xGLXSingleReq *)pc;
+ xGLXSingleReq *be_req;
+ __GLXcontext *glxc;
+ int from_screen = 0;
+ int to_screen = 0;
+ int buf_size;
+ int s;
+
+ glxc = __glXLookupContextByTag(cl, req->contextTag);
+ if (!glxc) {
+ return 0;
+ }
+ from_screen = to_screen = glxc->pScreen->myNum;
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ }
+#endif
+
+ pc += sz_xGLXSingleReq;
+ buf_size = (req->length << 2) - sz_xGLXSingleReq;
+
+ /*
+ * just forward the request to back-end server(s)
+ */
+ for (s=from_screen; s<=to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl,s);
+
+ LockDisplay(dpy);
+ GetReqSingle(GLXSingle,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = req->glxCode;
+ be_req->length = req->length;
+ be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s);
+ if (buf_size > 0)
+ _XSend(dpy, (const char *)pc, buf_size);
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ if (req->glxCode == X_GLsop_Flush) {
+ XFlush(dpy);
+ }
+
+ }
+
+ return Success;
+}
+
+int __glXForwardPipe0WithReply( __GLXclientState *cl, GLbyte *pc )
+{
+ ClientPtr client = cl->client;
+ xGLXSingleReq *req = (xGLXSingleReq *)pc;
+ xGLXSingleReq *be_req;
+ xGLXSingleReply reply;
+ xGLXSingleReply be_reply;
+ __GLXcontext *glxc;
+ int buf_size;
+ char *be_buf = NULL;
+ int be_buf_size;
+ DMXScreenInfo *dmxScreen;
+ Display *dpy;
+
+ glxc = __glXLookupContextByTag(cl, req->contextTag);
+ if (!glxc) {
+ return __glXBadContext;
+ }
+
+ pc += sz_xGLXSingleReq;
+ buf_size = (req->length << 2) - sz_xGLXSingleReq;
+
+ dmxScreen = &dmxScreens[glxc->pScreen->myNum];
+ dpy = GetBackEndDisplay(cl, glxc->pScreen->myNum);
+
+ /*
+ * send the request to the first back-end server
+ */
+ LockDisplay(dpy);
+ GetReqSingle(GLXSingle,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = req->glxCode;
+ be_req->length = req->length;
+ be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,glxc->pScreen->myNum);
+ if (buf_size > 0)
+ _XSend(dpy, (const char *)pc, buf_size);
+
+ /*
+ * get the reply from the back-end server
+ */
+ _XReply(dpy, (xReply*) &be_reply, 0, False);
+ be_buf_size = be_reply.length << 2;
+ if (be_buf_size > 0) {
+ be_buf = (char *)malloc( be_buf_size );
+ if (be_buf) {
+ _XRead(dpy, be_buf, be_buf_size);
+ }
+ else {
+ /* Throw data on the floor */
+ _XEatData(dpy, be_buf_size);
+ return BadAlloc;
+ }
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ /*
+ * send the reply to the client
+ */
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ reply.length = be_reply.length;
+ reply.retval = be_reply.retval;
+ reply.size = be_reply.size;
+ reply.pad3 = be_reply.pad3;
+ reply.pad4 = be_reply.pad4;
+
+ if (client->swapped) {
+ SendSwappedReply( client, &reply, be_buf, be_buf_size );
+ }
+ else {
+ WriteToClient(client, sizeof(xGLXSingleReply),(char *)&reply);
+ if (be_buf_size > 0)
+ WriteToClient(client, be_buf_size, (char *)be_buf);
+ }
+
+ if (be_buf_size > 0) free(be_buf);
+
+ return Success;
+}
+
+int __glXForwardAllWithReply( __GLXclientState *cl, GLbyte *pc )
+{
+ ClientPtr client = cl->client;
+ xGLXSingleReq *req = (xGLXSingleReq *)pc;
+ xGLXSingleReq *be_req;
+ xGLXSingleReply reply;
+ xGLXSingleReply be_reply;
+ __GLXcontext *glxc;
+ int buf_size;
+ char *be_buf = NULL;
+ int be_buf_size = 0;
+ int from_screen = 0;
+ int to_screen = 0;
+ int s;
+
+ DMXScreenInfo *dmxScreen;
+ Display *dpy;
+
+ glxc = __glXLookupContextByTag(cl, req->contextTag);
+ if (!glxc) {
+ return 0;
+ }
+ from_screen = to_screen = glxc->pScreen->myNum;
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ }
+#endif
+
+ pc += sz_xGLXSingleReq;
+ buf_size = (req->length << 2) - sz_xGLXSingleReq;
+
+ /*
+ * send the request to the first back-end server(s)
+ */
+ for (s=to_screen; s>=from_screen; s--) {
+ dmxScreen = &dmxScreens[s];
+ dpy = GetBackEndDisplay(cl,s);
+
+ LockDisplay(dpy);
+ GetReqSingle(GLXSingle,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = req->glxCode;
+ be_req->length = req->length;
+ be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s);
+ if (buf_size > 0)
+ _XSend(dpy, (const char *)pc, buf_size);
+
+ /*
+ * get the reply from the back-end server
+ */
+ _XReply(dpy, (xReply*) &be_reply, 0, False);
+ be_buf_size = be_reply.length << 2;
+ if (be_buf_size > 0) {
+ be_buf = (char *)malloc( be_buf_size );
+ if (be_buf) {
+ _XRead(dpy, be_buf, be_buf_size);
+ }
+ else {
+ /* Throw data on the floor */
+ _XEatData(dpy, be_buf_size);
+ return BadAlloc;
+ }
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ if (s > from_screen && be_buf_size > 0) {
+ free(be_buf);
+ }
+ }
+
+ /*
+ * send the reply to the client
+ */
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ reply.length = be_reply.length;
+ reply.retval = be_reply.retval;
+ reply.size = be_reply.size;
+ reply.pad3 = be_reply.pad3;
+ reply.pad4 = be_reply.pad4;
+
+ if (client->swapped) {
+ SendSwappedReply( client, &reply, be_buf, be_buf_size );
+ }
+ else {
+ WriteToClient(client, sizeof(xGLXSingleReply),(char *)&reply);
+ if (be_buf_size > 0)
+ WriteToClient(client, be_buf_size, (char *)be_buf);
+ }
+
+ if (be_buf_size > 0) free(be_buf);
+
+ return Success;
+}
+
+int __glXForwardSingleReqSwap( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXSingleReq *req = (xGLXSingleReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 0;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXSingleReq/4) {
+ int *data = (int *)(req+1);
+ int count = req->length - sz_xGLXSingleReq/4;
+ __GLX_SWAP_INT_ARRAY(data, count );
+ }
+
+ return( __glXForwardSingleReq( cl, pc ) );
+}
+
+int __glXForwardPipe0WithReplySwap( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXSingleReq *req = (xGLXSingleReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 0;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXSingleReq/4) {
+ int *data = (int *)(req+1);
+ int count = req->length - sz_xGLXSingleReq/4;
+ __GLX_SWAP_INT_ARRAY(data, count );
+ }
+
+ return( __glXForwardPipe0WithReply( cl, pc ) );
+}
+
+int __glXForwardPipe0WithReplySwapsv( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXSingleReq *req = (xGLXSingleReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 2;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXSingleReq/4) {
+ int *data = (int *)(req+1);
+ int count = req->length - sz_xGLXSingleReq/4;
+ __GLX_SWAP_INT_ARRAY(data, count );
+ }
+
+
+ return( __glXForwardPipe0WithReply( cl, pc ) );
+}
+
+int __glXForwardPipe0WithReplySwapiv( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXSingleReq *req = (xGLXSingleReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 4;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXSingleReq/4) {
+ int *data = (int *)(req+1);
+ int count = req->length - sz_xGLXSingleReq/4;
+ __GLX_SWAP_INT_ARRAY(data, count );
+ }
+
+
+ return( __glXForwardPipe0WithReply( cl, pc ) );
+}
+
+int __glXForwardPipe0WithReplySwapdv( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXSingleReq *req = (xGLXSingleReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 8;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXSingleReq/4) {
+ int *data = (int *)(req+1);
+ int count = req->length - sz_xGLXSingleReq/4;
+ __GLX_SWAP_INT_ARRAY(data, count );
+ }
+
+
+ return( __glXForwardPipe0WithReply( cl, pc ) );
+}
+
+int __glXForwardAllWithReplySwap( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXSingleReq *req = (xGLXSingleReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 0;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXSingleReq/4) {
+ int *data = (int *)(req+1);
+ int count = req->length - sz_xGLXSingleReq/4;
+ __GLX_SWAP_INT_ARRAY(data, count );
+ }
+
+
+ return( __glXForwardAllWithReply( cl, pc ) );
+}
+
+int __glXForwardAllWithReplySwapsv( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXSingleReq *req = (xGLXSingleReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 2;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXSingleReq/4) {
+ int *data = (int *)(req+1);
+ int count = req->length - sz_xGLXSingleReq/4;
+ __GLX_SWAP_INT_ARRAY(data, count );
+ }
+
+
+ return( __glXForwardAllWithReply( cl, pc ) );
+}
+
+int __glXForwardAllWithReplySwapiv( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXSingleReq *req = (xGLXSingleReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 4;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXSingleReq/4) {
+ int *data = (int *)(req+1);
+ int count = req->length - sz_xGLXSingleReq/4;
+ __GLX_SWAP_INT_ARRAY(data, count );
+ }
+
+
+ return( __glXForwardAllWithReply( cl, pc ) );
+}
+
+int __glXForwardAllWithReplySwapdv( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXSingleReq *req = (xGLXSingleReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 8;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXSingleReq/4) {
+ int *data = (int *)(req+1);
+ int count = req->length - sz_xGLXSingleReq/4;
+ __GLX_SWAP_INT_ARRAY(data, count );
+ }
+
+
+ return( __glXForwardAllWithReply( cl, pc ) );
+}
+
+static GLint __glReadPixels_size(GLenum format, GLenum type, GLint w, GLint h,
+ int *elementbits_return, int *rowbytes_return )
+{
+ GLint elements, esize;
+ GLint rowsize, padding;
+
+ if (w < 0 || h < 0) {
+ return -1;
+ }
+ switch (format) {
+ case GL_COLOR_INDEX:
+ case GL_STENCIL_INDEX:
+ case GL_DEPTH_COMPONENT:
+ elements = 1;
+ break;
+ case GL_RED:
+ case GL_GREEN:
+ case GL_BLUE:
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ elements = 1;
+ break;
+ case GL_LUMINANCE_ALPHA:
+ elements = 2;
+ break;
+ case GL_RGB:
+ case GL_BGR:
+ elements = 3;
+ break;
+ case GL_RGBA:
+ case GL_BGRA:
+ case GL_ABGR_EXT:
+ elements = 4;
+ break;
+ default:
+ return -1;
+ }
+ /*
+ ** According to the GLX protocol, each row must be padded to a multiple of
+ ** 4 bytes. 4 bytes also happens to be the default alignment in the pixel
+ ** store modes of the GL.
+ */
+ switch (type) {
+ case GL_BITMAP:
+ if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) {
+ rowsize = ((w * elements)+7)/8;
+ padding = rowsize % 4;
+ if (padding) {
+ rowsize += 4 - padding;
+ }
+ if (elementbits_return) *elementbits_return = elements;
+ if (rowbytes_return) *rowbytes_return = rowsize;
+ return rowsize * h;
+ } else {
+ return -1;
+ }
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ esize = 1;
+ break;
+ case GL_UNSIGNED_BYTE_3_3_2:
+ case GL_UNSIGNED_BYTE_2_3_3_REV:
+ esize = 1;
+ elements = 1;
+ break;
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ esize = 2;
+ break;
+ case GL_UNSIGNED_SHORT_5_6_5:
+ case GL_UNSIGNED_SHORT_5_6_5_REV:
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ esize = 2;
+ elements = 1;
+ break;
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_FLOAT:
+ esize = 4;
+ break;
+ case GL_UNSIGNED_INT_8_8_8_8:
+ case GL_UNSIGNED_INT_8_8_8_8_REV:
+ case GL_UNSIGNED_INT_10_10_10_2:
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ esize = 4;
+ elements = 1;
+ break;
+ default:
+ return -1;
+ }
+ rowsize = w * elements * esize;
+ padding = rowsize % 4;
+ if (padding) {
+ rowsize += 4 - padding;
+ }
+
+ if (elementbits_return) *elementbits_return = esize*elements*8;
+ if (rowbytes_return) *rowbytes_return = rowsize;
+
+ return rowsize * h;
+}
+
+static int intersectRect( int x1, int x2, int y1, int y2,
+ int X1, int X2, int Y1, int Y2,
+ int *ix1, int *ix2, int *iy1, int *iy2 )
+{
+ int right = (x2 < X2 ? x2 : X2);
+ int bottom = (y2 < Y2 ? y2 : Y2);
+ int left = (x1 > X1 ? x1 : X1);
+ int top = (y1 > Y1 ? y1 : Y1);
+ int width = right - left + 1;
+ int height = bottom - top + 1;
+
+ if ( (width <= 0) || (height <= 0) ) {
+ *ix1 = *ix2 = *iy1 = *iy2 = 0;
+ return 0;
+ }
+ else {
+ *ix1 = left;
+ *ix2 = right;
+ *iy1 = top;
+ *iy2 = bottom;
+ return width * height;
+ }
+
+}
+
+int __glXDisp_ReadPixels(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq *req = (xGLXSingleReq *)pc;
+ xGLXSingleReq *be_req;
+ xGLXReadPixelsReply reply;
+ xGLXReadPixelsReply be_reply;
+ GLbyte *be_pc;
+ GLint x,y;
+ GLsizei width, height;
+ GLenum format, type;
+ GLboolean swapBytes, lsbFirst;
+ ClientPtr client = cl->client;
+ DrawablePtr pDraw;
+ __GLXcontext *glxc;
+ int from_screen = 0;
+ int to_screen = 0;
+ char *buf;
+ int buf_size;
+ int s;
+ int win_x1, win_x2;
+ int win_y1, win_y2;
+ int ebits, rowsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ if (client->swapped) {
+ __GLX_SWAP_INT(&req->contextTag);
+ }
+
+ glxc = __glXLookupContextByTag(cl, req->contextTag);
+ if (!glxc) {
+ return 0;
+ }
+ from_screen = to_screen = glxc->pScreen->myNum;
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ }
+#endif
+
+ pc += sz_xGLXSingleReq;
+ x = *(GLint *)(pc + 0);
+ y = *(GLint *)(pc + 4);
+ width = *(GLsizei *)(pc + 8);
+ height = *(GLsizei *)(pc + 12);
+ format = *(GLenum *)(pc + 16);
+ type = *(GLenum *)(pc + 20);
+ swapBytes = *(GLboolean *)(pc + 24);
+ lsbFirst = *(GLboolean *)(pc + 25);
+
+ if (client->swapped) {
+ __GLX_SWAP_INT(&x);
+ __GLX_SWAP_INT(&y);
+ __GLX_SWAP_INT(&width);
+ __GLX_SWAP_INT(&height);
+ __GLX_SWAP_INT(&format);
+ __GLX_SWAP_INT(&type);
+ swapBytes = !swapBytes;
+ }
+
+ buf_size = __glReadPixels_size(format,type,width,height, &ebits, &rowsize);
+ if (buf_size > 0) {
+ buf = (char *) malloc( buf_size );
+ if ( !buf ) {
+ return BadAlloc;
+ }
+ }
+ else {
+ buf_size = 0;
+ buf = NULL;
+ }
+
+ if (buf_size > 0) {
+ /*
+ * Get the current drawable this context is bound to
+ */
+ pDraw = __glXLookupDrawableByTag( cl, req->contextTag );
+ win_x1 = pDraw->x + x;
+ win_x2 = win_x1 + width - 1;
+ win_y1 = (dmxGlobalHeight - pDraw->y - pDraw->height) + y;
+ win_y2 = win_y1 + height - 1;
+ if (pDraw->type != DRAWABLE_WINDOW) {
+ from_screen = to_screen = 0;
+ }
+
+ for (s=from_screen; s<=to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl,s);
+ int scr_x1 = dmxScreen->rootXOrigin;
+ int scr_x2 = dmxScreen->rootXOrigin + dmxScreen->scrnWidth - 1;
+ int scr_y1 = dmxScreen->rootYOrigin;
+ int scr_y2 = dmxScreen->rootYOrigin + dmxScreen->scrnHeight - 1;
+ int wx1, wx2, wy1, wy2;
+ int sx, sy, sw, sh;
+ int npixels;
+
+ /*
+ * find the window portion that is on the current screen
+ */
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ npixels = intersectRect( scr_x1, scr_x2, scr_y1, scr_y2,
+ win_x1, win_x2, win_y1, win_y2,
+ &wx1, &wx2, &wy1, &wy2 );
+ }
+ else {
+ wx1 = win_x1;
+ wx2 = win_x2;
+ wy1 = win_y1;
+ wy2 = win_y2;
+ npixels = (wx2-wx1+1) * (wy2-wy1+1);
+ }
+
+ if (npixels > 0) {
+
+ /* send the request to the back-end server */
+ LockDisplay(dpy);
+ GetReqExtra(GLXSingle,__GLX_PAD(26),be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLsop_ReadPixels;
+ be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s);
+ be_pc = ((GLbyte *)(be_req) + sz_xGLXSingleReq);
+
+ sx = wx1 - pDraw->x;
+ sy = wy1 - (dmxGlobalHeight - pDraw->y - pDraw->height);
+ sw = (wx2-wx1+1);
+ sh = (wy2-wy1+1);
+
+ *(GLint *)(be_pc + 0) = sx; /* x */
+ *(GLint *)(be_pc + 4) = sy; /* y */
+ *(GLsizei *)(be_pc + 8) = sw; /* width */
+ *(GLsizei *)(be_pc + 12) = sh; /* height */
+ *(GLenum *)(be_pc + 16) = format;
+ *(GLenum *)(be_pc + 20) = type;
+ *(GLboolean *)(be_pc + 24) = swapBytes;
+ *(GLboolean *)(be_pc + 25) = lsbFirst;
+
+ _XReply(dpy, (xReply*) &be_reply, 0, False);
+
+ if (be_reply.length > 0) {
+ char *be_buf;
+ int be_buf_size = be_reply.length << 2;
+
+ be_buf = (char *) malloc( be_buf_size );
+ if (be_buf) {
+ _XRead(dpy, be_buf, be_buf_size);
+
+ /* copy pixels data to the right location of the */
+ /* reply buffer */
+ if ( type != GL_BITMAP ) {
+ int pbytes = ebits / 8;
+ char *dst = buf + (sy-y)*rowsize + (sx-x)*pbytes;
+ char *src = be_buf;
+ int pad = (pbytes * sw) % 4;
+ int r;
+
+ for (r=0; r<sh; r++) {
+ memcpy( dst, src, pbytes*sw );
+ dst += rowsize;
+ src += (pbytes*sw + (pad ? 4-pad : 0) );
+ }
+ }
+ else {
+ /* this is a GL_BITMAP pixel type, should copy bits */
+ int r;
+ int src_rowsize = bits_to_bytes(sw * ebits);
+ int src_pad = src_rowsize % 4;
+ if ( src_pad ) {
+ src_rowsize += (4 - src_pad);
+ }
+
+ for (r=0; r<sh; r++) {
+ unsigned char dst_mask = 0x80 >> (sx % 8);
+ unsigned char src_mask = 0x80;
+ char *dst = buf + (sy-y+r)*rowsize + (sx-x)/8;
+ char *src = be_buf + r*src_rowsize;
+ int b;
+
+ for (b=0; b<sw*ebits; b++) {
+ if ( *src & src_mask ) {
+ *dst |= dst_mask;
+ }
+ else {
+ *dst &= ~dst_mask;
+ }
+
+ if (dst_mask > 1) dst_mask >>= 1;
+ else {
+ dst_mask = 0x80;
+ dst++;
+ }
+
+ if (src_mask > 1) src_mask >>= 1;
+ else {
+ src_mask = 0x80;
+ src++;
+ }
+ }
+ }
+
+ }
+
+ free( be_buf );
+ }
+ else {
+ /* Throw data on the floor */
+ _XEatData(dpy, be_buf_size);
+ free( buf );
+ return BadAlloc;
+ }
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ } /* of npixels > 0 */
+
+ } /* of for loop */
+
+ } /* of if buf_size > 0 */
+
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ reply.length = buf_size >> 2;
+
+ if (client->swapped) {
+ __GLX_SWAP_SHORT(&reply.sequenceNumber);
+ __GLX_SWAP_INT(&reply.length);
+ }
+
+ WriteToClient(client, sizeof(xGLXReadPixelsReply),(char *)&reply);
+ if (buf_size > 0) {
+ WriteToClient(client, buf_size, (char *)buf);
+ free( buf );
+ }
+
+ return Success;
+}
+
+int __glXDispSwap_GetTexImage(__GLXclientState *cl, GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+ GLbyte *lpc = pc;
+
+ lpc += sz_xGLXSingleReq;
+ __GLX_SWAP_INT(lpc+0);
+ __GLX_SWAP_INT(lpc+4);
+ __GLX_SWAP_INT(lpc+8);
+ __GLX_SWAP_INT(lpc+12);
+
+ /* reverse swapBytes */
+ *(GLboolean *)(lpc + 16) = ! *(GLboolean *)(lpc + 16);
+
+ return( __glXForwardPipe0WithReplySwap( cl, pc ) );
+}
+
+int __glXDispSwap_GetColorTable(__GLXclientState *cl, GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+ GLbyte *lpc = pc;
+
+ lpc += sz_xGLXSingleReq;
+ __GLX_SWAP_INT(lpc+0);
+ __GLX_SWAP_INT(lpc+4);
+ __GLX_SWAP_INT(lpc+8);
+
+ /* reverse swapBytes */
+ *(GLboolean *)(lpc + 12) = ! *(GLboolean *)(lpc + 12);
+
+ return( __glXForwardPipe0WithReplySwap( cl, pc ) );
+}
+
+
diff --git a/xorg-server/hw/dmx/glxProxy/glxvendor.c b/xorg-server/hw/dmx/glxProxy/glxvendor.c
index 26a9c92fb..0b6ba4134 100644
--- a/xorg-server/hw/dmx/glxProxy/glxvendor.c
+++ b/xorg-server/hw/dmx/glxProxy/glxvendor.c
@@ -1,585 +1,585 @@
-/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */
-/*
- * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
- * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice including the dates of first publication and
- * either this permission notice or a reference to
- * http://oss.sgi.com/projects/FreeB/
- * 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
- * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of Silicon Graphics, Inc.
- * shall not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization from
- * Silicon Graphics, Inc.
- */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include "dmx.h"
-#include "dmxwindow.h"
-#include "dmxpixmap.h"
-#include "dmxfont.h"
-
-#include "glxserver.h"
-#include "glxext.h"
-#include "g_disptab.h"
-/* #include "g_disptab_EXT.h" */
-#include "unpack.h"
-#include "glxutil.h"
-
-#include "GL/glxproto.h"
-
-#ifdef PANORAMIX
-#include "panoramiXsrv.h"
-#endif
-
-/*
- * GetReqVendorPrivate - this is the equivalent of GetReq macro
- * from Xlibint.h but it does not set the reqType field (the opcode).
- * this is because the GL single opcodes has different naming convension
- * the other X opcodes (ie. X_GLsop_GetFloatv).
- */
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
-#define GetReqVendorPrivate(name, req) \
- WORD64ALIGN\
- if ((dpy->bufptr + SIZEOF(x##name##Req)) > dpy->bufmax)\
- _XFlush(dpy);\
- req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\
- req->length = (SIZEOF(x##name##Req))>>2;\
- dpy->bufptr += SIZEOF(x##name##Req);\
- dpy->request++
-
-#else /* non-ANSI C uses empty comment instead of "##" for token concatenation */
-#define GetReqVendorPrivate(name, req) \
- WORD64ALIGN\
- if ((dpy->bufptr + SIZEOF(x/**/name/**/Req)) > dpy->bufmax)\
- _XFlush(dpy);\
- req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\
- req->length = (SIZEOF(x/**/name/**/Req))>>2;\
- dpy->bufptr += SIZEOF(x/**/name/**/Req);\
- dpy->request++
-#endif
-
-extern Display *GetBackEndDisplay( __GLXclientState *cl, int s );
-extern int GetCurrentBackEndTag(__GLXclientState *cl, GLXContextTag tag, int s);
-
-static int swap_vec_element_size = 0;
-
-static void SendSwappedReply( ClientPtr client,
- xGLXVendorPrivReply *reply,
- char *buf,
- int buf_size )
-{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_SHORT(&reply->sequenceNumber);
- __GLX_SWAP_INT(&reply->length);
- __GLX_SWAP_INT(&reply->retval);
- __GLX_SWAP_INT(&reply->size);
-
- if ( (buf_size == 0) && (swap_vec_element_size > 0) ) {
- /*
- * the reply has single component - need to swap pad3
- */
- if (swap_vec_element_size == 2) {
- __GLX_SWAP_SHORT(&reply->pad3);
- }
- else if (swap_vec_element_size == 4) {
- __GLX_SWAP_INT(&reply->pad3);
- __GLX_SWAP_INT(&reply->pad4);
- }
- else if (swap_vec_element_size == 8) {
- __GLX_SWAP_DOUBLE(&reply->pad3);
- }
- }
- else if ( (buf_size > 0) && (swap_vec_element_size > 0) ) {
- /*
- * the reply has vector of elements which needs to be swapped
- */
- int vsize = buf_size / swap_vec_element_size;
- char *p = buf;
- int i;
-
- for (i=0; i<vsize; i++) {
- if (swap_vec_element_size == 2) {
- __GLX_SWAP_SHORT(p);
- }
- else if (swap_vec_element_size == 4) {
- __GLX_SWAP_INT(p);
- }
- else if (swap_vec_element_size == 8) {
- __GLX_SWAP_DOUBLE(p);
- }
-
- p += swap_vec_element_size;
- }
-
- __GLX_SWAP_INT(&reply->pad3);
- __GLX_SWAP_INT(&reply->pad4);
- __GLX_SWAP_INT(&reply->pad5);
- __GLX_SWAP_INT(&reply->pad6);
-
- }
-
- WriteToClient(client, sizeof(xGLXVendorPrivReply),(char *)reply);
- if (buf_size > 0)
- WriteToClient(client, buf_size, (char *)buf);
-
-}
-
-int __glXVForwardSingleReq( __GLXclientState *cl, GLbyte *pc )
-{
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
- xGLXVendorPrivateReq *be_req;
- __GLXcontext *glxc;
- int from_screen = 0;
- int to_screen = 0;
- int buf_size;
- int s;
-
- glxc = __glXLookupContextByTag(cl, req->contextTag);
- if (!glxc) {
- return 0;
- }
- from_screen = to_screen = glxc->pScreen->myNum;
-
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
- }
-#endif
-
- pc += sz_xGLXVendorPrivateReq;
- buf_size = (req->length << 2) - sz_xGLXVendorPrivateReq;
-
- /*
- * just forward the request to back-end server(s)
- */
- for (s=from_screen; s<=to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
-
- LockDisplay(dpy);
- GetReqVendorPrivate(GLXVendorPrivate,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = req->glxCode;
- be_req->length = req->length;
- be_req->vendorCode = req->vendorCode;
- be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s);
- if (buf_size > 0)
- _XSend(dpy, (const char *)pc, buf_size);
- UnlockDisplay(dpy);
- SyncHandle();
- }
-
- return Success;
-}
-
-int __glXVForwardPipe0WithReply( __GLXclientState *cl, GLbyte *pc )
-{
- ClientPtr client = cl->client;
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
- xGLXVendorPrivateReq *be_req;
- xGLXVendorPrivReply reply;
- xGLXVendorPrivReply be_reply;
- __GLXcontext *glxc;
- int buf_size;
- char *be_buf;
- int be_buf_size;
- DMXScreenInfo *dmxScreen;
- Display *dpy;
-
- glxc = __glXLookupContextByTag(cl, req->contextTag);
- if (!glxc) {
- return __glXBadContext;
- }
-
- pc += sz_xGLXVendorPrivateReq;
- buf_size = (req->length << 2) - sz_xGLXVendorPrivateReq;
-
- dmxScreen = &dmxScreens[glxc->pScreen->myNum];
- dpy = GetBackEndDisplay(cl, glxc->pScreen->myNum);
-
- /*
- * send the request to the first back-end server
- */
- LockDisplay(dpy);
- GetReqVendorPrivate(GLXVendorPrivate,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = req->glxCode;
- be_req->length = req->length;
- be_req->vendorCode = req->vendorCode;
- be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag, glxc->pScreen->myNum);
- if (buf_size > 0)
- _XSend(dpy, (const char *)pc, buf_size);
-
- /*
- * get the reply from the back-end server
- */
- _XReply(dpy, (xReply*) &be_reply, 0, False);
- be_buf_size = be_reply.length << 2;
- if (be_buf_size > 0) {
- be_buf = (char *)malloc( be_buf_size );
- if (be_buf) {
- _XRead(dpy, be_buf, be_buf_size);
- }
- else {
- /* Throw data on the floor */
- _XEatData(dpy, be_buf_size);
- return BadAlloc;
- }
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- /*
- * send the reply to the client
- */
- memcpy( &reply, &be_reply, sz_xGLXVendorPrivReply );
- reply.type = X_Reply;
- reply.sequenceNumber = client->sequence;
-
- if (client->swapped) {
- SendSwappedReply( client, &reply, be_buf, be_buf_size );
- }
- else {
- WriteToClient(client, sizeof(xGLXVendorPrivReply),(char *)&reply);
- if (be_buf_size > 0)
- WriteToClient(client, be_buf_size, (char *)be_buf);
- }
-
- if (be_buf_size > 0) free(be_buf);
-
- return Success;
-}
-
-int __glXVForwardAllWithReply( __GLXclientState *cl, GLbyte *pc )
-{
- ClientPtr client = cl->client;
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
- xGLXVendorPrivateReq *be_req;
- xGLXVendorPrivReply reply;
- xGLXVendorPrivReply be_reply;
- __GLXcontext *glxc;
- int buf_size;
- char *be_buf;
- int be_buf_size;
- int from_screen = 0;
- int to_screen = 0;
- int s;
-
- DMXScreenInfo *dmxScreen;
- Display *dpy;
-
- glxc = __glXLookupContextByTag(cl, req->contextTag);
- if (!glxc) {
- return 0;
- }
- from_screen = to_screen = glxc->pScreen->myNum;
-
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
- }
-#endif
-
- pc += sz_xGLXVendorPrivateReq;
- buf_size = (req->length << 2) - sz_xGLXVendorPrivateReq;
-
- /*
- * send the request to the first back-end server(s)
- */
- for (s=to_screen; s>=from_screen; s--) {
- dmxScreen = &dmxScreens[s];
- dpy = GetBackEndDisplay(cl,s);
-
- LockDisplay(dpy);
- GetReqVendorPrivate(GLXVendorPrivate,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = req->glxCode;
- be_req->length = req->length;
- be_req->vendorCode = req->vendorCode;
- be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s);
- if (buf_size > 0)
- _XSend(dpy, (const char *)pc, buf_size);
-
- /*
- * get the reply from the back-end server
- */
- _XReply(dpy, (xReply*) &be_reply, 0, False);
- be_buf_size = be_reply.length << 2;
- if (be_buf_size > 0) {
- be_buf = (char *)malloc( be_buf_size );
- if (be_buf) {
- _XRead(dpy, be_buf, be_buf_size);
- }
- else {
- /* Throw data on the floor */
- _XEatData(dpy, be_buf_size);
- return BadAlloc;
- }
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- if (s > from_screen && be_buf_size > 0) {
- free(be_buf);
- }
- }
-
- /*
- * send the reply to the client
- */
- memcpy( &reply, &be_reply, sz_xGLXVendorPrivReply );
- reply.type = X_Reply;
- reply.sequenceNumber = client->sequence;
-
- if (client->swapped) {
- SendSwappedReply( client, &reply, be_buf, be_buf_size );
- }
- else {
- WriteToClient(client, sizeof(xGLXVendorPrivReply),(char *)&reply);
- if (be_buf_size > 0)
- WriteToClient(client, be_buf_size, (char *)be_buf);
- }
-
- if (be_buf_size > 0) free(be_buf);
-
- return Success;
-}
-
-int __glXVForwardSingleReqSwap( __GLXclientState *cl, GLbyte *pc )
-{
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->vendorCode);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 0;
-
- return( __glXVForwardSingleReq( cl, pc ) );
-}
-
-int __glXVForwardPipe0WithReplySwap( __GLXclientState *cl, GLbyte *pc )
-{
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->vendorCode);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 0;
-
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXVendorPrivateReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXVendorPrivateReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
-
- return( __glXVForwardPipe0WithReply( cl, pc ) );
-}
-
-int __glXVForwardPipe0WithReplySwapsv( __GLXclientState *cl, GLbyte *pc )
-{
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->vendorCode);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 2;
-
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXVendorPrivateReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXVendorPrivateReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
-
- return( __glXVForwardPipe0WithReply( cl, pc ) );
-}
-
-int __glXVForwardPipe0WithReplySwapiv( __GLXclientState *cl, GLbyte *pc )
-{
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->vendorCode);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 4;
-
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXVendorPrivateReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXVendorPrivateReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
-
- return( __glXVForwardPipe0WithReply( cl, pc ) );
-}
-
-int __glXVForwardPipe0WithReplySwapdv( __GLXclientState *cl, GLbyte *pc )
-{
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->vendorCode);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 8;
-
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXVendorPrivateReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXVendorPrivateReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
-
- return( __glXVForwardPipe0WithReply( cl, pc ) );
-}
-
-int __glXVForwardAllWithReplySwap( __GLXclientState *cl, GLbyte *pc )
-{
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->vendorCode);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 0;
-
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXVendorPrivateReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXVendorPrivateReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
-
- return( __glXVForwardAllWithReply( cl, pc ) );
-}
-
-int __glXVForwardAllWithReplySwapsv( __GLXclientState *cl, GLbyte *pc )
-{
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->vendorCode);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 2;
-
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXVendorPrivateReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXVendorPrivateReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
-
- return( __glXVForwardAllWithReply( cl, pc ) );
-}
-
-int __glXVForwardAllWithReplySwapiv( __GLXclientState *cl, GLbyte *pc )
-{
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->vendorCode);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 4;
-
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXVendorPrivateReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXVendorPrivateReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
-
- return( __glXVForwardAllWithReply( cl, pc ) );
-}
-
-int __glXVForwardAllWithReplySwapdv( __GLXclientState *cl, GLbyte *pc )
-{
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->vendorCode);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 8;
-
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXVendorPrivateReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXVendorPrivateReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
-
- return( __glXVForwardAllWithReply( cl, pc ) );
-}
-
+/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */
+/*
+ * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
+ * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice including the dates of first publication and
+ * either this permission notice or a reference to
+ * http://oss.sgi.com/projects/FreeB/
+ * 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
+ * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Silicon Graphics, Inc.
+ * shall not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization from
+ * Silicon Graphics, Inc.
+ */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxwindow.h"
+#include "dmxpixmap.h"
+#include "dmxfont.h"
+
+#include "glxserver.h"
+#include "glxext.h"
+#include "g_disptab.h"
+/* #include "g_disptab_EXT.h" */
+#include "unpack.h"
+#include "glxutil.h"
+
+#include "GL/glxproto.h"
+
+#ifdef PANORAMIX
+#include "panoramiXsrv.h"
+#endif
+
+/*
+ * GetReqVendorPrivate - this is the equivalent of GetReq macro
+ * from Xlibint.h but it does not set the reqType field (the opcode).
+ * this is because the GL single opcodes has different naming convension
+ * the other X opcodes (ie. X_GLsop_GetFloatv).
+ */
+#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
+#define GetReqVendorPrivate(name, req) \
+ WORD64ALIGN\
+ if ((dpy->bufptr + SIZEOF(x##name##Req)) > dpy->bufmax)\
+ _XFlush(dpy);\
+ req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\
+ req->length = (SIZEOF(x##name##Req))>>2;\
+ dpy->bufptr += SIZEOF(x##name##Req);\
+ dpy->request++
+
+#else /* non-ANSI C uses empty comment instead of "##" for token concatenation */
+#define GetReqVendorPrivate(name, req) \
+ WORD64ALIGN\
+ if ((dpy->bufptr + SIZEOF(x/**/name/**/Req)) > dpy->bufmax)\
+ _XFlush(dpy);\
+ req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\
+ req->length = (SIZEOF(x/**/name/**/Req))>>2;\
+ dpy->bufptr += SIZEOF(x/**/name/**/Req);\
+ dpy->request++
+#endif
+
+extern Display *GetBackEndDisplay( __GLXclientState *cl, int s );
+extern int GetCurrentBackEndTag(__GLXclientState *cl, GLXContextTag tag, int s);
+
+static int swap_vec_element_size = 0;
+
+static void SendSwappedReply( ClientPtr client,
+ xGLXVendorPrivReply *reply,
+ char *buf,
+ int buf_size )
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_SWAP_SHORT(&reply->sequenceNumber);
+ __GLX_SWAP_INT(&reply->length);
+ __GLX_SWAP_INT(&reply->retval);
+ __GLX_SWAP_INT(&reply->size);
+
+ if ( (buf_size == 0) && (swap_vec_element_size > 0) ) {
+ /*
+ * the reply has single component - need to swap pad3
+ */
+ if (swap_vec_element_size == 2) {
+ __GLX_SWAP_SHORT(&reply->pad3);
+ }
+ else if (swap_vec_element_size == 4) {
+ __GLX_SWAP_INT(&reply->pad3);
+ __GLX_SWAP_INT(&reply->pad4);
+ }
+ else if (swap_vec_element_size == 8) {
+ __GLX_SWAP_DOUBLE(&reply->pad3);
+ }
+ }
+ else if ( (buf_size > 0) && (swap_vec_element_size > 0) ) {
+ /*
+ * the reply has vector of elements which needs to be swapped
+ */
+ int vsize = buf_size / swap_vec_element_size;
+ char *p = buf;
+ int i;
+
+ for (i=0; i<vsize; i++) {
+ if (swap_vec_element_size == 2) {
+ __GLX_SWAP_SHORT(p);
+ }
+ else if (swap_vec_element_size == 4) {
+ __GLX_SWAP_INT(p);
+ }
+ else if (swap_vec_element_size == 8) {
+ __GLX_SWAP_DOUBLE(p);
+ }
+
+ p += swap_vec_element_size;
+ }
+
+ __GLX_SWAP_INT(&reply->pad3);
+ __GLX_SWAP_INT(&reply->pad4);
+ __GLX_SWAP_INT(&reply->pad5);
+ __GLX_SWAP_INT(&reply->pad6);
+
+ }
+
+ WriteToClient(client, sizeof(xGLXVendorPrivReply),(char *)reply);
+ if (buf_size > 0)
+ WriteToClient(client, buf_size, (char *)buf);
+
+}
+
+int __glXVForwardSingleReq( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
+ xGLXVendorPrivateReq *be_req;
+ __GLXcontext *glxc;
+ int from_screen = 0;
+ int to_screen = 0;
+ int buf_size;
+ int s;
+
+ glxc = __glXLookupContextByTag(cl, req->contextTag);
+ if (!glxc) {
+ return 0;
+ }
+ from_screen = to_screen = glxc->pScreen->myNum;
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ }
+#endif
+
+ pc += sz_xGLXVendorPrivateReq;
+ buf_size = (req->length << 2) - sz_xGLXVendorPrivateReq;
+
+ /*
+ * just forward the request to back-end server(s)
+ */
+ for (s=from_screen; s<=to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl,s);
+
+ LockDisplay(dpy);
+ GetReqVendorPrivate(GLXVendorPrivate,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = req->glxCode;
+ be_req->length = req->length;
+ be_req->vendorCode = req->vendorCode;
+ be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s);
+ if (buf_size > 0)
+ _XSend(dpy, (const char *)pc, buf_size);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
+
+ return Success;
+}
+
+int __glXVForwardPipe0WithReply( __GLXclientState *cl, GLbyte *pc )
+{
+ ClientPtr client = cl->client;
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
+ xGLXVendorPrivateReq *be_req;
+ xGLXVendorPrivReply reply;
+ xGLXVendorPrivReply be_reply;
+ __GLXcontext *glxc;
+ int buf_size;
+ char *be_buf = NULL;
+ int be_buf_size;
+ DMXScreenInfo *dmxScreen;
+ Display *dpy;
+
+ glxc = __glXLookupContextByTag(cl, req->contextTag);
+ if (!glxc) {
+ return __glXBadContext;
+ }
+
+ pc += sz_xGLXVendorPrivateReq;
+ buf_size = (req->length << 2) - sz_xGLXVendorPrivateReq;
+
+ dmxScreen = &dmxScreens[glxc->pScreen->myNum];
+ dpy = GetBackEndDisplay(cl, glxc->pScreen->myNum);
+
+ /*
+ * send the request to the first back-end server
+ */
+ LockDisplay(dpy);
+ GetReqVendorPrivate(GLXVendorPrivate,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = req->glxCode;
+ be_req->length = req->length;
+ be_req->vendorCode = req->vendorCode;
+ be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag, glxc->pScreen->myNum);
+ if (buf_size > 0)
+ _XSend(dpy, (const char *)pc, buf_size);
+
+ /*
+ * get the reply from the back-end server
+ */
+ _XReply(dpy, (xReply*) &be_reply, 0, False);
+ be_buf_size = be_reply.length << 2;
+ if (be_buf_size > 0) {
+ be_buf = (char *)malloc( be_buf_size );
+ if (be_buf) {
+ _XRead(dpy, be_buf, be_buf_size);
+ }
+ else {
+ /* Throw data on the floor */
+ _XEatData(dpy, be_buf_size);
+ return BadAlloc;
+ }
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ /*
+ * send the reply to the client
+ */
+ memcpy( &reply, &be_reply, sz_xGLXVendorPrivReply );
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+
+ if (client->swapped) {
+ SendSwappedReply( client, &reply, be_buf, be_buf_size );
+ }
+ else {
+ WriteToClient(client, sizeof(xGLXVendorPrivReply),(char *)&reply);
+ if (be_buf_size > 0)
+ WriteToClient(client, be_buf_size, (char *)be_buf);
+ }
+
+ if (be_buf_size > 0) free(be_buf);
+
+ return Success;
+}
+
+int __glXVForwardAllWithReply( __GLXclientState *cl, GLbyte *pc )
+{
+ ClientPtr client = cl->client;
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
+ xGLXVendorPrivateReq *be_req;
+ xGLXVendorPrivReply reply;
+ xGLXVendorPrivReply be_reply;
+ __GLXcontext *glxc;
+ int buf_size;
+ char *be_buf = NULL;
+ int be_buf_size = 0;
+ int from_screen = 0;
+ int to_screen = 0;
+ int s;
+
+ DMXScreenInfo *dmxScreen;
+ Display *dpy;
+
+ glxc = __glXLookupContextByTag(cl, req->contextTag);
+ if (!glxc) {
+ return 0;
+ }
+ from_screen = to_screen = glxc->pScreen->myNum;
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ }
+#endif
+
+ pc += sz_xGLXVendorPrivateReq;
+ buf_size = (req->length << 2) - sz_xGLXVendorPrivateReq;
+
+ /*
+ * send the request to the first back-end server(s)
+ */
+ for (s=to_screen; s>=from_screen; s--) {
+ dmxScreen = &dmxScreens[s];
+ dpy = GetBackEndDisplay(cl,s);
+
+ LockDisplay(dpy);
+ GetReqVendorPrivate(GLXVendorPrivate,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = req->glxCode;
+ be_req->length = req->length;
+ be_req->vendorCode = req->vendorCode;
+ be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s);
+ if (buf_size > 0)
+ _XSend(dpy, (const char *)pc, buf_size);
+
+ /*
+ * get the reply from the back-end server
+ */
+ _XReply(dpy, (xReply*) &be_reply, 0, False);
+ be_buf_size = be_reply.length << 2;
+ if (be_buf_size > 0) {
+ be_buf = (char *)malloc( be_buf_size );
+ if (be_buf) {
+ _XRead(dpy, be_buf, be_buf_size);
+ }
+ else {
+ /* Throw data on the floor */
+ _XEatData(dpy, be_buf_size);
+ return BadAlloc;
+ }
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ if (s > from_screen && be_buf_size > 0) {
+ free(be_buf);
+ }
+ }
+
+ /*
+ * send the reply to the client
+ */
+ memcpy( &reply, &be_reply, sz_xGLXVendorPrivReply );
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+
+ if (client->swapped) {
+ SendSwappedReply( client, &reply, be_buf, be_buf_size );
+ }
+ else {
+ WriteToClient(client, sizeof(xGLXVendorPrivReply),(char *)&reply);
+ if (be_buf_size > 0)
+ WriteToClient(client, be_buf_size, (char *)be_buf);
+ }
+
+ if (be_buf_size > 0) free(be_buf);
+
+ return Success;
+}
+
+int __glXVForwardSingleReqSwap( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 0;
+
+ return( __glXVForwardSingleReq( cl, pc ) );
+}
+
+int __glXVForwardPipe0WithReplySwap( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 0;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXVendorPrivateReq/4) {
+ int *data = (int *)(req+1);
+ int count = req->length - sz_xGLXVendorPrivateReq/4;
+ __GLX_SWAP_INT_ARRAY(data, count );
+ }
+
+ return( __glXVForwardPipe0WithReply( cl, pc ) );
+}
+
+int __glXVForwardPipe0WithReplySwapsv( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 2;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXVendorPrivateReq/4) {
+ int *data = (int *)(req+1);
+ int count = req->length - sz_xGLXVendorPrivateReq/4;
+ __GLX_SWAP_INT_ARRAY(data, count );
+ }
+
+ return( __glXVForwardPipe0WithReply( cl, pc ) );
+}
+
+int __glXVForwardPipe0WithReplySwapiv( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 4;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXVendorPrivateReq/4) {
+ int *data = (int *)(req+1);
+ int count = req->length - sz_xGLXVendorPrivateReq/4;
+ __GLX_SWAP_INT_ARRAY(data, count );
+ }
+
+ return( __glXVForwardPipe0WithReply( cl, pc ) );
+}
+
+int __glXVForwardPipe0WithReplySwapdv( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 8;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXVendorPrivateReq/4) {
+ int *data = (int *)(req+1);
+ int count = req->length - sz_xGLXVendorPrivateReq/4;
+ __GLX_SWAP_INT_ARRAY(data, count );
+ }
+
+ return( __glXVForwardPipe0WithReply( cl, pc ) );
+}
+
+int __glXVForwardAllWithReplySwap( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 0;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXVendorPrivateReq/4) {
+ int *data = (int *)(req+1);
+ int count = req->length - sz_xGLXVendorPrivateReq/4;
+ __GLX_SWAP_INT_ARRAY(data, count );
+ }
+
+ return( __glXVForwardAllWithReply( cl, pc ) );
+}
+
+int __glXVForwardAllWithReplySwapsv( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 2;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXVendorPrivateReq/4) {
+ int *data = (int *)(req+1);
+ int count = req->length - sz_xGLXVendorPrivateReq/4;
+ __GLX_SWAP_INT_ARRAY(data, count );
+ }
+
+ return( __glXVForwardAllWithReply( cl, pc ) );
+}
+
+int __glXVForwardAllWithReplySwapiv( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 4;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXVendorPrivateReq/4) {
+ int *data = (int *)(req+1);
+ int count = req->length - sz_xGLXVendorPrivateReq/4;
+ __GLX_SWAP_INT_ARRAY(data, count );
+ }
+
+ return( __glXVForwardAllWithReply( cl, pc ) );
+}
+
+int __glXVForwardAllWithReplySwapdv( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 8;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXVendorPrivateReq/4) {
+ int *data = (int *)(req+1);
+ int count = req->length - sz_xGLXVendorPrivateReq/4;
+ __GLX_SWAP_INT_ARRAY(data, count );
+ }
+
+ return( __glXVForwardAllWithReply( cl, pc ) );
+}
+
diff --git a/xorg-server/hw/dmx/glxProxy/render2swap.c b/xorg-server/hw/dmx/glxProxy/render2swap.c
index 34fd19624..81bb501ea 100644
--- a/xorg-server/hw/dmx/glxProxy/render2swap.c
+++ b/xorg-server/hw/dmx/glxProxy/render2swap.c
@@ -1,340 +1,286 @@
-/*
- * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
- * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice including the dates of first publication and
- * either this permission notice or a reference to
- * http://oss.sgi.com/projects/FreeB/
- * 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
- * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of Silicon Graphics, Inc.
- * shall not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization from
- * Silicon Graphics, Inc.
- */
-
-#include "glxserver.h"
-#include "unpack.h"
-#include "g_disptab.h"
-
-GLint __glEvalComputeK(GLenum target)
-{
- switch (target) {
- case GL_MAP1_VERTEX_4:
- case GL_MAP1_COLOR_4:
- case GL_MAP1_TEXTURE_COORD_4:
- case GL_MAP2_VERTEX_4:
- case GL_MAP2_COLOR_4:
- case GL_MAP2_TEXTURE_COORD_4:
- return 4;
- case GL_MAP1_VERTEX_3:
- case GL_MAP1_TEXTURE_COORD_3:
- case GL_MAP1_NORMAL:
- case GL_MAP2_VERTEX_3:
- case GL_MAP2_TEXTURE_COORD_3:
- case GL_MAP2_NORMAL:
- return 3;
- case GL_MAP1_TEXTURE_COORD_2:
- case GL_MAP2_TEXTURE_COORD_2:
- return 2;
- case GL_MAP1_TEXTURE_COORD_1:
- case GL_MAP2_TEXTURE_COORD_1:
- case GL_MAP1_INDEX:
- case GL_MAP2_INDEX:
- return 1;
- default:
- return 0;
- }
-}
-
-void __glXDispSwap_Map1f(GLbyte *pc)
-{
- GLint order, k;
- GLfloat u1, u2, *points;
- GLenum target;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 12);
- __GLX_SWAP_FLOAT(pc + 4);
- __GLX_SWAP_FLOAT(pc + 8);
-
- target = *(GLenum *)(pc + 0);
- order = *(GLint *)(pc + 12);
- u1 = *(GLfloat *)(pc + 4);
- u2 = *(GLfloat *)(pc + 8);
- points = (GLfloat *)(pc + 16);
- k = __glEvalComputeK(target);
-
- if (order <= 0 || k < 0) {
- /* Erroneous command. */
- compsize = 0;
- } else {
- compsize = order * k;
- }
- __GLX_SWAP_FLOAT_ARRAY(points, compsize);
-
-}
-
-void __glXDispSwap_Map2f(GLbyte *pc)
-{
- GLint uorder, vorder, ustride, vstride, k;
- GLfloat u1, u2, v1, v2, *points;
- GLenum target;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 12);
- __GLX_SWAP_INT(pc + 24);
- __GLX_SWAP_FLOAT(pc + 4);
- __GLX_SWAP_FLOAT(pc + 8);
- __GLX_SWAP_FLOAT(pc + 16);
- __GLX_SWAP_FLOAT(pc + 20);
-
- target = *(GLenum *)(pc + 0);
- uorder = *(GLint *)(pc + 12);
- vorder = *(GLint *)(pc + 24);
- u1 = *(GLfloat *)(pc + 4);
- u2 = *(GLfloat *)(pc + 8);
- v1 = *(GLfloat *)(pc + 16);
- v2 = *(GLfloat *)(pc + 20);
- points = (GLfloat *)(pc + 28);
-
- k = __glEvalComputeK(target);
- ustride = vorder * k;
- vstride = k;
-
- if (vorder <= 0 || uorder <= 0 || k < 0) {
- /* Erroneous command. */
- compsize = 0;
- } else {
- compsize = uorder * vorder * k;
- }
- __GLX_SWAP_FLOAT_ARRAY(points, compsize);
-
-}
-
-void __glXDispSwap_Map1d(GLbyte *pc)
-{
- GLint order, k, compsize;
- GLenum target;
- GLdouble u1, u2, *points;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_DOUBLE(pc + 0);
- __GLX_SWAP_DOUBLE(pc + 8);
- __GLX_SWAP_INT(pc + 16);
- __GLX_SWAP_INT(pc + 20);
-
- target = *(GLenum*) (pc + 16);
- order = *(GLint*) (pc + 20);
- k = __glEvalComputeK(target);
- if (order <= 0 || k < 0) {
- /* Erroneous command. */
- compsize = 0;
- } else {
- compsize = order * k;
- }
- __GLX_GET_DOUBLE(u1,pc);
- __GLX_GET_DOUBLE(u2,pc+8);
- __GLX_SWAP_DOUBLE_ARRAY(pc+24, compsize);
- pc += 24;
-
-#ifdef __GLX_ALIGN64
- if (((unsigned long)pc) & 7) {
- /*
- ** Copy the doubles up 4 bytes, trashing the command but aligning
- ** the data in the process
- */
- __GLX_MEM_COPY(pc-4, pc, compsize*8);
- points = (GLdouble*) (pc - 4);
- } else {
- points = (GLdouble*) pc;
- }
-#else
- points = (GLdouble*) pc;
-#endif
-}
-
-void __glXDispSwap_Map2d(GLbyte *pc)
-{
- GLdouble u1, u2, v1, v2, *points;
- GLint uorder, vorder, ustride, vstride, k, compsize;
- GLenum target;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_DOUBLE(pc + 0);
- __GLX_SWAP_DOUBLE(pc + 8);
- __GLX_SWAP_DOUBLE(pc + 16);
- __GLX_SWAP_DOUBLE(pc + 24);
- __GLX_SWAP_INT(pc + 32);
- __GLX_SWAP_INT(pc + 36);
- __GLX_SWAP_INT(pc + 40);
-
- target = *(GLenum *)(pc + 32);
- uorder = *(GLint *)(pc + 36);
- vorder = *(GLint *)(pc + 40);
- k = __glEvalComputeK(target);
- if (vorder <= 0 || uorder <= 0 || k < 0) {
- /* Erroneous command. */
- compsize = 0;
- } else {
- compsize = uorder * vorder * k;
- }
- __GLX_GET_DOUBLE(u1,pc);
- __GLX_GET_DOUBLE(u2,pc+8);
- __GLX_GET_DOUBLE(v1,pc+16);
- __GLX_GET_DOUBLE(v2,pc+24);
- __GLX_SWAP_DOUBLE_ARRAY(pc+44, compsize);
- pc += 44;
- ustride = vorder * k;
- vstride = k;
-
-#ifdef __GLX_ALIGN64
- if (((unsigned long)pc) & 7) {
- /*
- ** Copy the doubles up 4 bytes, trashing the command but aligning
- ** the data in the process
- */
- __GLX_MEM_COPY(pc-4, pc, compsize*8);
- points = (GLdouble*) (pc - 4);
- } else {
- points = (GLdouble*) pc;
- }
-#else
- points = (GLdouble*) pc;
-#endif
-}
-
-void __glXDispSwap_CallLists(GLbyte *pc)
-{
- GLenum type;
- GLsizei n;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 0);
- type = *(GLenum *)(pc + 4);
- n = *(GLsizei *)(pc + 0);
-
- switch (type) {
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- case GL_2_BYTES:
- case GL_3_BYTES:
- case GL_4_BYTES:
- break;
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- __GLX_SWAP_SHORT_ARRAY(pc+8, n);
- break;
- case GL_INT:
- case GL_UNSIGNED_INT:
- __GLX_SWAP_INT_ARRAY(pc+8, n);
- break;
- case GL_FLOAT:
- __GLX_SWAP_FLOAT_ARRAY(pc+8, n);
- break;
- }
-
-}
-
-static void swapArray(GLint numVals, GLenum datatype,
- GLint stride, GLint numVertexes, GLbyte *pc)
-{
- int i,j;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- switch (datatype) {
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- /* don't need to swap */
- return;
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- for (i=0; i<numVertexes; i++) {
- GLshort *pVal = (GLshort *) pc;
- for (j=0; j<numVals; j++) {
- __GLX_SWAP_SHORT(&pVal[j]);
- }
- pc += stride;
- }
- break;
- case GL_INT:
- case GL_UNSIGNED_INT:
- for (i=0; i<numVertexes; i++) {
- GLint *pVal = (GLint *) pc;
- for (j=0; j<numVals; j++) {
- __GLX_SWAP_INT(&pVal[j]);
- }
- pc += stride;
- }
- break;
- case GL_FLOAT:
- for (i=0; i<numVertexes; i++) {
- GLfloat *pVal = (GLfloat *) pc;
- for (j=0; j<numVals; j++) {
- __GLX_SWAP_FLOAT(&pVal[j]);
- }
- pc += stride;
- }
- break;
- case GL_DOUBLE:
- for (i=0; i<numVertexes; i++) {
- GLdouble *pVal = (GLdouble *) pc;
- for (j=0; j<numVals; j++) {
- __GLX_SWAP_DOUBLE(&pVal[j]);
- }
- pc += stride;
- }
- break;
- default:
- return;
- }
-}
-
-void __glXDispSwap_DrawArrays(GLbyte *pc)
-{
- __GLXdispatchDrawArraysHeader *hdr = (__GLXdispatchDrawArraysHeader *)pc;
- __GLXdispatchDrawArraysComponentHeader *compHeader;
- int i;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_INT(&hdr->numVertexes);
- __GLX_SWAP_INT(&hdr->numComponents);
- __GLX_SWAP_INT(&hdr->primType);
-
- pc += sizeof(__GLXdispatchDrawArraysHeader);
- compHeader = (__GLXdispatchDrawArraysComponentHeader *) pc;
-
- /* compute stride (same for all component arrays) */
- for (i=0; i<hdr->numComponents; i++) {
- __GLX_SWAP_INT(&compHeader[i].datatype);
- __GLX_SWAP_INT(&compHeader[i].numVals);
- __GLX_SWAP_INT(&compHeader[i].component);
-
- }
-
-}
+/*
+ * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
+ * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice including the dates of first publication and
+ * either this permission notice or a reference to
+ * http://oss.sgi.com/projects/FreeB/
+ * 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
+ * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Silicon Graphics, Inc.
+ * shall not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization from
+ * Silicon Graphics, Inc.
+ */
+
+#include "glxserver.h"
+#include "unpack.h"
+#include "g_disptab.h"
+
+GLint __glEvalComputeK(GLenum target)
+{
+ switch (target) {
+ case GL_MAP1_VERTEX_4:
+ case GL_MAP1_COLOR_4:
+ case GL_MAP1_TEXTURE_COORD_4:
+ case GL_MAP2_VERTEX_4:
+ case GL_MAP2_COLOR_4:
+ case GL_MAP2_TEXTURE_COORD_4:
+ return 4;
+ case GL_MAP1_VERTEX_3:
+ case GL_MAP1_TEXTURE_COORD_3:
+ case GL_MAP1_NORMAL:
+ case GL_MAP2_VERTEX_3:
+ case GL_MAP2_TEXTURE_COORD_3:
+ case GL_MAP2_NORMAL:
+ return 3;
+ case GL_MAP1_TEXTURE_COORD_2:
+ case GL_MAP2_TEXTURE_COORD_2:
+ return 2;
+ case GL_MAP1_TEXTURE_COORD_1:
+ case GL_MAP2_TEXTURE_COORD_1:
+ case GL_MAP1_INDEX:
+ case GL_MAP2_INDEX:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+void __glXDispSwap_Map1f(GLbyte *pc)
+{
+ GLint order, k;
+ GLfloat u1, u2, *points;
+ GLenum target;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+
+ target = *(GLenum *)(pc + 0);
+ order = *(GLint *)(pc + 12);
+ u1 = *(GLfloat *)(pc + 4);
+ u2 = *(GLfloat *)(pc + 8);
+ points = (GLfloat *)(pc + 16);
+ k = __glEvalComputeK(target);
+
+ if (order <= 0 || k < 0) {
+ /* Erroneous command. */
+ compsize = 0;
+ } else {
+ compsize = order * k;
+ }
+ __GLX_SWAP_FLOAT_ARRAY(points, compsize);
+
+}
+
+void __glXDispSwap_Map2f(GLbyte *pc)
+{
+ GLint uorder, vorder, ustride, vstride, k;
+ GLfloat u1, u2, v1, v2, *points;
+ GLenum target;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 24);
+ __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_FLOAT(pc + 16);
+ __GLX_SWAP_FLOAT(pc + 20);
+
+ target = *(GLenum *)(pc + 0);
+ uorder = *(GLint *)(pc + 12);
+ vorder = *(GLint *)(pc + 24);
+ u1 = *(GLfloat *)(pc + 4);
+ u2 = *(GLfloat *)(pc + 8);
+ v1 = *(GLfloat *)(pc + 16);
+ v2 = *(GLfloat *)(pc + 20);
+ points = (GLfloat *)(pc + 28);
+
+ k = __glEvalComputeK(target);
+ ustride = vorder * k;
+ vstride = k;
+
+ if (vorder <= 0 || uorder <= 0 || k < 0) {
+ /* Erroneous command. */
+ compsize = 0;
+ } else {
+ compsize = uorder * vorder * k;
+ }
+ __GLX_SWAP_FLOAT_ARRAY(points, compsize);
+
+}
+
+void __glXDispSwap_Map1d(GLbyte *pc)
+{
+ GLint order, k, compsize;
+ GLenum target;
+ GLdouble u1, u2, *points;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
+ __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_INT(pc + 20);
+
+ target = *(GLenum*) (pc + 16);
+ order = *(GLint*) (pc + 20);
+ k = __glEvalComputeK(target);
+ if (order <= 0 || k < 0) {
+ /* Erroneous command. */
+ compsize = 0;
+ } else {
+ compsize = order * k;
+ }
+ __GLX_GET_DOUBLE(u1,pc);
+ __GLX_GET_DOUBLE(u2,pc+8);
+ __GLX_SWAP_DOUBLE_ARRAY(pc+24, compsize);
+ pc += 24;
+
+#ifdef __GLX_ALIGN64
+ if (((unsigned long)pc) & 7) {
+ /*
+ ** Copy the doubles up 4 bytes, trashing the command but aligning
+ ** the data in the process
+ */
+ __GLX_MEM_COPY(pc-4, pc, compsize*8);
+ points = (GLdouble*) (pc - 4);
+ } else {
+ points = (GLdouble*) pc;
+ }
+#else
+ points = (GLdouble*) pc;
+#endif
+}
+
+void __glXDispSwap_Map2d(GLbyte *pc)
+{
+ GLdouble u1, u2, v1, v2, *points;
+ GLint uorder, vorder, ustride, vstride, k, compsize;
+ GLenum target;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
+ __GLX_SWAP_DOUBLE(pc + 16);
+ __GLX_SWAP_DOUBLE(pc + 24);
+ __GLX_SWAP_INT(pc + 32);
+ __GLX_SWAP_INT(pc + 36);
+ __GLX_SWAP_INT(pc + 40);
+
+ target = *(GLenum *)(pc + 32);
+ uorder = *(GLint *)(pc + 36);
+ vorder = *(GLint *)(pc + 40);
+ k = __glEvalComputeK(target);
+ if (vorder <= 0 || uorder <= 0 || k < 0) {
+ /* Erroneous command. */
+ compsize = 0;
+ } else {
+ compsize = uorder * vorder * k;
+ }
+ __GLX_GET_DOUBLE(u1,pc);
+ __GLX_GET_DOUBLE(u2,pc+8);
+ __GLX_GET_DOUBLE(v1,pc+16);
+ __GLX_GET_DOUBLE(v2,pc+24);
+ __GLX_SWAP_DOUBLE_ARRAY(pc+44, compsize);
+ pc += 44;
+ ustride = vorder * k;
+ vstride = k;
+
+#ifdef __GLX_ALIGN64
+ if (((unsigned long)pc) & 7) {
+ /*
+ ** Copy the doubles up 4 bytes, trashing the command but aligning
+ ** the data in the process
+ */
+ __GLX_MEM_COPY(pc-4, pc, compsize*8);
+ points = (GLdouble*) (pc - 4);
+ } else {
+ points = (GLdouble*) pc;
+ }
+#else
+ points = (GLdouble*) pc;
+#endif
+}
+
+void __glXDispSwap_CallLists(GLbyte *pc)
+{
+ GLenum type;
+ GLsizei n;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ type = *(GLenum *)(pc + 4);
+ n = *(GLsizei *)(pc + 0);
+
+ switch (type) {
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ case GL_2_BYTES:
+ case GL_3_BYTES:
+ case GL_4_BYTES:
+ break;
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ __GLX_SWAP_SHORT_ARRAY(pc+8, n);
+ break;
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ __GLX_SWAP_INT_ARRAY(pc+8, n);
+ break;
+ case GL_FLOAT:
+ __GLX_SWAP_FLOAT_ARRAY(pc+8, n);
+ break;
+ }
+
+}
+
+void __glXDispSwap_DrawArrays(GLbyte *pc)
+{
+ __GLXdispatchDrawArraysHeader *hdr = (__GLXdispatchDrawArraysHeader *)pc;
+ __GLXdispatchDrawArraysComponentHeader *compHeader;
+ int i;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&hdr->numVertexes);
+ __GLX_SWAP_INT(&hdr->numComponents);
+ __GLX_SWAP_INT(&hdr->primType);
+
+ pc += sizeof(__GLXdispatchDrawArraysHeader);
+ compHeader = (__GLXdispatchDrawArraysComponentHeader *) pc;
+
+ /* compute stride (same for all component arrays) */
+ for (i=0; i<hdr->numComponents; i++) {
+ __GLX_SWAP_INT(&compHeader[i].datatype);
+ __GLX_SWAP_INT(&compHeader[i].numVals);
+ __GLX_SWAP_INT(&compHeader[i].component);
+
+ }
+
+}
diff --git a/xorg-server/hw/xfree86/common/xf86Helper.c b/xorg-server/hw/xfree86/common/xf86Helper.c
index 8f61c4c72..1a5bf8a1c 100644
--- a/xorg-server/hw/xfree86/common/xf86Helper.c
+++ b/xorg-server/hw/xfree86/common/xf86Helper.c
@@ -1,2052 +1,2048 @@
-/*
- * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * authorization from the copyright holder(s) and author(s).
- */
-
-/*
- * Authors: Dirk Hohndel <hohndel@XFree86.Org>
- * David Dawes <dawes@XFree86.Org>
- * ... and others
- *
- * This file includes the helper functions that the server provides for
- * different drivers.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include "os.h"
-#include "servermd.h"
-#include "pixmapstr.h"
-#include "windowstr.h"
-#include "propertyst.h"
-#include "gcstruct.h"
-#include "loaderProcs.h"
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-#include "micmap.h"
-#include "xf86DDC.h"
-#include "xf86Xinput.h"
-#include "xf86InPriv.h"
-#include "mivalidate.h"
-#include "xf86Crtc.h"
-
-/* For xf86GetClocks */
-#if defined(CSRG_BASED) || defined(__GNU__)
-#define HAS_SETPRIORITY
-#include <sys/resource.h>
-#endif
-
-static int xf86ScrnInfoPrivateCount = 0;
-
-
-/* Add a pointer to a new DriverRec to xf86DriverList */
-
-void
-xf86AddDriver(DriverPtr driver, pointer module, int flags)
-{
- /* Don't add null entries */
- if (!driver)
- return;
-
- if (xf86DriverList == NULL)
- xf86NumDrivers = 0;
-
- xf86NumDrivers++;
- xf86DriverList = xnfrealloc(xf86DriverList,
- xf86NumDrivers * sizeof(DriverPtr));
- xf86DriverList[xf86NumDrivers - 1] = xnfalloc(sizeof(DriverRec));
- if (flags & HaveDriverFuncs)
- *xf86DriverList[xf86NumDrivers - 1] = *driver;
- else {
- (void) memset( xf86DriverList[xf86NumDrivers - 1], 0,
- sizeof( DriverRec ) );
- (void) memcpy( xf86DriverList[xf86NumDrivers - 1], driver,
- sizeof(DriverRec1));
-
- }
- xf86DriverList[xf86NumDrivers - 1]->module = module;
- xf86DriverList[xf86NumDrivers - 1]->refCount = 0;
-}
-
-void
-xf86DeleteDriver(int drvIndex)
-{
- if (xf86DriverList[drvIndex]
- && (!xf86DriverHasEntities(xf86DriverList[drvIndex]))) {
- if (xf86DriverList[drvIndex]->module)
- UnloadModule(xf86DriverList[drvIndex]->module);
- free(xf86DriverList[drvIndex]);
- xf86DriverList[drvIndex] = NULL;
- }
-}
-
-/* Add a pointer to a new InputDriverRec to xf86InputDriverList */
-
-void
-xf86AddInputDriver(InputDriverPtr driver, pointer module, int flags)
-{
- /* Don't add null entries */
- if (!driver)
- return;
-
- if (xf86InputDriverList == NULL)
- xf86NumInputDrivers = 0;
-
- xf86NumInputDrivers++;
- xf86InputDriverList = xnfrealloc(xf86InputDriverList,
- xf86NumInputDrivers * sizeof(InputDriverPtr));
- xf86InputDriverList[xf86NumInputDrivers - 1] =
- xnfalloc(sizeof(InputDriverRec));
- *xf86InputDriverList[xf86NumInputDrivers - 1] = *driver;
- xf86InputDriverList[xf86NumInputDrivers - 1]->module = module;
-}
-
-void
-xf86DeleteInputDriver(int drvIndex)
-{
- if (xf86InputDriverList[drvIndex] && xf86InputDriverList[drvIndex]->module)
- UnloadModule(xf86InputDriverList[drvIndex]->module);
- free(xf86InputDriverList[drvIndex]);
- xf86InputDriverList[drvIndex] = NULL;
-}
-
-InputDriverPtr
-xf86LookupInputDriver(const char *name)
-{
- int i;
-
- for (i = 0; i < xf86NumInputDrivers; i++) {
- if (xf86InputDriverList[i] && xf86InputDriverList[i]->driverName &&
- xf86NameCmp(name, xf86InputDriverList[i]->driverName) == 0)
- return xf86InputDriverList[i];
- }
- return NULL;
-}
-
-InputInfoPtr
-xf86LookupInput(const char *name)
-{
- InputInfoPtr p;
-
- for (p = xf86InputDevs; p != NULL; p = p->next) {
- if (strcmp(name, p->name) == 0)
- return p;
- }
-
- return NULL;
-}
-
-/* Allocate a new ScrnInfoRec in xf86Screens */
-
-ScrnInfoPtr
-xf86AllocateScreen(DriverPtr drv, int flags)
-{
- int i;
-
- if (xf86Screens == NULL)
- xf86NumScreens = 0;
-
- i = xf86NumScreens++;
- xf86Screens = xnfrealloc(xf86Screens, xf86NumScreens * sizeof(ScrnInfoPtr));
- xf86Screens[i] = xnfcalloc(sizeof(ScrnInfoRec), 1);
- xf86Screens[i]->scrnIndex = i; /* Changes when a screen is removed */
- xf86Screens[i]->origIndex = i; /* This never changes */
- xf86Screens[i]->privates = xnfcalloc(sizeof(DevUnion),
- xf86ScrnInfoPrivateCount);
- /*
- * EnableDisableFBAccess now gets initialized in InitOutput()
- * xf86Screens[i]->EnableDisableFBAccess = xf86EnableDisableFBAccess;
- */
-
- xf86Screens[i]->drv = drv;
- drv->refCount++;
- xf86Screens[i]->module = DuplicateModule(drv->module, NULL);
-
- xf86Screens[i]->DriverFunc = drv->driverFunc;
-
- return xf86Screens[i];
-}
-
-
-/*
- * Remove an entry from xf86Screens. Ideally it should free all allocated
- * data. To do this properly may require a driver hook.
- */
-
-void
-xf86DeleteScreen(int scrnIndex, int flags)
-{
- ScrnInfoPtr pScrn;
- int i;
-
- /* First check if the screen is valid */
- if (xf86NumScreens == 0 || xf86Screens == NULL)
- return;
-
- if (scrnIndex > xf86NumScreens - 1)
- return;
-
- if (!(pScrn = xf86Screens[scrnIndex]))
- return;
-
- /* If a FreeScreen function is defined, call it here */
- if (pScrn->FreeScreen != NULL)
- pScrn->FreeScreen(scrnIndex, 0);
-
- while (pScrn->modes)
- xf86DeleteMode(&pScrn->modes, pScrn->modes);
-
- while (pScrn->modePool)
- xf86DeleteMode(&pScrn->modePool, pScrn->modePool);
-
- xf86OptionListFree(pScrn->options);
-
- if (pScrn->module)
- UnloadModule(pScrn->module);
-
- if (pScrn->drv)
- pScrn->drv->refCount--;
-
- free(pScrn->privates);
-
- xf86ClearEntityListForScreen(scrnIndex);
-
- free(pScrn);
-
- /* Move the other entries down, updating their scrnIndex fields */
-
- xf86NumScreens--;
-
- for (i = scrnIndex; i < xf86NumScreens; i++) {
- xf86Screens[i] = xf86Screens[i + 1];
- xf86Screens[i]->scrnIndex = i;
- /* Also need to take care of the screen layout settings */
- }
-}
-
-/*
- * Allocate a private in ScrnInfoRec.
- */
-
-int
-xf86AllocateScrnInfoPrivateIndex(void)
-{
- int idx, i;
- ScrnInfoPtr pScr;
- DevUnion *nprivs;
-
- idx = xf86ScrnInfoPrivateCount++;
- for (i = 0; i < xf86NumScreens; i++) {
- pScr = xf86Screens[i];
- nprivs = xnfrealloc(pScr->privates,
- xf86ScrnInfoPrivateCount * sizeof(DevUnion));
- /* Zero the new private */
- memset(&nprivs[idx], 0, sizeof(DevUnion));
- pScr->privates = nprivs;
- }
- return idx;
-}
-
-Bool
-xf86AddPixFormat(ScrnInfoPtr pScrn, int depth, int bpp, int pad)
-{
- int i;
-
- if (pScrn->numFormats >= MAXFORMATS)
- return FALSE;
-
- if (bpp <= 0) {
- if (depth == 1)
- bpp = 1;
- else if (depth <= 8)
- bpp = 8;
- else if (depth <= 16)
- bpp = 16;
- else if (depth <= 32)
- bpp = 32;
- else
- return FALSE;
- }
- if (pad <= 0)
- pad = BITMAP_SCANLINE_PAD;
-
- i = pScrn->numFormats++;
- pScrn->formats[i].depth = depth;
- pScrn->formats[i].bitsPerPixel = bpp;
- pScrn->formats[i].scanlinePad = pad;
- return TRUE;
-}
-
-/*
- * Set the depth we are using based on (in the following order of preference):
- * - values given on the command line
- * - values given in the config file
- * - values provided by the driver
- * - an overall default when nothing else is given
- *
- * Also find a Display subsection matching the depth/bpp found.
- *
- * Sets the following ScrnInfoRec fields:
- * bitsPerPixel, pixmap24, depth, display, imageByteOrder,
- * bitmapScanlinePad, bitmapScanlineUnit, bitmapBitOrder, numFormats,
- * formats, fbFormat.
- */
-
-/* Can the screen handle 24 bpp pixmaps */
-#define DO_PIX24(f) ((f & Support24bppFb) || \
- ((f & Support32bppFb) && (f & SupportConvert24to32)))
-
-/* Can the screen handle 32 bpp pixmaps */
-#define DO_PIX32(f) ((f & Support32bppFb) || \
- ((f & Support24bppFb) && (f & SupportConvert32to24)))
-
-/* Does the screen prefer 32bpp fb for 24bpp pixmaps */
-#define CHOOSE32FOR24(f) ((f & Support32bppFb) && (f & SupportConvert24to32) \
- && (f & PreferConvert24to32))
-
-/* Does the screen prefer 24bpp fb for 32bpp pixmaps */
-#define CHOOSE24FOR32(f) ((f & Support24bppFb) && (f & SupportConvert32to24) \
- && (f & PreferConvert32to24))
-
-/* Can the screen handle 32bpp pixmaps for 24bpp fb */
-#define DO_PIX32FOR24(f) ((f & Support24bppFb) && (f & SupportConvert32to24))
-
-/* Can the screen handle 24bpp pixmaps for 32bpp fb */
-#define DO_PIX24FOR32(f) ((f & Support32bppFb) && (f & SupportConvert24to32))
-
-#ifndef GLOBAL_DEFAULT_DEPTH
-#define GLOBAL_DEFAULT_DEPTH 24
-#endif
-
-Bool
-xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int dummy, int fbbpp,
- int depth24flags)
-{
- int i;
- DispPtr disp;
- Pix24Flags pix24 = xf86Info.pixmap24;
- Bool nomatch = FALSE;
-
- scrp->bitsPerPixel = -1;
- scrp->depth = -1;
- scrp->pixmap24 = Pix24DontCare;
- scrp->bitsPerPixelFrom = X_DEFAULT;
- scrp->depthFrom = X_DEFAULT;
-
- if (xf86FbBpp > 0) {
- scrp->bitsPerPixel = xf86FbBpp;
- scrp->bitsPerPixelFrom = X_CMDLINE;
- }
-
- if (xf86Depth > 0) {
- scrp->depth = xf86Depth;
- scrp->depthFrom = X_CMDLINE;
- }
-
- if (xf86FbBpp < 0 && xf86Depth < 0) {
- if (scrp->confScreen->defaultfbbpp > 0) {
- scrp->bitsPerPixel = scrp->confScreen->defaultfbbpp;
- scrp->bitsPerPixelFrom = X_CONFIG;
- }
- if (scrp->confScreen->defaultdepth > 0) {
- scrp->depth = scrp->confScreen->defaultdepth;
- scrp->depthFrom = X_CONFIG;
- }
-
- if (scrp->confScreen->defaultfbbpp <= 0 &&
- scrp->confScreen->defaultdepth <= 0) {
- /*
- * Check for DefaultDepth and DefaultFbBpp options in the
- * Device sections.
- */
- int i;
- GDevPtr device;
- Bool found = FALSE;
-
- for (i = 0; i < scrp->numEntities; i++) {
- device = xf86GetDevFromEntity(scrp->entityList[i],
- scrp->entityInstanceList[i]);
- if (device && device->options) {
- if (xf86FindOption(device->options, "DefaultDepth")) {
- scrp->depth = xf86SetIntOption(device->options,
- "DefaultDepth", -1);
- scrp->depthFrom = X_CONFIG;
- found = TRUE;
- }
- if (xf86FindOption(device->options, "DefaultFbBpp")) {
- scrp->bitsPerPixel = xf86SetIntOption(device->options,
- "DefaultFbBpp",
- -1);
- scrp->bitsPerPixelFrom = X_CONFIG;
- found = TRUE;
- }
- }
- if (found)
- break;
- }
- }
- }
-
- /* If none of these is set, pick a default */
- if (scrp->bitsPerPixel < 0 && scrp->depth < 0) {
- if (fbbpp > 0 || depth > 0) {
- if (fbbpp > 0)
- scrp->bitsPerPixel = fbbpp;
- if (depth > 0)
- scrp->depth = depth;
- } else {
- scrp->depth = GLOBAL_DEFAULT_DEPTH;
- }
- }
-
- /* If any are not given, determine a default for the others */
-
- if (scrp->bitsPerPixel < 0) {
- /* The depth must be set */
- if (scrp->depth > -1) {
- if (scrp->depth == 1)
- scrp->bitsPerPixel = 1;
- else if (scrp->depth <= 4)
- scrp->bitsPerPixel = 4;
- else if (scrp->depth <= 8)
- scrp->bitsPerPixel = 8;
- else if (scrp->depth <= 16)
- scrp->bitsPerPixel = 16;
- else if (scrp->depth <= 24) {
- /*
- * Figure out if a choice is possible based on the depth24
- * and pix24 flags.
- */
- /* Check pix24 first */
- if (pix24 != Pix24DontCare) {
- if (pix24 == Pix24Use32) {
- if (DO_PIX32(depth24flags)) {
- if (CHOOSE24FOR32(depth24flags))
- scrp->bitsPerPixel = 24;
- else
- scrp->bitsPerPixel = 32;
- } else {
- nomatch = TRUE;
- }
- } else if (pix24 == Pix24Use24) {
- if (DO_PIX24(depth24flags)) {
- if (CHOOSE32FOR24(depth24flags))
- scrp->bitsPerPixel = 32;
- else
- scrp->bitsPerPixel = 24;
- } else {
- nomatch = TRUE;
- }
- }
- } else {
- if (DO_PIX32(depth24flags)) {
- if (CHOOSE24FOR32(depth24flags))
- scrp->bitsPerPixel = 24;
- else
- scrp->bitsPerPixel = 32;
- } else if (DO_PIX24(depth24flags)) {
- if (CHOOSE32FOR24(depth24flags))
- scrp->bitsPerPixel = 32;
- else
- scrp->bitsPerPixel = 24;
- }
- }
- } else if (scrp->depth <= 32)
- scrp->bitsPerPixel = 32;
- else {
- xf86DrvMsg(scrp->scrnIndex, X_ERROR,
- "Specified depth (%d) is greater than 32\n",
- scrp->depth);
- return FALSE;
- }
- } else {
- xf86DrvMsg(scrp->scrnIndex, X_ERROR,
- "xf86SetDepthBpp: internal error: depth and fbbpp"
- " are both not set\n");
- return FALSE;
- }
- if (scrp->bitsPerPixel < 0) {
- if (nomatch)
- xf86DrvMsg(scrp->scrnIndex, X_ERROR,
- "Driver can't support depth 24 pixmap format (%d)\n",
- PIX24TOBPP(pix24));
- else if ((depth24flags & (Support24bppFb | Support32bppFb)) ==
- NoDepth24Support)
- xf86DrvMsg(scrp->scrnIndex, X_ERROR,
- "Driver can't support depth 24\n");
- else
- xf86DrvMsg(scrp->scrnIndex, X_ERROR,
- "Can't find fbbpp for depth 24\n");
- return FALSE;
- }
- scrp->bitsPerPixelFrom = X_PROBED;
- }
-
- if (scrp->depth <= 0) {
- /* bitsPerPixel is already set */
- switch (scrp->bitsPerPixel) {
- case 32:
- scrp->depth = 24;
- break;
- default:
- /* 1, 4, 8, 16 and 24 */
- scrp->depth = scrp->bitsPerPixel;
- break;
- }
- scrp->depthFrom = X_PROBED;
- }
-
- /* Sanity checks */
- if (scrp->depth < 1 || scrp->depth > 32) {
- xf86DrvMsg(scrp->scrnIndex, X_ERROR,
- "Specified depth (%d) is not in the range 1-32\n",
- scrp->depth);
- return FALSE;
- }
- switch (scrp->bitsPerPixel) {
- case 1:
- case 4:
- case 8:
- case 16:
- case 24:
- case 32:
- break;
- default:
- xf86DrvMsg(scrp->scrnIndex, X_ERROR,
- "Specified fbbpp (%d) is not a permitted value\n",
- scrp->bitsPerPixel);
- return FALSE;
- }
- if (scrp->depth > scrp->bitsPerPixel) {
- xf86DrvMsg(scrp->scrnIndex, X_ERROR,
- "Specified depth (%d) is greater than the fbbpp (%d)\n",
- scrp->depth, scrp->bitsPerPixel);
- return FALSE;
- }
-
- /* set scrp->pixmap24 if the driver isn't flexible */
- if (scrp->bitsPerPixel == 24 && !DO_PIX32FOR24(depth24flags)) {
- scrp->pixmap24 = Pix24Use24;
- }
- if (scrp->bitsPerPixel == 32 && !DO_PIX24FOR32(depth24flags)) {
- scrp->pixmap24 = Pix24Use32;
- }
-
- /*
- * Find the Display subsection matching the depth/fbbpp and initialise
- * scrp->display with it.
- */
- for (i = 0, disp = scrp->confScreen->displays;
- i < scrp->confScreen->numdisplays; i++, disp++) {
- if ((disp->depth == scrp->depth && disp->fbbpp == scrp->bitsPerPixel)
- || (disp->depth == scrp->depth && disp->fbbpp <= 0)
- || (disp->fbbpp == scrp->bitsPerPixel && disp->depth <= 0)) {
- scrp->display = disp;
- break;
- }
- }
-
- /*
- * If an exact match can't be found, see if there is one with no
- * depth or fbbpp specified.
- */
- if (i == scrp->confScreen->numdisplays) {
- for (i = 0, disp = scrp->confScreen->displays;
- i < scrp->confScreen->numdisplays; i++, disp++) {
- if (disp->depth <= 0 && disp->fbbpp <= 0) {
- scrp->display = disp;
- break;
- }
- }
- }
-
- /*
- * If all else fails, create a default one.
- */
- if (i == scrp->confScreen->numdisplays) {
- scrp->confScreen->numdisplays++;
- scrp->confScreen->displays =
- xnfrealloc(scrp->confScreen->displays,
- scrp->confScreen->numdisplays * sizeof(DispRec));
- xf86DrvMsg(scrp->scrnIndex, X_INFO,
- "Creating default Display subsection in Screen section\n"
- "\t\"%s\" for depth/fbbpp %d/%d\n",
- scrp->confScreen->id, scrp->depth, scrp->bitsPerPixel);
- memset(&scrp->confScreen->displays[i], 0, sizeof(DispRec));
- scrp->confScreen->displays[i].blackColour.red = -1;
- scrp->confScreen->displays[i].blackColour.green = -1;
- scrp->confScreen->displays[i].blackColour.blue = -1;
- scrp->confScreen->displays[i].whiteColour.red = -1;
- scrp->confScreen->displays[i].whiteColour.green = -1;
- scrp->confScreen->displays[i].whiteColour.blue = -1;
- scrp->confScreen->displays[i].defaultVisual = -1;
- scrp->confScreen->displays[i].modes = xnfalloc(sizeof(char *));
- scrp->confScreen->displays[i].modes[0] = NULL;
- scrp->confScreen->displays[i].depth = depth;
- scrp->confScreen->displays[i].fbbpp = fbbpp;
- scrp->display = &scrp->confScreen->displays[i];
- }
-
- /*
- * Setup defaults for the display-wide attributes the framebuffer will
- * need. These defaults should eventually be set globally, and not
- * dependent on the screens.
- */
- scrp->imageByteOrder = IMAGE_BYTE_ORDER;
- scrp->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
- if (scrp->depth < 8) {
- /* Planar modes need these settings */
- scrp->bitmapScanlineUnit = 8;
- scrp->bitmapBitOrder = MSBFirst;
- } else {
- scrp->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
- scrp->bitmapBitOrder = BITMAP_BIT_ORDER;
- }
-
- /*
- * If an unusual depth is required, add it to scrp->formats. The formats
- * for the common depths are handled globally in InitOutput
- */
- switch (scrp->depth) {
- case 1:
- case 4:
- case 8:
- case 15:
- case 16:
- case 24:
- /* Common depths. Nothing to do for them */
- break;
- default:
- if (!xf86AddPixFormat(scrp, scrp->depth, 0, 0)) {
- xf86DrvMsg(scrp->scrnIndex, X_ERROR,
- "Can't add pixmap format for depth %d\n", scrp->depth);
- return FALSE;
- }
- }
-
- /* Initialise the framebuffer format for this screen */
- scrp->fbFormat.depth = scrp->depth;
- scrp->fbFormat.bitsPerPixel = scrp->bitsPerPixel;
- scrp->fbFormat.scanlinePad = BITMAP_SCANLINE_PAD;
-
- return TRUE;
-}
-
-/*
- * Print out the selected depth and bpp.
- */
-void
-xf86PrintDepthBpp(ScrnInfoPtr scrp)
-{
- xf86DrvMsg(scrp->scrnIndex, scrp->depthFrom, "Depth %d, ", scrp->depth);
- xf86Msg(scrp->bitsPerPixelFrom, "framebuffer bpp %d\n", scrp->bitsPerPixel);
-}
-
-/*
- * xf86SetWeight sets scrp->weight, scrp->mask, scrp->offset, and for depths
- * greater than MAX_PSEUDO_DEPTH also scrp->rgbBits.
- */
-Bool
-xf86SetWeight(ScrnInfoPtr scrp, rgb weight, rgb mask)
-{
- MessageType weightFrom = X_DEFAULT;
-
- scrp->weight.red = 0;
- scrp->weight.green = 0;
- scrp->weight.blue = 0;
-
- if (xf86Weight.red > 0 && xf86Weight.green > 0 && xf86Weight.blue > 0) {
- scrp->weight = xf86Weight;
- weightFrom = X_CMDLINE;
- } else if (scrp->display->weight.red > 0 && scrp->display->weight.green > 0
- && scrp->display->weight.blue > 0) {
- scrp->weight = scrp->display->weight;
- weightFrom = X_CONFIG;
- } else if (weight.red > 0 && weight.green > 0 && weight.blue > 0) {
- scrp->weight = weight;
- } else {
- switch (scrp->depth) {
- case 1:
- case 4:
- case 8:
- scrp->weight.red = scrp->weight.green =
- scrp->weight.blue = scrp->rgbBits;
- break;
- case 15:
- scrp->weight.red = scrp->weight.green = scrp->weight.blue = 5;
- break;
- case 16:
- scrp->weight.red = scrp->weight.blue = 5;
- scrp->weight.green = 6;
- break;
- case 18:
- scrp->weight.red = scrp->weight.green = scrp->weight.blue = 6;
- break;
- case 24:
- scrp->weight.red = scrp->weight.green = scrp->weight.blue = 8;
- break;
- case 30:
- scrp->weight.red = scrp->weight.green = scrp->weight.blue = 10;
- break;
- }
- }
-
- if (scrp->weight.red)
- xf86DrvMsg(scrp->scrnIndex, weightFrom, "RGB weight %d%d%d\n",
- (int)scrp->weight.red, (int)scrp->weight.green,
- (int)scrp->weight.blue);
-
- if (scrp->depth > MAX_PSEUDO_DEPTH &&
- (scrp->depth != scrp->weight.red + scrp->weight.green +
- scrp->weight.blue)) {
- xf86DrvMsg(scrp->scrnIndex, X_ERROR,
- "Weight given (%d%d%d) is inconsistent with the "
- "depth (%d)\n",
- (int)scrp->weight.red, (int)scrp->weight.green,
- (int)scrp->weight.blue, scrp->depth);
- return FALSE;
- }
- if (scrp->depth > MAX_PSEUDO_DEPTH && scrp->weight.red) {
- /*
- * XXX Does this even mean anything for TrueColor visuals?
- * If not, we shouldn't even be setting it here. However, this
- * matches the behaviour of 3.x versions of XFree86.
- */
- scrp->rgbBits = scrp->weight.red;
- if (scrp->weight.green > scrp->rgbBits)
- scrp->rgbBits = scrp->weight.green;
- if (scrp->weight.blue > scrp->rgbBits)
- scrp->rgbBits = scrp->weight.blue;
- }
-
- /* Set the mask and offsets */
- if (mask.red == 0 || mask.green == 0 || mask.blue == 0) {
- /* Default to a setting common to PC hardware */
- scrp->offset.red = scrp->weight.green + scrp->weight.blue;
- scrp->offset.green = scrp->weight.blue;
- scrp->offset.blue = 0;
- scrp->mask.red = ((1 << scrp->weight.red) - 1) << scrp->offset.red;
- scrp->mask.green = ((1 << scrp->weight.green) - 1)
- << scrp->offset.green;
- scrp->mask.blue = (1 << scrp->weight.blue) - 1;
- } else {
- /* Initialise to the values passed */
- scrp->mask.red = mask.red;
- scrp->mask.green = mask.green;
- scrp->mask.blue = mask.blue;
- scrp->offset.red = ffs(mask.red);
- scrp->offset.green = ffs(mask.green);
- scrp->offset.blue = ffs(mask.blue);
- }
- return TRUE;
-}
-
-Bool
-xf86SetDefaultVisual(ScrnInfoPtr scrp, int visual)
-{
- MessageType visualFrom = X_DEFAULT;
-
- if (defaultColorVisualClass >= 0) {
- scrp->defaultVisual = defaultColorVisualClass;
- visualFrom = X_CMDLINE;
- } else if (scrp->display->defaultVisual >= 0) {
- scrp->defaultVisual = scrp->display->defaultVisual;
- visualFrom = X_CONFIG;
- } else if (visual >= 0) {
- scrp->defaultVisual = visual;
- } else {
- if (scrp->depth == 1)
- scrp->defaultVisual = StaticGray;
- else if (scrp->depth == 4)
- scrp->defaultVisual = StaticColor;
- else if (scrp->depth <= MAX_PSEUDO_DEPTH)
- scrp->defaultVisual = PseudoColor;
- else
- scrp->defaultVisual = TrueColor;
- }
- switch (scrp->defaultVisual) {
- case StaticGray:
- case GrayScale:
- case StaticColor:
- case PseudoColor:
- case TrueColor:
- case DirectColor:
- xf86DrvMsg(scrp->scrnIndex, visualFrom, "Default visual is %s\n",
- xf86VisualNames[scrp->defaultVisual]);
- return TRUE;
- default:
-
- xf86DrvMsg(scrp->scrnIndex, X_ERROR,
- "Invalid default visual class (%d)\n", scrp->defaultVisual);
- return FALSE;
- }
-}
-
-#define TEST_GAMMA(g) \
- (g).red > GAMMA_ZERO || (g).green > GAMMA_ZERO || (g).blue > GAMMA_ZERO
-
-#define SET_GAMMA(g) \
- (g) > GAMMA_ZERO ? (g) : 1.0
-
-Bool
-xf86SetGamma(ScrnInfoPtr scrp, Gamma gamma)
-{
- MessageType from = X_DEFAULT;
-#if 0
- xf86MonPtr DDC = (xf86MonPtr)(scrp->monitor->DDC);
-#endif
- if (TEST_GAMMA(xf86Gamma)) {
- from = X_CMDLINE;
- scrp->gamma.red = SET_GAMMA(xf86Gamma.red);
- scrp->gamma.green = SET_GAMMA(xf86Gamma.green);
- scrp->gamma.blue = SET_GAMMA(xf86Gamma.blue);
- } else if (TEST_GAMMA(scrp->monitor->gamma)) {
- from = X_CONFIG;
- scrp->gamma.red = SET_GAMMA(scrp->monitor->gamma.red);
- scrp->gamma.green = SET_GAMMA(scrp->monitor->gamma.green);
- scrp->gamma.blue = SET_GAMMA(scrp->monitor->gamma.blue);
-#if 0
- } else if ( DDC && DDC->features.gamma > GAMMA_ZERO ) {
- from = X_PROBED;
- scrp->gamma.red = SET_GAMMA(DDC->features.gamma);
- scrp->gamma.green = SET_GAMMA(DDC->features.gamma);
- scrp->gamma.blue = SET_GAMMA(DDC->features.gamma);
- /* EDID structure version 2 gives optional seperate red, green & blue gamma values
- * in bytes 0x57-0x59 */
-#endif
- } else if (TEST_GAMMA(gamma)) {
- scrp->gamma.red = SET_GAMMA(gamma.red);
- scrp->gamma.green = SET_GAMMA(gamma.green);
- scrp->gamma.blue = SET_GAMMA(gamma.blue);
- } else {
- scrp->gamma.red = 1.0;
- 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);
-
- return TRUE;
-}
-
-#undef TEST_GAMMA
-#undef SET_GAMMA
-
-
-/*
- * Set the DPI from the command line option. XXX should allow it to be
- * calculated from the widthmm/heightmm values.
- */
-
-#undef MMPERINCH
-#define MMPERINCH 25.4
-
-void
-xf86SetDpi(ScrnInfoPtr pScrn, int x, int y)
-{
- MessageType from = X_DEFAULT;
- xf86MonPtr DDC = (xf86MonPtr)(pScrn->monitor->DDC);
- int ddcWidthmm, ddcHeightmm;
- int widthErr, heightErr;
-
- /* XXX Maybe there is no need for widthmm/heightmm in ScrnInfoRec */
- pScrn->widthmm = pScrn->monitor->widthmm;
- pScrn->heightmm = pScrn->monitor->heightmm;
-
- if (DDC && (DDC->features.hsize > 0 && DDC->features.vsize > 0) ) {
- /* DDC gives display size in mm for individual modes,
- * but cm for monitor
- */
- ddcWidthmm = DDC->features.hsize * 10; /* 10mm in 1cm */
- ddcHeightmm = DDC->features.vsize * 10; /* 10mm in 1cm */
- } else {
- ddcWidthmm = ddcHeightmm = 0;
- }
-
- if (monitorResolution > 0) {
- pScrn->xDpi = monitorResolution;
- pScrn->yDpi = monitorResolution;
- from = X_CMDLINE;
- } else if (pScrn->widthmm > 0 || pScrn->heightmm > 0) {
- from = X_CONFIG;
- if (pScrn->widthmm > 0) {
- pScrn->xDpi =
- (int)((double)pScrn->virtualX * MMPERINCH / pScrn->widthmm);
- }
- if (pScrn->heightmm > 0) {
- pScrn->yDpi =
- (int)((double)pScrn->virtualY * MMPERINCH / pScrn->heightmm);
- }
- if (pScrn->xDpi > 0 && pScrn->yDpi <= 0)
- pScrn->yDpi = pScrn->xDpi;
- if (pScrn->yDpi > 0 && pScrn->xDpi <= 0)
- pScrn->xDpi = pScrn->yDpi;
- xf86DrvMsg(pScrn->scrnIndex, from, "Display dimensions: (%d, %d) mm\n",
- pScrn->widthmm, pScrn->heightmm);
-
- /* Warn if config and probe disagree about display size */
- if ( ddcWidthmm && ddcHeightmm ) {
- if (pScrn->widthmm > 0) {
- widthErr = abs(ddcWidthmm - pScrn->widthmm);
- } else {
- widthErr = 0;
- }
- if (pScrn->heightmm > 0) {
- heightErr = abs(ddcHeightmm - pScrn->heightmm);
- } else {
- heightErr = 0;
- }
- if (widthErr>10 || heightErr>10) {
- /* Should include config file name for monitor here */
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Probed monitor is %dx%d mm, using Displaysize %dx%d mm\n",
- ddcWidthmm,ddcHeightmm, pScrn->widthmm,pScrn->heightmm);
- }
- }
- } else if ( ddcWidthmm && ddcHeightmm ) {
- from = X_PROBED;
- xf86DrvMsg(pScrn->scrnIndex, from, "Display dimensions: (%d, %d) mm\n",
- ddcWidthmm, ddcHeightmm );
- pScrn->widthmm = ddcWidthmm;
- pScrn->heightmm = ddcHeightmm;
- if (pScrn->widthmm > 0) {
- pScrn->xDpi =
- (int)((double)pScrn->virtualX * MMPERINCH / pScrn->widthmm);
- }
- if (pScrn->heightmm > 0) {
- pScrn->yDpi =
- (int)((double)pScrn->virtualY * MMPERINCH / pScrn->heightmm);
- }
- if (pScrn->xDpi > 0 && pScrn->yDpi <= 0)
- pScrn->yDpi = pScrn->xDpi;
- if (pScrn->yDpi > 0 && pScrn->xDpi <= 0)
- pScrn->xDpi = pScrn->yDpi;
- } else {
- if (x > 0)
- pScrn->xDpi = x;
- else
- pScrn->xDpi = DEFAULT_DPI;
- if (y > 0)
- pScrn->yDpi = y;
- else
- pScrn->yDpi = DEFAULT_DPI;
- }
- xf86DrvMsg(pScrn->scrnIndex, from, "DPI set to (%d, %d)\n",
- pScrn->xDpi, pScrn->yDpi);
-}
-
-#undef MMPERINCH
-
-
-void
-xf86SetBlackWhitePixels(ScreenPtr pScreen)
-{
- if (xf86FlipPixels) {
- pScreen->whitePixel = 0;
- pScreen->blackPixel = 1;
- } else {
- pScreen->whitePixel = 1;
- pScreen->blackPixel = 0;
- }
-}
-
-/*
- * xf86SetRootClip --
- * Enable or disable rendering to the screen by
- * setting the root clip list and revalidating
- * all of the windows
- */
-
-static void
-xf86SetRootClip (ScreenPtr pScreen, Bool enable)
-{
- WindowPtr pWin = pScreen->root;
- WindowPtr pChild;
- Bool WasViewable = (Bool)(pWin->viewable);
- Bool anyMarked = FALSE;
- WindowPtr pLayerWin;
- BoxRec box;
-
- if (WasViewable)
- {
- for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib)
- {
- (void) (*pScreen->MarkOverlappedWindows)(pChild,
- pChild,
- &pLayerWin);
- }
- (*pScreen->MarkWindow) (pWin);
- anyMarked = TRUE;
- if (pWin->valdata)
- {
- if (HasBorder (pWin))
- {
- RegionPtr borderVisible;
-
- borderVisible = RegionCreate(NullBox, 1);
- RegionSubtract(borderVisible,
- &pWin->borderClip, &pWin->winSize);
- pWin->valdata->before.borderVisible = borderVisible;
- }
- pWin->valdata->before.resized = TRUE;
- }
- }
-
- /*
- * Use REGION_BREAK to avoid optimizations in ValidateTree
- * that assume the root borderClip can't change well, normally
- * it doesn't...)
- */
- if (enable)
- {
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = pScreen->width;
- box.y2 = pScreen->height;
- RegionInit(&pWin->winSize, &box, 1);
- RegionInit(&pWin->borderSize, &box, 1);
- if (WasViewable)
- {
- PixmapPtr pPixmap = (*pScreen->GetScreenPixmap) (pScreen);
- box.x2 = pPixmap->drawable.width;
- box.y2 = pPixmap->drawable.height;
- RegionReset(&pWin->borderClip, &box);
- }
- pWin->drawable.width = pScreen->width;
- pWin->drawable.height = pScreen->height;
- RegionBreak(&pWin->clipList);
- }
- else
- {
- RegionEmpty(&pWin->borderClip);
- RegionBreak(&pWin->clipList);
- }
-
- ResizeChildrenWinSize (pWin, 0, 0, 0, 0);
-
- if (WasViewable)
- {
- if (pWin->firstChild)
- {
- anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin->firstChild,
- pWin->firstChild,
- (WindowPtr *)NULL);
- }
- else
- {
- (*pScreen->MarkWindow) (pWin);
- anyMarked = TRUE;
- }
-
-
- if (anyMarked)
- (*pScreen->ValidateTree)(pWin, NullWindow, VTOther);
- }
-
- if (WasViewable)
- {
- if (anyMarked)
- (*pScreen->HandleExposures)(pWin);
- if (anyMarked && pScreen->PostValidateTree)
- (*pScreen->PostValidateTree)(pWin, NullWindow, VTOther);
- }
- if (pWin->realized)
- WindowsRestructured ();
- FlushAllOutput ();
-}
-
-/*
- * Function to enable/disable access to the frame buffer
- *
- * This is used when VT switching and when entering/leaving DGA direct mode.
- *
- * This has been rewritten again to eliminate the saved pixmap. The
- * devPrivate field in the screen pixmap is set to NULL to catch code
- * accidentally referencing the frame buffer while the X server is not
- * supposed to touch it.
- *
- * Here, we exchange the pixmap private data, rather than the pixmaps
- * themselves to avoid having to find and change any references to the screen
- * pixmap such as GC's, window privates etc. This also means that this code
- * does not need to know exactly how the pixmap pixels are accessed. Further,
- * this exchange is >not< done through the screen's ModifyPixmapHeader()
- * vector. This means the called frame buffer code layers can determine
- * 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.
- */
-void
-xf86EnableDisableFBAccess(int scrnIndex, Bool enable)
-{
- ScrnInfoPtr pScrnInfo = xf86Screens[scrnIndex];
- ScreenPtr pScreen = pScrnInfo->pScreen;
- PixmapPtr pspix;
-
- pspix = (*pScreen->GetScreenPixmap) (pScreen);
- if (enable)
- {
- /*
- * Restore all of the clip lists on the screen
- */
- if (!xf86Resetting)
- xf86SetRootClip (pScreen, TRUE);
- }
- else
- {
- /*
- * Empty all of the clip lists on the screen
- */
- xf86SetRootClip (pScreen, FALSE);
- }
-}
-
-/* Print driver messages in the standard format */
-
-#undef PREFIX_SIZE
-#define PREFIX_SIZE 14
-
-void
-xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format,
- va_list args)
-{
- char *tmpFormat;
-
- /* Prefix the scrnIndex name to the format string. */
- if (scrnIndex >= 0 && scrnIndex < xf86NumScreens &&
- xf86Screens[scrnIndex]->name) {
- tmpFormat = malloc(strlen(format) +
- strlen(xf86Screens[scrnIndex]->name) +
- PREFIX_SIZE + 1);
- if (!tmpFormat)
- return;
-
- snprintf(tmpFormat, PREFIX_SIZE + 1, "%s(%d): ",
- xf86Screens[scrnIndex]->name, scrnIndex);
-
- strcat(tmpFormat, format);
- LogVMessageVerb(type, verb, tmpFormat, args);
- free(tmpFormat);
- } else
- LogVMessageVerb(type, verb, format, args);
-}
-#undef PREFIX_SIZE
-
-/* Print driver messages, with verbose level specified directly */
-void
-xf86DrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format,
- ...)
-{
- va_list ap;
-
- va_start(ap, format);
- xf86VDrvMsgVerb(scrnIndex, type, verb, format, ap);
- va_end(ap);
-}
-
-/* Print driver messages, with verbose level of 1 (default) */
-void
-xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...)
-{
- va_list ap;
-
- va_start(ap, format);
- xf86VDrvMsgVerb(scrnIndex, type, 1, format, ap);
- va_end(ap);
-}
-
-/* Print input driver messages in the standard format of
- <driver>: <device name>: <message> */
-void
-xf86VIDrvMsgVerb(InputInfoPtr dev, MessageType type, int verb, const char *format,
- va_list args)
-{
- char *msg;
-
- if (asprintf(&msg, "%s: %s: %s", dev->drv->driverName, dev->name, format)
- == -1) {
- LogVMessageVerb(type, verb, "%s", args);
- } else {
- LogVMessageVerb(type, verb, msg, args);
- free(msg);
- }
-}
-
-/* Print input driver message, with verbose level specified directly */
-void
-xf86IDrvMsgVerb(InputInfoPtr dev, MessageType type, int verb, const char *format,
- ...)
-{
- va_list ap;
-
- va_start(ap, format);
- xf86VIDrvMsgVerb(dev, type, verb, format, ap);
- va_end(ap);
-}
-
-/* Print input driver messages, with verbose level of 1 (default) */
-void
-xf86IDrvMsg(InputInfoPtr dev, MessageType type, const char *format, ...)
-{
- va_list ap;
-
- va_start(ap, format);
- xf86VIDrvMsgVerb(dev, type, 1, format, ap);
- va_end(ap);
-}
-
-
-/* Print non-driver messages with verbose level specified directly */
-void
-xf86MsgVerb(MessageType type, int verb, const char *format, ...)
-{
- va_list ap;
-
- va_start(ap, format);
- LogVMessageVerb(type, verb, format, ap);
- va_end(ap);
-}
-
-/* Print non-driver messages with verbose level of 1 (default) */
-void
-xf86Msg(MessageType type, const char *format, ...)
-{
- va_list ap;
-
- va_start(ap, format);
- LogVMessageVerb(type, 1, format, ap);
- va_end(ap);
-}
-
-/* Just like ErrorF, but with the verbose level checked */
-void
-xf86ErrorFVerb(int verb, const char *format, ...)
-{
- va_list ap;
-
- va_start(ap, format);
- if (xf86Verbose >= verb || xf86LogVerbose >= verb)
- LogVWrite(verb, format, ap);
- va_end(ap);
-}
-
-/* Like xf86ErrorFVerb, but with an implied verbose level of 1 */
-void
-xf86ErrorF(const char *format, ...)
-{
- va_list ap;
-
- va_start(ap, format);
- if (xf86Verbose >= 1 || xf86LogVerbose >= 1)
- LogVWrite(1, format, ap);
- va_end(ap);
-}
-
-
-void
-xf86LogInit(void)
-{
- char *lf = NULL;
-
-#define LOGSUFFIX ".log"
-#define LOGOLDSUFFIX ".old"
-
- /* Get the log file name */
- if (xf86LogFileFrom == X_DEFAULT) {
- /* Append the display number and ".log" */
- if (asprintf(&lf, "%s%%s" LOGSUFFIX, xf86LogFile) == -1)
- FatalError("Cannot allocate space for the log file name\n");
- xf86LogFile = lf;
- }
-
- xf86LogFile = LogInit(xf86LogFile, LOGOLDSUFFIX);
- xf86LogFileWasOpened = TRUE;
-
- xf86SetVerbosity(xf86Verbose);
- xf86SetLogVerbosity(xf86LogVerbose);
-
-#undef LOGSUFFIX
-#undef LOGOLDSUFFIX
-
- free(lf);
-}
-
-void
-xf86CloseLog(void)
-{
- LogClose();
-}
-
-
-/*
- * Drivers can use these for using their own SymTabRecs.
- */
-
-const char *
-xf86TokenToString(SymTabPtr table, int token)
-{
- int i;
-
- for (i = 0; table[i].token >= 0 && table[i].token != token; i++)
- ;
-
- if (table[i].token < 0)
- return NULL;
- else
- return table[i].name;
-}
-
-int
-xf86StringToToken(SymTabPtr table, const char *string)
-{
- int i;
-
- if (string == NULL)
- return -1;
-
- for (i = 0; table[i].token >= 0 && xf86NameCmp(string, table[i].name); i++)
- ;
-
- return table[i].token;
-}
-
-/*
- * helper to display the clocks found on a card
- */
-void
-xf86ShowClocks(ScrnInfoPtr scrp, MessageType from)
-{
- int j;
-
- xf86DrvMsg(scrp->scrnIndex, from, "Pixel clocks available:");
- for (j=0; j < scrp->numClocks; j++) {
- if ((j % 4) == 0) {
- xf86ErrorF("\n");
- xf86DrvMsg(scrp->scrnIndex, from, "pixel clocks:");
- }
- xf86ErrorF(" %7.3f", (double)scrp->clock[j] / 1000.0);
- }
- xf86ErrorF("\n");
-}
-
-
-/*
- * This prints out the driver identify message, including the names of
- * the supported chipsets.
- *
- * XXX This makes assumptions about the line width, etc. Maybe we could
- * use a more general "pretty print" function for messages.
- */
-void
-xf86PrintChipsets(const char *drvname, const char *drvmsg, SymTabPtr chips)
-{
- int len, i;
-
- len = 6 + strlen(drvname) + 2 + strlen(drvmsg) + 2;
- xf86Msg(X_INFO, "%s: %s:", drvname, drvmsg);
- for (i = 0; chips[i].name != NULL; i++) {
- if (i != 0) {
- xf86ErrorF(",");
- len++;
- }
- if (len + 2 + strlen(chips[i].name) < 78) {
- xf86ErrorF(" ");
- len++;
- } else {
- xf86ErrorF("\n\t");
- len = 8;
- }
- xf86ErrorF("%s", chips[i].name);
- len += strlen(chips[i].name);
- }
- xf86ErrorF("\n");
-}
-
-
-int
-xf86MatchDevice(const char *drivername, GDevPtr **sectlist)
-{
- GDevPtr gdp, *pgdp = NULL;
- confScreenPtr screensecptr;
- int i,j;
-
- if (sectlist)
- *sectlist = NULL;
-
- /*
- * This can happen when running Xorg -showopts and a module like ati
- * or vmware tries to load its submodules when xf86ConfigLayout is empty
- */
- if (!xf86ConfigLayout.screens)
- return 0;
-
- /*
- * This is a very important function that matches the device sections
- * as they show up in the config file with the drivers that the server
- * loads at run time.
- *
- * ChipProbe can call
- * int xf86MatchDevice(char * drivername, GDevPtr ** sectlist)
- * with its driver name. The function allocates an array of GDevPtr and
- * returns this via sectlist and returns the number of elements in
- * this list as return value. 0 means none found, -1 means fatal error.
- *
- * It can figure out which of the Device sections to use for which card
- * (using things like the Card statement, etc). For single headed servers
- * there will of course be just one such Device section.
- */
- i = 0;
-
- /*
- * first we need to loop over all the Screens sections to get to all
- * 'active' device sections
- */
- for (j=0; xf86ConfigLayout.screens[j].screen != NULL; j++) {
- screensecptr = xf86ConfigLayout.screens[j].screen;
- if ((screensecptr->device->driver != NULL)
- && (xf86NameCmp( screensecptr->device->driver,drivername) == 0)
- && (! screensecptr->device->claimed)) {
- /*
- * we have a matching driver that wasn't claimed, yet
- */
- pgdp = xnfrealloc(pgdp, (i + 2) * sizeof(GDevPtr));
- pgdp[i++] = screensecptr->device;
- }
- }
-
- /* Then handle the inactive devices */
- j = 0;
- while (xf86ConfigLayout.inactives[j].identifier) {
- gdp = &xf86ConfigLayout.inactives[j];
- if (gdp->driver && !gdp->claimed &&
- !xf86NameCmp(gdp->driver,drivername)) {
- /* we have a matching driver that wasn't claimed yet */
- pgdp = xnfrealloc(pgdp, (i + 2) * sizeof(GDevPtr));
- pgdp[i++] = gdp;
- }
- j++;
- }
-
- /*
- * make the array NULL terminated and return its address
- */
- if (i)
- pgdp[i] = NULL;
-
- if (sectlist)
- *sectlist = pgdp;
- else
- free(pgdp);
- return i;
-}
-
-/*
- * xf86GetClocks -- get the dot-clocks via a BIG BAD hack ...
- */
-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)
-{
- register int status = vertsyncreg;
- unsigned long i, cnt, rcnt, sync;
-
- /* First save registers that get written on */
- (*ClockFunc)(pScrn, CLK_REG_SAVE);
-
- if (num > MAXCLOCKS)
- num = MAXCLOCKS;
-
- for (i = 0; i < num; i++)
- {
- if (ProtectRegs)
- (*ProtectRegs)(pScrn, TRUE);
- if (!(*ClockFunc)(pScrn, i))
- {
- pScrn->clock[i] = -1;
- continue;
- }
- if (ProtectRegs)
- (*ProtectRegs)(pScrn, FALSE);
- if (BlankScreen)
- (*BlankScreen)(pScrn, FALSE);
-
- usleep(50000); /* let VCO stabilise */
-
- cnt = 0;
- sync = 200000;
-
- while ((inb(status) & maskval) == 0x00)
- if (sync-- == 0) goto finish;
- /* Something appears to be happening, so reset sync count */
- sync = 200000;
- while ((inb(status) & maskval) == maskval)
- if (sync-- == 0) goto finish;
- /* Something appears to be happening, so reset sync count */
- sync = 200000;
- while ((inb(status) & maskval) == 0x00)
- if (sync-- == 0) goto finish;
-
- for (rcnt = 0; rcnt < 5; rcnt++)
- {
- while (!(inb(status) & maskval))
- cnt++;
- while ((inb(status) & maskval))
- cnt++;
- }
-
-finish:
- pScrn->clock[i] = cnt ? cnt : -1;
- if (BlankScreen)
- (*BlankScreen)(pScrn, TRUE);
- }
-
- for (i = 0; i < num; i++)
- {
- if (i != knownclkindex)
- {
- if (pScrn->clock[i] == -1)
- {
- pScrn->clock[i] = 0;
- }
- else
- {
- pScrn->clock[i] = (int)(0.5 +
- (((float)knownclkvalue) * pScrn->clock[knownclkindex]) /
- (pScrn->clock[i]));
- /* Round to nearest 10KHz */
- pScrn->clock[i] += 5;
- pScrn->clock[i] /= 10;
- pScrn->clock[i] *= 10;
- }
- }
- }
-
- pScrn->clock[knownclkindex] = knownclkvalue;
- pScrn->numClocks = num;
-
- /* Restore registers that were written on */
- (*ClockFunc)(pScrn, CLK_REG_RESTORE);
-}
-
-const char *
-xf86GetVisualName(int visual)
-{
- if (visual < 0 || visual > DirectColor)
- return NULL;
-
- return xf86VisualNames[visual];
-}
-
-
-int
-xf86GetVerbosity(void)
-{
- return max(xf86Verbose, xf86LogVerbose);
-}
-
-Pix24Flags
-xf86GetPix24(void)
-{
- return xf86Info.pixmap24;
-}
-
-
-int
-xf86GetDepth(void)
-{
- return xf86Depth;
-}
-
-
-rgb
-xf86GetWeight(void)
-{
- return xf86Weight;
-}
-
-
-Gamma
-xf86GetGamma(void)
-{
- return xf86Gamma;
-}
-
-
-Bool
-xf86GetFlipPixels(void)
-{
- return xf86FlipPixels;
-}
-
-
-const char *
-xf86GetServerName(void)
-{
- return xf86ServerName;
-}
-
-
-Bool
-xf86ServerIsExiting(void)
-{
- return (dispatchException & DE_TERMINATE) == DE_TERMINATE;
-}
-
-
-Bool
-xf86ServerIsResetting(void)
-{
- return xf86Resetting;
-}
-
-
-Bool
-xf86ServerIsInitialising(void)
-{
- return xf86Initialising;
-}
-
-
-Bool
-xf86ServerIsOnlyDetecting(void)
-{
- return xf86DoConfigure;
-}
-
-
-Bool
-xf86CaughtSignal(void)
-{
- return xf86Info.caughtSignal;
-}
-
-
-Bool
-xf86GetVidModeAllowNonLocal(void)
-{
- return xf86Info.vidModeAllowNonLocal;
-}
-
-
-Bool
-xf86GetVidModeEnabled(void)
-{
- return xf86Info.vidModeEnabled;
-}
-
-Bool
-xf86GetModInDevAllowNonLocal(void)
-{
- return xf86Info.miscModInDevAllowNonLocal;
-}
-
-
-Bool
-xf86GetModInDevEnabled(void)
-{
- return xf86Info.miscModInDevEnabled;
-}
-
-
-Bool
-xf86GetAllowMouseOpenFail(void)
-{
- return xf86Info.allowMouseOpenFail;
-}
-
-
-Bool
-xf86IsPc98(void)
-{
-#if SUPPORT_PC98
- return xf86Info.pc98;
-#else
- return FALSE;
-#endif
-}
-
-void
-xf86DisableRandR(void)
-{
- xf86Info.disableRandR = TRUE;
- xf86Info.randRFrom = X_PROBED;
-}
-
-CARD32
-xf86GetModuleVersion(pointer module)
-{
- return (CARD32)LoaderGetModuleVersion(module);
-}
-
-pointer
-xf86LoadDrvSubModule(DriverPtr drv, const char *name)
-{
- pointer ret;
- int errmaj = 0, errmin = 0;
-
- ret = LoadSubModule(drv->module, name, NULL, NULL, NULL, NULL,
- &errmaj, &errmin);
- if (!ret)
- LoaderErrorMsg(NULL, name, errmaj, errmin);
- return ret;
-}
-
-pointer
-xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name)
-{
- pointer ret;
- int errmaj = 0, errmin = 0;
-
- ret = LoadSubModule(pScrn->module, name, NULL, NULL, NULL, NULL,
- &errmaj, &errmin);
- if (!ret)
- LoaderErrorMsg(pScrn->name, name, errmaj, errmin);
- return ret;
-}
-
-/*
- * xf86LoadOneModule loads a single module.
- */
-pointer
-xf86LoadOneModule(char *name, pointer opt)
-{
- int errmaj, errmin;
- char *Name;
- pointer mod;
-
- if (!name)
- return NULL;
-
- /* Normalise the module name */
- Name = xf86NormalizeName(name);
-
- /* Skip empty names */
- if (Name == NULL)
- return NULL;
- if (*Name == '\0') {
- free(Name);
- return NULL;
- }
-
- mod = LoadModule(Name, NULL, NULL, NULL, opt, NULL, &errmaj, &errmin);
- if (!mod)
- LoaderErrorMsg(NULL, Name, errmaj, errmin);
- free(Name);
- return mod;
-}
-
-void
-xf86UnloadSubModule(pointer mod)
-{
- /*
- * This is disabled for now. The loader isn't smart enough yet to undo
- * relocations.
- */
-#if 0
- UnloadSubModule(mod);
-#endif
-}
-
-Bool
-xf86LoaderCheckSymbol(const char *name)
-{
- return LoaderSymbol(name) != NULL;
-}
-
-typedef enum {
- OPTION_BACKING_STORE
-} BSOpts;
-
-static const OptionInfoRec BSOptions[] = {
- { OPTION_BACKING_STORE, "BackingStore", OPTV_BOOLEAN, {0}, FALSE },
- { -1, NULL, OPTV_NONE, {0}, FALSE }
-};
-
-void
-xf86SetBackingStore(ScreenPtr pScreen)
-{
- Bool useBS = FALSE;
- MessageType from = X_DEFAULT;
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- OptionInfoPtr options;
-
- options = xnfalloc(sizeof(BSOptions));
- (void)memcpy(options, BSOptions, sizeof(BSOptions));
- xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options);
-
- /* check for commandline option here */
- if (xf86bsEnableFlag) {
- from = X_CMDLINE;
- useBS = TRUE;
- } else if (xf86bsDisableFlag) {
- from = X_CMDLINE;
- useBS = FALSE;
- } else {
- if (xf86GetOptValBool(options, OPTION_BACKING_STORE, &useBS))
- from = X_CONFIG;
- }
- free(options);
- pScreen->backingStoreSupport = useBS ? Always : NotUseful;
- if (serverGeneration == 1)
- xf86DrvMsg(pScreen->myNum, from, "Backing store %s\n",
- useBS ? "enabled" : "disabled");
-}
-
-
-typedef enum {
- OPTION_SILKEN_MOUSE
-} SMOpts;
-
-static const OptionInfoRec SMOptions[] = {
- { OPTION_SILKEN_MOUSE, "SilkenMouse", OPTV_BOOLEAN, {0}, FALSE },
- { -1, NULL, OPTV_NONE, {0}, FALSE }
-};
-
-void
-xf86SetSilkenMouse (ScreenPtr pScreen)
-{
- Bool useSM = TRUE;
- MessageType from = X_DEFAULT;
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- OptionInfoPtr options;
-
- options = xnfalloc(sizeof(SMOptions));
- (void)memcpy(options, SMOptions, sizeof(SMOptions));
- xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options);
-
- /* check for commandline option here */
- /* disable if screen shares resources */
- /* TODO VGA arb disable silken mouse */
- if (xf86silkenMouseDisableFlag) {
- from = X_CMDLINE;
- useSM = FALSE;
- } else {
- if (xf86GetOptValBool(options, OPTION_SILKEN_MOUSE, &useSM))
- from = X_CONFIG;
- }
- free(options);
- /*
- * XXX quick hack to report correctly for OSs that can't do SilkenMouse
- * yet. Should handle this differently so that alternate async methods
- * work correctly with this too.
- */
- pScrn->silkenMouse = useSM && xf86Info.useSIGIO && xf86SIGIOSupported();
- if (serverGeneration == 1)
- xf86DrvMsg(pScreen->myNum, from, "Silken mouse %s\n",
- pScrn->silkenMouse ? "enabled" : "disabled");
-}
-
-/* Wrote this function for the PM2 Xv driver, preliminary. */
-
-pointer
-xf86FindXvOptions(int scrnIndex, int adaptor_index, char *port_name,
- char **adaptor_name, pointer *adaptor_options)
-{
- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
- confXvAdaptorPtr adaptor;
- int i;
-
- if (adaptor_index >= pScrn->confScreen->numxvadaptors) {
- if (adaptor_name) *adaptor_name = NULL;
- if (adaptor_options) *adaptor_options = NULL;
- return NULL;
- }
-
- adaptor = &pScrn->confScreen->xvadaptors[adaptor_index];
- if (adaptor_name) *adaptor_name = adaptor->identifier;
- if (adaptor_options) *adaptor_options = adaptor->options;
-
- for (i = 0; i < adaptor->numports; i++)
- if (!xf86NameCmp(adaptor->ports[i].identifier, port_name))
- return adaptor->ports[i].options;
-
- return NULL;
-}
-
-/* Rather than duplicate loader's get OS function, just include it directly */
-#define LoaderGetOS xf86GetOS
-#include "loader/os.c"
-
-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
-xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
- EntityProc init, EntityProc enter, EntityProc leave,
- pointer private)
-{
- EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex);
- if (!pEnt) return pScrn;
-
- if (!(pEnt->location.type == BUS_NONE)) {
- free(pEnt);
- return pScrn;
- }
-
- if (!pEnt->active) {
- xf86ConfigFbEntityInactive(pEnt, init, enter, leave, private);
- free(pEnt);
- return pScrn;
- }
-
- if (!pScrn)
- pScrn = xf86AllocateScreen(pEnt->driver,scrnFlag);
- xf86AddEntityToScreen(pScrn,entityIndex);
-
- xf86SetEntityFuncs(entityIndex,init,enter,leave,private);
-
- return pScrn;
-}
-
-Bool
-xf86IsScreenPrimary(int scrnIndex)
-{
- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
- int i;
-
- for (i=0 ; i < pScrn->numEntities; i++) {
- if (xf86IsEntityPrimary(i))
- return TRUE;
- }
- return FALSE;
-}
-
-int
-xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type,
- int format, unsigned long len, pointer value )
-{
- RootWinPropPtr pNewProp = NULL, pRegProp;
- int i;
- Bool existing = FALSE;
-
- DebugF("xf86RegisterRootWindowProperty(%d, %ld, %ld, %d, %ld, %p)\n",
- ScrnIndex, property, type, format, len, value);
-
- if (ScrnIndex<0 || ScrnIndex>=xf86NumScreens) {
- return BadMatch;
- }
-
- if (xf86RegisteredPropertiesTable &&
- xf86RegisteredPropertiesTable[ScrnIndex]) {
- for (pNewProp = xf86RegisteredPropertiesTable[ScrnIndex];
- pNewProp; pNewProp = pNewProp->next) {
- if (strcmp(pNewProp->name, NameForAtom(property)) == 0)
- break;
- }
- }
-
- if (!pNewProp) {
- if ((pNewProp = (RootWinPropPtr)malloc(sizeof(RootWinProp))) == NULL) {
- return BadAlloc;
- }
- /*
- * We will put this property at the end of the list so that
- * the changes are made in the order they were requested.
- */
- pNewProp->next = NULL;
- } else {
- free(pNewProp->name);
- existing = TRUE;
- }
-
- pNewProp->name = xnfstrdup(NameForAtom(property));
- pNewProp->type = type;
- pNewProp->format = format;
- pNewProp->size = len;
- pNewProp->data = value;
-
- DebugF("new property filled\n");
-
- if (NULL==xf86RegisteredPropertiesTable) {
- DebugF("creating xf86RegisteredPropertiesTable[] size %d\n",
- xf86NumScreens);
- if ( NULL==(xf86RegisteredPropertiesTable=(RootWinPropPtr*)xnfcalloc(sizeof(RootWinProp),xf86NumScreens) )) {
- return BadAlloc;
- }
- for (i=0; i<xf86NumScreens; i++) {
- xf86RegisteredPropertiesTable[i] = NULL;
- }
- }
-
- DebugF("xf86RegisteredPropertiesTable %p\n",
- (void *)xf86RegisteredPropertiesTable);
- DebugF("xf86RegisteredPropertiesTable[%d] %p\n",
- ScrnIndex, (void *)xf86RegisteredPropertiesTable[ScrnIndex]);
-
- if (!existing) {
- if ( xf86RegisteredPropertiesTable[ScrnIndex] == NULL) {
- xf86RegisteredPropertiesTable[ScrnIndex] = pNewProp;
- } else {
- pRegProp = xf86RegisteredPropertiesTable[ScrnIndex];
- while (pRegProp->next != NULL) {
- DebugF("- next %p\n", (void *)pRegProp);
- pRegProp = pRegProp->next;
- }
- pRegProp->next = pNewProp;
- }
- }
- DebugF("xf86RegisterRootWindowProperty succeeded\n");
- return Success;
-}
-
-Bool
-xf86IsUnblank(int mode)
-{
- switch(mode) {
- case SCREEN_SAVER_OFF:
- case SCREEN_SAVER_FORCER:
- return TRUE;
- case SCREEN_SAVER_ON:
- case SCREEN_SAVER_CYCLE:
- return FALSE;
- default:
- xf86MsgVerb(X_WARNING, 0, "Unexpected save screen mode: %d\n", mode);
- return TRUE;
- }
-}
-
-void
-xf86MotionHistoryAllocate(InputInfoPtr pInfo)
-{
- AllocateMotionHistory(pInfo->dev);
-}
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+/*
+ * Authors: Dirk Hohndel <hohndel@XFree86.Org>
+ * David Dawes <dawes@XFree86.Org>
+ * ... and others
+ *
+ * This file includes the helper functions that the server provides for
+ * different drivers.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "os.h"
+#include "servermd.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "propertyst.h"
+#include "gcstruct.h"
+#include "loaderProcs.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "micmap.h"
+#include "xf86DDC.h"
+#include "xf86Xinput.h"
+#include "xf86InPriv.h"
+#include "mivalidate.h"
+#include "xf86Crtc.h"
+
+/* For xf86GetClocks */
+#if defined(CSRG_BASED) || defined(__GNU__)
+#define HAS_SETPRIORITY
+#include <sys/resource.h>
+#endif
+
+static int xf86ScrnInfoPrivateCount = 0;
+
+
+/* Add a pointer to a new DriverRec to xf86DriverList */
+
+void
+xf86AddDriver(DriverPtr driver, pointer module, int flags)
+{
+ /* Don't add null entries */
+ if (!driver)
+ return;
+
+ if (xf86DriverList == NULL)
+ xf86NumDrivers = 0;
+
+ xf86NumDrivers++;
+ xf86DriverList = xnfrealloc(xf86DriverList,
+ xf86NumDrivers * sizeof(DriverPtr));
+ xf86DriverList[xf86NumDrivers - 1] = xnfalloc(sizeof(DriverRec));
+ if (flags & HaveDriverFuncs)
+ *xf86DriverList[xf86NumDrivers - 1] = *driver;
+ else {
+ (void) memset( xf86DriverList[xf86NumDrivers - 1], 0,
+ sizeof( DriverRec ) );
+ (void) memcpy( xf86DriverList[xf86NumDrivers - 1], driver,
+ sizeof(DriverRec1));
+
+ }
+ xf86DriverList[xf86NumDrivers - 1]->module = module;
+ xf86DriverList[xf86NumDrivers - 1]->refCount = 0;
+}
+
+void
+xf86DeleteDriver(int drvIndex)
+{
+ if (xf86DriverList[drvIndex]
+ && (!xf86DriverHasEntities(xf86DriverList[drvIndex]))) {
+ if (xf86DriverList[drvIndex]->module)
+ UnloadModule(xf86DriverList[drvIndex]->module);
+ free(xf86DriverList[drvIndex]);
+ xf86DriverList[drvIndex] = NULL;
+ }
+}
+
+/* Add a pointer to a new InputDriverRec to xf86InputDriverList */
+
+void
+xf86AddInputDriver(InputDriverPtr driver, pointer module, int flags)
+{
+ /* Don't add null entries */
+ if (!driver)
+ return;
+
+ if (xf86InputDriverList == NULL)
+ xf86NumInputDrivers = 0;
+
+ xf86NumInputDrivers++;
+ xf86InputDriverList = xnfrealloc(xf86InputDriverList,
+ xf86NumInputDrivers * sizeof(InputDriverPtr));
+ xf86InputDriverList[xf86NumInputDrivers - 1] =
+ xnfalloc(sizeof(InputDriverRec));
+ *xf86InputDriverList[xf86NumInputDrivers - 1] = *driver;
+ xf86InputDriverList[xf86NumInputDrivers - 1]->module = module;
+}
+
+void
+xf86DeleteInputDriver(int drvIndex)
+{
+ if (xf86InputDriverList[drvIndex] && xf86InputDriverList[drvIndex]->module)
+ UnloadModule(xf86InputDriverList[drvIndex]->module);
+ free(xf86InputDriverList[drvIndex]);
+ xf86InputDriverList[drvIndex] = NULL;
+}
+
+InputDriverPtr
+xf86LookupInputDriver(const char *name)
+{
+ int i;
+
+ for (i = 0; i < xf86NumInputDrivers; i++) {
+ if (xf86InputDriverList[i] && xf86InputDriverList[i]->driverName &&
+ xf86NameCmp(name, xf86InputDriverList[i]->driverName) == 0)
+ return xf86InputDriverList[i];
+ }
+ return NULL;
+}
+
+InputInfoPtr
+xf86LookupInput(const char *name)
+{
+ InputInfoPtr p;
+
+ for (p = xf86InputDevs; p != NULL; p = p->next) {
+ if (strcmp(name, p->name) == 0)
+ return p;
+ }
+
+ return NULL;
+}
+
+/* Allocate a new ScrnInfoRec in xf86Screens */
+
+ScrnInfoPtr
+xf86AllocateScreen(DriverPtr drv, int flags)
+{
+ int i;
+
+ if (xf86Screens == NULL)
+ xf86NumScreens = 0;
+
+ i = xf86NumScreens++;
+ xf86Screens = xnfrealloc(xf86Screens, xf86NumScreens * sizeof(ScrnInfoPtr));
+ xf86Screens[i] = xnfcalloc(sizeof(ScrnInfoRec), 1);
+ xf86Screens[i]->scrnIndex = i; /* Changes when a screen is removed */
+ xf86Screens[i]->origIndex = i; /* This never changes */
+ xf86Screens[i]->privates = xnfcalloc(sizeof(DevUnion),
+ xf86ScrnInfoPrivateCount);
+ /*
+ * EnableDisableFBAccess now gets initialized in InitOutput()
+ * xf86Screens[i]->EnableDisableFBAccess = xf86EnableDisableFBAccess;
+ */
+
+ xf86Screens[i]->drv = drv;
+ drv->refCount++;
+ xf86Screens[i]->module = DuplicateModule(drv->module, NULL);
+
+ xf86Screens[i]->DriverFunc = drv->driverFunc;
+
+ return xf86Screens[i];
+}
+
+
+/*
+ * Remove an entry from xf86Screens. Ideally it should free all allocated
+ * data. To do this properly may require a driver hook.
+ */
+
+void
+xf86DeleteScreen(int scrnIndex, int flags)
+{
+ ScrnInfoPtr pScrn;
+ int i;
+
+ /* First check if the screen is valid */
+ if (xf86NumScreens == 0 || xf86Screens == NULL)
+ return;
+
+ if (scrnIndex > xf86NumScreens - 1)
+ return;
+
+ if (!(pScrn = xf86Screens[scrnIndex]))
+ return;
+
+ /* If a FreeScreen function is defined, call it here */
+ if (pScrn->FreeScreen != NULL)
+ pScrn->FreeScreen(scrnIndex, 0);
+
+ while (pScrn->modes)
+ xf86DeleteMode(&pScrn->modes, pScrn->modes);
+
+ while (pScrn->modePool)
+ xf86DeleteMode(&pScrn->modePool, pScrn->modePool);
+
+ xf86OptionListFree(pScrn->options);
+
+ if (pScrn->module)
+ UnloadModule(pScrn->module);
+
+ if (pScrn->drv)
+ pScrn->drv->refCount--;
+
+ free(pScrn->privates);
+
+ xf86ClearEntityListForScreen(scrnIndex);
+
+ free(pScrn);
+
+ /* Move the other entries down, updating their scrnIndex fields */
+
+ xf86NumScreens--;
+
+ for (i = scrnIndex; i < xf86NumScreens; i++) {
+ xf86Screens[i] = xf86Screens[i + 1];
+ xf86Screens[i]->scrnIndex = i;
+ /* Also need to take care of the screen layout settings */
+ }
+}
+
+/*
+ * Allocate a private in ScrnInfoRec.
+ */
+
+int
+xf86AllocateScrnInfoPrivateIndex(void)
+{
+ int idx, i;
+ ScrnInfoPtr pScr;
+ DevUnion *nprivs;
+
+ idx = xf86ScrnInfoPrivateCount++;
+ for (i = 0; i < xf86NumScreens; i++) {
+ pScr = xf86Screens[i];
+ nprivs = xnfrealloc(pScr->privates,
+ xf86ScrnInfoPrivateCount * sizeof(DevUnion));
+ /* Zero the new private */
+ memset(&nprivs[idx], 0, sizeof(DevUnion));
+ pScr->privates = nprivs;
+ }
+ return idx;
+}
+
+Bool
+xf86AddPixFormat(ScrnInfoPtr pScrn, int depth, int bpp, int pad)
+{
+ int i;
+
+ if (pScrn->numFormats >= MAXFORMATS)
+ return FALSE;
+
+ if (bpp <= 0) {
+ if (depth == 1)
+ bpp = 1;
+ else if (depth <= 8)
+ bpp = 8;
+ else if (depth <= 16)
+ bpp = 16;
+ else if (depth <= 32)
+ bpp = 32;
+ else
+ return FALSE;
+ }
+ if (pad <= 0)
+ pad = BITMAP_SCANLINE_PAD;
+
+ i = pScrn->numFormats++;
+ pScrn->formats[i].depth = depth;
+ pScrn->formats[i].bitsPerPixel = bpp;
+ pScrn->formats[i].scanlinePad = pad;
+ return TRUE;
+}
+
+/*
+ * Set the depth we are using based on (in the following order of preference):
+ * - values given on the command line
+ * - values given in the config file
+ * - values provided by the driver
+ * - an overall default when nothing else is given
+ *
+ * Also find a Display subsection matching the depth/bpp found.
+ *
+ * Sets the following ScrnInfoRec fields:
+ * bitsPerPixel, pixmap24, depth, display, imageByteOrder,
+ * bitmapScanlinePad, bitmapScanlineUnit, bitmapBitOrder, numFormats,
+ * formats, fbFormat.
+ */
+
+/* Can the screen handle 24 bpp pixmaps */
+#define DO_PIX24(f) ((f & Support24bppFb) || \
+ ((f & Support32bppFb) && (f & SupportConvert24to32)))
+
+/* Can the screen handle 32 bpp pixmaps */
+#define DO_PIX32(f) ((f & Support32bppFb) || \
+ ((f & Support24bppFb) && (f & SupportConvert32to24)))
+
+/* Does the screen prefer 32bpp fb for 24bpp pixmaps */
+#define CHOOSE32FOR24(f) ((f & Support32bppFb) && (f & SupportConvert24to32) \
+ && (f & PreferConvert24to32))
+
+/* Does the screen prefer 24bpp fb for 32bpp pixmaps */
+#define CHOOSE24FOR32(f) ((f & Support24bppFb) && (f & SupportConvert32to24) \
+ && (f & PreferConvert32to24))
+
+/* Can the screen handle 32bpp pixmaps for 24bpp fb */
+#define DO_PIX32FOR24(f) ((f & Support24bppFb) && (f & SupportConvert32to24))
+
+/* Can the screen handle 24bpp pixmaps for 32bpp fb */
+#define DO_PIX24FOR32(f) ((f & Support32bppFb) && (f & SupportConvert24to32))
+
+#ifndef GLOBAL_DEFAULT_DEPTH
+#define GLOBAL_DEFAULT_DEPTH 24
+#endif
+
+Bool
+xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int dummy, int fbbpp,
+ int depth24flags)
+{
+ int i;
+ DispPtr disp;
+ Pix24Flags pix24 = xf86Info.pixmap24;
+ Bool nomatch = FALSE;
+
+ scrp->bitsPerPixel = -1;
+ scrp->depth = -1;
+ scrp->pixmap24 = Pix24DontCare;
+ scrp->bitsPerPixelFrom = X_DEFAULT;
+ scrp->depthFrom = X_DEFAULT;
+
+ if (xf86FbBpp > 0) {
+ scrp->bitsPerPixel = xf86FbBpp;
+ scrp->bitsPerPixelFrom = X_CMDLINE;
+ }
+
+ if (xf86Depth > 0) {
+ scrp->depth = xf86Depth;
+ scrp->depthFrom = X_CMDLINE;
+ }
+
+ if (xf86FbBpp < 0 && xf86Depth < 0) {
+ if (scrp->confScreen->defaultfbbpp > 0) {
+ scrp->bitsPerPixel = scrp->confScreen->defaultfbbpp;
+ scrp->bitsPerPixelFrom = X_CONFIG;
+ }
+ if (scrp->confScreen->defaultdepth > 0) {
+ scrp->depth = scrp->confScreen->defaultdepth;
+ scrp->depthFrom = X_CONFIG;
+ }
+
+ if (scrp->confScreen->defaultfbbpp <= 0 &&
+ scrp->confScreen->defaultdepth <= 0) {
+ /*
+ * Check for DefaultDepth and DefaultFbBpp options in the
+ * Device sections.
+ */
+ int i;
+ GDevPtr device;
+ Bool found = FALSE;
+
+ for (i = 0; i < scrp->numEntities; i++) {
+ device = xf86GetDevFromEntity(scrp->entityList[i],
+ scrp->entityInstanceList[i]);
+ if (device && device->options) {
+ if (xf86FindOption(device->options, "DefaultDepth")) {
+ scrp->depth = xf86SetIntOption(device->options,
+ "DefaultDepth", -1);
+ scrp->depthFrom = X_CONFIG;
+ found = TRUE;
+ }
+ if (xf86FindOption(device->options, "DefaultFbBpp")) {
+ scrp->bitsPerPixel = xf86SetIntOption(device->options,
+ "DefaultFbBpp",
+ -1);
+ scrp->bitsPerPixelFrom = X_CONFIG;
+ found = TRUE;
+ }
+ }
+ if (found)
+ break;
+ }
+ }
+ }
+
+ /* If none of these is set, pick a default */
+ if (scrp->bitsPerPixel < 0 && scrp->depth < 0) {
+ if (fbbpp > 0 || depth > 0) {
+ if (fbbpp > 0)
+ scrp->bitsPerPixel = fbbpp;
+ if (depth > 0)
+ scrp->depth = depth;
+ } else {
+ scrp->depth = GLOBAL_DEFAULT_DEPTH;
+ }
+ }
+
+ /* If any are not given, determine a default for the others */
+
+ if (scrp->bitsPerPixel < 0) {
+ /* The depth must be set */
+ if (scrp->depth > -1) {
+ if (scrp->depth == 1)
+ scrp->bitsPerPixel = 1;
+ else if (scrp->depth <= 4)
+ scrp->bitsPerPixel = 4;
+ else if (scrp->depth <= 8)
+ scrp->bitsPerPixel = 8;
+ else if (scrp->depth <= 16)
+ scrp->bitsPerPixel = 16;
+ else if (scrp->depth <= 24) {
+ /*
+ * Figure out if a choice is possible based on the depth24
+ * and pix24 flags.
+ */
+ /* Check pix24 first */
+ if (pix24 != Pix24DontCare) {
+ if (pix24 == Pix24Use32) {
+ if (DO_PIX32(depth24flags)) {
+ if (CHOOSE24FOR32(depth24flags))
+ scrp->bitsPerPixel = 24;
+ else
+ scrp->bitsPerPixel = 32;
+ } else {
+ nomatch = TRUE;
+ }
+ } else if (pix24 == Pix24Use24) {
+ if (DO_PIX24(depth24flags)) {
+ if (CHOOSE32FOR24(depth24flags))
+ scrp->bitsPerPixel = 32;
+ else
+ scrp->bitsPerPixel = 24;
+ } else {
+ nomatch = TRUE;
+ }
+ }
+ } else {
+ if (DO_PIX32(depth24flags)) {
+ if (CHOOSE24FOR32(depth24flags))
+ scrp->bitsPerPixel = 24;
+ else
+ scrp->bitsPerPixel = 32;
+ } else if (DO_PIX24(depth24flags)) {
+ if (CHOOSE32FOR24(depth24flags))
+ scrp->bitsPerPixel = 32;
+ else
+ scrp->bitsPerPixel = 24;
+ }
+ }
+ } else if (scrp->depth <= 32)
+ scrp->bitsPerPixel = 32;
+ else {
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Specified depth (%d) is greater than 32\n",
+ scrp->depth);
+ return FALSE;
+ }
+ } else {
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "xf86SetDepthBpp: internal error: depth and fbbpp"
+ " are both not set\n");
+ return FALSE;
+ }
+ if (scrp->bitsPerPixel < 0) {
+ if (nomatch)
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Driver can't support depth 24 pixmap format (%d)\n",
+ PIX24TOBPP(pix24));
+ else if ((depth24flags & (Support24bppFb | Support32bppFb)) ==
+ NoDepth24Support)
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Driver can't support depth 24\n");
+ else
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Can't find fbbpp for depth 24\n");
+ return FALSE;
+ }
+ scrp->bitsPerPixelFrom = X_PROBED;
+ }
+
+ if (scrp->depth <= 0) {
+ /* bitsPerPixel is already set */
+ switch (scrp->bitsPerPixel) {
+ case 32:
+ scrp->depth = 24;
+ break;
+ default:
+ /* 1, 4, 8, 16 and 24 */
+ scrp->depth = scrp->bitsPerPixel;
+ break;
+ }
+ scrp->depthFrom = X_PROBED;
+ }
+
+ /* Sanity checks */
+ if (scrp->depth < 1 || scrp->depth > 32) {
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Specified depth (%d) is not in the range 1-32\n",
+ scrp->depth);
+ return FALSE;
+ }
+ switch (scrp->bitsPerPixel) {
+ case 1:
+ case 4:
+ case 8:
+ case 16:
+ case 24:
+ case 32:
+ break;
+ default:
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Specified fbbpp (%d) is not a permitted value\n",
+ scrp->bitsPerPixel);
+ return FALSE;
+ }
+ if (scrp->depth > scrp->bitsPerPixel) {
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Specified depth (%d) is greater than the fbbpp (%d)\n",
+ scrp->depth, scrp->bitsPerPixel);
+ return FALSE;
+ }
+
+ /* set scrp->pixmap24 if the driver isn't flexible */
+ if (scrp->bitsPerPixel == 24 && !DO_PIX32FOR24(depth24flags)) {
+ scrp->pixmap24 = Pix24Use24;
+ }
+ if (scrp->bitsPerPixel == 32 && !DO_PIX24FOR32(depth24flags)) {
+ scrp->pixmap24 = Pix24Use32;
+ }
+
+ /*
+ * Find the Display subsection matching the depth/fbbpp and initialise
+ * scrp->display with it.
+ */
+ for (i = 0, disp = scrp->confScreen->displays;
+ i < scrp->confScreen->numdisplays; i++, disp++) {
+ if ((disp->depth == scrp->depth && disp->fbbpp == scrp->bitsPerPixel)
+ || (disp->depth == scrp->depth && disp->fbbpp <= 0)
+ || (disp->fbbpp == scrp->bitsPerPixel && disp->depth <= 0)) {
+ scrp->display = disp;
+ break;
+ }
+ }
+
+ /*
+ * If an exact match can't be found, see if there is one with no
+ * depth or fbbpp specified.
+ */
+ if (i == scrp->confScreen->numdisplays) {
+ for (i = 0, disp = scrp->confScreen->displays;
+ i < scrp->confScreen->numdisplays; i++, disp++) {
+ if (disp->depth <= 0 && disp->fbbpp <= 0) {
+ scrp->display = disp;
+ break;
+ }
+ }
+ }
+
+ /*
+ * If all else fails, create a default one.
+ */
+ if (i == scrp->confScreen->numdisplays) {
+ scrp->confScreen->numdisplays++;
+ scrp->confScreen->displays =
+ xnfrealloc(scrp->confScreen->displays,
+ scrp->confScreen->numdisplays * sizeof(DispRec));
+ xf86DrvMsg(scrp->scrnIndex, X_INFO,
+ "Creating default Display subsection in Screen section\n"
+ "\t\"%s\" for depth/fbbpp %d/%d\n",
+ scrp->confScreen->id, scrp->depth, scrp->bitsPerPixel);
+ memset(&scrp->confScreen->displays[i], 0, sizeof(DispRec));
+ scrp->confScreen->displays[i].blackColour.red = -1;
+ scrp->confScreen->displays[i].blackColour.green = -1;
+ scrp->confScreen->displays[i].blackColour.blue = -1;
+ scrp->confScreen->displays[i].whiteColour.red = -1;
+ scrp->confScreen->displays[i].whiteColour.green = -1;
+ scrp->confScreen->displays[i].whiteColour.blue = -1;
+ scrp->confScreen->displays[i].defaultVisual = -1;
+ scrp->confScreen->displays[i].modes = xnfalloc(sizeof(char *));
+ scrp->confScreen->displays[i].modes[0] = NULL;
+ scrp->confScreen->displays[i].depth = depth;
+ scrp->confScreen->displays[i].fbbpp = fbbpp;
+ scrp->display = &scrp->confScreen->displays[i];
+ }
+
+ /*
+ * Setup defaults for the display-wide attributes the framebuffer will
+ * need. These defaults should eventually be set globally, and not
+ * dependent on the screens.
+ */
+ scrp->imageByteOrder = IMAGE_BYTE_ORDER;
+ scrp->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
+ if (scrp->depth < 8) {
+ /* Planar modes need these settings */
+ scrp->bitmapScanlineUnit = 8;
+ scrp->bitmapBitOrder = MSBFirst;
+ } else {
+ scrp->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
+ scrp->bitmapBitOrder = BITMAP_BIT_ORDER;
+ }
+
+ /*
+ * If an unusual depth is required, add it to scrp->formats. The formats
+ * for the common depths are handled globally in InitOutput
+ */
+ switch (scrp->depth) {
+ case 1:
+ case 4:
+ case 8:
+ case 15:
+ case 16:
+ case 24:
+ /* Common depths. Nothing to do for them */
+ break;
+ default:
+ if (!xf86AddPixFormat(scrp, scrp->depth, 0, 0)) {
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Can't add pixmap format for depth %d\n", scrp->depth);
+ return FALSE;
+ }
+ }
+
+ /* Initialise the framebuffer format for this screen */
+ scrp->fbFormat.depth = scrp->depth;
+ scrp->fbFormat.bitsPerPixel = scrp->bitsPerPixel;
+ scrp->fbFormat.scanlinePad = BITMAP_SCANLINE_PAD;
+
+ return TRUE;
+}
+
+/*
+ * Print out the selected depth and bpp.
+ */
+void
+xf86PrintDepthBpp(ScrnInfoPtr scrp)
+{
+ xf86DrvMsg(scrp->scrnIndex, scrp->depthFrom, "Depth %d, ", scrp->depth);
+ xf86Msg(scrp->bitsPerPixelFrom, "framebuffer bpp %d\n", scrp->bitsPerPixel);
+}
+
+/*
+ * xf86SetWeight sets scrp->weight, scrp->mask, scrp->offset, and for depths
+ * greater than MAX_PSEUDO_DEPTH also scrp->rgbBits.
+ */
+Bool
+xf86SetWeight(ScrnInfoPtr scrp, rgb weight, rgb mask)
+{
+ MessageType weightFrom = X_DEFAULT;
+
+ scrp->weight.red = 0;
+ scrp->weight.green = 0;
+ scrp->weight.blue = 0;
+
+ if (xf86Weight.red > 0 && xf86Weight.green > 0 && xf86Weight.blue > 0) {
+ scrp->weight = xf86Weight;
+ weightFrom = X_CMDLINE;
+ } else if (scrp->display->weight.red > 0 && scrp->display->weight.green > 0
+ && scrp->display->weight.blue > 0) {
+ scrp->weight = scrp->display->weight;
+ weightFrom = X_CONFIG;
+ } else if (weight.red > 0 && weight.green > 0 && weight.blue > 0) {
+ scrp->weight = weight;
+ } else {
+ switch (scrp->depth) {
+ case 1:
+ case 4:
+ case 8:
+ scrp->weight.red = scrp->weight.green =
+ scrp->weight.blue = scrp->rgbBits;
+ break;
+ case 15:
+ scrp->weight.red = scrp->weight.green = scrp->weight.blue = 5;
+ break;
+ case 16:
+ scrp->weight.red = scrp->weight.blue = 5;
+ scrp->weight.green = 6;
+ break;
+ case 18:
+ scrp->weight.red = scrp->weight.green = scrp->weight.blue = 6;
+ break;
+ case 24:
+ scrp->weight.red = scrp->weight.green = scrp->weight.blue = 8;
+ break;
+ case 30:
+ scrp->weight.red = scrp->weight.green = scrp->weight.blue = 10;
+ break;
+ }
+ }
+
+ if (scrp->weight.red)
+ xf86DrvMsg(scrp->scrnIndex, weightFrom, "RGB weight %d%d%d\n",
+ (int)scrp->weight.red, (int)scrp->weight.green,
+ (int)scrp->weight.blue);
+
+ if (scrp->depth > MAX_PSEUDO_DEPTH &&
+ (scrp->depth != scrp->weight.red + scrp->weight.green +
+ scrp->weight.blue)) {
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Weight given (%d%d%d) is inconsistent with the "
+ "depth (%d)\n",
+ (int)scrp->weight.red, (int)scrp->weight.green,
+ (int)scrp->weight.blue, scrp->depth);
+ return FALSE;
+ }
+ if (scrp->depth > MAX_PSEUDO_DEPTH && scrp->weight.red) {
+ /*
+ * XXX Does this even mean anything for TrueColor visuals?
+ * If not, we shouldn't even be setting it here. However, this
+ * matches the behaviour of 3.x versions of XFree86.
+ */
+ scrp->rgbBits = scrp->weight.red;
+ if (scrp->weight.green > scrp->rgbBits)
+ scrp->rgbBits = scrp->weight.green;
+ if (scrp->weight.blue > scrp->rgbBits)
+ scrp->rgbBits = scrp->weight.blue;
+ }
+
+ /* Set the mask and offsets */
+ if (mask.red == 0 || mask.green == 0 || mask.blue == 0) {
+ /* Default to a setting common to PC hardware */
+ scrp->offset.red = scrp->weight.green + scrp->weight.blue;
+ scrp->offset.green = scrp->weight.blue;
+ scrp->offset.blue = 0;
+ scrp->mask.red = ((1 << scrp->weight.red) - 1) << scrp->offset.red;
+ scrp->mask.green = ((1 << scrp->weight.green) - 1)
+ << scrp->offset.green;
+ scrp->mask.blue = (1 << scrp->weight.blue) - 1;
+ } else {
+ /* Initialise to the values passed */
+ scrp->mask.red = mask.red;
+ scrp->mask.green = mask.green;
+ scrp->mask.blue = mask.blue;
+ scrp->offset.red = ffs(mask.red);
+ scrp->offset.green = ffs(mask.green);
+ scrp->offset.blue = ffs(mask.blue);
+ }
+ return TRUE;
+}
+
+Bool
+xf86SetDefaultVisual(ScrnInfoPtr scrp, int visual)
+{
+ MessageType visualFrom = X_DEFAULT;
+
+ if (defaultColorVisualClass >= 0) {
+ scrp->defaultVisual = defaultColorVisualClass;
+ visualFrom = X_CMDLINE;
+ } else if (scrp->display->defaultVisual >= 0) {
+ scrp->defaultVisual = scrp->display->defaultVisual;
+ visualFrom = X_CONFIG;
+ } else if (visual >= 0) {
+ scrp->defaultVisual = visual;
+ } else {
+ if (scrp->depth == 1)
+ scrp->defaultVisual = StaticGray;
+ else if (scrp->depth == 4)
+ scrp->defaultVisual = StaticColor;
+ else if (scrp->depth <= MAX_PSEUDO_DEPTH)
+ scrp->defaultVisual = PseudoColor;
+ else
+ scrp->defaultVisual = TrueColor;
+ }
+ switch (scrp->defaultVisual) {
+ case StaticGray:
+ case GrayScale:
+ case StaticColor:
+ case PseudoColor:
+ case TrueColor:
+ case DirectColor:
+ xf86DrvMsg(scrp->scrnIndex, visualFrom, "Default visual is %s\n",
+ xf86VisualNames[scrp->defaultVisual]);
+ return TRUE;
+ default:
+
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Invalid default visual class (%d)\n", scrp->defaultVisual);
+ return FALSE;
+ }
+}
+
+#define TEST_GAMMA(g) \
+ (g).red > GAMMA_ZERO || (g).green > GAMMA_ZERO || (g).blue > GAMMA_ZERO
+
+#define SET_GAMMA(g) \
+ (g) > GAMMA_ZERO ? (g) : 1.0
+
+Bool
+xf86SetGamma(ScrnInfoPtr scrp, Gamma gamma)
+{
+ MessageType from = X_DEFAULT;
+#if 0
+ xf86MonPtr DDC = (xf86MonPtr)(scrp->monitor->DDC);
+#endif
+ if (TEST_GAMMA(xf86Gamma)) {
+ from = X_CMDLINE;
+ scrp->gamma.red = SET_GAMMA(xf86Gamma.red);
+ scrp->gamma.green = SET_GAMMA(xf86Gamma.green);
+ scrp->gamma.blue = SET_GAMMA(xf86Gamma.blue);
+ } else if (TEST_GAMMA(scrp->monitor->gamma)) {
+ from = X_CONFIG;
+ scrp->gamma.red = SET_GAMMA(scrp->monitor->gamma.red);
+ scrp->gamma.green = SET_GAMMA(scrp->monitor->gamma.green);
+ scrp->gamma.blue = SET_GAMMA(scrp->monitor->gamma.blue);
+#if 0
+ } else if ( DDC && DDC->features.gamma > GAMMA_ZERO ) {
+ from = X_PROBED;
+ scrp->gamma.red = SET_GAMMA(DDC->features.gamma);
+ scrp->gamma.green = SET_GAMMA(DDC->features.gamma);
+ scrp->gamma.blue = SET_GAMMA(DDC->features.gamma);
+ /* EDID structure version 2 gives optional seperate red, green & blue gamma values
+ * in bytes 0x57-0x59 */
+#endif
+ } else if (TEST_GAMMA(gamma)) {
+ scrp->gamma.red = SET_GAMMA(gamma.red);
+ scrp->gamma.green = SET_GAMMA(gamma.green);
+ scrp->gamma.blue = SET_GAMMA(gamma.blue);
+ } else {
+ scrp->gamma.red = 1.0;
+ 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);
+
+ return TRUE;
+}
+
+#undef TEST_GAMMA
+#undef SET_GAMMA
+
+
+/*
+ * Set the DPI from the command line option. XXX should allow it to be
+ * calculated from the widthmm/heightmm values.
+ */
+
+#undef MMPERINCH
+#define MMPERINCH 25.4
+
+void
+xf86SetDpi(ScrnInfoPtr pScrn, int x, int y)
+{
+ MessageType from = X_DEFAULT;
+ xf86MonPtr DDC = (xf86MonPtr)(pScrn->monitor->DDC);
+ int ddcWidthmm, ddcHeightmm;
+ int widthErr, heightErr;
+
+ /* XXX Maybe there is no need for widthmm/heightmm in ScrnInfoRec */
+ pScrn->widthmm = pScrn->monitor->widthmm;
+ pScrn->heightmm = pScrn->monitor->heightmm;
+
+ if (DDC && (DDC->features.hsize > 0 && DDC->features.vsize > 0) ) {
+ /* DDC gives display size in mm for individual modes,
+ * but cm for monitor
+ */
+ ddcWidthmm = DDC->features.hsize * 10; /* 10mm in 1cm */
+ ddcHeightmm = DDC->features.vsize * 10; /* 10mm in 1cm */
+ } else {
+ ddcWidthmm = ddcHeightmm = 0;
+ }
+
+ if (monitorResolution > 0) {
+ pScrn->xDpi = monitorResolution;
+ pScrn->yDpi = monitorResolution;
+ from = X_CMDLINE;
+ } else if (pScrn->widthmm > 0 || pScrn->heightmm > 0) {
+ from = X_CONFIG;
+ if (pScrn->widthmm > 0) {
+ pScrn->xDpi =
+ (int)((double)pScrn->virtualX * MMPERINCH / pScrn->widthmm);
+ }
+ if (pScrn->heightmm > 0) {
+ pScrn->yDpi =
+ (int)((double)pScrn->virtualY * MMPERINCH / pScrn->heightmm);
+ }
+ if (pScrn->xDpi > 0 && pScrn->yDpi <= 0)
+ pScrn->yDpi = pScrn->xDpi;
+ if (pScrn->yDpi > 0 && pScrn->xDpi <= 0)
+ pScrn->xDpi = pScrn->yDpi;
+ xf86DrvMsg(pScrn->scrnIndex, from, "Display dimensions: (%d, %d) mm\n",
+ pScrn->widthmm, pScrn->heightmm);
+
+ /* Warn if config and probe disagree about display size */
+ if ( ddcWidthmm && ddcHeightmm ) {
+ if (pScrn->widthmm > 0) {
+ widthErr = abs(ddcWidthmm - pScrn->widthmm);
+ } else {
+ widthErr = 0;
+ }
+ if (pScrn->heightmm > 0) {
+ heightErr = abs(ddcHeightmm - pScrn->heightmm);
+ } else {
+ heightErr = 0;
+ }
+ if (widthErr>10 || heightErr>10) {
+ /* Should include config file name for monitor here */
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Probed monitor is %dx%d mm, using Displaysize %dx%d mm\n",
+ ddcWidthmm,ddcHeightmm, pScrn->widthmm,pScrn->heightmm);
+ }
+ }
+ } else if ( ddcWidthmm && ddcHeightmm ) {
+ from = X_PROBED;
+ xf86DrvMsg(pScrn->scrnIndex, from, "Display dimensions: (%d, %d) mm\n",
+ ddcWidthmm, ddcHeightmm );
+ pScrn->widthmm = ddcWidthmm;
+ pScrn->heightmm = ddcHeightmm;
+ if (pScrn->widthmm > 0) {
+ pScrn->xDpi =
+ (int)((double)pScrn->virtualX * MMPERINCH / pScrn->widthmm);
+ }
+ if (pScrn->heightmm > 0) {
+ pScrn->yDpi =
+ (int)((double)pScrn->virtualY * MMPERINCH / pScrn->heightmm);
+ }
+ if (pScrn->xDpi > 0 && pScrn->yDpi <= 0)
+ pScrn->yDpi = pScrn->xDpi;
+ if (pScrn->yDpi > 0 && pScrn->xDpi <= 0)
+ pScrn->xDpi = pScrn->yDpi;
+ } else {
+ if (x > 0)
+ pScrn->xDpi = x;
+ else
+ pScrn->xDpi = DEFAULT_DPI;
+ if (y > 0)
+ pScrn->yDpi = y;
+ else
+ pScrn->yDpi = DEFAULT_DPI;
+ }
+ xf86DrvMsg(pScrn->scrnIndex, from, "DPI set to (%d, %d)\n",
+ pScrn->xDpi, pScrn->yDpi);
+}
+
+#undef MMPERINCH
+
+
+void
+xf86SetBlackWhitePixels(ScreenPtr pScreen)
+{
+ if (xf86FlipPixels) {
+ pScreen->whitePixel = 0;
+ pScreen->blackPixel = 1;
+ } else {
+ pScreen->whitePixel = 1;
+ pScreen->blackPixel = 0;
+ }
+}
+
+/*
+ * xf86SetRootClip --
+ * Enable or disable rendering to the screen by
+ * setting the root clip list and revalidating
+ * all of the windows
+ */
+
+static void
+xf86SetRootClip (ScreenPtr pScreen, Bool enable)
+{
+ WindowPtr pWin = pScreen->root;
+ WindowPtr pChild;
+ Bool WasViewable = (Bool)(pWin->viewable);
+ Bool anyMarked = FALSE;
+ WindowPtr pLayerWin;
+ BoxRec box;
+
+ if (WasViewable)
+ {
+ for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib)
+ {
+ (void) (*pScreen->MarkOverlappedWindows)(pChild,
+ pChild,
+ &pLayerWin);
+ }
+ (*pScreen->MarkWindow) (pWin);
+ anyMarked = TRUE;
+ if (pWin->valdata)
+ {
+ if (HasBorder (pWin))
+ {
+ RegionPtr borderVisible;
+
+ borderVisible = RegionCreate(NullBox, 1);
+ RegionSubtract(borderVisible,
+ &pWin->borderClip, &pWin->winSize);
+ pWin->valdata->before.borderVisible = borderVisible;
+ }
+ pWin->valdata->before.resized = TRUE;
+ }
+ }
+
+ /*
+ * Use REGION_BREAK to avoid optimizations in ValidateTree
+ * that assume the root borderClip can't change well, normally
+ * it doesn't...)
+ */
+ if (enable)
+ {
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pScreen->width;
+ box.y2 = pScreen->height;
+ RegionInit(&pWin->winSize, &box, 1);
+ RegionInit(&pWin->borderSize, &box, 1);
+ if (WasViewable)
+ RegionReset(&pWin->borderClip, &box);
+ pWin->drawable.width = pScreen->width;
+ pWin->drawable.height = pScreen->height;
+ RegionBreak(&pWin->clipList);
+ }
+ else
+ {
+ RegionEmpty(&pWin->borderClip);
+ RegionBreak(&pWin->clipList);
+ }
+
+ ResizeChildrenWinSize (pWin, 0, 0, 0, 0);
+
+ if (WasViewable)
+ {
+ if (pWin->firstChild)
+ {
+ anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin->firstChild,
+ pWin->firstChild,
+ (WindowPtr *)NULL);
+ }
+ else
+ {
+ (*pScreen->MarkWindow) (pWin);
+ anyMarked = TRUE;
+ }
+
+
+ if (anyMarked)
+ (*pScreen->ValidateTree)(pWin, NullWindow, VTOther);
+ }
+
+ if (WasViewable)
+ {
+ if (anyMarked)
+ (*pScreen->HandleExposures)(pWin);
+ if (anyMarked && pScreen->PostValidateTree)
+ (*pScreen->PostValidateTree)(pWin, NullWindow, VTOther);
+ }
+ if (pWin->realized)
+ WindowsRestructured ();
+ FlushAllOutput ();
+}
+
+/*
+ * Function to enable/disable access to the frame buffer
+ *
+ * This is used when VT switching and when entering/leaving DGA direct mode.
+ *
+ * This has been rewritten again to eliminate the saved pixmap. The
+ * devPrivate field in the screen pixmap is set to NULL to catch code
+ * accidentally referencing the frame buffer while the X server is not
+ * supposed to touch it.
+ *
+ * Here, we exchange the pixmap private data, rather than the pixmaps
+ * themselves to avoid having to find and change any references to the screen
+ * pixmap such as GC's, window privates etc. This also means that this code
+ * does not need to know exactly how the pixmap pixels are accessed. Further,
+ * this exchange is >not< done through the screen's ModifyPixmapHeader()
+ * vector. This means the called frame buffer code layers can determine
+ * 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.
+ */
+void
+xf86EnableDisableFBAccess(int scrnIndex, Bool enable)
+{
+ ScrnInfoPtr pScrnInfo = xf86Screens[scrnIndex];
+ ScreenPtr pScreen = pScrnInfo->pScreen;
+ PixmapPtr pspix;
+
+ pspix = (*pScreen->GetScreenPixmap) (pScreen);
+ if (enable)
+ {
+ /*
+ * Restore all of the clip lists on the screen
+ */
+ if (!xf86Resetting)
+ xf86SetRootClip (pScreen, TRUE);
+
+ }
+ else
+ {
+ /*
+ * Empty all of the clip lists on the screen
+ */
+ xf86SetRootClip (pScreen, FALSE);
+ }
+}
+
+/* Print driver messages in the standard format */
+
+#undef PREFIX_SIZE
+#define PREFIX_SIZE 14
+
+void
+xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format,
+ va_list args)
+{
+ char *tmpFormat;
+
+ /* Prefix the scrnIndex name to the format string. */
+ if (scrnIndex >= 0 && scrnIndex < xf86NumScreens &&
+ xf86Screens[scrnIndex]->name) {
+ tmpFormat = malloc(strlen(format) +
+ strlen(xf86Screens[scrnIndex]->name) +
+ PREFIX_SIZE + 1);
+ if (!tmpFormat)
+ return;
+
+ snprintf(tmpFormat, PREFIX_SIZE + 1, "%s(%d): ",
+ xf86Screens[scrnIndex]->name, scrnIndex);
+
+ strcat(tmpFormat, format);
+ LogVMessageVerb(type, verb, tmpFormat, args);
+ free(tmpFormat);
+ } else
+ LogVMessageVerb(type, verb, format, args);
+}
+#undef PREFIX_SIZE
+
+/* Print driver messages, with verbose level specified directly */
+void
+xf86DrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format,
+ ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ xf86VDrvMsgVerb(scrnIndex, type, verb, format, ap);
+ va_end(ap);
+}
+
+/* Print driver messages, with verbose level of 1 (default) */
+void
+xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ xf86VDrvMsgVerb(scrnIndex, type, 1, format, ap);
+ va_end(ap);
+}
+
+/* Print input driver messages in the standard format of
+ <driver>: <device name>: <message> */
+void
+xf86VIDrvMsgVerb(InputInfoPtr dev, MessageType type, int verb, const char *format,
+ va_list args)
+{
+ char *msg;
+
+ if (asprintf(&msg, "%s: %s: %s", dev->drv->driverName, dev->name, format)
+ == -1) {
+ LogVMessageVerb(type, verb, "%s", args);
+ } else {
+ LogVMessageVerb(type, verb, msg, args);
+ free(msg);
+ }
+}
+
+/* Print input driver message, with verbose level specified directly */
+void
+xf86IDrvMsgVerb(InputInfoPtr dev, MessageType type, int verb, const char *format,
+ ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ xf86VIDrvMsgVerb(dev, type, verb, format, ap);
+ va_end(ap);
+}
+
+/* Print input driver messages, with verbose level of 1 (default) */
+void
+xf86IDrvMsg(InputInfoPtr dev, MessageType type, const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ xf86VIDrvMsgVerb(dev, type, 1, format, ap);
+ va_end(ap);
+}
+
+
+/* Print non-driver messages with verbose level specified directly */
+void
+xf86MsgVerb(MessageType type, int verb, const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ LogVMessageVerb(type, verb, format, ap);
+ va_end(ap);
+}
+
+/* Print non-driver messages with verbose level of 1 (default) */
+void
+xf86Msg(MessageType type, const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ LogVMessageVerb(type, 1, format, ap);
+ va_end(ap);
+}
+
+/* Just like ErrorF, but with the verbose level checked */
+void
+xf86ErrorFVerb(int verb, const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ if (xf86Verbose >= verb || xf86LogVerbose >= verb)
+ LogVWrite(verb, format, ap);
+ va_end(ap);
+}
+
+/* Like xf86ErrorFVerb, but with an implied verbose level of 1 */
+void
+xf86ErrorF(const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ if (xf86Verbose >= 1 || xf86LogVerbose >= 1)
+ LogVWrite(1, format, ap);
+ va_end(ap);
+}
+
+
+void
+xf86LogInit(void)
+{
+ char *lf = NULL;
+
+#define LOGSUFFIX ".log"
+#define LOGOLDSUFFIX ".old"
+
+ /* Get the log file name */
+ if (xf86LogFileFrom == X_DEFAULT) {
+ /* Append the display number and ".log" */
+ if (asprintf(&lf, "%s%%s" LOGSUFFIX, xf86LogFile) == -1)
+ FatalError("Cannot allocate space for the log file name\n");
+ xf86LogFile = lf;
+ }
+
+ xf86LogFile = LogInit(xf86LogFile, LOGOLDSUFFIX);
+ xf86LogFileWasOpened = TRUE;
+
+ xf86SetVerbosity(xf86Verbose);
+ xf86SetLogVerbosity(xf86LogVerbose);
+
+#undef LOGSUFFIX
+#undef LOGOLDSUFFIX
+
+ free(lf);
+}
+
+void
+xf86CloseLog(void)
+{
+ LogClose();
+}
+
+
+/*
+ * Drivers can use these for using their own SymTabRecs.
+ */
+
+const char *
+xf86TokenToString(SymTabPtr table, int token)
+{
+ int i;
+
+ for (i = 0; table[i].token >= 0 && table[i].token != token; i++)
+ ;
+
+ if (table[i].token < 0)
+ return NULL;
+ else
+ return table[i].name;
+}
+
+int
+xf86StringToToken(SymTabPtr table, const char *string)
+{
+ int i;
+
+ if (string == NULL)
+ return -1;
+
+ for (i = 0; table[i].token >= 0 && xf86NameCmp(string, table[i].name); i++)
+ ;
+
+ return table[i].token;
+}
+
+/*
+ * helper to display the clocks found on a card
+ */
+void
+xf86ShowClocks(ScrnInfoPtr scrp, MessageType from)
+{
+ int j;
+
+ xf86DrvMsg(scrp->scrnIndex, from, "Pixel clocks available:");
+ for (j=0; j < scrp->numClocks; j++) {
+ if ((j % 4) == 0) {
+ xf86ErrorF("\n");
+ xf86DrvMsg(scrp->scrnIndex, from, "pixel clocks:");
+ }
+ xf86ErrorF(" %7.3f", (double)scrp->clock[j] / 1000.0);
+ }
+ xf86ErrorF("\n");
+}
+
+
+/*
+ * This prints out the driver identify message, including the names of
+ * the supported chipsets.
+ *
+ * XXX This makes assumptions about the line width, etc. Maybe we could
+ * use a more general "pretty print" function for messages.
+ */
+void
+xf86PrintChipsets(const char *drvname, const char *drvmsg, SymTabPtr chips)
+{
+ int len, i;
+
+ len = 6 + strlen(drvname) + 2 + strlen(drvmsg) + 2;
+ xf86Msg(X_INFO, "%s: %s:", drvname, drvmsg);
+ for (i = 0; chips[i].name != NULL; i++) {
+ if (i != 0) {
+ xf86ErrorF(",");
+ len++;
+ }
+ if (len + 2 + strlen(chips[i].name) < 78) {
+ xf86ErrorF(" ");
+ len++;
+ } else {
+ xf86ErrorF("\n\t");
+ len = 8;
+ }
+ xf86ErrorF("%s", chips[i].name);
+ len += strlen(chips[i].name);
+ }
+ xf86ErrorF("\n");
+}
+
+
+int
+xf86MatchDevice(const char *drivername, GDevPtr **sectlist)
+{
+ GDevPtr gdp, *pgdp = NULL;
+ confScreenPtr screensecptr;
+ int i,j;
+
+ if (sectlist)
+ *sectlist = NULL;
+
+ /*
+ * This can happen when running Xorg -showopts and a module like ati
+ * or vmware tries to load its submodules when xf86ConfigLayout is empty
+ */
+ if (!xf86ConfigLayout.screens)
+ return 0;
+
+ /*
+ * This is a very important function that matches the device sections
+ * as they show up in the config file with the drivers that the server
+ * loads at run time.
+ *
+ * ChipProbe can call
+ * int xf86MatchDevice(char * drivername, GDevPtr ** sectlist)
+ * with its driver name. The function allocates an array of GDevPtr and
+ * returns this via sectlist and returns the number of elements in
+ * this list as return value. 0 means none found, -1 means fatal error.
+ *
+ * It can figure out which of the Device sections to use for which card
+ * (using things like the Card statement, etc). For single headed servers
+ * there will of course be just one such Device section.
+ */
+ i = 0;
+
+ /*
+ * first we need to loop over all the Screens sections to get to all
+ * 'active' device sections
+ */
+ for (j=0; xf86ConfigLayout.screens[j].screen != NULL; j++) {
+ screensecptr = xf86ConfigLayout.screens[j].screen;
+ if ((screensecptr->device->driver != NULL)
+ && (xf86NameCmp( screensecptr->device->driver,drivername) == 0)
+ && (! screensecptr->device->claimed)) {
+ /*
+ * we have a matching driver that wasn't claimed, yet
+ */
+ pgdp = xnfrealloc(pgdp, (i + 2) * sizeof(GDevPtr));
+ pgdp[i++] = screensecptr->device;
+ }
+ }
+
+ /* Then handle the inactive devices */
+ j = 0;
+ while (xf86ConfigLayout.inactives[j].identifier) {
+ gdp = &xf86ConfigLayout.inactives[j];
+ if (gdp->driver && !gdp->claimed &&
+ !xf86NameCmp(gdp->driver,drivername)) {
+ /* we have a matching driver that wasn't claimed yet */
+ pgdp = xnfrealloc(pgdp, (i + 2) * sizeof(GDevPtr));
+ pgdp[i++] = gdp;
+ }
+ j++;
+ }
+
+ /*
+ * make the array NULL terminated and return its address
+ */
+ if (i)
+ pgdp[i] = NULL;
+
+ if (sectlist)
+ *sectlist = pgdp;
+ else
+ free(pgdp);
+ return i;
+}
+
+/*
+ * xf86GetClocks -- get the dot-clocks via a BIG BAD hack ...
+ */
+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)
+{
+ register int status = vertsyncreg;
+ unsigned long i, cnt, rcnt, sync;
+
+ /* First save registers that get written on */
+ (*ClockFunc)(pScrn, CLK_REG_SAVE);
+
+ if (num > MAXCLOCKS)
+ num = MAXCLOCKS;
+
+ for (i = 0; i < num; i++)
+ {
+ if (ProtectRegs)
+ (*ProtectRegs)(pScrn, TRUE);
+ if (!(*ClockFunc)(pScrn, i))
+ {
+ pScrn->clock[i] = -1;
+ continue;
+ }
+ if (ProtectRegs)
+ (*ProtectRegs)(pScrn, FALSE);
+ if (BlankScreen)
+ (*BlankScreen)(pScrn, FALSE);
+
+ usleep(50000); /* let VCO stabilise */
+
+ cnt = 0;
+ sync = 200000;
+
+ while ((inb(status) & maskval) == 0x00)
+ if (sync-- == 0) goto finish;
+ /* Something appears to be happening, so reset sync count */
+ sync = 200000;
+ while ((inb(status) & maskval) == maskval)
+ if (sync-- == 0) goto finish;
+ /* Something appears to be happening, so reset sync count */
+ sync = 200000;
+ while ((inb(status) & maskval) == 0x00)
+ if (sync-- == 0) goto finish;
+
+ for (rcnt = 0; rcnt < 5; rcnt++)
+ {
+ while (!(inb(status) & maskval))
+ cnt++;
+ while ((inb(status) & maskval))
+ cnt++;
+ }
+
+finish:
+ pScrn->clock[i] = cnt ? cnt : -1;
+ if (BlankScreen)
+ (*BlankScreen)(pScrn, TRUE);
+ }
+
+ for (i = 0; i < num; i++)
+ {
+ if (i != knownclkindex)
+ {
+ if (pScrn->clock[i] == -1)
+ {
+ pScrn->clock[i] = 0;
+ }
+ else
+ {
+ pScrn->clock[i] = (int)(0.5 +
+ (((float)knownclkvalue) * pScrn->clock[knownclkindex]) /
+ (pScrn->clock[i]));
+ /* Round to nearest 10KHz */
+ pScrn->clock[i] += 5;
+ pScrn->clock[i] /= 10;
+ pScrn->clock[i] *= 10;
+ }
+ }
+ }
+
+ pScrn->clock[knownclkindex] = knownclkvalue;
+ pScrn->numClocks = num;
+
+ /* Restore registers that were written on */
+ (*ClockFunc)(pScrn, CLK_REG_RESTORE);
+}
+
+const char *
+xf86GetVisualName(int visual)
+{
+ if (visual < 0 || visual > DirectColor)
+ return NULL;
+
+ return xf86VisualNames[visual];
+}
+
+
+int
+xf86GetVerbosity(void)
+{
+ return max(xf86Verbose, xf86LogVerbose);
+}
+
+Pix24Flags
+xf86GetPix24(void)
+{
+ return xf86Info.pixmap24;
+}
+
+
+int
+xf86GetDepth(void)
+{
+ return xf86Depth;
+}
+
+
+rgb
+xf86GetWeight(void)
+{
+ return xf86Weight;
+}
+
+
+Gamma
+xf86GetGamma(void)
+{
+ return xf86Gamma;
+}
+
+
+Bool
+xf86GetFlipPixels(void)
+{
+ return xf86FlipPixels;
+}
+
+
+const char *
+xf86GetServerName(void)
+{
+ return xf86ServerName;
+}
+
+
+Bool
+xf86ServerIsExiting(void)
+{
+ return (dispatchException & DE_TERMINATE) == DE_TERMINATE;
+}
+
+
+Bool
+xf86ServerIsResetting(void)
+{
+ return xf86Resetting;
+}
+
+
+Bool
+xf86ServerIsInitialising(void)
+{
+ return xf86Initialising;
+}
+
+
+Bool
+xf86ServerIsOnlyDetecting(void)
+{
+ return xf86DoConfigure;
+}
+
+
+Bool
+xf86CaughtSignal(void)
+{
+ return xf86Info.caughtSignal;
+}
+
+
+Bool
+xf86GetVidModeAllowNonLocal(void)
+{
+ return xf86Info.vidModeAllowNonLocal;
+}
+
+
+Bool
+xf86GetVidModeEnabled(void)
+{
+ return xf86Info.vidModeEnabled;
+}
+
+Bool
+xf86GetModInDevAllowNonLocal(void)
+{
+ return xf86Info.miscModInDevAllowNonLocal;
+}
+
+
+Bool
+xf86GetModInDevEnabled(void)
+{
+ return xf86Info.miscModInDevEnabled;
+}
+
+
+Bool
+xf86GetAllowMouseOpenFail(void)
+{
+ return xf86Info.allowMouseOpenFail;
+}
+
+
+Bool
+xf86IsPc98(void)
+{
+#if SUPPORT_PC98
+ return xf86Info.pc98;
+#else
+ return FALSE;
+#endif
+}
+
+void
+xf86DisableRandR(void)
+{
+ xf86Info.disableRandR = TRUE;
+ xf86Info.randRFrom = X_PROBED;
+}
+
+CARD32
+xf86GetModuleVersion(pointer module)
+{
+ return (CARD32)LoaderGetModuleVersion(module);
+}
+
+pointer
+xf86LoadDrvSubModule(DriverPtr drv, const char *name)
+{
+ pointer ret;
+ int errmaj = 0, errmin = 0;
+
+ ret = LoadSubModule(drv->module, name, NULL, NULL, NULL, NULL,
+ &errmaj, &errmin);
+ if (!ret)
+ LoaderErrorMsg(NULL, name, errmaj, errmin);
+ return ret;
+}
+
+pointer
+xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name)
+{
+ pointer ret;
+ int errmaj = 0, errmin = 0;
+
+ ret = LoadSubModule(pScrn->module, name, NULL, NULL, NULL, NULL,
+ &errmaj, &errmin);
+ if (!ret)
+ LoaderErrorMsg(pScrn->name, name, errmaj, errmin);
+ return ret;
+}
+
+/*
+ * xf86LoadOneModule loads a single module.
+ */
+pointer
+xf86LoadOneModule(char *name, pointer opt)
+{
+ int errmaj, errmin;
+ char *Name;
+ pointer mod;
+
+ if (!name)
+ return NULL;
+
+ /* Normalise the module name */
+ Name = xf86NormalizeName(name);
+
+ /* Skip empty names */
+ if (Name == NULL)
+ return NULL;
+ if (*Name == '\0') {
+ free(Name);
+ return NULL;
+ }
+
+ mod = LoadModule(Name, NULL, NULL, NULL, opt, NULL, &errmaj, &errmin);
+ if (!mod)
+ LoaderErrorMsg(NULL, Name, errmaj, errmin);
+ free(Name);
+ return mod;
+}
+
+void
+xf86UnloadSubModule(pointer mod)
+{
+ /*
+ * This is disabled for now. The loader isn't smart enough yet to undo
+ * relocations.
+ */
+#if 0
+ UnloadSubModule(mod);
+#endif
+}
+
+Bool
+xf86LoaderCheckSymbol(const char *name)
+{
+ return LoaderSymbol(name) != NULL;
+}
+
+typedef enum {
+ OPTION_BACKING_STORE
+} BSOpts;
+
+static const OptionInfoRec BSOptions[] = {
+ { OPTION_BACKING_STORE, "BackingStore", OPTV_BOOLEAN, {0}, FALSE },
+ { -1, NULL, OPTV_NONE, {0}, FALSE }
+};
+
+void
+xf86SetBackingStore(ScreenPtr pScreen)
+{
+ Bool useBS = FALSE;
+ MessageType from = X_DEFAULT;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ OptionInfoPtr options;
+
+ options = xnfalloc(sizeof(BSOptions));
+ (void)memcpy(options, BSOptions, sizeof(BSOptions));
+ xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options);
+
+ /* check for commandline option here */
+ if (xf86bsEnableFlag) {
+ from = X_CMDLINE;
+ useBS = TRUE;
+ } else if (xf86bsDisableFlag) {
+ from = X_CMDLINE;
+ useBS = FALSE;
+ } else {
+ if (xf86GetOptValBool(options, OPTION_BACKING_STORE, &useBS))
+ from = X_CONFIG;
+ }
+ free(options);
+ pScreen->backingStoreSupport = useBS ? Always : NotUseful;
+ if (serverGeneration == 1)
+ xf86DrvMsg(pScreen->myNum, from, "Backing store %s\n",
+ useBS ? "enabled" : "disabled");
+}
+
+
+typedef enum {
+ OPTION_SILKEN_MOUSE
+} SMOpts;
+
+static const OptionInfoRec SMOptions[] = {
+ { OPTION_SILKEN_MOUSE, "SilkenMouse", OPTV_BOOLEAN, {0}, FALSE },
+ { -1, NULL, OPTV_NONE, {0}, FALSE }
+};
+
+void
+xf86SetSilkenMouse (ScreenPtr pScreen)
+{
+ Bool useSM = TRUE;
+ MessageType from = X_DEFAULT;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ OptionInfoPtr options;
+
+ options = xnfalloc(sizeof(SMOptions));
+ (void)memcpy(options, SMOptions, sizeof(SMOptions));
+ xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options);
+
+ /* check for commandline option here */
+ /* disable if screen shares resources */
+ /* TODO VGA arb disable silken mouse */
+ if (xf86silkenMouseDisableFlag) {
+ from = X_CMDLINE;
+ useSM = FALSE;
+ } else {
+ if (xf86GetOptValBool(options, OPTION_SILKEN_MOUSE, &useSM))
+ from = X_CONFIG;
+ }
+ free(options);
+ /*
+ * XXX quick hack to report correctly for OSs that can't do SilkenMouse
+ * yet. Should handle this differently so that alternate async methods
+ * work correctly with this too.
+ */
+ pScrn->silkenMouse = useSM && xf86Info.useSIGIO && xf86SIGIOSupported();
+ if (serverGeneration == 1)
+ xf86DrvMsg(pScreen->myNum, from, "Silken mouse %s\n",
+ pScrn->silkenMouse ? "enabled" : "disabled");
+}
+
+/* Wrote this function for the PM2 Xv driver, preliminary. */
+
+pointer
+xf86FindXvOptions(int scrnIndex, int adaptor_index, char *port_name,
+ char **adaptor_name, pointer *adaptor_options)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ confXvAdaptorPtr adaptor;
+ int i;
+
+ if (adaptor_index >= pScrn->confScreen->numxvadaptors) {
+ if (adaptor_name) *adaptor_name = NULL;
+ if (adaptor_options) *adaptor_options = NULL;
+ return NULL;
+ }
+
+ adaptor = &pScrn->confScreen->xvadaptors[adaptor_index];
+ if (adaptor_name) *adaptor_name = adaptor->identifier;
+ if (adaptor_options) *adaptor_options = adaptor->options;
+
+ for (i = 0; i < adaptor->numports; i++)
+ if (!xf86NameCmp(adaptor->ports[i].identifier, port_name))
+ return adaptor->ports[i].options;
+
+ return NULL;
+}
+
+/* Rather than duplicate loader's get OS function, just include it directly */
+#define LoaderGetOS xf86GetOS
+#include "loader/os.c"
+
+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
+xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
+ EntityProc init, EntityProc enter, EntityProc leave,
+ pointer private)
+{
+ EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex);
+ if (!pEnt) return pScrn;
+
+ if (!(pEnt->location.type == BUS_NONE)) {
+ free(pEnt);
+ return pScrn;
+ }
+
+ if (!pEnt->active) {
+ xf86ConfigFbEntityInactive(pEnt, init, enter, leave, private);
+ free(pEnt);
+ return pScrn;
+ }
+
+ if (!pScrn)
+ pScrn = xf86AllocateScreen(pEnt->driver,scrnFlag);
+ xf86AddEntityToScreen(pScrn,entityIndex);
+
+ xf86SetEntityFuncs(entityIndex,init,enter,leave,private);
+
+ return pScrn;
+}
+
+Bool
+xf86IsScreenPrimary(int scrnIndex)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ int i;
+
+ for (i=0 ; i < pScrn->numEntities; i++) {
+ if (xf86IsEntityPrimary(i))
+ return TRUE;
+ }
+ return FALSE;
+}
+
+int
+xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type,
+ int format, unsigned long len, pointer value )
+{
+ RootWinPropPtr pNewProp = NULL, pRegProp;
+ int i;
+ Bool existing = FALSE;
+
+ DebugF("xf86RegisterRootWindowProperty(%d, %ld, %ld, %d, %ld, %p)\n",
+ ScrnIndex, property, type, format, len, value);
+
+ if (ScrnIndex<0 || ScrnIndex>=xf86NumScreens) {
+ return BadMatch;
+ }
+
+ if (xf86RegisteredPropertiesTable &&
+ xf86RegisteredPropertiesTable[ScrnIndex]) {
+ for (pNewProp = xf86RegisteredPropertiesTable[ScrnIndex];
+ pNewProp; pNewProp = pNewProp->next) {
+ if (strcmp(pNewProp->name, NameForAtom(property)) == 0)
+ break;
+ }
+ }
+
+ if (!pNewProp) {
+ if ((pNewProp = (RootWinPropPtr)malloc(sizeof(RootWinProp))) == NULL) {
+ return BadAlloc;
+ }
+ /*
+ * We will put this property at the end of the list so that
+ * the changes are made in the order they were requested.
+ */
+ pNewProp->next = NULL;
+ } else {
+ free(pNewProp->name);
+ existing = TRUE;
+ }
+
+ pNewProp->name = xnfstrdup(NameForAtom(property));
+ pNewProp->type = type;
+ pNewProp->format = format;
+ pNewProp->size = len;
+ pNewProp->data = value;
+
+ DebugF("new property filled\n");
+
+ if (NULL==xf86RegisteredPropertiesTable) {
+ DebugF("creating xf86RegisteredPropertiesTable[] size %d\n",
+ xf86NumScreens);
+ if ( NULL==(xf86RegisteredPropertiesTable=(RootWinPropPtr*)xnfcalloc(sizeof(RootWinProp),xf86NumScreens) )) {
+ return BadAlloc;
+ }
+ for (i=0; i<xf86NumScreens; i++) {
+ xf86RegisteredPropertiesTable[i] = NULL;
+ }
+ }
+
+ DebugF("xf86RegisteredPropertiesTable %p\n",
+ (void *)xf86RegisteredPropertiesTable);
+ DebugF("xf86RegisteredPropertiesTable[%d] %p\n",
+ ScrnIndex, (void *)xf86RegisteredPropertiesTable[ScrnIndex]);
+
+ if (!existing) {
+ if ( xf86RegisteredPropertiesTable[ScrnIndex] == NULL) {
+ xf86RegisteredPropertiesTable[ScrnIndex] = pNewProp;
+ } else {
+ pRegProp = xf86RegisteredPropertiesTable[ScrnIndex];
+ while (pRegProp->next != NULL) {
+ DebugF("- next %p\n", (void *)pRegProp);
+ pRegProp = pRegProp->next;
+ }
+ pRegProp->next = pNewProp;
+ }
+ }
+ DebugF("xf86RegisterRootWindowProperty succeeded\n");
+ return Success;
+}
+
+Bool
+xf86IsUnblank(int mode)
+{
+ switch(mode) {
+ case SCREEN_SAVER_OFF:
+ case SCREEN_SAVER_FORCER:
+ return TRUE;
+ case SCREEN_SAVER_ON:
+ case SCREEN_SAVER_CYCLE:
+ return FALSE;
+ default:
+ xf86MsgVerb(X_WARNING, 0, "Unexpected save screen mode: %d\n", mode);
+ return TRUE;
+ }
+}
+
+void
+xf86MotionHistoryAllocate(InputInfoPtr pInfo)
+{
+ AllocateMotionHistory(pInfo->dev);
+}
diff --git a/xorg-server/hw/xfree86/common/xf86Module.h b/xorg-server/hw/xfree86/common/xf86Module.h
index 49a98bd05..581047dcf 100644
--- a/xorg-server/hw/xfree86/common/xf86Module.h
+++ b/xorg-server/hw/xfree86/common/xf86Module.h
@@ -82,7 +82,7 @@ typedef enum {
* mask is 0xFFFF0000.
*/
#define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 4)
-#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(9, 0)
+#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(10, 0)
#define ABI_XINPUT_VERSION SET_ABI_VERSION(12, 2)
#define ABI_EXTENSION_VERSION SET_ABI_VERSION(5, 0)
#define ABI_FONT_VERSION SET_ABI_VERSION(0, 6)
diff --git a/xorg-server/hw/xfree86/common/xf86sbusBus.c b/xorg-server/hw/xfree86/common/xf86sbusBus.c
index c0de88dda..181c6ab00 100644
--- a/xorg-server/hw/xfree86/common/xf86sbusBus.c
+++ b/xorg-server/hw/xfree86/common/xf86sbusBus.c
@@ -1,714 +1,714 @@
-/*
- * SBUS bus-specific code.
- *
- * Copyright (C) 2000 Jakub Jelinek (jakub@redhat.com)
- *
- * 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
- * JAKUB JELINEK 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 <ctype.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <X11/X.h>
-#include "os.h"
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-#include "xf86cmap.h"
-
-#include "xf86Bus.h"
-
-#include "xf86sbusBus.h"
-#include "xf86Sbus.h"
-
-Bool sbusSlotClaimed = FALSE;
-
-static int xf86nSbusInfo;
-
-static void
-CheckSbusDevice(const char *device, int fbNum)
-{
- int fd, i;
- struct fbgattr fbattr;
- sbusDevicePtr psdp;
-
- fd = open(device, O_RDONLY, 0);
- if (fd < 0)
- return;
- memset(&fbattr, 0, sizeof(fbattr));
- if (ioctl(fd, FBIOGATTR, &fbattr) < 0) {
- if (ioctl(fd, FBIOGTYPE, &fbattr.fbtype) < 0) {
- close(fd);
- return;
- }
- }
- close(fd);
- for (i = 0; sbusDeviceTable[i].devId; i++)
- if (sbusDeviceTable[i].fbType == fbattr.fbtype.fb_type)
- break;
- if (! sbusDeviceTable[i].devId)
- return;
- xf86SbusInfo = xnfrealloc(xf86SbusInfo, sizeof(psdp) * (++xf86nSbusInfo + 1));
- xf86SbusInfo[xf86nSbusInfo] = NULL;
- xf86SbusInfo[xf86nSbusInfo - 1] = psdp = xnfcalloc(sizeof (sbusDevice), 1);
- psdp->devId = sbusDeviceTable[i].devId;
- psdp->fbNum = fbNum;
- psdp->device = xnfstrdup(device);
- psdp->width = fbattr.fbtype.fb_width;
- psdp->height = fbattr.fbtype.fb_height;
- psdp->fd = -1;
-}
-
-void
-xf86SbusProbe(void)
-{
- int i, useProm = 0;
- char fbDevName[32];
- sbusDevicePtr psdp, *psdpp;
-
- xf86SbusInfo = malloc(sizeof(psdp));
- *xf86SbusInfo = NULL;
- for (i = 0; i < 32; i++) {
- sprintf(fbDevName, "/dev/fb%d", i);
- CheckSbusDevice(fbDevName, i);
- }
- if (sparcPromInit() >= 0) {
- useProm = 1;
- sparcPromAssignNodes();
- }
- for (psdpp = xf86SbusInfo; (psdp = *psdpp); psdpp++) {
- for (i = 0; sbusDeviceTable[i].devId; i++)
- if (sbusDeviceTable[i].devId == psdp->devId)
- psdp->descr = sbusDeviceTable[i].descr;
- /*
- * If we can use PROM information and found the PROM node for this
- * device, we can tell more about the card.
- */
- if (useProm && psdp->node.node) {
- char *prop, *promPath;
- int len, chiprev, vmsize;
-
- switch (psdp->devId) {
- case SBUS_DEVICE_MGX:
- prop = sparcPromGetProperty(&psdp->node, "fb_size", &len);
- if (prop && len == 4 && *(int *)prop == 0x400000)
- psdp->descr = "Quantum 3D MGXplus with 4M VRAM";
- break;
- case SBUS_DEVICE_CG6:
- chiprev = 0;
- vmsize = 0;
- prop = sparcPromGetProperty(&psdp->node, "chiprev", &len);
- if (prop && len == 4)
- chiprev = *(int *)prop;
- prop = sparcPromGetProperty(&psdp->node, "vmsize", &len);
- if (prop && len == 4)
- vmsize = *(int *)prop;
- switch (chiprev) {
- case 1:
- case 2:
- case 3:
- case 4:
- psdp->descr = "Sun Double width GX"; break;
- case 5:
- case 6:
- case 7:
- case 8:
- case 9:
- psdp->descr = "Sun Single width GX"; break;
- case 11:
- switch (vmsize) {
- case 2:
- psdp->descr = "Sun Turbo GX with 1M VSIMM"; break;
- case 4:
- psdp->descr = "Sun Turbo GX Plus"; break;
- default:
- psdp->descr = "Sun Turbo GX"; break;
- }
- }
- break;
- case SBUS_DEVICE_CG14:
- prop = sparcPromGetProperty(&psdp->node, "reg", &len);
- vmsize = 0;
- if (prop && !(len % 12) && len > 0)
- vmsize = *(int *)(prop + len - 4);
- switch (vmsize) {
- case 0x400000:
- psdp->descr = "Sun SX with 4M VSIMM"; break;
- case 0x800000:
- psdp->descr = "Sun SX with 8M VSIMM"; break;
- }
- break;
- case SBUS_DEVICE_LEO:
- prop = sparcPromGetProperty(&psdp->node, "model", &len);
- if (prop && len > 0 && !strstr(prop, "501-2503"))
- psdp->descr = "Sun Turbo ZX";
- break;
- case SBUS_DEVICE_TCX:
- if (sparcPromGetBool(&psdp->node, "tcx-8-bit"))
- psdp->descr = "Sun TCX (8bit)";
- else
- psdp->descr = "Sun TCX (S24)";
- break;
- case SBUS_DEVICE_FFB:
- prop = sparcPromGetProperty(&psdp->node, "name", &len);
- chiprev = 0;
- prop = sparcPromGetProperty(&psdp->node, "board_type", &len);
- if (prop && len == 4)
- chiprev = *(int *)prop;
- if (strstr (prop, "afb")) {
- if (chiprev == 3)
- psdp->descr = "Sun|Elite3D-M6 Horizontal";
- } else {
- switch (chiprev) {
- case 0x08:
- psdp->descr = "Sun FFB 67MHz Creator"; break;
- case 0x0b:
- psdp->descr = "Sun FFB 67MHz Creator 3D"; break;
- case 0x1b:
- psdp->descr = "Sun FFB 75MHz Creator 3D"; break;
- case 0x20:
- case 0x28:
- psdp->descr = "Sun FFB2 Vertical Creator"; break;
- case 0x23:
- case 0x2b:
- psdp->descr = "Sun FFB2 Vertical Creator 3D"; break;
- case 0x30:
- psdp->descr = "Sun FFB2+ Vertical Creator"; break;
- case 0x33:
- psdp->descr = "Sun FFB2+ Vertical Creator 3D"; break;
- case 0x40:
- case 0x48:
- psdp->descr = "Sun FFB2 Horizontal Creator"; break;
- case 0x43:
- case 0x4b:
- psdp->descr = "Sun FFB2 Horizontal Creator 3D"; break;
- }
- }
- break;
- }
-
- xf86Msg(X_PROBED, "SBUS:(0x%08x) %s", psdp->node.node, psdp->descr);
- promPath = sparcPromNode2Pathname (&psdp->node);
- if (promPath) {
- xf86ErrorF(" at %s", promPath);
- free(promPath);
- }
- } else
- xf86Msg(X_PROBED, "SBUS: %s", psdp->descr);
- xf86ErrorF("\n");
- }
- if (useProm)
- sparcPromClose();
-}
-
-/*
- * Parse a BUS ID string, and return the SBUS bus parameters if it was
- * in the correct format for a SBUS bus id.
- */
-
-Bool
-xf86ParseSbusBusString(const char *busID, int *fbNum)
-{
- /*
- * The format is assumed to be one of:
- * "fbN", e.g. "fb1", which means the device corresponding to /dev/fbN
- * "nameN", e.g. "cgsix0", which means Nth instance of card NAME
- * "/prompath", e.g. "/sbus@0,10001000/cgsix@3,0" which is PROM pathname
- * to the device.
- */
-
- const char *id;
- int i, len;
-
- if (StringToBusType(busID, &id) != BUS_SBUS)
- return FALSE;
-
- if (*id != '/') {
- if (!strncmp (id, "fb", 2)) {
- if (!isdigit(id[2]))
- return FALSE;
- *fbNum = atoi(id + 2);
- return TRUE;
- } else {
- sbusDevicePtr *psdpp;
- int devId;
-
- for (i = 0, len = 0; sbusDeviceTable[i].devId; i++) {
- len = strlen(sbusDeviceTable[i].promName);
- if (!strncmp (sbusDeviceTable[i].promName, id, len)
- && isdigit(id[len]))
- break;
- }
- devId = sbusDeviceTable[i].devId;
- if (!devId) return FALSE;
- i = atoi(id + len);
- for (psdpp = xf86SbusInfo; *psdpp; ++psdpp) {
- if ((*psdpp)->devId != devId)
- continue;
- if (!i) {
- *fbNum = (*psdpp)->fbNum;
- return TRUE;
- }
- i--;
- }
- }
- return FALSE;
- }
-
- if (sparcPromInit() >= 0) {
- i = sparcPromPathname2Node(id);
- sparcPromClose();
- if (i) {
- sbusDevicePtr *psdpp;
- for (psdpp = xf86SbusInfo; *psdpp; ++psdpp) {
- if ((*psdpp)->node.node == i) {
- *fbNum = (*psdpp)->fbNum;
- return TRUE;
- }
- }
- }
- }
- return FALSE;
-}
-
-/*
- * Compare a BUS ID string with a SBUS bus id. Return TRUE if they match.
- */
-
-Bool
-xf86CompareSbusBusString(const char *busID, int fbNum)
-{
- int iFbNum;
-
- if (xf86ParseSbusBusString(busID, &iFbNum)) {
- return fbNum == iFbNum;
- } else {
- return FALSE;
- }
-}
-
-/*
- * Check if the slot requested is free. If it is already in use, return FALSE.
- */
-
-Bool
-xf86CheckSbusSlot(int fbNum)
-{
- int i;
- EntityPtr p;
-
- for (i = 0; i < xf86NumEntities; i++) {
- p = xf86Entities[i];
- /* Check if this SBUS slot is taken */
- if (p->bus.type == BUS_SBUS && p->bus.id.sbus.fbNum == fbNum)
- return FALSE;
- }
-
- return TRUE;
-}
-
-/*
- * If the slot requested is already in use, return -1.
- * Otherwise, claim the slot for the screen requesting it.
- */
-
-int
-xf86ClaimSbusSlot(sbusDevicePtr psdp, DriverPtr drvp,
- GDevPtr dev, Bool active)
-{
- EntityPtr p = NULL;
-
- int num;
-
- if (xf86CheckSbusSlot(psdp->fbNum)) {
- num = xf86AllocateEntity();
- p = xf86Entities[num];
- p->driver = drvp;
- p->chipset = -1;
- p->bus.type = BUS_SBUS;
- xf86AddDevToEntity(num, dev);
- p->bus.id.sbus.fbNum = psdp->fbNum;
- p->active = active;
- p->inUse = FALSE;
- sbusSlotClaimed = TRUE;
- return num;
- } else
- return -1;
-}
-
-int
-xf86MatchSbusInstances(const char *driverName, int sbusDevId,
- GDevPtr *devList, int numDevs, DriverPtr drvp,
- int **foundEntities)
-{
- int i,j;
- sbusDevicePtr psdp, *psdpp;
- int numClaimedInstances = 0;
- int allocatedInstances = 0;
- int numFound = 0;
- GDevPtr devBus = NULL;
- GDevPtr dev = NULL;
- int *retEntities = NULL;
- int useProm = 0;
-
- struct Inst {
- sbusDevicePtr sbus;
- GDevPtr dev;
- Bool claimed; /* BusID matches with a device section */
- } *instances = NULL;
-
- *foundEntities = NULL;
- for (psdpp = xf86SbusInfo, psdp = *psdpp; psdp; psdp = *++psdpp) {
- if (psdp->devId != sbusDevId)
- continue;
- if (psdp->fd == -2)
- continue;
- ++allocatedInstances;
- instances = xnfrealloc(instances,
- allocatedInstances * sizeof(struct Inst));
- instances[allocatedInstances - 1].sbus = psdp;
- instances[allocatedInstances - 1].dev = NULL;
- instances[allocatedInstances - 1].claimed = FALSE;
- numFound++;
- }
-
- /*
- * This may be debatable, but if no SBUS devices with a matching vendor
- * type is found, return zero now. It is probably not desirable to
- * allow the config file to override this.
- */
- if (allocatedInstances <= 0) {
- free(instances);
- return 0;
- }
-
- if (sparcPromInit() >= 0)
- useProm = 1;
-
- if (xf86DoConfigure && xf86DoConfigurePass1) {
- GDevPtr pGDev;
- int actualcards = 0;
- for (i = 0; i < allocatedInstances; i++) {
- actualcards++;
- pGDev = xf86AddBusDeviceToConfigure(drvp->driverName, BUS_SBUS,
- instances[i].sbus, -1);
- if (pGDev) {
- /*
- * XF86Match???Instances() treat chipID and chipRev as
- * overrides, so clobber them here.
- */
- pGDev->chipID = pGDev->chipRev = -1;
- }
- }
- free(instances);
- if (useProm)
- sparcPromClose();
- return actualcards;
- }
-
- DebugF("%s instances found: %d\n", driverName, allocatedInstances);
-
- for (i = 0; i < allocatedInstances; i++) {
- char *promPath = NULL;
-
- psdp = instances[i].sbus;
- devBus = NULL;
- dev = NULL;
- if (useProm && psdp->node.node)
- promPath = sparcPromNode2Pathname(&psdp->node);
-
- for (j = 0; j < numDevs; j++) {
- if (devList[j]->busID && *devList[j]->busID) {
- if (xf86CompareSbusBusString(devList[j]->busID, psdp->fbNum)) {
- if (devBus)
- xf86MsgVerb(X_WARNING,0,
- "%s: More than one matching Device section for "
- "instance (BusID: %s) found: %s\n",
- driverName,devList[j]->identifier,
- devList[j]->busID);
- else
- devBus = devList[j];
- }
- } else {
- if (!dev && !devBus) {
- if (promPath)
- xf86Msg(X_PROBED, "Assigning device section with no busID to SBUS:%s\n",
- promPath);
- else
- xf86Msg(X_PROBED, "Assigning device section with no busID to SBUS:fb%d\n",
- psdp->fbNum);
- dev = devList[j];
- } else
- xf86MsgVerb(X_WARNING, 0,
- "%s: More than one matching Device section "
- "found: %s\n", driverName, devList[j]->identifier);
- }
- }
- if (devBus) dev = devBus; /* busID preferred */
- if (!dev && psdp->fd != -2) {
- if (promPath) {
- xf86MsgVerb(X_WARNING, 0, "%s: No matching Device section "
- "for instance (BusID SBUS:%s) found\n",
- driverName, promPath);
- } else
- xf86MsgVerb(X_WARNING, 0, "%s: No matching Device section "
- "for instance (BusID SBUS:fb%d) found\n",
- driverName, psdp->fbNum);
- } else if (dev) {
- numClaimedInstances++;
- instances[i].claimed = TRUE;
- instances[i].dev = dev;
- }
- free(promPath);
- }
-
- DebugF("%s instances found: %d\n", driverName, numClaimedInstances);
-
- /*
- * Of the claimed instances, check that another driver hasn't already
- * claimed its slot.
- */
- numFound = 0;
- for (i = 0; i < allocatedInstances && numClaimedInstances > 0; i++) {
- if (!instances[i].claimed)
- continue;
- psdp = instances[i].sbus;
- if (!xf86CheckSbusSlot(psdp->fbNum))
- continue;
-
- DebugF("%s: card at fb%d %08x is claimed by a Device section\n",
- driverName, psdp->fbNum, psdp->node.node);
-
- /* Allocate an entry in the lists to be returned */
- numFound++;
- retEntities = xnfrealloc(retEntities, numFound * sizeof(int));
- retEntities[numFound - 1]
- = xf86ClaimSbusSlot(psdp, drvp, instances[i].dev,instances[i].dev->active ?
- TRUE : FALSE);
- }
- free(instances);
- if (numFound > 0) {
- *foundEntities = retEntities;
- }
-
- if (useProm)
- sparcPromClose();
-
- return numFound;
-}
-
-/*
- * xf86GetSbusInfoForEntity() -- Get the sbusDevicePtr of entity.
- */
-sbusDevicePtr
-xf86GetSbusInfoForEntity(int entityIndex)
-{
- sbusDevicePtr *psdpp;
- EntityPtr p = xf86Entities[entityIndex];
-
- if (entityIndex >= xf86NumEntities
- || p->bus.type != BUS_SBUS) return NULL;
-
- for (psdpp = xf86SbusInfo; *psdpp != NULL; psdpp++) {
- if (p->bus.id.sbus.fbNum == (*psdpp)->fbNum)
- return *psdpp;
- }
- return NULL;
-}
-
-int
-xf86GetEntityForSbusInfo(sbusDevicePtr psdp)
-{
- int i;
-
- for (i = 0; i < xf86NumEntities; i++) {
- EntityPtr p = xf86Entities[i];
- if (p->bus.type != BUS_SBUS) continue;
-
- if (p->bus.id.sbus.fbNum == psdp->fbNum)
- return i;
- }
- return -1;
-}
-
-void
-xf86SbusUseBuiltinMode(ScrnInfoPtr pScrn, sbusDevicePtr psdp)
-{
- DisplayModePtr mode;
-
- mode = xnfcalloc(sizeof(DisplayModeRec), 1);
- mode->name = "current";
- mode->next = mode;
- mode->prev = mode;
- mode->type = M_T_BUILTIN;
- mode->Clock = 100000000;
- mode->HDisplay = psdp->width;
- mode->HSyncStart = psdp->width;
- mode->HSyncEnd = psdp->width;
- mode->HTotal = psdp->width;
- mode->VDisplay = psdp->height;
- mode->VSyncStart = psdp->height;
- mode->VSyncEnd = psdp->height;
- mode->VTotal = psdp->height;
- mode->SynthClock = mode->Clock;
- mode->CrtcHDisplay = mode->HDisplay;
- mode->CrtcHSyncStart = mode->HSyncStart;
- mode->CrtcHSyncEnd = mode->HSyncEnd;
- mode->CrtcHTotal = mode->HTotal;
- mode->CrtcVDisplay = mode->VDisplay;
- mode->CrtcVSyncStart = mode->VSyncStart;
- mode->CrtcVSyncEnd = mode->VSyncEnd;
- mode->CrtcVTotal = mode->VTotal;
- mode->CrtcHAdjusted = FALSE;
- mode->CrtcVAdjusted = FALSE;
- pScrn->modes = mode;
- pScrn->virtualX = psdp->width;
- pScrn->virtualY = psdp->height;
-}
-
-static sbusPaletteKeyIndex;
-static DevPrivateKey sbusPaletteKey = &sbusPaletteKeyIndex;
-typedef struct _sbusCmap {
- sbusDevicePtr psdp;
- CloseScreenProcPtr CloseScreen;
- Bool origCmapValid;
- unsigned char origRed[16];
- unsigned char origGreen[16];
- unsigned char origBlue[16];
-} sbusCmapRec, *sbusCmapPtr;
-
-#define SBUSCMAPPTR(pScreen) ((sbusCmapPtr) \
- dixLookupPrivate(&(pScreen)->devPrivates, sbusPaletteKey))
-
-static void
-xf86SbusCmapLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
- LOCO *colors, VisualPtr pVisual)
-{
- int i, index;
- sbusCmapPtr cmap;
- struct fbcmap fbcmap;
- unsigned char *data = malloc(numColors*3);
-
- cmap = SBUSCMAPPTR(pScrn->pScreen);
- if (!cmap) return;
- fbcmap.count = 0;
- fbcmap.index = indices[0];
- fbcmap.red = data;
- fbcmap.green = data + numColors;
- fbcmap.blue = fbcmap.green + numColors;
- for (i = 0; i < numColors; i++) {
- index = indices[i];
- if (fbcmap.count && index != fbcmap.index + fbcmap.count) {
- ioctl (cmap->psdp->fd, FBIOPUTCMAP, &fbcmap);
- fbcmap.count = 0;
- fbcmap.index = index;
- }
- fbcmap.red[fbcmap.count] = colors[index].red;
- fbcmap.green[fbcmap.count] = colors[index].green;
- fbcmap.blue[fbcmap.count++] = colors[index].blue;
- }
- ioctl (cmap->psdp->fd, FBIOPUTCMAP, &fbcmap);
- free(data);
-}
-
-static Bool
-xf86SbusCmapCloseScreen(int i, ScreenPtr pScreen)
-{
- sbusCmapPtr cmap;
- struct fbcmap fbcmap;
-
- cmap = SBUSCMAPPTR(pScreen);
- if (cmap->origCmapValid) {
- fbcmap.index = 0;
- fbcmap.count = 16;
- fbcmap.red = cmap->origRed;
- fbcmap.green = cmap->origGreen;
- fbcmap.blue = cmap->origBlue;
- ioctl (cmap->psdp->fd, FBIOPUTCMAP, &fbcmap);
- }
- pScreen->CloseScreen = cmap->CloseScreen;
- free(cmap);
- return (*pScreen->CloseScreen) (i, pScreen);
-}
-
-Bool
-xf86SbusHandleColormaps(ScreenPtr pScreen, sbusDevicePtr psdp)
-{
- sbusCmapPtr cmap;
- struct fbcmap fbcmap;
- unsigned char data[2];
-
- cmap = xnfcalloc(1, sizeof(sbusCmapRec));
- dixSetPrivate(&pScreen->devPrivates, sbusPaletteKey, cmap);
- cmap->psdp = psdp;
- fbcmap.index = 0;
- fbcmap.count = 16;
- fbcmap.red = cmap->origRed;
- fbcmap.green = cmap->origGreen;
- fbcmap.blue = cmap->origBlue;
- if (ioctl (psdp->fd, FBIOGETCMAP, &fbcmap) >= 0)
- cmap->origCmapValid = TRUE;
- fbcmap.index = 0;
- fbcmap.count = 2;
- fbcmap.red = data;
- fbcmap.green = data;
- fbcmap.blue = data;
- if (pScreen->whitePixel == 0) {
- data[0] = 255;
- data[1] = 0;
- } else {
- data[0] = 0;
- data[1] = 255;
- }
- ioctl (psdp->fd, FBIOPUTCMAP, &fbcmap);
- cmap->CloseScreen = pScreen->CloseScreen;
- pScreen->CloseScreen = xf86SbusCmapCloseScreen;
- return xf86HandleColormaps(pScreen, 256, 8,
- xf86SbusCmapLoadPalette, NULL, 0);
-}
-
-Bool
-xf86SbusConfigure(void *busData, sbusDevicePtr sBus)
-{
- if (sBus && sBus->fbNum == ((sbusDevicePtr) busData)->fbNum)
- return 0;
- return 1;
-}
-
-void
-xf86SbusConfigureNewDev(void *busData, sbusDevicePtr sBus, GDevRec *GDev)
-{
- char *promPath = NULL;
-
- sBus = (sbusDevicePtr) busData;
- GDev->identifier = sBus->descr;
- if (sparcPromInit() >= 0) {
- promPath = sparcPromNode2Pathname(&sBus->node);
- sparcPromClose();
- }
- if (promPath) {
- XNFasprintf(&GDev->busID, "SBUS:%s", promPath);
- free(promPath);
- } else {
- XNFsprintf(&GDev->busID, "SBUS:fb%d", sBus->fbNum);
- }
-}
+/*
+ * SBUS bus-specific code.
+ *
+ * Copyright (C) 2000 Jakub Jelinek (jakub@redhat.com)
+ *
+ * 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
+ * JAKUB JELINEK 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 <ctype.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "xf86cmap.h"
+
+#include "xf86Bus.h"
+
+#include "xf86sbusBus.h"
+#include "xf86Sbus.h"
+
+Bool sbusSlotClaimed = FALSE;
+
+static int xf86nSbusInfo;
+
+static void
+CheckSbusDevice(const char *device, int fbNum)
+{
+ int fd, i;
+ struct fbgattr fbattr;
+ sbusDevicePtr psdp;
+
+ fd = open(device, O_RDONLY, 0);
+ if (fd < 0)
+ return;
+ memset(&fbattr, 0, sizeof(fbattr));
+ if (ioctl(fd, FBIOGATTR, &fbattr) < 0) {
+ if (ioctl(fd, FBIOGTYPE, &fbattr.fbtype) < 0) {
+ close(fd);
+ return;
+ }
+ }
+ close(fd);
+ for (i = 0; sbusDeviceTable[i].devId; i++)
+ if (sbusDeviceTable[i].fbType == fbattr.fbtype.fb_type)
+ break;
+ if (! sbusDeviceTable[i].devId)
+ return;
+ xf86SbusInfo = xnfrealloc(xf86SbusInfo, sizeof(psdp) * (++xf86nSbusInfo + 1));
+ xf86SbusInfo[xf86nSbusInfo] = NULL;
+ xf86SbusInfo[xf86nSbusInfo - 1] = psdp = xnfcalloc(sizeof (sbusDevice), 1);
+ psdp->devId = sbusDeviceTable[i].devId;
+ psdp->fbNum = fbNum;
+ psdp->device = xnfstrdup(device);
+ psdp->width = fbattr.fbtype.fb_width;
+ psdp->height = fbattr.fbtype.fb_height;
+ psdp->fd = -1;
+}
+
+void
+xf86SbusProbe(void)
+{
+ int i, useProm = 0;
+ char fbDevName[32];
+ sbusDevicePtr psdp, *psdpp;
+
+ xf86SbusInfo = malloc(sizeof(psdp));
+ *xf86SbusInfo = NULL;
+ for (i = 0; i < 32; i++) {
+ sprintf(fbDevName, "/dev/fb%d", i);
+ CheckSbusDevice(fbDevName, i);
+ }
+ if (sparcPromInit() >= 0) {
+ useProm = 1;
+ sparcPromAssignNodes();
+ }
+ for (psdpp = xf86SbusInfo; (psdp = *psdpp); psdpp++) {
+ for (i = 0; sbusDeviceTable[i].devId; i++)
+ if (sbusDeviceTable[i].devId == psdp->devId)
+ psdp->descr = sbusDeviceTable[i].descr;
+ /*
+ * If we can use PROM information and found the PROM node for this
+ * device, we can tell more about the card.
+ */
+ if (useProm && psdp->node.node) {
+ char *prop, *promPath;
+ int len, chiprev, vmsize;
+
+ switch (psdp->devId) {
+ case SBUS_DEVICE_MGX:
+ prop = sparcPromGetProperty(&psdp->node, "fb_size", &len);
+ if (prop && len == 4 && *(int *)prop == 0x400000)
+ psdp->descr = "Quantum 3D MGXplus with 4M VRAM";
+ break;
+ case SBUS_DEVICE_CG6:
+ chiprev = 0;
+ vmsize = 0;
+ prop = sparcPromGetProperty(&psdp->node, "chiprev", &len);
+ if (prop && len == 4)
+ chiprev = *(int *)prop;
+ prop = sparcPromGetProperty(&psdp->node, "vmsize", &len);
+ if (prop && len == 4)
+ vmsize = *(int *)prop;
+ switch (chiprev) {
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ psdp->descr = "Sun Double width GX"; break;
+ case 5:
+ case 6:
+ case 7:
+ case 8:
+ case 9:
+ psdp->descr = "Sun Single width GX"; break;
+ case 11:
+ switch (vmsize) {
+ case 2:
+ psdp->descr = "Sun Turbo GX with 1M VSIMM"; break;
+ case 4:
+ psdp->descr = "Sun Turbo GX Plus"; break;
+ default:
+ psdp->descr = "Sun Turbo GX"; break;
+ }
+ }
+ break;
+ case SBUS_DEVICE_CG14:
+ prop = sparcPromGetProperty(&psdp->node, "reg", &len);
+ vmsize = 0;
+ if (prop && !(len % 12) && len > 0)
+ vmsize = *(int *)(prop + len - 4);
+ switch (vmsize) {
+ case 0x400000:
+ psdp->descr = "Sun SX with 4M VSIMM"; break;
+ case 0x800000:
+ psdp->descr = "Sun SX with 8M VSIMM"; break;
+ }
+ break;
+ case SBUS_DEVICE_LEO:
+ prop = sparcPromGetProperty(&psdp->node, "model", &len);
+ if (prop && len > 0 && !strstr(prop, "501-2503"))
+ psdp->descr = "Sun Turbo ZX";
+ break;
+ case SBUS_DEVICE_TCX:
+ if (sparcPromGetBool(&psdp->node, "tcx-8-bit"))
+ psdp->descr = "Sun TCX (8bit)";
+ else
+ psdp->descr = "Sun TCX (S24)";
+ break;
+ case SBUS_DEVICE_FFB:
+ prop = sparcPromGetProperty(&psdp->node, "name", &len);
+ chiprev = 0;
+ prop = sparcPromGetProperty(&psdp->node, "board_type", &len);
+ if (prop && len == 4)
+ chiprev = *(int *)prop;
+ if (strstr (prop, "afb")) {
+ if (chiprev == 3)
+ psdp->descr = "Sun|Elite3D-M6 Horizontal";
+ } else {
+ switch (chiprev) {
+ case 0x08:
+ psdp->descr = "Sun FFB 67MHz Creator"; break;
+ case 0x0b:
+ psdp->descr = "Sun FFB 67MHz Creator 3D"; break;
+ case 0x1b:
+ psdp->descr = "Sun FFB 75MHz Creator 3D"; break;
+ case 0x20:
+ case 0x28:
+ psdp->descr = "Sun FFB2 Vertical Creator"; break;
+ case 0x23:
+ case 0x2b:
+ psdp->descr = "Sun FFB2 Vertical Creator 3D"; break;
+ case 0x30:
+ psdp->descr = "Sun FFB2+ Vertical Creator"; break;
+ case 0x33:
+ psdp->descr = "Sun FFB2+ Vertical Creator 3D"; break;
+ case 0x40:
+ case 0x48:
+ psdp->descr = "Sun FFB2 Horizontal Creator"; break;
+ case 0x43:
+ case 0x4b:
+ psdp->descr = "Sun FFB2 Horizontal Creator 3D"; break;
+ }
+ }
+ break;
+ }
+
+ xf86Msg(X_PROBED, "SBUS:(0x%08x) %s", psdp->node.node, psdp->descr);
+ promPath = sparcPromNode2Pathname (&psdp->node);
+ if (promPath) {
+ xf86ErrorF(" at %s", promPath);
+ free(promPath);
+ }
+ } else
+ xf86Msg(X_PROBED, "SBUS: %s", psdp->descr);
+ xf86ErrorF("\n");
+ }
+ if (useProm)
+ sparcPromClose();
+}
+
+/*
+ * Parse a BUS ID string, and return the SBUS bus parameters if it was
+ * in the correct format for a SBUS bus id.
+ */
+
+Bool
+xf86ParseSbusBusString(const char *busID, int *fbNum)
+{
+ /*
+ * The format is assumed to be one of:
+ * "fbN", e.g. "fb1", which means the device corresponding to /dev/fbN
+ * "nameN", e.g. "cgsix0", which means Nth instance of card NAME
+ * "/prompath", e.g. "/sbus@0,10001000/cgsix@3,0" which is PROM pathname
+ * to the device.
+ */
+
+ const char *id;
+ int i, len;
+
+ if (StringToBusType(busID, &id) != BUS_SBUS)
+ return FALSE;
+
+ if (*id != '/') {
+ if (!strncmp (id, "fb", 2)) {
+ if (!isdigit(id[2]))
+ return FALSE;
+ *fbNum = atoi(id + 2);
+ return TRUE;
+ } else {
+ sbusDevicePtr *psdpp;
+ int devId;
+
+ for (i = 0, len = 0; sbusDeviceTable[i].devId; i++) {
+ len = strlen(sbusDeviceTable[i].promName);
+ if (!strncmp (sbusDeviceTable[i].promName, id, len)
+ && isdigit(id[len]))
+ break;
+ }
+ devId = sbusDeviceTable[i].devId;
+ if (!devId) return FALSE;
+ i = atoi(id + len);
+ for (psdpp = xf86SbusInfo; *psdpp; ++psdpp) {
+ if ((*psdpp)->devId != devId)
+ continue;
+ if (!i) {
+ *fbNum = (*psdpp)->fbNum;
+ return TRUE;
+ }
+ i--;
+ }
+ }
+ return FALSE;
+ }
+
+ if (sparcPromInit() >= 0) {
+ i = sparcPromPathname2Node(id);
+ sparcPromClose();
+ if (i) {
+ sbusDevicePtr *psdpp;
+ for (psdpp = xf86SbusInfo; *psdpp; ++psdpp) {
+ if ((*psdpp)->node.node == i) {
+ *fbNum = (*psdpp)->fbNum;
+ return TRUE;
+ }
+ }
+ }
+ }
+ return FALSE;
+}
+
+/*
+ * Compare a BUS ID string with a SBUS bus id. Return TRUE if they match.
+ */
+
+Bool
+xf86CompareSbusBusString(const char *busID, int fbNum)
+{
+ int iFbNum;
+
+ if (xf86ParseSbusBusString(busID, &iFbNum)) {
+ return fbNum == iFbNum;
+ } else {
+ return FALSE;
+ }
+}
+
+/*
+ * Check if the slot requested is free. If it is already in use, return FALSE.
+ */
+
+Bool
+xf86CheckSbusSlot(int fbNum)
+{
+ int i;
+ EntityPtr p;
+
+ for (i = 0; i < xf86NumEntities; i++) {
+ p = xf86Entities[i];
+ /* Check if this SBUS slot is taken */
+ if (p->bus.type == BUS_SBUS && p->bus.id.sbus.fbNum == fbNum)
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/*
+ * If the slot requested is already in use, return -1.
+ * Otherwise, claim the slot for the screen requesting it.
+ */
+
+int
+xf86ClaimSbusSlot(sbusDevicePtr psdp, DriverPtr drvp,
+ GDevPtr dev, Bool active)
+{
+ EntityPtr p = NULL;
+
+ int num;
+
+ if (xf86CheckSbusSlot(psdp->fbNum)) {
+ num = xf86AllocateEntity();
+ p = xf86Entities[num];
+ p->driver = drvp;
+ p->chipset = -1;
+ p->bus.type = BUS_SBUS;
+ xf86AddDevToEntity(num, dev);
+ p->bus.id.sbus.fbNum = psdp->fbNum;
+ p->active = active;
+ p->inUse = FALSE;
+ sbusSlotClaimed = TRUE;
+ return num;
+ } else
+ return -1;
+}
+
+int
+xf86MatchSbusInstances(const char *driverName, int sbusDevId,
+ GDevPtr *devList, int numDevs, DriverPtr drvp,
+ int **foundEntities)
+{
+ int i,j;
+ sbusDevicePtr psdp, *psdpp;
+ int numClaimedInstances = 0;
+ int allocatedInstances = 0;
+ int numFound = 0;
+ GDevPtr devBus = NULL;
+ GDevPtr dev = NULL;
+ int *retEntities = NULL;
+ int useProm = 0;
+
+ struct Inst {
+ sbusDevicePtr sbus;
+ GDevPtr dev;
+ Bool claimed; /* BusID matches with a device section */
+ } *instances = NULL;
+
+ *foundEntities = NULL;
+ for (psdpp = xf86SbusInfo, psdp = *psdpp; psdp; psdp = *++psdpp) {
+ if (psdp->devId != sbusDevId)
+ continue;
+ if (psdp->fd == -2)
+ continue;
+ ++allocatedInstances;
+ instances = xnfrealloc(instances,
+ allocatedInstances * sizeof(struct Inst));
+ instances[allocatedInstances - 1].sbus = psdp;
+ instances[allocatedInstances - 1].dev = NULL;
+ instances[allocatedInstances - 1].claimed = FALSE;
+ numFound++;
+ }
+
+ /*
+ * This may be debatable, but if no SBUS devices with a matching vendor
+ * type is found, return zero now. It is probably not desirable to
+ * allow the config file to override this.
+ */
+ if (allocatedInstances <= 0) {
+ free(instances);
+ return 0;
+ }
+
+ if (sparcPromInit() >= 0)
+ useProm = 1;
+
+ if (xf86DoConfigure && xf86DoConfigurePass1) {
+ GDevPtr pGDev;
+ int actualcards = 0;
+ for (i = 0; i < allocatedInstances; i++) {
+ actualcards++;
+ pGDev = xf86AddBusDeviceToConfigure(drvp->driverName, BUS_SBUS,
+ instances[i].sbus, -1);
+ if (pGDev) {
+ /*
+ * XF86Match???Instances() treat chipID and chipRev as
+ * overrides, so clobber them here.
+ */
+ pGDev->chipID = pGDev->chipRev = -1;
+ }
+ }
+ free(instances);
+ if (useProm)
+ sparcPromClose();
+ return actualcards;
+ }
+
+ DebugF("%s instances found: %d\n", driverName, allocatedInstances);
+
+ for (i = 0; i < allocatedInstances; i++) {
+ char *promPath = NULL;
+
+ psdp = instances[i].sbus;
+ devBus = NULL;
+ dev = NULL;
+ if (useProm && psdp->node.node)
+ promPath = sparcPromNode2Pathname(&psdp->node);
+
+ for (j = 0; j < numDevs; j++) {
+ if (devList[j]->busID && *devList[j]->busID) {
+ if (xf86CompareSbusBusString(devList[j]->busID, psdp->fbNum)) {
+ if (devBus)
+ xf86MsgVerb(X_WARNING,0,
+ "%s: More than one matching Device section for "
+ "instance (BusID: %s) found: %s\n",
+ driverName,devList[j]->identifier,
+ devList[j]->busID);
+ else
+ devBus = devList[j];
+ }
+ } else {
+ if (!dev && !devBus) {
+ if (promPath)
+ xf86Msg(X_PROBED, "Assigning device section with no busID to SBUS:%s\n",
+ promPath);
+ else
+ xf86Msg(X_PROBED, "Assigning device section with no busID to SBUS:fb%d\n",
+ psdp->fbNum);
+ dev = devList[j];
+ } else
+ xf86MsgVerb(X_WARNING, 0,
+ "%s: More than one matching Device section "
+ "found: %s\n", driverName, devList[j]->identifier);
+ }
+ }
+ if (devBus) dev = devBus; /* busID preferred */
+ if (!dev && psdp->fd != -2) {
+ if (promPath) {
+ xf86MsgVerb(X_WARNING, 0, "%s: No matching Device section "
+ "for instance (BusID SBUS:%s) found\n",
+ driverName, promPath);
+ } else
+ xf86MsgVerb(X_WARNING, 0, "%s: No matching Device section "
+ "for instance (BusID SBUS:fb%d) found\n",
+ driverName, psdp->fbNum);
+ } else if (dev) {
+ numClaimedInstances++;
+ instances[i].claimed = TRUE;
+ instances[i].dev = dev;
+ }
+ free(promPath);
+ }
+
+ DebugF("%s instances found: %d\n", driverName, numClaimedInstances);
+
+ /*
+ * Of the claimed instances, check that another driver hasn't already
+ * claimed its slot.
+ */
+ numFound = 0;
+ for (i = 0; i < allocatedInstances && numClaimedInstances > 0; i++) {
+ if (!instances[i].claimed)
+ continue;
+ psdp = instances[i].sbus;
+ if (!xf86CheckSbusSlot(psdp->fbNum))
+ continue;
+
+ DebugF("%s: card at fb%d %08x is claimed by a Device section\n",
+ driverName, psdp->fbNum, psdp->node.node);
+
+ /* Allocate an entry in the lists to be returned */
+ numFound++;
+ retEntities = xnfrealloc(retEntities, numFound * sizeof(int));
+ retEntities[numFound - 1]
+ = xf86ClaimSbusSlot(psdp, drvp, instances[i].dev,instances[i].dev->active ?
+ TRUE : FALSE);
+ }
+ free(instances);
+ if (numFound > 0) {
+ *foundEntities = retEntities;
+ }
+
+ if (useProm)
+ sparcPromClose();
+
+ return numFound;
+}
+
+/*
+ * xf86GetSbusInfoForEntity() -- Get the sbusDevicePtr of entity.
+ */
+sbusDevicePtr
+xf86GetSbusInfoForEntity(int entityIndex)
+{
+ sbusDevicePtr *psdpp;
+ EntityPtr p = xf86Entities[entityIndex];
+
+ if (entityIndex >= xf86NumEntities
+ || p->bus.type != BUS_SBUS) return NULL;
+
+ for (psdpp = xf86SbusInfo; *psdpp != NULL; psdpp++) {
+ if (p->bus.id.sbus.fbNum == (*psdpp)->fbNum)
+ return *psdpp;
+ }
+ return NULL;
+}
+
+int
+xf86GetEntityForSbusInfo(sbusDevicePtr psdp)
+{
+ int i;
+
+ for (i = 0; i < xf86NumEntities; i++) {
+ EntityPtr p = xf86Entities[i];
+ if (p->bus.type != BUS_SBUS) continue;
+
+ if (p->bus.id.sbus.fbNum == psdp->fbNum)
+ return i;
+ }
+ return -1;
+}
+
+void
+xf86SbusUseBuiltinMode(ScrnInfoPtr pScrn, sbusDevicePtr psdp)
+{
+ DisplayModePtr mode;
+
+ mode = xnfcalloc(sizeof(DisplayModeRec), 1);
+ mode->name = "current";
+ mode->next = mode;
+ mode->prev = mode;
+ mode->type = M_T_BUILTIN;
+ mode->Clock = 100000000;
+ mode->HDisplay = psdp->width;
+ mode->HSyncStart = psdp->width;
+ mode->HSyncEnd = psdp->width;
+ mode->HTotal = psdp->width;
+ mode->VDisplay = psdp->height;
+ mode->VSyncStart = psdp->height;
+ mode->VSyncEnd = psdp->height;
+ mode->VTotal = psdp->height;
+ mode->SynthClock = mode->Clock;
+ mode->CrtcHDisplay = mode->HDisplay;
+ mode->CrtcHSyncStart = mode->HSyncStart;
+ mode->CrtcHSyncEnd = mode->HSyncEnd;
+ mode->CrtcHTotal = mode->HTotal;
+ mode->CrtcVDisplay = mode->VDisplay;
+ mode->CrtcVSyncStart = mode->VSyncStart;
+ mode->CrtcVSyncEnd = mode->VSyncEnd;
+ mode->CrtcVTotal = mode->VTotal;
+ mode->CrtcHAdjusted = FALSE;
+ mode->CrtcVAdjusted = FALSE;
+ pScrn->modes = mode;
+ pScrn->virtualX = psdp->width;
+ pScrn->virtualY = psdp->height;
+}
+
+static sbusPaletteKeyIndex;
+static DevPrivateKey sbusPaletteKey = &sbusPaletteKeyIndex;
+typedef struct _sbusCmap {
+ sbusDevicePtr psdp;
+ CloseScreenProcPtr CloseScreen;
+ Bool origCmapValid;
+ unsigned char origRed[16];
+ unsigned char origGreen[16];
+ unsigned char origBlue[16];
+} sbusCmapRec, *sbusCmapPtr;
+
+#define SBUSCMAPPTR(pScreen) ((sbusCmapPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, sbusPaletteKey))
+
+static void
+xf86SbusCmapLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
+ LOCO *colors, VisualPtr pVisual)
+{
+ int i, index;
+ sbusCmapPtr cmap;
+ struct fbcmap fbcmap;
+ unsigned char *data = malloc(numColors*3);
+
+ cmap = SBUSCMAPPTR(pScrn->pScreen);
+ if (!cmap) return;
+ fbcmap.count = 0;
+ fbcmap.index = indices[0];
+ fbcmap.red = data;
+ fbcmap.green = data + numColors;
+ fbcmap.blue = fbcmap.green + numColors;
+ for (i = 0; i < numColors; i++) {
+ index = indices[i];
+ if (fbcmap.count && index != fbcmap.index + fbcmap.count) {
+ ioctl (cmap->psdp->fd, FBIOPUTCMAP, &fbcmap);
+ fbcmap.count = 0;
+ fbcmap.index = index;
+ }
+ fbcmap.red[fbcmap.count] = colors[index].red;
+ fbcmap.green[fbcmap.count] = colors[index].green;
+ fbcmap.blue[fbcmap.count++] = colors[index].blue;
+ }
+ ioctl (cmap->psdp->fd, FBIOPUTCMAP, &fbcmap);
+ free(data);
+}
+
+static Bool
+xf86SbusCmapCloseScreen(int i, ScreenPtr pScreen)
+{
+ sbusCmapPtr cmap;
+ struct fbcmap fbcmap;
+
+ cmap = SBUSCMAPPTR(pScreen);
+ if (cmap->origCmapValid) {
+ fbcmap.index = 0;
+ fbcmap.count = 16;
+ fbcmap.red = cmap->origRed;
+ fbcmap.green = cmap->origGreen;
+ fbcmap.blue = cmap->origBlue;
+ ioctl (cmap->psdp->fd, FBIOPUTCMAP, &fbcmap);
+ }
+ pScreen->CloseScreen = cmap->CloseScreen;
+ free(cmap);
+ return (*pScreen->CloseScreen) (i, pScreen);
+}
+
+Bool
+xf86SbusHandleColormaps(ScreenPtr pScreen, sbusDevicePtr psdp)
+{
+ sbusCmapPtr cmap;
+ struct fbcmap fbcmap;
+ unsigned char data[2];
+
+ cmap = xnfcalloc(1, sizeof(sbusCmapRec));
+ dixSetPrivate(&pScreen->devPrivates, sbusPaletteKey, cmap);
+ cmap->psdp = psdp;
+ fbcmap.index = 0;
+ fbcmap.count = 16;
+ fbcmap.red = cmap->origRed;
+ fbcmap.green = cmap->origGreen;
+ fbcmap.blue = cmap->origBlue;
+ if (ioctl (psdp->fd, FBIOGETCMAP, &fbcmap) >= 0)
+ cmap->origCmapValid = TRUE;
+ fbcmap.index = 0;
+ fbcmap.count = 2;
+ fbcmap.red = data;
+ fbcmap.green = data;
+ fbcmap.blue = data;
+ if (pScreen->whitePixel == 0) {
+ data[0] = 255;
+ data[1] = 0;
+ } else {
+ data[0] = 0;
+ data[1] = 255;
+ }
+ ioctl (psdp->fd, FBIOPUTCMAP, &fbcmap);
+ cmap->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = xf86SbusCmapCloseScreen;
+ return xf86HandleColormaps(pScreen, 256, 8,
+ xf86SbusCmapLoadPalette, NULL, 0);
+}
+
+Bool
+xf86SbusConfigure(void *busData, sbusDevicePtr sBus)
+{
+ if (sBus && sBus->fbNum == ((sbusDevicePtr) busData)->fbNum)
+ return 0;
+ return 1;
+}
+
+void
+xf86SbusConfigureNewDev(void *busData, sbusDevicePtr sBus, GDevRec *GDev)
+{
+ char *promPath = NULL;
+
+ sBus = (sbusDevicePtr) busData;
+ GDev->identifier = sBus->descr;
+ if (sparcPromInit() >= 0) {
+ promPath = sparcPromNode2Pathname(&sBus->node);
+ sparcPromClose();
+ }
+ if (promPath) {
+ XNFasprintf(&GDev->busID, "SBUS:%s", promPath);
+ free(promPath);
+ } else {
+ XNFasprintf(&GDev->busID, "SBUS:fb%d", sBus->fbNum);
+ }
+}
diff --git a/xorg-server/hw/xfree86/modes/xf86Crtc.c b/xorg-server/hw/xfree86/modes/xf86Crtc.c
index d721b131f..86f038aa1 100644
--- a/xorg-server/hw/xfree86/modes/xf86Crtc.c
+++ b/xorg-server/hw/xfree86/modes/xf86Crtc.c
@@ -1,3281 +1,3242 @@
-/*
- * Copyright © 2006 Keith Packard
- * Copyright © 2008 Red Hat, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting documentation, and
- * that the name of the copyright holders not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. The copyright holders make no representations
- * about the suitability of this software for any purpose. It is provided "as
- * is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
- * OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#else
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#endif
-
-#include <stddef.h>
-#include <string.h>
-#include <stdio.h>
-
-#include "xf86.h"
-#include "xf86DDC.h"
-#include "xf86Crtc.h"
-#include "xf86Modes.h"
-#include "xf86Priv.h"
-#include "xf86RandR12.h"
-#include "X11/extensions/render.h"
-#include "X11/extensions/dpmsconst.h"
-#include "X11/Xatom.h"
-#include "picturestr.h"
-
-#include "xf86xv.h"
-
-#define NO_OUTPUT_DEFAULT_WIDTH 1024
-#define NO_OUTPUT_DEFAULT_HEIGHT 768
-/*
- * Initialize xf86CrtcConfig structure
- */
-
-int xf86CrtcConfigPrivateIndex = -1;
-
-void
-xf86CrtcConfigInit (ScrnInfoPtr scrn,
- const xf86CrtcConfigFuncsRec *funcs)
-{
- xf86CrtcConfigPtr config;
-
- if (xf86CrtcConfigPrivateIndex == -1)
- xf86CrtcConfigPrivateIndex = xf86AllocateScrnInfoPrivateIndex();
- config = xnfcalloc (1, sizeof (xf86CrtcConfigRec));
-
- config->funcs = funcs;
-
- scrn->privates[xf86CrtcConfigPrivateIndex].ptr = config;
-}
-
-void
-xf86CrtcSetSizeRange (ScrnInfoPtr scrn,
- int minWidth, int minHeight,
- int maxWidth, int maxHeight)
-{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
-
- config->minWidth = minWidth;
- config->minHeight = minHeight;
- config->maxWidth = maxWidth;
- config->maxHeight = maxHeight;
-}
-
-void
-xf86CrtcSetScanoutFormats(ScrnInfoPtr scrn,
- int num_formats,
- xf86CrtcScanoutFormat *formats)
-{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
-
- config->num_scanout_formats = num_formats;
- config->scanout_formats = formats;
-}
-
-/*
- * Crtc functions
- */
-xf86CrtcPtr
-xf86CrtcCreate (ScrnInfoPtr scrn,
- const xf86CrtcFuncsRec *funcs)
-{
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- xf86CrtcPtr crtc, *crtcs;
-
- crtc = calloc(sizeof (xf86CrtcRec), 1);
- if (!crtc)
- return NULL;
- crtc->version = XF86_CRTC_VERSION;
- crtc->scrn = scrn;
- crtc->funcs = funcs;
-#ifdef RANDR_12_INTERFACE
- crtc->randr_crtc = NULL;
-#endif
- crtc->rotation = RR_Rotate_0;
- crtc->desiredRotation = RR_Rotate_0;
- pixman_transform_init_identity (&crtc->crtc_to_framebuffer);
- pixman_f_transform_init_identity (&crtc->f_crtc_to_framebuffer);
- pixman_f_transform_init_identity (&crtc->f_framebuffer_to_crtc);
- pixman_f_transform_init_identity (&crtc->f_screen_to_crtc);
- pixman_f_transform_init_identity (&crtc->user_sprite_position_transform);
- pixman_f_transform_init_identity (&crtc->f_crtc_to_cursor);
- pixman_f_transform_init_identity (&crtc->user_sprite_image_transform);
- crtc->filter = NULL;
- crtc->params = NULL;
- crtc->nparams = 0;
- crtc->filter_width = 0;
- crtc->filter_height = 0;
- crtc->transform_in_use = FALSE;
- crtc->sprite_transform_in_use = FALSE;
- crtc->transformPresent = FALSE;
- crtc->desiredTransformPresent = FALSE;
- memset (&crtc->bounds, '\0', sizeof (crtc->bounds));
-
- /* Preallocate gamma at a sensible size. */
- crtc->gamma_size = 256;
- crtc->gamma_red = malloc(3 * crtc->gamma_size * sizeof (CARD16));
- if (!crtc->gamma_red) {
- free(crtc);
- return NULL;
- }
- crtc->gamma_green = crtc->gamma_red + crtc->gamma_size;
- crtc->gamma_blue = crtc->gamma_green + crtc->gamma_size;
-
- if (xf86_config->crtc)
- crtcs = realloc(xf86_config->crtc,
- (xf86_config->num_crtc + 1) * sizeof (xf86CrtcPtr));
- else
- crtcs = malloc((xf86_config->num_crtc + 1) * sizeof (xf86CrtcPtr));
- if (!crtcs)
- {
- free(crtc);
- return NULL;
- }
- xf86_config->crtc = crtcs;
- xf86_config->crtc[xf86_config->num_crtc++] = crtc;
- return crtc;
-}
-
-void
-xf86CrtcDestroy (xf86CrtcPtr crtc)
-{
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
- int c;
-
- (*crtc->funcs->destroy) (crtc);
- for (c = 0; c < xf86_config->num_crtc; c++)
- if (xf86_config->crtc[c] == crtc)
- {
- memmove (&xf86_config->crtc[c],
- &xf86_config->crtc[c+1],
- ((xf86_config->num_crtc - (c + 1)) * sizeof(void*)));
- xf86_config->num_crtc--;
- break;
- }
- free(crtc->params);
- free(crtc->gamma_red);
- free(crtc);
-}
-
-
-/**
- * Return whether any outputs are connected to the specified pipe
- */
-
-Bool
-xf86CrtcInUse (xf86CrtcPtr crtc)
-{
- ScrnInfoPtr pScrn = crtc->scrn;
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
- int o;
-
- for (o = 0; o < xf86_config->num_output; o++)
- if (xf86_config->output[o]->crtc == crtc)
- return TRUE;
- return FALSE;
-}
-
-void
-xf86CrtcSetScreenSubpixelOrder (ScreenPtr pScreen)
-{
- int subpixel_order = SubPixelUnknown;
- Bool has_none = FALSE;
- ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- int c, o;
-
- for (c = 0; c < xf86_config->num_crtc; c++)
- {
- xf86CrtcPtr crtc = xf86_config->crtc[c];
-
- for (o = 0; o < xf86_config->num_output; o++)
- {
- xf86OutputPtr output = xf86_config->output[o];
-
- if (output->crtc == crtc)
- {
- switch (output->subpixel_order) {
- case SubPixelNone:
- has_none = TRUE;
- break;
- case SubPixelUnknown:
- break;
- default:
- subpixel_order = output->subpixel_order;
- break;
- }
- }
- if (subpixel_order != SubPixelUnknown)
- break;
- }
- if (subpixel_order != SubPixelUnknown)
- {
- static const int circle[4] = {
- SubPixelHorizontalRGB,
- SubPixelVerticalRGB,
- SubPixelHorizontalBGR,
- SubPixelVerticalBGR,
- };
- int rotate;
- int c;
- for (rotate = 0; rotate < 4; rotate++)
- if (crtc->rotation & (1 << rotate))
- break;
- for (c = 0; c < 4; c++)
- if (circle[c] == subpixel_order)
- break;
- c = (c + rotate) & 0x3;
- if ((crtc->rotation & RR_Reflect_X) && !(c & 1))
- c ^= 2;
- if ((crtc->rotation & RR_Reflect_Y) && (c & 1))
- c ^= 2;
- subpixel_order = circle[c];
- break;
- }
- }
- if (subpixel_order == SubPixelUnknown && has_none)
- subpixel_order = SubPixelNone;
- PictureSetSubpixelOrder (pScreen, subpixel_order);
-}
-
-/**
- * Sets the given video mode on the given crtc
- */
-Bool
-xf86CrtcSet(xf86CrtcPtr crtc, xf86CrtcSetRec *set)
-{
- ScrnInfoPtr scrn = crtc->scrn;
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- int i;
- Bool ret = FALSE;
- Bool didLock = FALSE;
- DisplayModePtr adjusted_mode = NULL;
- DisplayModeRec saved_mode;
- int saved_x, saved_y;
- Rotation saved_rotation;
- RRTransformRec saved_transform;
- Bool saved_transform_present;
- PixmapPtr saved_scanout_pixmap;
-
- crtc->enabled = xf86CrtcInUse (crtc);
-
- /* We only hit this if someone explicitly sends a "disabled" modeset. */
- if (!crtc->enabled)
- {
- /* Check everything for stuff that should be off. */
- xf86DisableUnusedFunctions(scrn);
- return TRUE;
- }
-
- /* See if nothing has changed */
- if (!set->flags)
- return TRUE;
-
- saved_mode = crtc->mode;
- saved_x = crtc->x;
- saved_y = crtc->y;
- saved_rotation = crtc->rotation;
- saved_scanout_pixmap = crtc->scanoutPixmap;
- if (crtc->transformPresent) {
- RRTransformInit (&saved_transform);
- RRTransformCopy (&saved_transform, &crtc->transform);
- }
- saved_transform_present = crtc->transformPresent;
-
- /* Update crtc values up front so the driver can rely on them for mode
- * setting.
- */
- if (set->flags & XF86CrtcSetMode)
- crtc->mode = *set->mode;
- if (set->flags & XF86CrtcSetOrigin) {
- crtc->x = set->x;
- crtc->y = set->y;
- }
- if (set->flags & XF86CrtcSetRotation)
- crtc->rotation = set->rotation;
- if (set->flags & XF86CrtcSetScanoutPixmap)
- crtc->scanoutPixmap = set->scanout_pixmap;
-
- if (set->flags & XF86CrtcSetTransform) {
- if (set->transform) {
- RRTransformCopy (&crtc->transform, set->transform);
- crtc->transformPresent = TRUE;
- } else
- crtc->transformPresent = FALSE;
- }
-
- if (crtc->funcs->set) {
- ret = crtc->funcs->set(crtc, set->flags);
- goto done;
- }
-
- if (set->flags == XF86CrtcSetOrigin && crtc->funcs->set_origin) {
- ret = xf86CrtcRotate(crtc);
- if (ret)
- crtc->funcs->set_origin(crtc, crtc->x, crtc->y);
- goto done;
- }
-
- if (crtc->funcs->set_mode_major) {
- ret = crtc->funcs->set_mode_major(crtc, &crtc->mode,
- crtc->rotation,
- crtc->x, crtc->y);
- goto done;
- }
-
- adjusted_mode = xf86DuplicateMode(&crtc->mode);
-
- didLock = crtc->funcs->lock (crtc);
- /* Pass our mode to the outputs and the CRTC to give them a chance to
- * adjust it according to limitations or output properties, and also
- * a chance to reject the mode entirely.
- */
- for (i = 0; i < xf86_config->num_output; i++) {
- xf86OutputPtr output = xf86_config->output[i];
-
- if (output->crtc != crtc)
- continue;
-
- if (!output->funcs->mode_fixup(output, &crtc->mode, adjusted_mode)) {
- goto done;
- }
- }
-
- if (!crtc->funcs->mode_fixup(crtc, &crtc->mode, adjusted_mode)) {
- goto done;
- }
-
- if (!xf86CrtcRotate (crtc))
- goto done;
-
- /* Prepare the outputs and CRTCs before setting the mode. */
- for (i = 0; i < xf86_config->num_output; i++) {
- xf86OutputPtr output = xf86_config->output[i];
-
- if (output->crtc != crtc)
- continue;
-
- /* Disable the output as the first thing we do. */
- output->funcs->prepare(output);
- }
-
- crtc->funcs->prepare(crtc);
-
- /* Set up the DPLL and any output state that needs to adjust or depend
- * on the DPLL.
- */
- crtc->funcs->mode_set(crtc, &crtc->mode, adjusted_mode, crtc->x, crtc->y);
- for (i = 0; i < xf86_config->num_output; i++)
- {
- xf86OutputPtr output = xf86_config->output[i];
- if (output->crtc == crtc)
- output->funcs->mode_set(output, &crtc->mode, adjusted_mode);
- }
-
- /* Only upload when needed, to avoid unneeded delays. */
- if (!crtc->active && crtc->funcs->gamma_set)
- crtc->funcs->gamma_set(crtc, crtc->gamma_red, crtc->gamma_green,
- crtc->gamma_blue, crtc->gamma_size);
-
- /* Now, enable the clocks, plane, pipe, and outputs that we set up. */
- crtc->funcs->commit(crtc);
- for (i = 0; i < xf86_config->num_output; i++)
- {
- xf86OutputPtr output = xf86_config->output[i];
- if (output->crtc == crtc)
- output->funcs->commit(output);
- }
-
- ret = TRUE;
-
-done:
- if (ret) {
- crtc->active = TRUE;
- if (scrn->pScreen)
- xf86CrtcSetScreenSubpixelOrder (scrn->pScreen);
- if (scrn->ModeSet)
- scrn->ModeSet(scrn);
- } else {
- crtc->x = saved_x;
- crtc->y = saved_y;
- crtc->rotation = saved_rotation;
- crtc->mode = saved_mode;
- if (saved_transform_present)
- RRTransformCopy (&crtc->transform, &saved_transform);
- crtc->transformPresent = saved_transform_present;
- crtc->scanoutPixmap = saved_scanout_pixmap;
- }
-
- if (adjusted_mode) {
- free(adjusted_mode->name);
- free(adjusted_mode);
- }
-
- if (didLock)
- crtc->funcs->unlock (crtc);
-
- return ret;
-}
-
-/**
- * Pans the screen, does not change the mode
- */
-void
-xf86CrtcSetOrigin (xf86CrtcPtr crtc, int x, int y)
-{
- xf86CrtcSetRec set;
-
- if (x != crtc->x || y != crtc->y) {
- set.x = x;
- set.y = y;
- set.flags = XF86CrtcSetOrigin;
- (void) xf86CrtcSet(crtc, &set);
- }
-}
-
-/*
- * Output functions
- */
-
-extern XF86ConfigPtr xf86configptr;
-
-typedef enum {
- OPTION_PREFERRED_MODE,
- OPTION_POSITION,
- OPTION_BELOW,
- OPTION_RIGHT_OF,
- OPTION_ABOVE,
- OPTION_LEFT_OF,
- OPTION_ENABLE,
- OPTION_DISABLE,
- OPTION_MIN_CLOCK,
- OPTION_MAX_CLOCK,
- OPTION_IGNORE,
- OPTION_ROTATE,
- OPTION_PANNING,
- OPTION_PRIMARY,
- OPTION_DEFAULT_MODES,
-} OutputOpts;
-
-static OptionInfoRec xf86OutputOptions[] = {
- {OPTION_PREFERRED_MODE, "PreferredMode", OPTV_STRING, {0}, FALSE },
- {OPTION_POSITION, "Position", OPTV_STRING, {0}, FALSE },
- {OPTION_BELOW, "Below", OPTV_STRING, {0}, FALSE },
- {OPTION_RIGHT_OF, "RightOf", OPTV_STRING, {0}, FALSE },
- {OPTION_ABOVE, "Above", OPTV_STRING, {0}, FALSE },
- {OPTION_LEFT_OF, "LeftOf", OPTV_STRING, {0}, FALSE },
- {OPTION_ENABLE, "Enable", OPTV_BOOLEAN, {0}, FALSE },
- {OPTION_DISABLE, "Disable", OPTV_BOOLEAN, {0}, FALSE },
- {OPTION_MIN_CLOCK, "MinClock", OPTV_FREQ, {0}, FALSE },
- {OPTION_MAX_CLOCK, "MaxClock", OPTV_FREQ, {0}, FALSE },
- {OPTION_IGNORE, "Ignore", OPTV_BOOLEAN, {0}, FALSE },
- {OPTION_ROTATE, "Rotate", OPTV_STRING, {0}, FALSE },
- {OPTION_PANNING, "Panning", OPTV_STRING, {0}, FALSE },
- {OPTION_PRIMARY, "Primary", OPTV_BOOLEAN, {0}, FALSE },
- {OPTION_DEFAULT_MODES, "DefaultModes", OPTV_BOOLEAN, {0}, FALSE },
- {-1, NULL, OPTV_NONE, {0}, FALSE },
-};
-
-enum {
- OPTION_MODEDEBUG,
-};
-
-static OptionInfoRec xf86DeviceOptions[] = {
- {OPTION_MODEDEBUG, "ModeDebug", OPTV_BOOLEAN, {0}, FALSE },
- {-1, NULL, OPTV_NONE, {0}, FALSE },
-};
-
-static void
-xf86OutputSetMonitor (xf86OutputPtr output)
-{
- char *option_name;
- char *monitor;
-
- if (!output->name)
- return;
-
- free(output->options);
-
- output->options = xnfalloc (sizeof (xf86OutputOptions));
- memcpy (output->options, xf86OutputOptions, sizeof (xf86OutputOptions));
-
- XNFasprintf(&option_name, "monitor-%s", output->name);
- monitor = xf86findOptionValue (output->scrn->options, option_name);
- if (!monitor)
- monitor = output->name;
- else
- xf86MarkOptionUsedByName (output->scrn->options, option_name);
- free(option_name);
- output->conf_monitor = xf86findMonitor (monitor,
- xf86configptr->conf_monitor_lst);
- /*
- * Find the monitor section of the screen and use that
- */
- if (!output->conf_monitor && output->use_screen_monitor)
- output->conf_monitor = xf86findMonitor (output->scrn->monitor->id,
- xf86configptr->conf_monitor_lst);
- if (output->conf_monitor)
- {
- xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
- "Output %s using monitor section %s\n",
- output->name, output->conf_monitor->mon_identifier);
- xf86ProcessOptions (output->scrn->scrnIndex,
- output->conf_monitor->mon_option_lst,
- output->options);
- }
- else
- xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
- "Output %s has no monitor section\n",
- output->name);
-}
-
-static Bool
-xf86OutputEnabled (xf86OutputPtr output, Bool strict)
-{
- Bool enable, disable;
-
- /* check to see if this output was enabled in the config file */
- if (xf86GetOptValBool (output->options, OPTION_ENABLE, &enable) && enable)
- {
- xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
- "Output %s enabled by config file\n", output->name);
- return TRUE;
- }
- /* or if this output was disabled in the config file */
- if (xf86GetOptValBool (output->options, OPTION_DISABLE, &disable) && disable)
- {
- xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
- "Output %s disabled by config file\n", output->name);
- return FALSE;
- }
-
- /* If not, try to only light up the ones we know are connected */
- if (strict) {
- enable = output->status == XF86OutputStatusConnected;
- }
- /* But if that fails, try to light up even outputs we're unsure of */
- else {
- enable = output->status != XF86OutputStatusDisconnected;
- }
-
- xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
- "Output %s %sconnected\n", output->name, enable ? "" : "dis");
- return enable;
-}
-
-static Bool
-xf86OutputIgnored (xf86OutputPtr output)
-{
- return xf86ReturnOptValBool (output->options, OPTION_IGNORE, FALSE);
-}
-
-static char *direction[4] = {
- "normal",
- "left",
- "inverted",
- "right"
-};
-
-static Rotation
-xf86OutputInitialRotation (xf86OutputPtr output)
-{
- char *rotate_name = xf86GetOptValString (output->options,
- OPTION_ROTATE);
- int i;
-
- if (!rotate_name) {
- if (output->initial_rotation)
- return output->initial_rotation;
- return RR_Rotate_0;
- }
-
- for (i = 0; i < 4; i++)
- if (xf86nameCompare (direction[i], rotate_name) == 0)
- return 1 << i;
- return RR_Rotate_0;
-}
-
-xf86OutputPtr
-xf86OutputCreate (ScrnInfoPtr scrn,
- const xf86OutputFuncsRec *funcs,
- const char *name)
-{
- xf86OutputPtr output, *outputs;
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- int len;
- Bool primary;
-
- if (name)
- len = strlen (name) + 1;
- else
- len = 0;
-
- output = calloc(sizeof (xf86OutputRec) + len, 1);
- if (!output)
- return NULL;
- output->scrn = scrn;
- output->funcs = funcs;
- if (name)
- {
- output->name = (char *) (output + 1);
- strcpy (output->name, name);
- }
- output->subpixel_order = SubPixelUnknown;
- /*
- * Use the old per-screen monitor section for the first output
- */
- output->use_screen_monitor = (xf86_config->num_output == 0);
-#ifdef RANDR_12_INTERFACE
- output->randr_output = NULL;
-#endif
- if (name)
- {
- xf86OutputSetMonitor (output);
- if (xf86OutputIgnored (output))
- {
- free(output);
- return FALSE;
- }
- }
-
-
- if (xf86_config->output)
- outputs = realloc(xf86_config->output,
- (xf86_config->num_output + 1) * sizeof (xf86OutputPtr));
- else
- outputs = malloc((xf86_config->num_output + 1) * sizeof (xf86OutputPtr));
- if (!outputs)
- {
- free(output);
- return NULL;
- }
-
- xf86_config->output = outputs;
-
- if (xf86GetOptValBool (output->options, OPTION_PRIMARY, &primary) && primary)
- {
- memmove(xf86_config->output + 1, xf86_config->output,
- xf86_config->num_output * sizeof (xf86OutputPtr));
- xf86_config->output[0] = output;
- }
- else
- {
- xf86_config->output[xf86_config->num_output] = output;
- }
-
- xf86_config->num_output++;
-
- return output;
-}
-
-Bool
-xf86OutputRename (xf86OutputPtr output, const char *name)
-{
- char *newname = strdup(name);
-
- if (!newname)
- return FALSE; /* so sorry... */
-
- if (output->name && output->name != (char *) (output + 1))
- free(output->name);
- output->name = newname;
- xf86OutputSetMonitor (output);
- if (xf86OutputIgnored (output))
- return FALSE;
- return TRUE;
-}
-
-void
-xf86OutputUseScreenMonitor (xf86OutputPtr output, Bool use_screen_monitor)
-{
- if (use_screen_monitor != output->use_screen_monitor)
- {
- output->use_screen_monitor = use_screen_monitor;
- xf86OutputSetMonitor (output);
- }
-}
-
-void
-xf86OutputDestroy (xf86OutputPtr output)
-{
- ScrnInfoPtr scrn = output->scrn;
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- int o;
-
- (*output->funcs->destroy) (output);
- while (output->probed_modes)
- xf86DeleteMode (&output->probed_modes, output->probed_modes);
- for (o = 0; o < xf86_config->num_output; o++)
- if (xf86_config->output[o] == output)
- {
- memmove (&xf86_config->output[o],
- &xf86_config->output[o+1],
- ((xf86_config->num_output - (o + 1)) * sizeof(void*)));
- xf86_config->num_output--;
- break;
- }
- if (output->name && output->name != (char *) (output + 1))
- free(output->name);
- free(output);
-}
-
-/*
- * Called during CreateScreenResources to hook up RandR
- */
-static Bool
-xf86CrtcCreateScreenResources (ScreenPtr screen)
-{
- ScrnInfoPtr scrn = xf86Screens[screen->myNum];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
-
- screen->CreateScreenResources = config->CreateScreenResources;
-
- if (!(*screen->CreateScreenResources)(screen))
- return FALSE;
-
- if (!xf86RandR12CreateScreenResources (screen))
- return FALSE;
-
- return TRUE;
-}
-
-/*
- * Clean up config on server reset
- */
-static Bool
-xf86CrtcCloseScreen (int index, ScreenPtr screen)
-{
- ScrnInfoPtr scrn = xf86Screens[screen->myNum];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- int o, c;
-
- screen->CloseScreen = config->CloseScreen;
-
- xf86RotateCloseScreen (screen);
-
- for (o = 0; o < config->num_output; o++)
- {
- xf86OutputPtr output = config->output[o];
-
- output->randr_output = NULL;
- }
- for (c = 0; c < config->num_crtc; c++)
- {
- xf86CrtcPtr crtc = config->crtc[c];
-
- crtc->randr_crtc = NULL;
- }
- xf86RandR12CloseScreen (screen);
-
- return screen->CloseScreen (index, screen);
-}
-
-/*
- * Called at ScreenInit time to set up
- */
-#ifdef RANDR_13_INTERFACE
-int
-#else
-Bool
-#endif
-xf86CrtcScreenInit (ScreenPtr screen)
-{
- ScrnInfoPtr scrn = xf86Screens[screen->myNum];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- int c;
-
- /* Rotation */
- xf86DrvMsg(scrn->scrnIndex, X_INFO, "RandR 1.2 enabled, ignore the following RandR disabled message.\n");
- xf86DisableRandR(); /* Disable old RandR extension support */
- xf86RandR12Init (screen);
-
- /* support all rotations if every crtc has the shadow alloc funcs */
- for (c = 0; c < config->num_crtc; c++)
- {
- xf86CrtcPtr crtc = config->crtc[c];
- if (!crtc->funcs->shadow_allocate || !crtc->funcs->shadow_create)
- break;
- }
- if (c == config->num_crtc)
- {
- xf86RandR12SetRotations (screen, RR_Rotate_0 | RR_Rotate_90 |
- RR_Rotate_180 | RR_Rotate_270 |
- RR_Reflect_X | RR_Reflect_Y);
- xf86RandR12SetTransformSupport (screen, TRUE);
- }
- else
- {
- xf86RandR12SetRotations (screen, RR_Rotate_0);
- xf86RandR12SetTransformSupport (screen, FALSE);
- }
-
- /* Wrap CreateScreenResources so we can initialize the RandR code */
- config->CreateScreenResources = screen->CreateScreenResources;
- screen->CreateScreenResources = xf86CrtcCreateScreenResources;
-
- config->CloseScreen = screen->CloseScreen;
- screen->CloseScreen = xf86CrtcCloseScreen;
-
-#ifdef XFreeXDGA
- _xf86_di_dga_init_internal(screen);
-#endif
-#ifdef RANDR_13_INTERFACE
- return RANDR_INTERFACE_VERSION;
-#else
- return TRUE;
-#endif
-}
-
-static DisplayModePtr
-xf86DefaultMode (xf86OutputPtr output, int width, int height)
-{
- DisplayModePtr target_mode = NULL;
- DisplayModePtr mode;
- int target_diff = 0;
- int target_preferred = 0;
- int mm_height;
-
- mm_height = output->mm_height;
- if (!mm_height)
- mm_height = (768 * 25.4) / DEFAULT_DPI;
- /*
- * Pick a mode closest to DEFAULT_DPI
- */
- for (mode = output->probed_modes; mode; mode = mode->next)
- {
- int dpi;
- int preferred = (((mode->type & M_T_PREFERRED) != 0) +
- ((mode->type & M_T_USERPREF) != 0));
- int diff;
-
- if (xf86ModeWidth (mode, output->initial_rotation) > width ||
- xf86ModeHeight (mode, output->initial_rotation) > height)
- continue;
-
- /* yes, use VDisplay here, not xf86ModeHeight */
- dpi = (mode->VDisplay * 254) / (mm_height * 10);
- diff = dpi - DEFAULT_DPI;
- diff = diff < 0 ? -diff : diff;
- if (target_mode == NULL || (preferred > target_preferred) ||
- (preferred == target_preferred && diff < target_diff))
- {
- target_mode = mode;
- target_diff = diff;
- target_preferred = preferred;
- }
- }
- return target_mode;
-}
-
-static DisplayModePtr
-xf86ClosestMode (xf86OutputPtr output,
- DisplayModePtr match, Rotation match_rotation,
- int width, int height)
-{
- DisplayModePtr target_mode = NULL;
- DisplayModePtr mode;
- int target_diff = 0;
-
- /*
- * Pick a mode closest to the specified mode
- */
- for (mode = output->probed_modes; mode; mode = mode->next)
- {
- int dx, dy;
- int diff;
-
- if (xf86ModeWidth (mode, output->initial_rotation) > width ||
- xf86ModeHeight (mode, output->initial_rotation) > height)
- continue;
-
- /* exact matches are preferred */
- if (output->initial_rotation == match_rotation &&
- xf86ModesEqual (mode, match))
- return mode;
-
- dx = xf86ModeWidth (match, match_rotation) - xf86ModeWidth (mode, output->initial_rotation);
- dy = xf86ModeHeight (match, match_rotation) - xf86ModeHeight (mode, output->initial_rotation);
- diff = dx * dx + dy * dy;
- if (target_mode == NULL || diff < target_diff)
- {
- target_mode = mode;
- target_diff = diff;
- }
- }
- return target_mode;
-}
-
-static DisplayModePtr
-xf86OutputHasPreferredMode (xf86OutputPtr output, int width, int height)
-{
- DisplayModePtr mode;
-
- for (mode = output->probed_modes; mode; mode = mode->next)
- {
- if (xf86ModeWidth (mode, output->initial_rotation) > width ||
- xf86ModeHeight (mode, output->initial_rotation) > height)
- continue;
-
- if (mode->type & M_T_PREFERRED)
- return mode;
- }
- return NULL;
-}
-
-static DisplayModePtr
-xf86OutputHasUserPreferredMode (xf86OutputPtr output)
-{
- DisplayModePtr mode, first = output->probed_modes;
-
- for (mode = first; mode && mode->next != first; mode = mode->next)
- if (mode->type & M_T_USERPREF)
- return mode;
-
- return NULL;
-}
-
-static int
-xf86PickCrtcs (ScrnInfoPtr scrn,
- xf86CrtcPtr *best_crtcs,
- DisplayModePtr *modes,
- int n,
- int width,
- int height)
-{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- int c, o;
- xf86OutputPtr output;
- xf86CrtcPtr crtc;
- xf86CrtcPtr *crtcs;
- xf86CrtcPtr best_crtc;
- int best_score;
- int score;
- int my_score;
-
- if (n == config->num_output)
- return 0;
- output = config->output[n];
-
- /*
- * Compute score with this output disabled
- */
- best_crtcs[n] = NULL;
- best_crtc = NULL;
- best_score = xf86PickCrtcs (scrn, best_crtcs, modes, n+1, width, height);
- if (modes[n] == NULL)
- return best_score;
-
- crtcs = malloc(config->num_output * sizeof (xf86CrtcPtr));
- if (!crtcs)
- return best_score;
-
- my_score = 1;
- /* Score outputs that are known to be connected higher */
- if (output->status == XF86OutputStatusConnected)
- my_score++;
- /* Score outputs with preferred modes higher */
- if (xf86OutputHasPreferredMode (output, width, height))
- my_score++;
- /*
- * Select a crtc for this output and
- * then attempt to configure the remaining
- * outputs
- */
- for (c = 0; c < config->num_crtc; c++)
- {
- if ((output->possible_crtcs & (1 << c)) == 0)
- continue;
-
- crtc = config->crtc[c];
- /*
- * Check to see if some other output is
- * using this crtc
- */
- for (o = 0; o < n; o++)
- if (best_crtcs[o] == crtc)
- break;
- if (o < n)
- {
- /*
- * If the two outputs desire the same mode,
- * see if they can be cloned
- */
- if (xf86ModesEqual (modes[o], modes[n]) &&
- config->output[o]->initial_rotation == config->output[n]->initial_rotation &&
- config->output[o]->initial_x == config->output[n]->initial_x &&
- config->output[o]->initial_y == config->output[n]->initial_y)
- {
- if ((output->possible_clones & (1 << o)) == 0)
- continue; /* nope, try next CRTC */
- }
- else
- continue; /* different modes, can't clone */
- }
- crtcs[n] = crtc;
- memcpy (crtcs, best_crtcs, n * sizeof (xf86CrtcPtr));
- score = my_score + xf86PickCrtcs (scrn, crtcs, modes, n+1, width, height);
- if (score > best_score)
- {
- best_crtc = crtc;
- best_score = score;
- memcpy (best_crtcs, crtcs, config->num_output * sizeof (xf86CrtcPtr));
- }
- }
- free(crtcs);
- return best_score;
-}
-
-
-/*
- * Compute the virtual size necessary to place all of the available
- * crtcs in the specified configuration.
- *
- * canGrow indicates that the driver can make the screen larger than its initial
- * configuration. If FALSE, this function will enlarge the screen to include
- * the largest available mode.
- */
-
-static void
-xf86DefaultScreenLimits (ScrnInfoPtr scrn, int *widthp, int *heightp,
- Bool canGrow)
-{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- int width = 0, height = 0;
- int o;
- int c;
- int s;
-
- for (c = 0; c < config->num_crtc; c++)
- {
- int crtc_width = 0, crtc_height = 0;
- xf86CrtcPtr crtc = config->crtc[c];
-
- if (crtc->enabled)
- {
- crtc_width = crtc->desiredX + xf86ModeWidth (&crtc->desiredMode, crtc->desiredRotation);
- crtc_height = crtc->desiredY + xf86ModeHeight (&crtc->desiredMode, crtc->desiredRotation);
- }
- if (!canGrow) {
- for (o = 0; o < config->num_output; o++)
- {
- xf86OutputPtr output = config->output[o];
-
- for (s = 0; s < config->num_crtc; s++)
- if (output->possible_crtcs & (1 << s))
- {
- DisplayModePtr mode;
- for (mode = output->probed_modes; mode; mode = mode->next)
- {
- if (mode->HDisplay > crtc_width)
- crtc_width = mode->HDisplay;
- if (mode->VDisplay > crtc_width)
- crtc_width = mode->VDisplay;
- if (mode->VDisplay > crtc_height)
- crtc_height = mode->VDisplay;
- if (mode->HDisplay > crtc_height)
- crtc_height = mode->HDisplay;
- }
- }
- }
- }
- if (crtc_width > width)
- width = crtc_width;
- if (crtc_height > height)
- height = crtc_height;
- }
- if (config->maxWidth && width > config->maxWidth) width = config->maxWidth;
- if (config->maxHeight && height > config->maxHeight) height = config->maxHeight;
- if (config->minWidth && width < config->minWidth) width = config->minWidth;
- if (config->minHeight && height < config->minHeight) height = config->minHeight;
- *widthp = width;
- *heightp = height;
-}
-
-#define POSITION_UNSET -100000
-
-/*
- * check if the user configured any outputs at all
- * with either a position or a relative setting or a mode.
- */
-static Bool
-xf86UserConfiguredOutputs(ScrnInfoPtr scrn, DisplayModePtr *modes)
-{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- int o;
- Bool user_conf = FALSE;
-
- for (o = 0; o < config->num_output; o++)
- {
- xf86OutputPtr output = config->output[o];
- char *position;
- char *relative_name;
- OutputOpts relation;
- int r;
- static const OutputOpts relations[] = {
- OPTION_BELOW, OPTION_RIGHT_OF, OPTION_ABOVE, OPTION_LEFT_OF
- };
-
- position = xf86GetOptValString (output->options,
- OPTION_POSITION);
- if (position)
- user_conf = TRUE;
-
- relation = 0;
- relative_name = NULL;
- for (r = 0; r < 4; r++)
- {
- relation = relations[r];
- relative_name = xf86GetOptValString (output->options,
- relation);
- if (relative_name)
- break;
- }
- if (relative_name)
- user_conf = TRUE;
-
- modes[o] = xf86OutputHasUserPreferredMode(output);
- if (modes[o])
- user_conf = TRUE;
- }
-
- return user_conf;
-}
-
-static Bool
-xf86InitialOutputPositions (ScrnInfoPtr scrn, DisplayModePtr *modes)
-{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- int o;
- int min_x, min_y;
-
- for (o = 0; o < config->num_output; o++)
- {
- xf86OutputPtr output = config->output[o];
-
- output->initial_x = output->initial_y = POSITION_UNSET;
- }
-
- /*
- * Loop until all outputs are set
- */
- for (;;)
- {
- Bool any_set = FALSE;
- Bool keep_going = FALSE;
-
- for (o = 0; o < config->num_output; o++)
- {
- static const OutputOpts relations[] = {
- OPTION_BELOW, OPTION_RIGHT_OF, OPTION_ABOVE, OPTION_LEFT_OF
- };
- xf86OutputPtr output = config->output[o];
- xf86OutputPtr relative;
- char *relative_name;
- char *position;
- OutputOpts relation;
- int r;
-
- if (output->initial_x != POSITION_UNSET)
- continue;
- position = xf86GetOptValString (output->options,
- OPTION_POSITION);
- /*
- * Absolute position wins
- */
- if (position)
- {
- int x, y;
- if (sscanf (position, "%d %d", &x, &y) == 2)
- {
- output->initial_x = x;
- output->initial_y = y;
- }
- else
- {
- xf86DrvMsg (scrn->scrnIndex, X_ERROR,
- "Output %s position not of form \"x y\"\n",
- output->name);
- output->initial_x = output->initial_y = 0;
- }
- any_set = TRUE;
- continue;
- }
- /*
- * Next comes relative positions
- */
- relation = 0;
- relative_name = NULL;
- for (r = 0; r < 4; r++)
- {
- relation = relations[r];
- relative_name = xf86GetOptValString (output->options,
- relation);
- if (relative_name)
- break;
- }
- if (relative_name)
- {
- int or;
- relative = NULL;
- for (or = 0; or < config->num_output; or++)
- {
- xf86OutputPtr out_rel = config->output[or];
- XF86ConfMonitorPtr rel_mon = out_rel->conf_monitor;
-
- if (rel_mon)
- {
- if (xf86nameCompare (rel_mon->mon_identifier,
- relative_name) == 0)
- {
- relative = config->output[or];
- break;
- }
- }
- if (strcmp (out_rel->name, relative_name) == 0)
- {
- relative = config->output[or];
- break;
- }
- }
- if (!relative)
- {
- xf86DrvMsg (scrn->scrnIndex, X_ERROR,
- "Cannot position output %s relative to unknown output %s\n",
- output->name, relative_name);
- output->initial_x = 0;
- output->initial_y = 0;
- any_set = TRUE;
- continue;
- }
- if (!modes[or])
- {
- xf86DrvMsg (scrn->scrnIndex, X_ERROR,
- "Cannot position output %s relative to output %s without modes\n",
- output->name, relative_name);
- output->initial_x = 0;
- output->initial_y = 0;
- any_set = TRUE;
- continue;
- }
- if (relative->initial_x == POSITION_UNSET)
- {
- keep_going = TRUE;
- continue;
- }
- output->initial_x = relative->initial_x;
- output->initial_y = relative->initial_y;
- switch (relation) {
- case OPTION_BELOW:
- output->initial_y += xf86ModeHeight (modes[or], relative->initial_rotation);
- break;
- case OPTION_RIGHT_OF:
- output->initial_x += xf86ModeWidth (modes[or], relative->initial_rotation);
- break;
- case OPTION_ABOVE:
- if (modes[o])
- output->initial_y -= xf86ModeHeight (modes[o], output->initial_rotation);
- break;
- case OPTION_LEFT_OF:
- if (modes[o])
- output->initial_x -= xf86ModeWidth (modes[o], output->initial_rotation);
- break;
- default:
- break;
- }
- any_set = TRUE;
- continue;
- }
-
- /* Nothing set, just stick them at 0,0 */
- output->initial_x = 0;
- output->initial_y = 0;
- any_set = TRUE;
- }
- if (!keep_going)
- break;
- if (!any_set)
- {
- for (o = 0; o < config->num_output; o++)
- {
- xf86OutputPtr output = config->output[o];
- if (output->initial_x == POSITION_UNSET)
- {
- xf86DrvMsg (scrn->scrnIndex, X_ERROR,
- "Output position loop. Moving %s to 0,0\n",
- output->name);
- output->initial_x = output->initial_y = 0;
- break;
- }
- }
- }
- }
-
- /*
- * normalize positions
- */
- min_x = 1000000;
- min_y = 1000000;
- for (o = 0; o < config->num_output; o++)
- {
- xf86OutputPtr output = config->output[o];
-
- if (output->initial_x < min_x)
- min_x = output->initial_x;
- if (output->initial_y < min_y)
- min_y = output->initial_y;
- }
-
- for (o = 0; o < config->num_output; o++)
- {
- xf86OutputPtr output = config->output[o];
-
- output->initial_x -= min_x;
- output->initial_y -= min_y;
- }
- return TRUE;
-}
-
-static void
-xf86InitialPanning (ScrnInfoPtr scrn)
-{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- int o;
-
- for (o = 0; o < config->num_output; o++)
- {
- xf86OutputPtr output = config->output[o];
- char *panning = xf86GetOptValString (output->options, OPTION_PANNING);
- int width, height, left, top;
- int track_width, track_height, track_left, track_top;
- int brdr[4];
-
- memset (&output->initialTotalArea, 0, sizeof(BoxRec));
- memset (&output->initialTrackingArea, 0, sizeof(BoxRec));
- memset (output->initialBorder, 0, 4*sizeof(INT16));
-
- if (! panning)
- continue;
-
- switch (sscanf (panning, "%dx%d+%d+%d/%dx%d+%d+%d/%d/%d/%d/%d",
- &width, &height, &left, &top,
- &track_width, &track_height, &track_left, &track_top,
- &brdr[0], &brdr[1], &brdr[2], &brdr[3])) {
- case 12:
- output->initialBorder[0] = brdr[0];
- output->initialBorder[1] = brdr[1];
- output->initialBorder[2] = brdr[2];
- output->initialBorder[3] = brdr[3];
- /* fall through */
- case 8:
- output->initialTrackingArea.x1 = track_left;
- output->initialTrackingArea.y1 = track_top;
- output->initialTrackingArea.x2 = track_left + track_width;
- output->initialTrackingArea.y2 = track_top + track_height;
- /* fall through */
- case 4:
- output->initialTotalArea.x1 = left;
- output->initialTotalArea.y1 = top;
- /* fall through */
- case 2:
- output->initialTotalArea.x2 = output->initialTotalArea.x1 + width;
- output->initialTotalArea.y2 = output->initialTotalArea.y1 + height;
- break;
- default:
- xf86DrvMsg (scrn->scrnIndex, X_ERROR,
- "Broken panning specification '%s' for output %s in config file\n",
- panning, output->name);
- }
- }
-}
-
-/** Return - 0 + if a should be earlier, same or later than b in list
- */
-static int
-xf86ModeCompare (DisplayModePtr a, DisplayModePtr b)
-{
- int diff;
-
- diff = ((b->type & M_T_PREFERRED) != 0) - ((a->type & M_T_PREFERRED) != 0);
- if (diff)
- return diff;
- diff = b->HDisplay * b->VDisplay - a->HDisplay * a->VDisplay;
- if (diff)
- return diff;
- diff = b->Clock - a->Clock;
- return diff;
-}
-
-/**
- * Insertion sort input in-place and return the resulting head
- */
-static DisplayModePtr
-xf86SortModes (DisplayModePtr input)
-{
- DisplayModePtr output = NULL, i, o, n, *op, prev;
-
- /* sort by preferred status and pixel area */
- while (input)
- {
- i = input;
- input = input->next;
- for (op = &output; (o = *op); op = &o->next)
- if (xf86ModeCompare (o, i) > 0)
- break;
- i->next = *op;
- *op = i;
- }
- /* prune identical modes */
- for (o = output; o && (n = o->next); o = n)
- {
- if (!strcmp (o->name, n->name) && xf86ModesEqual (o, n))
- {
- o->next = n->next;
- free(n->name);
- free(n);
- n = o;
- }
- }
- /* hook up backward links */
- prev = NULL;
- for (o = output; o; o = o->next)
- {
- o->prev = prev;
- prev = o;
- }
- return output;
-}
-
-static char *
-preferredMode(ScrnInfoPtr pScrn, xf86OutputPtr output)
-{
- char *preferred_mode = NULL;
-
- /* Check for a configured preference for a particular mode */
- preferred_mode = xf86GetOptValString (output->options,
- OPTION_PREFERRED_MODE);
- if (preferred_mode)
- return preferred_mode;
-
- if (pScrn->display->modes && *pScrn->display->modes)
- preferred_mode = *pScrn->display->modes;
-
- return preferred_mode;
-}
-
-static void
-GuessRangeFromModes(MonPtr mon, DisplayModePtr mode)
-{
- if (!mon || !mode)
- return;
-
- mon->nHsync = 1;
- mon->hsync[0].lo = 1024.0;
- mon->hsync[0].hi = 0.0;
-
- mon->nVrefresh = 1;
- mon->vrefresh[0].lo = 1024.0;
- mon->vrefresh[0].hi = 0.0;
-
- while (mode) {
- if (!mode->HSync)
- mode->HSync = ((float) mode->Clock ) / ((float) mode->HTotal);
-
- if (!mode->VRefresh)
- mode->VRefresh = (1000.0 * ((float) mode->Clock)) /
- ((float) (mode->HTotal * mode->VTotal));
-
- if (mode->HSync < mon->hsync[0].lo)
- mon->hsync[0].lo = mode->HSync;
-
- if (mode->HSync > mon->hsync[0].hi)
- mon->hsync[0].hi = mode->HSync;
-
- if (mode->VRefresh < mon->vrefresh[0].lo)
- mon->vrefresh[0].lo = mode->VRefresh;
-
- if (mode->VRefresh > mon->vrefresh[0].hi)
- mon->vrefresh[0].hi = mode->VRefresh;
-
- mode = mode->next;
- }
-
- /* stretch out the bottom to fit 640x480@60 */
- if (mon->hsync[0].lo > 31.0)
- mon->hsync[0].lo = 31.0;
- if (mon->vrefresh[0].lo > 58.0)
- mon->vrefresh[0].lo = 58.0;
-}
-
-enum det_monrec_source {
- sync_config, sync_edid, sync_default
-};
-
-struct det_monrec_parameter {
- MonRec *mon_rec;
- int *max_clock;
- Bool set_hsync;
- Bool set_vrefresh;
- enum det_monrec_source *sync_source;
-};
-
-static void handle_detailed_monrec(struct detailed_monitor_section *det_mon,
- void *data)
-{
- struct det_monrec_parameter *p;
- p = (struct det_monrec_parameter *)data;
-
- if (det_mon->type == DS_RANGES) {
- struct monitor_ranges *ranges = &det_mon->section.ranges;
- if (p->set_hsync && ranges->max_h) {
- p->mon_rec->hsync[p->mon_rec->nHsync].lo = ranges->min_h;
- p->mon_rec->hsync[p->mon_rec->nHsync].hi = ranges->max_h;
- p->mon_rec->nHsync++;
- if (*p->sync_source == sync_default)
- *p->sync_source = sync_edid;
- }
- if (p->set_vrefresh && ranges->max_v) {
- p->mon_rec->vrefresh[p->mon_rec->nVrefresh].lo = ranges->min_v;
- p->mon_rec->vrefresh[p->mon_rec->nVrefresh].hi = ranges->max_v;
- p->mon_rec->nVrefresh++;
- if (*p->sync_source == sync_default)
- *p->sync_source = sync_edid;
- }
- if (ranges->max_clock * 1000 > *p->max_clock)
- *p->max_clock = ranges->max_clock * 1000;
- }
-}
-
-void
-xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY)
-{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- int o;
-
- /* When canGrow was TRUE in the initial configuration we have to
- * compare against the maximum values so that we don't drop modes.
- * When canGrow was FALSE, the maximum values would have been clamped
- * anyway.
- */
- if (maxX == 0 || maxY == 0) {
- maxX = config->maxWidth;
- maxY = config->maxHeight;
- }
-
- /* Probe the list of modes for each output. */
- for (o = 0; o < config->num_output; o++)
- {
- xf86OutputPtr output = config->output[o];
- DisplayModePtr mode;
- DisplayModePtr config_modes = NULL, output_modes, default_modes = NULL;
- char *preferred_mode;
- xf86MonPtr edid_monitor;
- XF86ConfMonitorPtr conf_monitor;
- MonRec mon_rec;
- int min_clock = 0;
- int max_clock = 0;
- double clock;
- Bool add_default_modes = xf86ReturnOptValBool(output->options, OPTION_DEFAULT_MODES, TRUE);
- Bool debug_modes = config->debug_modes ||
- xf86Initialising;
- enum det_monrec_source sync_source = sync_default;
-
- while (output->probed_modes != NULL)
- xf86DeleteMode(&output->probed_modes, output->probed_modes);
-
- /*
- * Check connection status
- */
- output->status = (*output->funcs->detect)(output);
-
- if (output->status == XF86OutputStatusDisconnected &&
- !xf86ReturnOptValBool(output->options, OPTION_ENABLE, FALSE))
- {
- xf86OutputSetEDID (output, NULL);
- continue;
- }
-
- memset (&mon_rec, '\0', sizeof (mon_rec));
-
- conf_monitor = output->conf_monitor;
-
- if (conf_monitor)
- {
- int i;
-
- for (i = 0; i < conf_monitor->mon_n_hsync; i++)
- {
- mon_rec.hsync[mon_rec.nHsync].lo = conf_monitor->mon_hsync[i].lo;
- mon_rec.hsync[mon_rec.nHsync].hi = conf_monitor->mon_hsync[i].hi;
- mon_rec.nHsync++;
- sync_source = sync_config;
- }
- for (i = 0; i < conf_monitor->mon_n_vrefresh; i++)
- {
- mon_rec.vrefresh[mon_rec.nVrefresh].lo = conf_monitor->mon_vrefresh[i].lo;
- mon_rec.vrefresh[mon_rec.nVrefresh].hi = conf_monitor->mon_vrefresh[i].hi;
- mon_rec.nVrefresh++;
- sync_source = sync_config;
- }
- config_modes = xf86GetMonitorModes (scrn, conf_monitor);
- }
-
- output_modes = (*output->funcs->get_modes) (output);
-
- edid_monitor = output->MonInfo;
-
- if (edid_monitor)
- {
- struct det_monrec_parameter p;
- struct disp_features *features = &edid_monitor->features;
-
- /* if display is not continuous-frequency, don't add default modes */
- if (!GTF_SUPPORTED(features->msc))
- add_default_modes = FALSE;
-
- p.mon_rec = &mon_rec;
- p.max_clock = &max_clock;
- p.set_hsync = mon_rec.nHsync == 0;
- p.set_vrefresh = mon_rec.nVrefresh == 0;
- p.sync_source = &sync_source;
-
- xf86ForEachDetailedBlock(edid_monitor,
- handle_detailed_monrec,
- &p);
- }
-
- if (xf86GetOptValFreq (output->options, OPTION_MIN_CLOCK,
- OPTUNITS_KHZ, &clock))
- min_clock = (int) clock;
- if (xf86GetOptValFreq (output->options, OPTION_MAX_CLOCK,
- OPTUNITS_KHZ, &clock))
- max_clock = (int) clock;
-
- /* If we still don't have a sync range, guess wildly */
- if (!mon_rec.nHsync || !mon_rec.nVrefresh)
- GuessRangeFromModes(&mon_rec, output_modes);
-
- /*
- * These limits will end up setting a 1024x768@60Hz mode by default,
- * which seems like a fairly good mode to use when nothing else is
- * specified
- */
- if (mon_rec.nHsync == 0)
- {
- mon_rec.hsync[0].lo = 31.0;
- mon_rec.hsync[0].hi = 55.0;
- mon_rec.nHsync = 1;
- }
- if (mon_rec.nVrefresh == 0)
- {
- mon_rec.vrefresh[0].lo = 58.0;
- mon_rec.vrefresh[0].hi = 62.0;
- mon_rec.nVrefresh = 1;
- }
-
- if (add_default_modes)
- default_modes = xf86GetDefaultModes ();
-
- /*
- * If this is not an RB monitor, remove RB modes from the default
- * pool. RB modes from the config or the monitor itself are fine.
- */
- if (!mon_rec.reducedblanking)
- xf86ValidateModesReducedBlanking (scrn, default_modes);
-
- if (sync_source == sync_config)
- {
- /*
- * Check output and config modes against sync range from config file
- */
- xf86ValidateModesSync (scrn, output_modes, &mon_rec);
- xf86ValidateModesSync (scrn, config_modes, &mon_rec);
- }
- /*
- * Check default modes against sync range
- */
- xf86ValidateModesSync (scrn, default_modes, &mon_rec);
- /*
- * Check default modes against monitor max clock
- */
- if (max_clock) {
- xf86ValidateModesClocks(scrn, default_modes,
- &min_clock, &max_clock, 1);
- xf86ValidateModesClocks(scrn, output_modes,
- &min_clock, &max_clock, 1);
- }
-
- output->probed_modes = NULL;
- output->probed_modes = xf86ModesAdd (output->probed_modes, config_modes);
- output->probed_modes = xf86ModesAdd (output->probed_modes, output_modes);
- output->probed_modes = xf86ModesAdd (output->probed_modes, default_modes);
-
- /*
- * Check all modes against max size, interlace, and doublescan
- */
- if (maxX && maxY)
- xf86ValidateModesSize (scrn, output->probed_modes,
- maxX, maxY, 0);
-
- {
- int flags = (output->interlaceAllowed ? V_INTERLACE : 0) |
- (output->doubleScanAllowed ? V_DBLSCAN : 0);
- xf86ValidateModesFlags (scrn, output->probed_modes, flags);
- }
-
- /*
- * Check all modes against output
- */
- for (mode = output->probed_modes; mode != NULL; mode = mode->next)
- if (mode->status == MODE_OK)
- mode->status = (*output->funcs->mode_valid)(output, mode);
-
- xf86PruneInvalidModes(scrn, &output->probed_modes, debug_modes);
-
- output->probed_modes = xf86SortModes (output->probed_modes);
-
- /* Check for a configured preference for a particular mode */
- preferred_mode = preferredMode(scrn, output);
-
- if (preferred_mode)
- {
- for (mode = output->probed_modes; mode; mode = mode->next)
- {
- if (!strcmp (preferred_mode, mode->name))
- {
- if (mode != output->probed_modes)
- {
- if (mode->prev)
- mode->prev->next = mode->next;
- if (mode->next)
- mode->next->prev = mode->prev;
- mode->next = output->probed_modes;
- output->probed_modes->prev = mode;
- mode->prev = NULL;
- output->probed_modes = mode;
- }
- mode->type |= (M_T_PREFERRED|M_T_USERPREF);
- break;
- }
- }
- }
-
- output->initial_rotation = xf86OutputInitialRotation (output);
-
- if (debug_modes) {
- if (output->probed_modes != NULL) {
- xf86DrvMsg(scrn->scrnIndex, X_INFO,
- "Printing probed modes for output %s\n",
- output->name);
- } else {
- xf86DrvMsg(scrn->scrnIndex, X_INFO,
- "No remaining probed modes for output %s\n",
- output->name);
- }
- }
- for (mode = output->probed_modes; mode != NULL; mode = mode->next)
- {
- /* The code to choose the best mode per pipe later on will require
- * VRefresh to be set.
- */
- mode->VRefresh = xf86ModeVRefresh(mode);
- xf86SetModeCrtc(mode, INTERLACE_HALVE_V);
-
- if (debug_modes)
- xf86PrintModeline(scrn->scrnIndex, mode);
- }
- }
-}
-
-
-/**
- * Copy one of the output mode lists to the ScrnInfo record
- */
-
-/* XXX where does this function belong? Here? */
-void
-xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr scrn, int *x, int *y);
-
-static DisplayModePtr
-biggestMode(DisplayModePtr a, DisplayModePtr b)
-{
- int A, B;
-
- if (!a)
- return b;
- if (!b)
- return a;
-
- A = a->HDisplay * a->VDisplay;
- B = b->HDisplay * b->VDisplay;
-
- if (A > B)
- return a;
-
- return b;
-}
-
-static xf86OutputPtr
-SetCompatOutput(xf86CrtcConfigPtr config)
-{
- xf86OutputPtr output = NULL, test = NULL;
- DisplayModePtr maxmode = NULL, testmode, mode;
- int o, compat = -1, count, mincount = 0;
-
- /* Look for one that's definitely connected */
- for (o = 0; o < config->num_output; o++)
- {
- test = config->output[o];
- if (!test->crtc)
- continue;
- if (test->status != XF86OutputStatusConnected)
- continue;
- if (!test->probed_modes)
- continue;
-
- testmode = mode = test->probed_modes;
- for (count = 0; mode; mode = mode->next, count++)
- testmode = biggestMode(testmode, mode);
-
- if (!output) {
- output = test;
- compat = o;
- maxmode = testmode;
- mincount = count;
- } else if (maxmode == biggestMode(maxmode, testmode)) {
- output = test;
- compat = o;
- maxmode = testmode;
- mincount = count;
- } else if ((maxmode->HDisplay == testmode->HDisplay) &&
- (maxmode->VDisplay == testmode->VDisplay) &&
- count <= mincount) {
- output = test;
- compat = o;
- maxmode = testmode;
- mincount = count;
- }
- }
-
- /* If we didn't find one, take anything we can get */
- if (!output)
- {
- for (o = 0; o < config->num_output; o++)
- {
- test = config->output[o];
- if (!test->crtc)
- continue;
- if (!test->probed_modes)
- continue;
-
- if (!output) {
- output = test;
- compat = o;
- } else if (test->probed_modes->HDisplay < output->probed_modes->HDisplay) {
- output = test;
- compat = o;
- }
- }
- }
-
- if (compat >= 0) {
- config->compat_output = compat;
- } else {
- /* Don't change the compat output when no valid outputs found */
- output = config->output[config->compat_output];
- }
-
- return output;
-}
-
-void
-xf86SetScrnInfoModes (ScrnInfoPtr scrn)
-{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- xf86OutputPtr output;
- xf86CrtcPtr crtc;
- DisplayModePtr last, mode = NULL;
-
- output = SetCompatOutput(config);
-
- if (!output)
- return; /* punt */
-
- crtc = output->crtc;
-
- /* Clear any existing modes from scrn->modes */
- while (scrn->modes != NULL)
- xf86DeleteMode(&scrn->modes, scrn->modes);
-
- /* Set scrn->modes to the mode list for the 'compat' output */
- scrn->modes = xf86DuplicateModes(scrn, output->probed_modes);
-
- if (crtc) {
- for (mode = scrn->modes; mode; mode = mode->next)
- if (xf86ModesEqual (mode, &crtc->desiredMode))
- break;
- }
-
- if (scrn->modes != NULL) {
- /* For some reason, scrn->modes is circular, unlike the other mode
- * lists. How great is that?
- */
- for (last = scrn->modes; last && last->next; last = last->next)
- ;
- last->next = scrn->modes;
- scrn->modes->prev = last;
- if (mode) {
- while (scrn->modes != mode)
- scrn->modes = scrn->modes->next;
- }
- }
- scrn->currentMode = scrn->modes;
-#ifdef XFreeXDGA
- if (scrn->pScreen)
- _xf86_di_dga_reinit_internal(scrn->pScreen);
-#endif
-}
-
-static Bool
-xf86CollectEnabledOutputs(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
- Bool *enabled)
-{
- Bool any_enabled = FALSE;
- int o;
-
- for (o = 0; o < config->num_output; o++)
- any_enabled |= enabled[o] = xf86OutputEnabled(config->output[o], TRUE);
-
- if (!any_enabled) {
- xf86DrvMsg(scrn->scrnIndex, X_WARNING,
- "No outputs definitely connected, trying again...\n");
-
- for (o = 0; o < config->num_output; o++)
- any_enabled |= enabled[o] = xf86OutputEnabled(config->output[o], FALSE);
- }
-
- return any_enabled;
-}
-
-static Bool
-nextEnabledOutput(xf86CrtcConfigPtr config, Bool *enabled, int *index)
-{
- int o = *index;
-
- for (o++; o < config->num_output; o++) {
- if (enabled[o]) {
- *index = o;
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-static Bool
-aspectMatch(float a, float b)
-{
- return fabs(1 - (a / b)) < 0.05;
-}
-
-static DisplayModePtr
-nextAspectMode(xf86OutputPtr o, DisplayModePtr last, float aspect)
-{
- DisplayModePtr m = NULL;
-
- if (!o)
- return NULL;
-
- if (!last)
- m = o->probed_modes;
- else
- m = last->next;
-
- for (; m; m = m->next)
- if (aspectMatch(aspect, (float)m->HDisplay / (float)m->VDisplay))
- return m;
-
- return NULL;
-}
-
-static DisplayModePtr
-bestModeForAspect(xf86CrtcConfigPtr config, Bool *enabled, float aspect)
-{
- int o = -1, p;
- DisplayModePtr mode = NULL, test = NULL, match = NULL;
-
- if (!nextEnabledOutput(config, enabled, &o))
- return NULL;
- while ((mode = nextAspectMode(config->output[o], mode, aspect))) {
- test = mode;
- for (p = o; nextEnabledOutput(config, enabled, &p); ) {
- test = xf86OutputFindClosestMode(config->output[p], mode);
- if (!test)
- break;
- if (test->HDisplay != mode->HDisplay ||
- test->VDisplay != mode->VDisplay) {
- test = NULL;
- break;
- }
- }
-
- /* if we didn't match it on all outputs, try the next one */
- if (!test)
- continue;
-
- /* if it's bigger than the last one, save it */
- if (!match || (test->HDisplay > match->HDisplay))
- match = test;
- }
-
- /* return the biggest one found */
- return match;
-}
-
-static Bool
-xf86TargetPreferred(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
- DisplayModePtr *modes, Bool *enabled,
- int width, int height)
-{
- int o, p;
- int max_pref_width = 0, max_pref_height = 0;
- DisplayModePtr *preferred, *preferred_match;
- Bool ret = FALSE;
-
- preferred = xnfcalloc(config->num_output, sizeof(DisplayModePtr));
- preferred_match = xnfcalloc(config->num_output, sizeof(DisplayModePtr));
-
- /* Check if the preferred mode is available on all outputs */
- for (p = -1; nextEnabledOutput(config, enabled, &p); ) {
- Rotation r = config->output[p]->initial_rotation;
- DisplayModePtr mode;
- if ((preferred[p] = xf86OutputHasPreferredMode(config->output[p],
- width, height))) {
- int pref_width = xf86ModeWidth(preferred[p], r);
- int pref_height = xf86ModeHeight(preferred[p], r);
- Bool all_match = TRUE;
-
- for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
- Bool match = FALSE;
- xf86OutputPtr output = config->output[o];
- if (o == p)
- continue;
-
- for (mode = output->probed_modes; mode; mode = mode->next) {
- Rotation r = output->initial_rotation;
- if (xf86ModeWidth(mode, r) == pref_width &&
- xf86ModeHeight(mode, r) == pref_height) {
- preferred[o] = mode;
- match = TRUE;
- }
- }
-
- all_match &= match;
- }
-
- if (all_match &&
- (pref_width*pref_height > max_pref_width*max_pref_height)) {
- for (o = -1; nextEnabledOutput(config, enabled, &o); )
- preferred_match[o] = preferred[o];
- max_pref_width = pref_width;
- max_pref_height = pref_height;
- ret = TRUE;
- }
- }
- }
-
- /*
- * If there's no preferred mode, but only one monitor, pick the
- * biggest mode for its aspect ratio, assuming one exists.
- */
- if (!ret) do {
- int i = 0;
- float aspect = 0.0;
-
- /* count the number of enabled outputs */
- for (i = 0, p = -1; nextEnabledOutput(config, enabled, &p); i++) ;
-
- if (i != 1)
- break;
-
- p = -1;
- nextEnabledOutput(config, enabled, &p);
- if (config->output[p]->mm_height)
- aspect = (float)config->output[p]->mm_width /
- (float)config->output[p]->mm_height;
-
- if (aspect)
- preferred_match[p] = bestModeForAspect(config, enabled, aspect);
-
- if (preferred_match[p])
- ret = TRUE;
-
- } while (0);
-
- if (ret) {
- /* oh good, there is a match. stash the selected modes and return. */
- memcpy(modes, preferred_match,
- config->num_output * sizeof(DisplayModePtr));
- }
-
- free(preferred);
- free(preferred_match);
- return ret;
-}
-
-static Bool
-xf86TargetAspect(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
- DisplayModePtr *modes, Bool *enabled,
- int width, int height)
-{
- int o;
- float aspect = 0.0, *aspects;
- xf86OutputPtr output;
- Bool ret = FALSE;
- DisplayModePtr guess = NULL, aspect_guess = NULL, base_guess = NULL;
-
- aspects = xnfcalloc(config->num_output, sizeof(float));
-
- /* collect the aspect ratios */
- for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
- output = config->output[o];
- if (output->mm_height)
- aspects[o] = (float)output->mm_width / (float)output->mm_height;
- else
- aspects[o] = 4.0 / 3.0;
- }
-
- /* check that they're all the same */
- for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
- output = config->output[o];
- if (!aspect) {
- aspect = aspects[o];
- } else if (!aspectMatch(aspect, aspects[o])) {
- goto no_aspect_match;
- }
- }
-
- /* if they're all 4:3, just skip ahead and save effort */
- if (!aspectMatch(aspect, 4.0/3.0))
- aspect_guess = bestModeForAspect(config, enabled, aspect);
-
-no_aspect_match:
- base_guess = bestModeForAspect(config, enabled, 4.0/3.0);
-
- guess = biggestMode(base_guess, aspect_guess);
-
- if (!guess)
- goto out;
-
- /* found a mode that works everywhere, now apply it */
- for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
- modes[o] = xf86OutputFindClosestMode(config->output[o], guess);
- }
- ret = TRUE;
-
-out:
- free(aspects);
- return ret;
-}
-
-static Bool
-xf86TargetFallback(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
- DisplayModePtr *modes, Bool *enabled,
- int width, int height)
-{
- DisplayModePtr target_mode = NULL;
- Rotation target_rotation = RR_Rotate_0;
- DisplayModePtr default_mode;
- int default_preferred, target_preferred = 0, o;
-
- /* User preferred > preferred > other modes */
- for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
- default_mode = xf86DefaultMode (config->output[o], width, height);
- if (!default_mode)
- continue;
-
- default_preferred = (((default_mode->type & M_T_PREFERRED) != 0) +
- ((default_mode->type & M_T_USERPREF) != 0));
-
- if (default_preferred > target_preferred || !target_mode) {
- target_mode = default_mode;
- target_preferred = default_preferred;
- target_rotation = config->output[o]->initial_rotation;
- config->compat_output = o;
- }
- }
-
- if (target_mode)
- modes[config->compat_output] = target_mode;
-
- /* Fill in other output modes */
- for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
- if (!modes[o])
- modes[o] = xf86ClosestMode(config->output[o], target_mode,
- target_rotation, width, height);
- }
-
- return target_mode != NULL;
-}
-
-static Bool
-xf86TargetUserpref(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
- DisplayModePtr *modes, Bool *enabled,
- int width, int height)
-{
- int o;
-
- if (xf86UserConfiguredOutputs(scrn, modes))
- return xf86TargetFallback(scrn, config, modes, enabled, width, height);
-
- for (o = -1; nextEnabledOutput(config, enabled, &o); )
- if (xf86OutputHasUserPreferredMode(config->output[o]))
- return
- xf86TargetFallback(scrn, config, modes, enabled, width, height);
-
- return FALSE;
-}
-
-static Bool
-xf86CrtcSetInitialGamma(xf86CrtcPtr crtc, float gamma_red, float gamma_green,
- float gamma_blue)
-{
- int i, size = 256;
- CARD16 *red, *green, *blue;
-
- red = malloc(3 * size * sizeof(CARD16));
- green = red + size;
- blue = green + size;
-
- /* Only cause warning if user wanted gamma to be set. */
- if (!crtc->funcs->gamma_set && (gamma_red != 1.0 || gamma_green != 1.0 || gamma_blue != 1.0)) {
- free(red);
- return FALSE;
- } else if (!crtc->funcs->gamma_set) {
- free(red);
- return TRUE;
- }
-
- /* At this early stage none of the randr-interface stuff is up.
- * So take the default gamma size for lack of something better.
- */
- for (i = 0; i < size; i++) {
- if (gamma_red == 1.0)
- red[i] = i << 8;
- else
- red[i] = (CARD16)(pow((double)i/(double)(size - 1),
- 1. / (double)gamma_red) * (double)(size - 1) * 256);
-
- if (gamma_green == 1.0)
- green[i] = i << 8;
- else
- green[i] = (CARD16)(pow((double)i/(double)(size - 1),
- 1. / (double)gamma_green) * (double)(size - 1) * 256);
-
- if (gamma_blue == 1.0)
- blue[i] = i << 8;
- else
- blue[i] = (CARD16)(pow((double)i/(double)(size - 1),
- 1. / (double)gamma_blue) * (double)(size - 1) * 256);
- }
-
- /* Default size is 256, so anything else is failure. */
- if (size != crtc->gamma_size) {
- free(red);
- return FALSE;
- }
-
- crtc->gamma_size = size;
- memcpy (crtc->gamma_red, red, crtc->gamma_size * sizeof (CARD16));
- memcpy (crtc->gamma_green, green, crtc->gamma_size * sizeof (CARD16));
- memcpy (crtc->gamma_blue, blue, crtc->gamma_size * sizeof (CARD16));
-
- /* Do not set gamma now, delay until the crtc is activated. */
-
- free(red);
-
- return TRUE;
-}
-
-static Bool
-xf86OutputSetInitialGamma(xf86OutputPtr output)
-{
- XF86ConfMonitorPtr mon = output->conf_monitor;
- float gamma_red = 1.0, gamma_green = 1.0, gamma_blue = 1.0;
-
- if (!mon)
- return TRUE;
-
- if (!output->crtc)
- return FALSE;
-
- /* Get configured values, where they exist. */
- if (mon->mon_gamma_red >= GAMMA_MIN &&
- mon->mon_gamma_red <= GAMMA_MAX)
- gamma_red = mon->mon_gamma_red;
-
- if (mon->mon_gamma_green >= GAMMA_MIN &&
- mon->mon_gamma_green <= GAMMA_MAX)
- gamma_green = mon->mon_gamma_green;
-
- if (mon->mon_gamma_blue >= GAMMA_MIN &&
- mon->mon_gamma_blue <= GAMMA_MAX)
- gamma_blue = mon->mon_gamma_blue;
-
- /* This avoids setting gamma 1.0 in case another cloned output on this crtc has a specific gamma. */
- if (gamma_red != 1.0 || gamma_green != 1.0 || gamma_blue != 1.0) {
- xf86DrvMsg(output->scrn->scrnIndex, X_INFO, "Output %s wants gamma correction (%.1f, %.1f, %.1f)\n", output->name, gamma_red, gamma_green, gamma_blue);
- return xf86CrtcSetInitialGamma(output->crtc, gamma_red, gamma_green, gamma_blue);
- }else
- return TRUE;
-}
-
-/**
- * Construct default screen configuration
- *
- * Given auto-detected (and, eventually, configured) values,
- * construct a usable configuration for the system
- *
- * canGrow indicates that the driver can resize the screen to larger than its
- * initially configured size via the config->funcs->resize hook. If TRUE, this
- * function will set virtualX and virtualY to match the initial configuration
- * and leave config->max{Width,Height} alone. If FALSE, it will bloat
- * virtual[XY] to include the largest modes and set config->max{Width,Height}
- * accordingly.
- */
-
-Bool
-xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
-{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- int o, c;
- xf86CrtcPtr *crtcs;
- DisplayModePtr *modes;
- Bool *enabled;
- int width, height;
- int i = scrn->scrnIndex;
- Bool have_outputs = TRUE;
- Bool ret;
-
- /* Set up the device options */
- config->options = xnfalloc (sizeof (xf86DeviceOptions));
- memcpy (config->options, xf86DeviceOptions, sizeof (xf86DeviceOptions));
- xf86ProcessOptions (scrn->scrnIndex,
- scrn->options,
- config->options);
- config->debug_modes = xf86ReturnOptValBool (config->options,
- OPTION_MODEDEBUG, FALSE);
-
- if (scrn->display->virtualX)
- width = scrn->display->virtualX;
- else
- width = config->maxWidth;
- if (scrn->display->virtualY)
- height = scrn->display->virtualY;
- else
- height = config->maxHeight;
-
- xf86ProbeOutputModes (scrn, width, height);
-
- crtcs = xnfcalloc (config->num_output, sizeof (xf86CrtcPtr));
- modes = xnfcalloc (config->num_output, sizeof (DisplayModePtr));
- enabled = xnfcalloc (config->num_output, sizeof (Bool));
-
- ret = xf86CollectEnabledOutputs(scrn, config, enabled);
- if (ret == FALSE && canGrow) {
- xf86DrvMsg(i, X_WARNING, "Unable to find connected outputs - setting %dx%d initial framebuffer\n",
- NO_OUTPUT_DEFAULT_WIDTH, NO_OUTPUT_DEFAULT_HEIGHT);
- have_outputs = FALSE;
- } else {
- if (xf86TargetUserpref(scrn, config, modes, enabled, width, height))
- xf86DrvMsg(i, X_INFO, "Using user preference for initial modes\n");
- else if (xf86TargetPreferred(scrn, config, modes, enabled, width, height))
- xf86DrvMsg(i, X_INFO, "Using exact sizes for initial modes\n");
- else if (xf86TargetAspect(scrn, config, modes, enabled, width, height))
- xf86DrvMsg(i, X_INFO, "Using fuzzy aspect match for initial modes\n");
- else if (xf86TargetFallback(scrn, config, modes, enabled, width, height))
- xf86DrvMsg(i, X_INFO, "Using sloppy heuristic for initial modes\n");
- else
- xf86DrvMsg(i, X_WARNING, "Unable to find initial modes\n");
- }
-
- for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
- if (!modes[o])
- xf86DrvMsg (scrn->scrnIndex, X_ERROR,
- "Output %s enabled but has no modes\n",
- config->output[o]->name);
- else
- xf86DrvMsg (scrn->scrnIndex, X_INFO,
- "Output %s using initial mode %s\n",
- config->output[o]->name, modes[o]->name);
- }
-
- /*
- * Set the position of each output
- */
- if (!xf86InitialOutputPositions (scrn, modes))
- {
- free(crtcs);
- free(modes);
- return FALSE;
- }
-
- /*
- * Set initial panning of each output
- */
- xf86InitialPanning (scrn);
-
- /*
- * Assign CRTCs to fit output configuration
- */
- if (have_outputs && !xf86PickCrtcs (scrn, crtcs, modes, 0, width, height))
- {
- free(crtcs);
- free(modes);
- return FALSE;
- }
-
- /* XXX override xf86 common frame computation code */
-
- scrn->display->frameX0 = 0;
- scrn->display->frameY0 = 0;
-
- for (c = 0; c < config->num_crtc; c++)
- {
- xf86CrtcPtr crtc = config->crtc[c];
-
- crtc->enabled = FALSE;
- memset (&crtc->desiredMode, '\0', sizeof (crtc->desiredMode));
- /* Set default gamma for all crtc's. */
- /* This is done to avoid problems later on with cloned outputs. */
- xf86CrtcSetInitialGamma(crtc, 1.0, 1.0, 1.0);
- }
-
- if (xf86_crtc_supports_gamma(scrn))
- xf86DrvMsg(scrn->scrnIndex, X_INFO, "Using default gamma of (1.0, 1.0, 1.0) unless otherwise stated.\n");
-
- /*
- * Set initial configuration
- */
- for (o = 0; o < config->num_output; o++)
- {
- xf86OutputPtr output = config->output[o];
- DisplayModePtr mode = modes[o];
- xf86CrtcPtr crtc = crtcs[o];
-
- if (mode && crtc)
- {
- crtc->desiredMode = *mode;
- crtc->desiredRotation = output->initial_rotation;
- crtc->desiredX = output->initial_x;
- crtc->desiredY = output->initial_y;
- crtc->desiredTransformPresent = FALSE;
- crtc->enabled = TRUE;
- memcpy (&crtc->panningTotalArea, &output->initialTotalArea, sizeof(BoxRec));
- memcpy (&crtc->panningTrackingArea, &output->initialTrackingArea, sizeof(BoxRec));
- memcpy (crtc->panningBorder, output->initialBorder, 4*sizeof(INT16));
- output->crtc = crtc;
- if (!xf86OutputSetInitialGamma(output))
- xf86DrvMsg (scrn->scrnIndex, X_WARNING, "Initial gamma correction for output %s: failed.\n", output->name);
- } else {
- output->crtc = NULL;
- }
- }
-
- if (scrn->display->virtualX == 0)
- {
- /*
- * Expand virtual size to cover the current config and potential mode
- * switches, if the driver can't enlarge the screen later.
- */
- xf86DefaultScreenLimits (scrn, &width, &height, canGrow);
-
- if (have_outputs == FALSE) {
- if (width < NO_OUTPUT_DEFAULT_WIDTH && height < NO_OUTPUT_DEFAULT_HEIGHT) {
- width = NO_OUTPUT_DEFAULT_WIDTH;
- height = NO_OUTPUT_DEFAULT_HEIGHT;
- }
- }
-
- scrn->display->virtualX = width;
- scrn->display->virtualY = height;
- }
-
- if (width > scrn->virtualX)
- scrn->virtualX = width;
- if (height > scrn->virtualY)
- scrn->virtualY = height;
-
- /*
- * Make sure the configuration isn't too small.
- */
- if (width < config->minWidth || height < config->minHeight)
- return FALSE;
-
- /*
- * Limit the crtc config to virtual[XY] if the driver can't grow the
- * desktop.
- */
- if (!canGrow)
- {
- xf86CrtcSetSizeRange (scrn, config->minWidth, config->minHeight,
- width, height);
- }
-
- if (have_outputs) {
- /* Mirror output modes to scrn mode list */
- xf86SetScrnInfoModes (scrn);
- } else {
- /* Clear any existing modes from scrn->modes */
- while (scrn->modes != NULL)
- xf86DeleteMode(&scrn->modes, scrn->modes);
- scrn->modes = xf86ModesAdd(scrn->modes,
- xf86CVTMode(width, height, 60, 0, 0));
- }
-
-
- free(crtcs);
- free(modes);
- return TRUE;
-}
-
-/*
- * Check the CRTC we're going to map each output to vs. it's current
- * CRTC. If they don't match, we have to disable the output and the CRTC
- * since the driver will have to re-route things.
- */
-static void
-xf86PrepareOutputs (ScrnInfoPtr scrn)
-{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- int o;
-
- for (o = 0; o < config->num_output; o++) {
- xf86OutputPtr output = config->output[o];
-#if RANDR_GET_CRTC_INTERFACE
- /* Disable outputs that are unused or will be re-routed */
- if (!output->funcs->get_crtc ||
- output->crtc != (*output->funcs->get_crtc)(output) ||
- output->crtc == NULL)
-#endif
- (*output->funcs->dpms)(output, DPMSModeOff);
- }
-}
-
-static void
-xf86PrepareCrtcs (ScrnInfoPtr scrn)
-{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- int c;
-
- for (c = 0; c < config->num_crtc; c++) {
-#if RANDR_GET_CRTC_INTERFACE
- xf86CrtcPtr crtc = config->crtc[c];
- xf86OutputPtr output = NULL;
- uint32_t desired_outputs = 0, current_outputs = 0;
- int o;
-
- for (o = 0; o < config->num_output; o++) {
- output = config->output[o];
- if (output->crtc == crtc)
- desired_outputs |= (1<<o);
- /* If we can't tell where it's mapped, force it off */
- if (!output->funcs->get_crtc) {
- desired_outputs = 0;
- break;
- }
- if ((*output->funcs->get_crtc)(output) == crtc)
- current_outputs |= (1<<o);
- }
-
- /*
- * If mappings are different or the CRTC is unused,
- * we need to disable it
- */
- if (desired_outputs != current_outputs ||
- !desired_outputs)
- (*crtc->funcs->dpms)(crtc, DPMSModeOff);
-#else
- (*crtc->funcs->dpms)(crtc, DPMSModeOff);
-#endif
- }
-}
-
-/*
- * Using the desired mode information in each crtc, set
- * modes (used in EnterVT functions, or at server startup)
- */
-
-Bool
-xf86SetDesiredModes (ScrnInfoPtr scrn)
-{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- xf86CrtcPtr crtc = config->crtc[0];
- int c;
-
- /* A driver with this hook will take care of this */
- if (!crtc->funcs->set_mode_major) {
- xf86PrepareOutputs(scrn);
- xf86PrepareCrtcs(scrn);
- }
-
- for (c = 0; c < config->num_crtc; c++)
- {
- xf86OutputPtr output = NULL;
- xf86CrtcSetRec set;
- int o;
- RRTransformPtr transform;
-
- crtc = config->crtc[c];
-
- /* Skip disabled CRTCs */
- if (!crtc->enabled)
- continue;
-
- if (xf86CompatOutput(scrn) && xf86CompatCrtc(scrn) == crtc)
- output = xf86CompatOutput(scrn);
- else
- {
- for (o = 0; o < config->num_output; o++)
- if (config->output[o]->crtc == crtc)
- {
- output = config->output[o];
- break;
- }
- }
- /* paranoia */
- if (!output)
- continue;
-
- /* Mark that we'll need to re-set the mode for sure */
- memset(&crtc->mode, 0, sizeof(crtc->mode));
- if (!crtc->desiredMode.CrtcHDisplay)
- {
- DisplayModePtr mode = xf86OutputFindClosestMode (output, scrn->currentMode);
-
- if (!mode)
- return FALSE;
- crtc->desiredMode = *mode;
- crtc->desiredRotation = RR_Rotate_0;
- crtc->desiredTransformPresent = FALSE;
- crtc->desiredX = 0;
- crtc->desiredY = 0;
- }
-
- if (crtc->desiredTransformPresent)
- transform = &crtc->desiredTransform;
- else
- transform = NULL;
- set.mode = &crtc->desiredMode;
- set.rotation = crtc->desiredRotation;
- set.transform = transform;
- set.x = crtc->desiredX;
- set.y = crtc->desiredY;
- set.flags = (XF86CrtcSetMode | XF86CrtcSetOutput |
- XF86CrtcSetOrigin | XF86CrtcSetTransform |
- XF86CrtcSetRotation);
- if (!xf86CrtcSet(crtc, &set))
- return FALSE;
- }
-
- xf86DisableUnusedFunctions(scrn);
- return TRUE;
-}
-
-/**
- * In the current world order, there are lists of modes per output, which may
- * or may not include the mode that was asked to be set by XFree86's mode
- * selection. Find the closest one, in the following preference order:
- *
- * - Equality
- * - Closer in size to the requested mode, but no larger
- * - Closer in refresh rate to the requested mode.
- */
-
-DisplayModePtr
-xf86OutputFindClosestMode (xf86OutputPtr output, DisplayModePtr desired)
-{
- DisplayModePtr best = NULL, scan = NULL;
-
- for (scan = output->probed_modes; scan != NULL; scan = scan->next)
- {
- /* If there's an exact match, we're done. */
- if (xf86ModesEqual(scan, desired)) {
- best = desired;
- break;
- }
-
- /* Reject if it's larger than the desired mode. */
- if (scan->HDisplay > desired->HDisplay ||
- scan->VDisplay > desired->VDisplay)
- {
- continue;
- }
-
- /*
- * If we haven't picked a best mode yet, use the first
- * one in the size range
- */
- if (best == NULL)
- {
- best = scan;
- continue;
- }
-
- /* Find if it's closer to the right size than the current best
- * option.
- */
- if ((scan->HDisplay > best->HDisplay &&
- scan->VDisplay >= best->VDisplay) ||
- (scan->HDisplay >= best->HDisplay &&
- scan->VDisplay > best->VDisplay))
- {
- best = scan;
- continue;
- }
-
- /* Find if it's still closer to the right refresh than the current
- * best resolution.
- */
- if (scan->HDisplay == best->HDisplay &&
- scan->VDisplay == best->VDisplay &&
- (fabs(scan->VRefresh - desired->VRefresh) <
- fabs(best->VRefresh - desired->VRefresh))) {
- best = scan;
- }
- }
- return best;
-}
-
-/**
- * When setting a mode through XFree86-VidModeExtension or XFree86-DGA,
- * take the specified mode and apply it to the crtc connected to the compat
- * output. Then, find similar modes for the other outputs, as with the
- * InitialConfiguration code above. The goal is to clone the desired
- * mode across all outputs that are currently active.
- */
-
-Bool
-xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation)
-{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
- Bool ok = TRUE;
- xf86OutputPtr compat_output;
- DisplayModePtr compat_mode = NULL;
- int c;
-
- /*
- * Let the compat output drive the final mode selection
- */
- compat_output = xf86CompatOutput(pScrn);
- if (compat_output)
- compat_mode = xf86OutputFindClosestMode (compat_output, desired);
- if (compat_mode)
- desired = compat_mode;
-
- for (c = 0; c < config->num_crtc; c++)
- {
- xf86CrtcPtr crtc = config->crtc[c];
- DisplayModePtr crtc_mode = NULL;
- int o;
- xf86CrtcSetRec set;
-
- if (!crtc->enabled)
- continue;
-
- for (o = 0; o < config->num_output; o++)
- {
- xf86OutputPtr output = config->output[o];
- DisplayModePtr output_mode;
-
- /* skip outputs not on this crtc */
- if (output->crtc != crtc)
- continue;
-
- if (crtc_mode)
- {
- output_mode = xf86OutputFindClosestMode (output, crtc_mode);
- if (output_mode != crtc_mode)
- output->crtc = NULL;
- }
- else
- crtc_mode = xf86OutputFindClosestMode (output, desired);
- }
- if (!crtc_mode)
- {
- crtc->enabled = FALSE;
- continue;
- }
- set.mode = crtc_mode;
- set.rotation = rotation;
- set.transform = NULL;
- set.x = 0;
- set.y = 0;
- set.flags = (XF86CrtcSetMode | XF86CrtcSetOutput |
- XF86CrtcSetOrigin | XF86CrtcSetTransform |
- XF86CrtcSetRotation);
- if (!xf86CrtcSet (crtc, &set))
- ok = FALSE;
- else
- {
- crtc->desiredMode = *crtc_mode;
- crtc->desiredRotation = rotation;
- crtc->desiredTransformPresent = FALSE;
- crtc->desiredX = 0;
- crtc->desiredY = 0;
- }
- }
- xf86DisableUnusedFunctions(pScrn);
-#ifdef RANDR_12_INTERFACE
- xf86RandR12TellChanged (pScrn->pScreen);
-#endif
- return ok;
-}
-
-
-/**
- * Set the DPMS power mode of all outputs and CRTCs.
- *
- * If the new mode is off, it will turn off outputs and then CRTCs.
- * Otherwise, it will affect CRTCs before outputs.
- */
-void
-xf86DPMSSet(ScrnInfoPtr scrn, int mode, int flags)
-{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- int i;
-
- if (!scrn->vtSema)
- return;
-
- if (mode == DPMSModeOff) {
- for (i = 0; i < config->num_output; i++) {
- xf86OutputPtr output = config->output[i];
- if (output->crtc != NULL)
- (*output->funcs->dpms) (output, mode);
- }
- }
-
- for (i = 0; i < config->num_crtc; i++) {
- xf86CrtcPtr crtc = config->crtc[i];
- if (crtc->enabled)
- (*crtc->funcs->dpms) (crtc, mode);
- }
-
- if (mode != DPMSModeOff) {
- for (i = 0; i < config->num_output; i++) {
- xf86OutputPtr output = config->output[i];
- if (output->crtc != NULL)
- (*output->funcs->dpms) (output, mode);
- }
- }
-}
-
-/**
- * Implement the screensaver by just calling down into the driver DPMS hooks.
- *
- * Even for monitors with no DPMS support, by the definition of our DPMS hooks,
- * the outputs will still get disabled (blanked).
- */
-Bool
-xf86SaveScreen(ScreenPtr pScreen, int mode)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-
- if (xf86IsUnblank(mode))
- xf86DPMSSet(pScrn, DPMSModeOn, 0);
- else
- xf86DPMSSet(pScrn, DPMSModeOff, 0);
-
- return TRUE;
-}
-
-/**
- * Disable all inactive crtcs and outputs
- */
-void
-xf86DisableUnusedFunctions(ScrnInfoPtr pScrn)
-{
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
- int o, c;
-
- for (o = 0; o < xf86_config->num_output; o++)
- {
- xf86OutputPtr output = xf86_config->output[o];
- if (!output->crtc)
- (*output->funcs->dpms)(output, DPMSModeOff);
- }
-
- for (c = 0; c < xf86_config->num_crtc; c++)
- {
- xf86CrtcPtr crtc = xf86_config->crtc[c];
-
- if (!crtc->enabled)
- {
- crtc->funcs->dpms(crtc, DPMSModeOff);
- memset(&crtc->mode, 0, sizeof(crtc->mode));
- xf86RotateDestroy(crtc);
- crtc->active = FALSE;
- }
- }
- if (pScrn->pScreen)
- xf86_crtc_notify(pScrn->pScreen);
- if (pScrn->ModeSet)
- pScrn->ModeSet(pScrn);
-}
-
-#ifdef RANDR_12_INTERFACE
-
-#define EDID_ATOM_NAME "EDID"
-
-/**
- * Set the RandR EDID property
- */
-static void
-xf86OutputSetEDIDProperty (xf86OutputPtr output, void *data, int data_len)
-{
- Atom edid_atom = MakeAtom(EDID_ATOM_NAME, sizeof(EDID_ATOM_NAME) - 1, TRUE);
-
- /* This may get called before the RandR resources have been created */
- if (output->randr_output == NULL)
- return;
-
- if (data_len != 0) {
- RRChangeOutputProperty(output->randr_output, edid_atom, XA_INTEGER, 8,
- PropModeReplace, data_len, data, FALSE, TRUE);
- } else {
- RRDeleteOutputProperty(output->randr_output, edid_atom);
- }
-}
-
-#endif
-
-/* Pull out a phyiscal size from a detailed timing if available. */
-struct det_phySize_parameter {
- xf86OutputPtr output;
- ddc_quirk_t quirks;
- Bool ret;
-};
-
-static void handle_detailed_physical_size(struct detailed_monitor_section
- *det_mon, void *data)
-{
- struct det_phySize_parameter *p;
- p = (struct det_phySize_parameter *)data;
-
- if (p->ret == TRUE )
- return ;
-
- xf86DetTimingApplyQuirks(det_mon, p->quirks,
- p->output->MonInfo->features.hsize,
- p->output->MonInfo->features.vsize);
- if (det_mon->type == DT &&
- det_mon->section.d_timings.h_size != 0 &&
- det_mon->section.d_timings.v_size != 0) {
-
- p->output->mm_width = det_mon->section.d_timings.h_size;
- p->output->mm_height = det_mon->section.d_timings.v_size;
- p->ret = TRUE;
- }
-}
-
-/**
- * Set the EDID information for the specified output
- */
-void
-xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon)
-{
- ScrnInfoPtr scrn = output->scrn;
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- Bool debug_modes = config->debug_modes || xf86Initialising;
-#ifdef RANDR_12_INTERFACE
- int size;
-#endif
-
- free(output->MonInfo);
-
- output->MonInfo = edid_mon;
- output->mm_width = 0;
- output->mm_height = 0;
-
- if (debug_modes) {
- xf86DrvMsg(scrn->scrnIndex, X_INFO, "EDID for output %s\n",
- output->name);
- xf86PrintEDID(edid_mon);
- }
-
- /* Set the DDC properties for the 'compat' output */
- if (output == xf86CompatOutput(scrn))
- xf86SetDDCproperties(scrn, edid_mon);
-
-#ifdef RANDR_12_INTERFACE
- /* Set the RandR output properties */
- size = 0;
- if (edid_mon)
- {
- if (edid_mon->ver.version == 1) {
- size = 128;
- if (edid_mon->flags & EDID_COMPLETE_RAWDATA)
- size += edid_mon->no_sections * 128;
- } else if (edid_mon->ver.version == 2)
- size = 256;
- }
- xf86OutputSetEDIDProperty (output, edid_mon ? edid_mon->rawData : NULL, size);
-#endif
-
- if (edid_mon) {
-
- struct det_phySize_parameter p;
- p.output = output;
- p.quirks = xf86DDCDetectQuirks(scrn->scrnIndex,edid_mon, FALSE);
- p.ret = FALSE;
- xf86ForEachDetailedBlock(edid_mon,
- handle_detailed_physical_size, &p);
-
- /* if no mm size is available from a detailed timing, check the max size field */
- if ((!output->mm_width || !output->mm_height) &&
- (edid_mon->features.hsize && edid_mon->features.vsize))
- {
- output->mm_width = edid_mon->features.hsize * 10;
- output->mm_height = edid_mon->features.vsize * 10;
- }
- }
-}
-
-/**
- * Return the list of modes supported by the EDID information
- * stored in 'output'
- */
-DisplayModePtr
-xf86OutputGetEDIDModes (xf86OutputPtr output)
-{
- ScrnInfoPtr scrn = output->scrn;
- xf86MonPtr edid_mon = output->MonInfo;
-
- if (!edid_mon)
- return NULL;
- return xf86DDCGetModes(scrn->scrnIndex, edid_mon);
-}
-
-/* maybe we should care about DDC1? meh. */
-xf86MonPtr
-xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus)
-{
- ScrnInfoPtr scrn = output->scrn;
- xf86MonPtr mon;
-
- mon = xf86DoEEDID(scrn->scrnIndex, pDDCBus, TRUE);
- if (mon)
- xf86DDCApplyQuirks(scrn->scrnIndex, mon);
-
- return mon;
-}
-
-static char *_xf86ConnectorNames[] = {
- "None", "VGA", "DVI-I", "DVI-D",
- "DVI-A", "Composite", "S-Video",
- "Component", "LFP", "Proprietary",
- "HDMI", "DisplayPort",
- };
-char *
-xf86ConnectorGetName(xf86ConnectorType connector)
-{
- return _xf86ConnectorNames[connector];
-}
-
-static void
-x86_crtc_box_intersect(BoxPtr dest, BoxPtr a, BoxPtr b)
-{
- dest->x1 = a->x1 > b->x1 ? a->x1 : b->x1;
- dest->x2 = a->x2 < b->x2 ? a->x2 : b->x2;
- dest->y1 = a->y1 > b->y1 ? a->y1 : b->y1;
- dest->y2 = a->y2 < b->y2 ? a->y2 : b->y2;
-
- if (dest->x1 >= dest->x2 || dest->y1 >= dest->y2)
- dest->x1 = dest->x2 = dest->y1 = dest->y2 = 0;
-}
-
-static void
-x86_crtc_box(xf86CrtcPtr crtc, BoxPtr crtc_box)
-{
- if (crtc->enabled) {
- crtc_box->x1 = crtc->x;
- crtc_box->x2 = crtc->x + xf86ModeWidth(&crtc->mode, crtc->rotation);
- crtc_box->y1 = crtc->y;
- crtc_box->y2 = crtc->y + xf86ModeHeight(&crtc->mode, crtc->rotation);
- } else
- crtc_box->x1 = crtc_box->x2 = crtc_box->y1 = crtc_box->y2 = 0;
-}
-
-static int
-xf86_crtc_box_area(BoxPtr box)
-{
- return (int) (box->x2 - box->x1) * (int) (box->y2 - box->y1);
-}
-
-/*
- * Return the crtc covering 'box'. If two crtcs cover a portion of
- * 'box', then prefer 'desired'. If 'desired' is NULL, then prefer the crtc
- * with greater coverage
- */
-
-static xf86CrtcPtr
-xf86_covering_crtc(ScrnInfoPtr pScrn,
- BoxPtr box,
- xf86CrtcPtr desired,
- BoxPtr crtc_box_ret)
-{
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
- xf86CrtcPtr crtc, best_crtc;
- int coverage, best_coverage;
- int c;
- BoxRec crtc_box, cover_box;
-
- best_crtc = NULL;
- best_coverage = 0;
- crtc_box_ret->x1 = 0;
- crtc_box_ret->x2 = 0;
- crtc_box_ret->y1 = 0;
- crtc_box_ret->y2 = 0;
- for (c = 0; c < xf86_config->num_crtc; c++) {
- crtc = xf86_config->crtc[c];
- x86_crtc_box(crtc, &crtc_box);
- x86_crtc_box_intersect(&cover_box, &crtc_box, box);
- coverage = xf86_crtc_box_area(&cover_box);
- if (coverage && crtc == desired) {
- *crtc_box_ret = crtc_box;
- return crtc;
- } else if (coverage > best_coverage) {
- *crtc_box_ret = crtc_box;
- best_crtc = crtc;
- best_coverage = coverage;
- }
- }
- return best_crtc;
-}
-
-/*
- * For overlay video, compute the relevant CRTC and
- * clip video to that.
- *
- * returning FALSE means there was a memory failure of some kind,
- * not that the video shouldn't be displayed
- */
-
-Bool
-xf86_crtc_clip_video_helper(ScrnInfoPtr pScrn,
- xf86CrtcPtr *crtc_ret,
- xf86CrtcPtr desired_crtc,
- BoxPtr dst,
- INT32 *xa,
- INT32 *xb,
- INT32 *ya,
- INT32 *yb,
- RegionPtr reg,
- INT32 width,
- INT32 height)
-{
- Bool ret;
- RegionRec crtc_region_local;
- RegionPtr crtc_region = reg;
-
- if (crtc_ret) {
- BoxRec crtc_box;
- xf86CrtcPtr crtc = xf86_covering_crtc(pScrn, dst,
- desired_crtc,
- &crtc_box);
-
- if (crtc) {
- RegionInit(&crtc_region_local, &crtc_box, 1);
- crtc_region = &crtc_region_local;
- RegionIntersect(crtc_region, crtc_region, reg);
- }
- *crtc_ret = crtc;
- }
-
- ret = xf86XVClipVideoHelper(dst, xa, xb, ya, yb,
- crtc_region, width, height);
-
- if (crtc_region != reg)
- RegionUninit(&crtc_region_local);
-
- return ret;
-}
-
-xf86_crtc_notify_proc_ptr
-xf86_wrap_crtc_notify (ScreenPtr screen, xf86_crtc_notify_proc_ptr new)
-{
- if (xf86CrtcConfigPrivateIndex != -1)
- {
- ScrnInfoPtr scrn = xf86Screens[screen->myNum];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- xf86_crtc_notify_proc_ptr old;
-
- old = config->xf86_crtc_notify;
- config->xf86_crtc_notify = new;
- return old;
- }
- return NULL;
-}
-
-void
-xf86_unwrap_crtc_notify(ScreenPtr screen, xf86_crtc_notify_proc_ptr old)
-{
- if (xf86CrtcConfigPrivateIndex != -1)
- {
- ScrnInfoPtr scrn = xf86Screens[screen->myNum];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
-
- config->xf86_crtc_notify = old;
- }
-}
-
-void
-xf86_crtc_notify(ScreenPtr screen)
-{
- ScrnInfoPtr scrn = xf86Screens[screen->myNum];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
-
- if (config->xf86_crtc_notify)
- config->xf86_crtc_notify(screen);
-}
-
-Bool
-xf86_crtc_supports_gamma(ScrnInfoPtr pScrn)
-{
- if (xf86CrtcConfigPrivateIndex != -1) {
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
- xf86CrtcPtr crtc;
-
- /* for multiple drivers loaded we need this */
- if (!xf86_config)
- return FALSE;
- if (xf86_config->num_crtc == 0)
- return FALSE;
- crtc = xf86_config->crtc[0];
-
- return crtc->funcs->gamma_set != NULL;
- }
-
- return FALSE;
-}
+/*
+ * Copyright © 2006 Keith Packard
+ * Copyright © 2008 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#else
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#endif
+
+#include <stddef.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "xf86.h"
+#include "xf86DDC.h"
+#include "xf86Crtc.h"
+#include "xf86Modes.h"
+#include "xf86Priv.h"
+#include "xf86RandR12.h"
+#include "X11/extensions/render.h"
+#include "X11/extensions/dpmsconst.h"
+#include "X11/Xatom.h"
+#include "picturestr.h"
+
+#include "xf86xv.h"
+
+#define NO_OUTPUT_DEFAULT_WIDTH 1024
+#define NO_OUTPUT_DEFAULT_HEIGHT 768
+/*
+ * Initialize xf86CrtcConfig structure
+ */
+
+int xf86CrtcConfigPrivateIndex = -1;
+
+void
+xf86CrtcConfigInit (ScrnInfoPtr scrn,
+ const xf86CrtcConfigFuncsRec *funcs)
+{
+ xf86CrtcConfigPtr config;
+
+ if (xf86CrtcConfigPrivateIndex == -1)
+ xf86CrtcConfigPrivateIndex = xf86AllocateScrnInfoPrivateIndex();
+ config = xnfcalloc (1, sizeof (xf86CrtcConfigRec));
+
+ config->funcs = funcs;
+
+ scrn->privates[xf86CrtcConfigPrivateIndex].ptr = config;
+}
+
+void
+xf86CrtcSetSizeRange (ScrnInfoPtr scrn,
+ int minWidth, int minHeight,
+ int maxWidth, int maxHeight)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ config->minWidth = minWidth;
+ config->minHeight = minHeight;
+ config->maxWidth = maxWidth;
+ config->maxHeight = maxHeight;
+}
+
+/*
+ * Crtc functions
+ */
+xf86CrtcPtr
+xf86CrtcCreate (ScrnInfoPtr scrn,
+ const xf86CrtcFuncsRec *funcs)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CrtcPtr crtc, *crtcs;
+
+ crtc = calloc(sizeof (xf86CrtcRec), 1);
+ if (!crtc)
+ return NULL;
+ crtc->version = XF86_CRTC_VERSION;
+ crtc->scrn = scrn;
+ crtc->funcs = funcs;
+#ifdef RANDR_12_INTERFACE
+ crtc->randr_crtc = NULL;
+#endif
+ crtc->rotation = RR_Rotate_0;
+ crtc->desiredRotation = RR_Rotate_0;
+ pixman_transform_init_identity (&crtc->crtc_to_framebuffer);
+ pixman_f_transform_init_identity (&crtc->f_crtc_to_framebuffer);
+ pixman_f_transform_init_identity (&crtc->f_framebuffer_to_crtc);
+ crtc->filter = NULL;
+ crtc->params = NULL;
+ crtc->nparams = 0;
+ crtc->filter_width = 0;
+ crtc->filter_height = 0;
+ crtc->transform_in_use = FALSE;
+ crtc->transformPresent = FALSE;
+ crtc->desiredTransformPresent = FALSE;
+ memset (&crtc->bounds, '\0', sizeof (crtc->bounds));
+
+ /* Preallocate gamma at a sensible size. */
+ crtc->gamma_size = 256;
+ crtc->gamma_red = malloc(3 * crtc->gamma_size * sizeof (CARD16));
+ if (!crtc->gamma_red) {
+ free(crtc);
+ return NULL;
+ }
+ crtc->gamma_green = crtc->gamma_red + crtc->gamma_size;
+ crtc->gamma_blue = crtc->gamma_green + crtc->gamma_size;
+
+ if (xf86_config->crtc)
+ crtcs = realloc(xf86_config->crtc,
+ (xf86_config->num_crtc + 1) * sizeof (xf86CrtcPtr));
+ else
+ crtcs = malloc((xf86_config->num_crtc + 1) * sizeof (xf86CrtcPtr));
+ if (!crtcs)
+ {
+ free(crtc);
+ return NULL;
+ }
+ xf86_config->crtc = crtcs;
+ xf86_config->crtc[xf86_config->num_crtc++] = crtc;
+ return crtc;
+}
+
+void
+xf86CrtcDestroy (xf86CrtcPtr crtc)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
+ int c;
+
+ (*crtc->funcs->destroy) (crtc);
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ if (xf86_config->crtc[c] == crtc)
+ {
+ memmove (&xf86_config->crtc[c],
+ &xf86_config->crtc[c+1],
+ ((xf86_config->num_crtc - (c + 1)) * sizeof(void*)));
+ xf86_config->num_crtc--;
+ break;
+ }
+ free(crtc->params);
+ free(crtc->gamma_red);
+ free(crtc);
+}
+
+
+/**
+ * Return whether any outputs are connected to the specified pipe
+ */
+
+Bool
+xf86CrtcInUse (xf86CrtcPtr crtc)
+{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int o;
+
+ for (o = 0; o < xf86_config->num_output; o++)
+ if (xf86_config->output[o]->crtc == crtc)
+ return TRUE;
+ return FALSE;
+}
+
+void
+xf86CrtcSetScreenSubpixelOrder (ScreenPtr pScreen)
+{
+ int subpixel_order = SubPixelUnknown;
+ Bool has_none = FALSE;
+ ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c, o;
+
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ for (o = 0; o < xf86_config->num_output; o++)
+ {
+ xf86OutputPtr output = xf86_config->output[o];
+
+ if (output->crtc == crtc)
+ {
+ switch (output->subpixel_order) {
+ case SubPixelNone:
+ has_none = TRUE;
+ break;
+ case SubPixelUnknown:
+ break;
+ default:
+ subpixel_order = output->subpixel_order;
+ break;
+ }
+ }
+ if (subpixel_order != SubPixelUnknown)
+ break;
+ }
+ if (subpixel_order != SubPixelUnknown)
+ {
+ static const int circle[4] = {
+ SubPixelHorizontalRGB,
+ SubPixelVerticalRGB,
+ SubPixelHorizontalBGR,
+ SubPixelVerticalBGR,
+ };
+ int rotate;
+ int c;
+ for (rotate = 0; rotate < 4; rotate++)
+ if (crtc->rotation & (1 << rotate))
+ break;
+ for (c = 0; c < 4; c++)
+ if (circle[c] == subpixel_order)
+ break;
+ c = (c + rotate) & 0x3;
+ if ((crtc->rotation & RR_Reflect_X) && !(c & 1))
+ c ^= 2;
+ if ((crtc->rotation & RR_Reflect_Y) && (c & 1))
+ c ^= 2;
+ subpixel_order = circle[c];
+ break;
+ }
+ }
+ if (subpixel_order == SubPixelUnknown && has_none)
+ subpixel_order = SubPixelNone;
+ PictureSetSubpixelOrder (pScreen, subpixel_order);
+}
+
+/**
+ * Sets the given video mode on the given crtc
+ */
+Bool
+xf86CrtcSetModeTransform (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
+ RRTransformPtr transform, int x, int y)
+{
+ ScrnInfoPtr scrn = crtc->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int i;
+ Bool ret = FALSE;
+ Bool didLock = FALSE;
+ DisplayModePtr adjusted_mode;
+ DisplayModeRec saved_mode;
+ int saved_x, saved_y;
+ Rotation saved_rotation;
+ RRTransformRec saved_transform;
+ Bool saved_transform_present;
+
+ crtc->enabled = xf86CrtcInUse (crtc);
+
+ /* We only hit this if someone explicitly sends a "disabled" modeset. */
+ if (!crtc->enabled)
+ {
+ /* Check everything for stuff that should be off. */
+ xf86DisableUnusedFunctions(scrn);
+ return TRUE;
+ }
+
+ adjusted_mode = xf86DuplicateMode(mode);
+
+
+ saved_mode = crtc->mode;
+ saved_x = crtc->x;
+ saved_y = crtc->y;
+ saved_rotation = crtc->rotation;
+ if (crtc->transformPresent) {
+ RRTransformInit (&saved_transform);
+ RRTransformCopy (&saved_transform, &crtc->transform);
+ }
+ saved_transform_present = crtc->transformPresent;
+
+ /* Update crtc values up front so the driver can rely on them for mode
+ * setting.
+ */
+ crtc->mode = *mode;
+ crtc->x = x;
+ crtc->y = y;
+ crtc->rotation = rotation;
+ if (transform) {
+ RRTransformCopy (&crtc->transform, transform);
+ crtc->transformPresent = TRUE;
+ } else
+ crtc->transformPresent = FALSE;
+
+ if (crtc->funcs->set_mode_major) {
+ ret = crtc->funcs->set_mode_major(crtc, mode, rotation, x, y);
+ goto done;
+ }
+
+ didLock = crtc->funcs->lock (crtc);
+ /* Pass our mode to the outputs and the CRTC to give them a chance to
+ * adjust it according to limitations or output properties, and also
+ * a chance to reject the mode entirely.
+ */
+ for (i = 0; i < xf86_config->num_output; i++) {
+ xf86OutputPtr output = xf86_config->output[i];
+
+ if (output->crtc != crtc)
+ continue;
+
+ if (!output->funcs->mode_fixup(output, mode, adjusted_mode)) {
+ goto done;
+ }
+ }
+
+ if (!crtc->funcs->mode_fixup(crtc, mode, adjusted_mode)) {
+ goto done;
+ }
+
+ if (!xf86CrtcRotate (crtc))
+ goto done;
+
+ /* Prepare the outputs and CRTCs before setting the mode. */
+ for (i = 0; i < xf86_config->num_output; i++) {
+ xf86OutputPtr output = xf86_config->output[i];
+
+ if (output->crtc != crtc)
+ continue;
+
+ /* Disable the output as the first thing we do. */
+ output->funcs->prepare(output);
+ }
+
+ crtc->funcs->prepare(crtc);
+
+ /* Set up the DPLL and any output state that needs to adjust or depend
+ * on the DPLL.
+ */
+ crtc->funcs->mode_set(crtc, mode, adjusted_mode, crtc->x, crtc->y);
+ for (i = 0; i < xf86_config->num_output; i++)
+ {
+ xf86OutputPtr output = xf86_config->output[i];
+ if (output->crtc == crtc)
+ output->funcs->mode_set(output, mode, adjusted_mode);
+ }
+
+ /* Only upload when needed, to avoid unneeded delays. */
+ if (!crtc->active && crtc->funcs->gamma_set)
+ crtc->funcs->gamma_set(crtc, crtc->gamma_red, crtc->gamma_green,
+ crtc->gamma_blue, crtc->gamma_size);
+
+ /* Now, enable the clocks, plane, pipe, and outputs that we set up. */
+ crtc->funcs->commit(crtc);
+ for (i = 0; i < xf86_config->num_output; i++)
+ {
+ xf86OutputPtr output = xf86_config->output[i];
+ if (output->crtc == crtc)
+ output->funcs->commit(output);
+ }
+
+ ret = TRUE;
+
+done:
+ if (ret) {
+ crtc->active = TRUE;
+ if (scrn->pScreen)
+ xf86CrtcSetScreenSubpixelOrder (scrn->pScreen);
+ if (scrn->ModeSet)
+ scrn->ModeSet(scrn);
+ } else {
+ crtc->x = saved_x;
+ crtc->y = saved_y;
+ crtc->rotation = saved_rotation;
+ crtc->mode = saved_mode;
+ if (saved_transform_present)
+ RRTransformCopy (&crtc->transform, &saved_transform);
+ crtc->transformPresent = saved_transform_present;
+ }
+
+ free(adjusted_mode->name);
+ free(adjusted_mode);
+
+ if (didLock)
+ crtc->funcs->unlock (crtc);
+
+ return ret;
+}
+
+/**
+ * Sets the given video mode on the given crtc, but without providing
+ * a transform
+ */
+Bool
+xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
+ int x, int y)
+{
+ return xf86CrtcSetModeTransform (crtc, mode, rotation, NULL, x, y);
+}
+
+/**
+ * Pans the screen, does not change the mode
+ */
+void
+xf86CrtcSetOrigin (xf86CrtcPtr crtc, int x, int y)
+{
+ ScrnInfoPtr scrn = crtc->scrn;
+
+ crtc->x = x;
+ crtc->y = y;
+ if (crtc->funcs->set_origin) {
+ if (!xf86CrtcRotate (crtc))
+ return;
+ crtc->funcs->set_origin (crtc, x, y);
+ if (scrn->ModeSet)
+ scrn->ModeSet(scrn);
+ }
+ else
+ xf86CrtcSetMode (crtc, &crtc->mode, crtc->rotation, x, y);
+}
+
+/*
+ * Output functions
+ */
+
+extern XF86ConfigPtr xf86configptr;
+
+typedef enum {
+ OPTION_PREFERRED_MODE,
+ OPTION_POSITION,
+ OPTION_BELOW,
+ OPTION_RIGHT_OF,
+ OPTION_ABOVE,
+ OPTION_LEFT_OF,
+ OPTION_ENABLE,
+ OPTION_DISABLE,
+ OPTION_MIN_CLOCK,
+ OPTION_MAX_CLOCK,
+ OPTION_IGNORE,
+ OPTION_ROTATE,
+ OPTION_PANNING,
+ OPTION_PRIMARY,
+ OPTION_DEFAULT_MODES,
+} OutputOpts;
+
+static OptionInfoRec xf86OutputOptions[] = {
+ {OPTION_PREFERRED_MODE, "PreferredMode", OPTV_STRING, {0}, FALSE },
+ {OPTION_POSITION, "Position", OPTV_STRING, {0}, FALSE },
+ {OPTION_BELOW, "Below", OPTV_STRING, {0}, FALSE },
+ {OPTION_RIGHT_OF, "RightOf", OPTV_STRING, {0}, FALSE },
+ {OPTION_ABOVE, "Above", OPTV_STRING, {0}, FALSE },
+ {OPTION_LEFT_OF, "LeftOf", OPTV_STRING, {0}, FALSE },
+ {OPTION_ENABLE, "Enable", OPTV_BOOLEAN, {0}, FALSE },
+ {OPTION_DISABLE, "Disable", OPTV_BOOLEAN, {0}, FALSE },
+ {OPTION_MIN_CLOCK, "MinClock", OPTV_FREQ, {0}, FALSE },
+ {OPTION_MAX_CLOCK, "MaxClock", OPTV_FREQ, {0}, FALSE },
+ {OPTION_IGNORE, "Ignore", OPTV_BOOLEAN, {0}, FALSE },
+ {OPTION_ROTATE, "Rotate", OPTV_STRING, {0}, FALSE },
+ {OPTION_PANNING, "Panning", OPTV_STRING, {0}, FALSE },
+ {OPTION_PRIMARY, "Primary", OPTV_BOOLEAN, {0}, FALSE },
+ {OPTION_DEFAULT_MODES, "DefaultModes", OPTV_BOOLEAN, {0}, FALSE },
+ {-1, NULL, OPTV_NONE, {0}, FALSE },
+};
+
+enum {
+ OPTION_MODEDEBUG,
+};
+
+static OptionInfoRec xf86DeviceOptions[] = {
+ {OPTION_MODEDEBUG, "ModeDebug", OPTV_BOOLEAN, {0}, FALSE },
+ {-1, NULL, OPTV_NONE, {0}, FALSE },
+};
+
+static void
+xf86OutputSetMonitor (xf86OutputPtr output)
+{
+ char *option_name;
+ char *monitor;
+
+ if (!output->name)
+ return;
+
+ free(output->options);
+
+ output->options = xnfalloc (sizeof (xf86OutputOptions));
+ memcpy (output->options, xf86OutputOptions, sizeof (xf86OutputOptions));
+
+ XNFasprintf(&option_name, "monitor-%s", output->name);
+ monitor = xf86findOptionValue (output->scrn->options, option_name);
+ if (!monitor)
+ monitor = output->name;
+ else
+ xf86MarkOptionUsedByName (output->scrn->options, option_name);
+ free(option_name);
+ output->conf_monitor = xf86findMonitor (monitor,
+ xf86configptr->conf_monitor_lst);
+ /*
+ * Find the monitor section of the screen and use that
+ */
+ if (!output->conf_monitor && output->use_screen_monitor)
+ output->conf_monitor = xf86findMonitor (output->scrn->monitor->id,
+ xf86configptr->conf_monitor_lst);
+ if (output->conf_monitor)
+ {
+ xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
+ "Output %s using monitor section %s\n",
+ output->name, output->conf_monitor->mon_identifier);
+ xf86ProcessOptions (output->scrn->scrnIndex,
+ output->conf_monitor->mon_option_lst,
+ output->options);
+ }
+ else
+ xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
+ "Output %s has no monitor section\n",
+ output->name);
+}
+
+static Bool
+xf86OutputEnabled (xf86OutputPtr output, Bool strict)
+{
+ Bool enable, disable;
+
+ /* check to see if this output was enabled in the config file */
+ if (xf86GetOptValBool (output->options, OPTION_ENABLE, &enable) && enable)
+ {
+ xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
+ "Output %s enabled by config file\n", output->name);
+ return TRUE;
+ }
+ /* or if this output was disabled in the config file */
+ if (xf86GetOptValBool (output->options, OPTION_DISABLE, &disable) && disable)
+ {
+ xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
+ "Output %s disabled by config file\n", output->name);
+ return FALSE;
+ }
+
+ /* If not, try to only light up the ones we know are connected */
+ if (strict) {
+ enable = output->status == XF86OutputStatusConnected;
+ }
+ /* But if that fails, try to light up even outputs we're unsure of */
+ else {
+ enable = output->status != XF86OutputStatusDisconnected;
+ }
+
+ xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
+ "Output %s %sconnected\n", output->name, enable ? "" : "dis");
+ return enable;
+}
+
+static Bool
+xf86OutputIgnored (xf86OutputPtr output)
+{
+ return xf86ReturnOptValBool (output->options, OPTION_IGNORE, FALSE);
+}
+
+static char *direction[4] = {
+ "normal",
+ "left",
+ "inverted",
+ "right"
+};
+
+static Rotation
+xf86OutputInitialRotation (xf86OutputPtr output)
+{
+ char *rotate_name = xf86GetOptValString (output->options,
+ OPTION_ROTATE);
+ int i;
+
+ if (!rotate_name) {
+ if (output->initial_rotation)
+ return output->initial_rotation;
+ return RR_Rotate_0;
+ }
+
+ for (i = 0; i < 4; i++)
+ if (xf86nameCompare (direction[i], rotate_name) == 0)
+ return 1 << i;
+ return RR_Rotate_0;
+}
+
+xf86OutputPtr
+xf86OutputCreate (ScrnInfoPtr scrn,
+ const xf86OutputFuncsRec *funcs,
+ const char *name)
+{
+ xf86OutputPtr output, *outputs;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int len;
+ Bool primary;
+
+ if (name)
+ len = strlen (name) + 1;
+ else
+ len = 0;
+
+ output = calloc(sizeof (xf86OutputRec) + len, 1);
+ if (!output)
+ return NULL;
+ output->scrn = scrn;
+ output->funcs = funcs;
+ if (name)
+ {
+ output->name = (char *) (output + 1);
+ strcpy (output->name, name);
+ }
+ output->subpixel_order = SubPixelUnknown;
+ /*
+ * Use the old per-screen monitor section for the first output
+ */
+ output->use_screen_monitor = (xf86_config->num_output == 0);
+#ifdef RANDR_12_INTERFACE
+ output->randr_output = NULL;
+#endif
+ if (name)
+ {
+ xf86OutputSetMonitor (output);
+ if (xf86OutputIgnored (output))
+ {
+ free(output);
+ return FALSE;
+ }
+ }
+
+
+ if (xf86_config->output)
+ outputs = realloc(xf86_config->output,
+ (xf86_config->num_output + 1) * sizeof (xf86OutputPtr));
+ else
+ outputs = malloc((xf86_config->num_output + 1) * sizeof (xf86OutputPtr));
+ if (!outputs)
+ {
+ free(output);
+ return NULL;
+ }
+
+ xf86_config->output = outputs;
+
+ if (xf86GetOptValBool (output->options, OPTION_PRIMARY, &primary) && primary)
+ {
+ memmove(xf86_config->output + 1, xf86_config->output,
+ xf86_config->num_output * sizeof (xf86OutputPtr));
+ xf86_config->output[0] = output;
+ }
+ else
+ {
+ xf86_config->output[xf86_config->num_output] = output;
+ }
+
+ xf86_config->num_output++;
+
+ return output;
+}
+
+Bool
+xf86OutputRename (xf86OutputPtr output, const char *name)
+{
+ char *newname = strdup(name);
+
+ if (!newname)
+ return FALSE; /* so sorry... */
+
+ if (output->name && output->name != (char *) (output + 1))
+ free(output->name);
+ output->name = newname;
+ xf86OutputSetMonitor (output);
+ if (xf86OutputIgnored (output))
+ return FALSE;
+ return TRUE;
+}
+
+void
+xf86OutputUseScreenMonitor (xf86OutputPtr output, Bool use_screen_monitor)
+{
+ if (use_screen_monitor != output->use_screen_monitor)
+ {
+ output->use_screen_monitor = use_screen_monitor;
+ xf86OutputSetMonitor (output);
+ }
+}
+
+void
+xf86OutputDestroy (xf86OutputPtr output)
+{
+ ScrnInfoPtr scrn = output->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int o;
+
+ (*output->funcs->destroy) (output);
+ while (output->probed_modes)
+ xf86DeleteMode (&output->probed_modes, output->probed_modes);
+ for (o = 0; o < xf86_config->num_output; o++)
+ if (xf86_config->output[o] == output)
+ {
+ memmove (&xf86_config->output[o],
+ &xf86_config->output[o+1],
+ ((xf86_config->num_output - (o + 1)) * sizeof(void*)));
+ xf86_config->num_output--;
+ break;
+ }
+ if (output->name && output->name != (char *) (output + 1))
+ free(output->name);
+ free(output);
+}
+
+/*
+ * Called during CreateScreenResources to hook up RandR
+ */
+static Bool
+xf86CrtcCreateScreenResources (ScreenPtr screen)
+{
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ screen->CreateScreenResources = config->CreateScreenResources;
+
+ if (!(*screen->CreateScreenResources)(screen))
+ return FALSE;
+
+ if (!xf86RandR12CreateScreenResources (screen))
+ return FALSE;
+
+ return TRUE;
+}
+
+/*
+ * Clean up config on server reset
+ */
+static Bool
+xf86CrtcCloseScreen (int index, ScreenPtr screen)
+{
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int o, c;
+
+ screen->CloseScreen = config->CloseScreen;
+
+ xf86RotateCloseScreen (screen);
+
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+
+ output->randr_output = NULL;
+ }
+ for (c = 0; c < config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = config->crtc[c];
+
+ crtc->randr_crtc = NULL;
+ }
+ xf86RandR12CloseScreen (screen);
+
+ return screen->CloseScreen (index, screen);
+}
+
+/*
+ * Called at ScreenInit time to set up
+ */
+#ifdef RANDR_13_INTERFACE
+int
+#else
+Bool
+#endif
+xf86CrtcScreenInit (ScreenPtr screen)
+{
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c;
+
+ /* Rotation */
+ xf86DrvMsg(scrn->scrnIndex, X_INFO, "RandR 1.2 enabled, ignore the following RandR disabled message.\n");
+ xf86DisableRandR(); /* Disable old RandR extension support */
+ xf86RandR12Init (screen);
+
+ /* support all rotations if every crtc has the shadow alloc funcs */
+ for (c = 0; c < config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = config->crtc[c];
+ if (!crtc->funcs->shadow_allocate || !crtc->funcs->shadow_create)
+ break;
+ }
+ if (c == config->num_crtc)
+ {
+ xf86RandR12SetRotations (screen, RR_Rotate_0 | RR_Rotate_90 |
+ RR_Rotate_180 | RR_Rotate_270 |
+ RR_Reflect_X | RR_Reflect_Y);
+ xf86RandR12SetTransformSupport (screen, TRUE);
+ }
+ else
+ {
+ xf86RandR12SetRotations (screen, RR_Rotate_0);
+ xf86RandR12SetTransformSupport (screen, FALSE);
+ }
+
+ /* Wrap CreateScreenResources so we can initialize the RandR code */
+ config->CreateScreenResources = screen->CreateScreenResources;
+ screen->CreateScreenResources = xf86CrtcCreateScreenResources;
+
+ config->CloseScreen = screen->CloseScreen;
+ screen->CloseScreen = xf86CrtcCloseScreen;
+
+#ifdef XFreeXDGA
+ _xf86_di_dga_init_internal(screen);
+#endif
+#ifdef RANDR_13_INTERFACE
+ return RANDR_INTERFACE_VERSION;
+#else
+ return TRUE;
+#endif
+}
+
+static DisplayModePtr
+xf86DefaultMode (xf86OutputPtr output, int width, int height)
+{
+ DisplayModePtr target_mode = NULL;
+ DisplayModePtr mode;
+ int target_diff = 0;
+ int target_preferred = 0;
+ int mm_height;
+
+ mm_height = output->mm_height;
+ if (!mm_height)
+ mm_height = (768 * 25.4) / DEFAULT_DPI;
+ /*
+ * Pick a mode closest to DEFAULT_DPI
+ */
+ for (mode = output->probed_modes; mode; mode = mode->next)
+ {
+ int dpi;
+ int preferred = (((mode->type & M_T_PREFERRED) != 0) +
+ ((mode->type & M_T_USERPREF) != 0));
+ int diff;
+
+ if (xf86ModeWidth (mode, output->initial_rotation) > width ||
+ xf86ModeHeight (mode, output->initial_rotation) > height)
+ continue;
+
+ /* yes, use VDisplay here, not xf86ModeHeight */
+ dpi = (mode->VDisplay * 254) / (mm_height * 10);
+ diff = dpi - DEFAULT_DPI;
+ diff = diff < 0 ? -diff : diff;
+ if (target_mode == NULL || (preferred > target_preferred) ||
+ (preferred == target_preferred && diff < target_diff))
+ {
+ target_mode = mode;
+ target_diff = diff;
+ target_preferred = preferred;
+ }
+ }
+ return target_mode;
+}
+
+static DisplayModePtr
+xf86ClosestMode (xf86OutputPtr output,
+ DisplayModePtr match, Rotation match_rotation,
+ int width, int height)
+{
+ DisplayModePtr target_mode = NULL;
+ DisplayModePtr mode;
+ int target_diff = 0;
+
+ /*
+ * Pick a mode closest to the specified mode
+ */
+ for (mode = output->probed_modes; mode; mode = mode->next)
+ {
+ int dx, dy;
+ int diff;
+
+ if (xf86ModeWidth (mode, output->initial_rotation) > width ||
+ xf86ModeHeight (mode, output->initial_rotation) > height)
+ continue;
+
+ /* exact matches are preferred */
+ if (output->initial_rotation == match_rotation &&
+ xf86ModesEqual (mode, match))
+ return mode;
+
+ dx = xf86ModeWidth (match, match_rotation) - xf86ModeWidth (mode, output->initial_rotation);
+ dy = xf86ModeHeight (match, match_rotation) - xf86ModeHeight (mode, output->initial_rotation);
+ diff = dx * dx + dy * dy;
+ if (target_mode == NULL || diff < target_diff)
+ {
+ target_mode = mode;
+ target_diff = diff;
+ }
+ }
+ return target_mode;
+}
+
+static DisplayModePtr
+xf86OutputHasPreferredMode (xf86OutputPtr output, int width, int height)
+{
+ DisplayModePtr mode;
+
+ for (mode = output->probed_modes; mode; mode = mode->next)
+ {
+ if (xf86ModeWidth (mode, output->initial_rotation) > width ||
+ xf86ModeHeight (mode, output->initial_rotation) > height)
+ continue;
+
+ if (mode->type & M_T_PREFERRED)
+ return mode;
+ }
+ return NULL;
+}
+
+static DisplayModePtr
+xf86OutputHasUserPreferredMode (xf86OutputPtr output)
+{
+ DisplayModePtr mode, first = output->probed_modes;
+
+ for (mode = first; mode && mode->next != first; mode = mode->next)
+ if (mode->type & M_T_USERPREF)
+ return mode;
+
+ return NULL;
+}
+
+static int
+xf86PickCrtcs (ScrnInfoPtr scrn,
+ xf86CrtcPtr *best_crtcs,
+ DisplayModePtr *modes,
+ int n,
+ int width,
+ int height)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c, o;
+ xf86OutputPtr output;
+ xf86CrtcPtr crtc;
+ xf86CrtcPtr *crtcs;
+ xf86CrtcPtr best_crtc;
+ int best_score;
+ int score;
+ int my_score;
+
+ if (n == config->num_output)
+ return 0;
+ output = config->output[n];
+
+ /*
+ * Compute score with this output disabled
+ */
+ best_crtcs[n] = NULL;
+ best_crtc = NULL;
+ best_score = xf86PickCrtcs (scrn, best_crtcs, modes, n+1, width, height);
+ if (modes[n] == NULL)
+ return best_score;
+
+ crtcs = malloc(config->num_output * sizeof (xf86CrtcPtr));
+ if (!crtcs)
+ return best_score;
+
+ my_score = 1;
+ /* Score outputs that are known to be connected higher */
+ if (output->status == XF86OutputStatusConnected)
+ my_score++;
+ /* Score outputs with preferred modes higher */
+ if (xf86OutputHasPreferredMode (output, width, height))
+ my_score++;
+ /*
+ * Select a crtc for this output and
+ * then attempt to configure the remaining
+ * outputs
+ */
+ for (c = 0; c < config->num_crtc; c++)
+ {
+ if ((output->possible_crtcs & (1 << c)) == 0)
+ continue;
+
+ crtc = config->crtc[c];
+ /*
+ * Check to see if some other output is
+ * using this crtc
+ */
+ for (o = 0; o < n; o++)
+ if (best_crtcs[o] == crtc)
+ break;
+ if (o < n)
+ {
+ /*
+ * If the two outputs desire the same mode,
+ * see if they can be cloned
+ */
+ if (xf86ModesEqual (modes[o], modes[n]) &&
+ config->output[o]->initial_rotation == config->output[n]->initial_rotation &&
+ config->output[o]->initial_x == config->output[n]->initial_x &&
+ config->output[o]->initial_y == config->output[n]->initial_y)
+ {
+ if ((output->possible_clones & (1 << o)) == 0)
+ continue; /* nope, try next CRTC */
+ }
+ else
+ continue; /* different modes, can't clone */
+ }
+ crtcs[n] = crtc;
+ memcpy (crtcs, best_crtcs, n * sizeof (xf86CrtcPtr));
+ score = my_score + xf86PickCrtcs (scrn, crtcs, modes, n+1, width, height);
+ if (score > best_score)
+ {
+ best_crtc = crtc;
+ best_score = score;
+ memcpy (best_crtcs, crtcs, config->num_output * sizeof (xf86CrtcPtr));
+ }
+ }
+ free(crtcs);
+ return best_score;
+}
+
+
+/*
+ * Compute the virtual size necessary to place all of the available
+ * crtcs in the specified configuration.
+ *
+ * canGrow indicates that the driver can make the screen larger than its initial
+ * configuration. If FALSE, this function will enlarge the screen to include
+ * the largest available mode.
+ */
+
+static void
+xf86DefaultScreenLimits (ScrnInfoPtr scrn, int *widthp, int *heightp,
+ Bool canGrow)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int width = 0, height = 0;
+ int o;
+ int c;
+ int s;
+
+ for (c = 0; c < config->num_crtc; c++)
+ {
+ int crtc_width = 0, crtc_height = 0;
+ xf86CrtcPtr crtc = config->crtc[c];
+
+ if (crtc->enabled)
+ {
+ crtc_width = crtc->desiredX + xf86ModeWidth (&crtc->desiredMode, crtc->desiredRotation);
+ crtc_height = crtc->desiredY + xf86ModeHeight (&crtc->desiredMode, crtc->desiredRotation);
+ }
+ if (!canGrow) {
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+
+ for (s = 0; s < config->num_crtc; s++)
+ if (output->possible_crtcs & (1 << s))
+ {
+ DisplayModePtr mode;
+ for (mode = output->probed_modes; mode; mode = mode->next)
+ {
+ if (mode->HDisplay > crtc_width)
+ crtc_width = mode->HDisplay;
+ if (mode->VDisplay > crtc_width)
+ crtc_width = mode->VDisplay;
+ if (mode->VDisplay > crtc_height)
+ crtc_height = mode->VDisplay;
+ if (mode->HDisplay > crtc_height)
+ crtc_height = mode->HDisplay;
+ }
+ }
+ }
+ }
+ if (crtc_width > width)
+ width = crtc_width;
+ if (crtc_height > height)
+ height = crtc_height;
+ }
+ if (config->maxWidth && width > config->maxWidth) width = config->maxWidth;
+ if (config->maxHeight && height > config->maxHeight) height = config->maxHeight;
+ if (config->minWidth && width < config->minWidth) width = config->minWidth;
+ if (config->minHeight && height < config->minHeight) height = config->minHeight;
+ *widthp = width;
+ *heightp = height;
+}
+
+#define POSITION_UNSET -100000
+
+/*
+ * check if the user configured any outputs at all
+ * with either a position or a relative setting or a mode.
+ */
+static Bool
+xf86UserConfiguredOutputs(ScrnInfoPtr scrn, DisplayModePtr *modes)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int o;
+ Bool user_conf = FALSE;
+
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+ char *position;
+ char *relative_name;
+ OutputOpts relation;
+ int r;
+ static const OutputOpts relations[] = {
+ OPTION_BELOW, OPTION_RIGHT_OF, OPTION_ABOVE, OPTION_LEFT_OF
+ };
+
+ position = xf86GetOptValString (output->options,
+ OPTION_POSITION);
+ if (position)
+ user_conf = TRUE;
+
+ relation = 0;
+ relative_name = NULL;
+ for (r = 0; r < 4; r++)
+ {
+ relation = relations[r];
+ relative_name = xf86GetOptValString (output->options,
+ relation);
+ if (relative_name)
+ break;
+ }
+ if (relative_name)
+ user_conf = TRUE;
+
+ modes[o] = xf86OutputHasUserPreferredMode(output);
+ if (modes[o])
+ user_conf = TRUE;
+ }
+
+ return user_conf;
+}
+
+static Bool
+xf86InitialOutputPositions (ScrnInfoPtr scrn, DisplayModePtr *modes)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int o;
+ int min_x, min_y;
+
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+
+ output->initial_x = output->initial_y = POSITION_UNSET;
+ }
+
+ /*
+ * Loop until all outputs are set
+ */
+ for (;;)
+ {
+ Bool any_set = FALSE;
+ Bool keep_going = FALSE;
+
+ for (o = 0; o < config->num_output; o++)
+ {
+ static const OutputOpts relations[] = {
+ OPTION_BELOW, OPTION_RIGHT_OF, OPTION_ABOVE, OPTION_LEFT_OF
+ };
+ xf86OutputPtr output = config->output[o];
+ xf86OutputPtr relative;
+ char *relative_name;
+ char *position;
+ OutputOpts relation;
+ int r;
+
+ if (output->initial_x != POSITION_UNSET)
+ continue;
+ position = xf86GetOptValString (output->options,
+ OPTION_POSITION);
+ /*
+ * Absolute position wins
+ */
+ if (position)
+ {
+ int x, y;
+ if (sscanf (position, "%d %d", &x, &y) == 2)
+ {
+ output->initial_x = x;
+ output->initial_y = y;
+ }
+ else
+ {
+ xf86DrvMsg (scrn->scrnIndex, X_ERROR,
+ "Output %s position not of form \"x y\"\n",
+ output->name);
+ output->initial_x = output->initial_y = 0;
+ }
+ any_set = TRUE;
+ continue;
+ }
+ /*
+ * Next comes relative positions
+ */
+ relation = 0;
+ relative_name = NULL;
+ for (r = 0; r < 4; r++)
+ {
+ relation = relations[r];
+ relative_name = xf86GetOptValString (output->options,
+ relation);
+ if (relative_name)
+ break;
+ }
+ if (relative_name)
+ {
+ int or;
+ relative = NULL;
+ for (or = 0; or < config->num_output; or++)
+ {
+ xf86OutputPtr out_rel = config->output[or];
+ XF86ConfMonitorPtr rel_mon = out_rel->conf_monitor;
+
+ if (rel_mon)
+ {
+ if (xf86nameCompare (rel_mon->mon_identifier,
+ relative_name) == 0)
+ {
+ relative = config->output[or];
+ break;
+ }
+ }
+ if (strcmp (out_rel->name, relative_name) == 0)
+ {
+ relative = config->output[or];
+ break;
+ }
+ }
+ if (!relative)
+ {
+ xf86DrvMsg (scrn->scrnIndex, X_ERROR,
+ "Cannot position output %s relative to unknown output %s\n",
+ output->name, relative_name);
+ output->initial_x = 0;
+ output->initial_y = 0;
+ any_set = TRUE;
+ continue;
+ }
+ if (!modes[or])
+ {
+ xf86DrvMsg (scrn->scrnIndex, X_ERROR,
+ "Cannot position output %s relative to output %s without modes\n",
+ output->name, relative_name);
+ output->initial_x = 0;
+ output->initial_y = 0;
+ any_set = TRUE;
+ continue;
+ }
+ if (relative->initial_x == POSITION_UNSET)
+ {
+ keep_going = TRUE;
+ continue;
+ }
+ output->initial_x = relative->initial_x;
+ output->initial_y = relative->initial_y;
+ switch (relation) {
+ case OPTION_BELOW:
+ output->initial_y += xf86ModeHeight (modes[or], relative->initial_rotation);
+ break;
+ case OPTION_RIGHT_OF:
+ output->initial_x += xf86ModeWidth (modes[or], relative->initial_rotation);
+ break;
+ case OPTION_ABOVE:
+ if (modes[o])
+ output->initial_y -= xf86ModeHeight (modes[o], output->initial_rotation);
+ break;
+ case OPTION_LEFT_OF:
+ if (modes[o])
+ output->initial_x -= xf86ModeWidth (modes[o], output->initial_rotation);
+ break;
+ default:
+ break;
+ }
+ any_set = TRUE;
+ continue;
+ }
+
+ /* Nothing set, just stick them at 0,0 */
+ output->initial_x = 0;
+ output->initial_y = 0;
+ any_set = TRUE;
+ }
+ if (!keep_going)
+ break;
+ if (!any_set)
+ {
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+ if (output->initial_x == POSITION_UNSET)
+ {
+ xf86DrvMsg (scrn->scrnIndex, X_ERROR,
+ "Output position loop. Moving %s to 0,0\n",
+ output->name);
+ output->initial_x = output->initial_y = 0;
+ break;
+ }
+ }
+ }
+ }
+
+ /*
+ * normalize positions
+ */
+ min_x = 1000000;
+ min_y = 1000000;
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+
+ if (output->initial_x < min_x)
+ min_x = output->initial_x;
+ if (output->initial_y < min_y)
+ min_y = output->initial_y;
+ }
+
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+
+ output->initial_x -= min_x;
+ output->initial_y -= min_y;
+ }
+ return TRUE;
+}
+
+static void
+xf86InitialPanning (ScrnInfoPtr scrn)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int o;
+
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+ char *panning = xf86GetOptValString (output->options, OPTION_PANNING);
+ int width, height, left, top;
+ int track_width, track_height, track_left, track_top;
+ int brdr[4];
+
+ memset (&output->initialTotalArea, 0, sizeof(BoxRec));
+ memset (&output->initialTrackingArea, 0, sizeof(BoxRec));
+ memset (output->initialBorder, 0, 4*sizeof(INT16));
+
+ if (! panning)
+ continue;
+
+ switch (sscanf (panning, "%dx%d+%d+%d/%dx%d+%d+%d/%d/%d/%d/%d",
+ &width, &height, &left, &top,
+ &track_width, &track_height, &track_left, &track_top,
+ &brdr[0], &brdr[1], &brdr[2], &brdr[3])) {
+ case 12:
+ output->initialBorder[0] = brdr[0];
+ output->initialBorder[1] = brdr[1];
+ output->initialBorder[2] = brdr[2];
+ output->initialBorder[3] = brdr[3];
+ /* fall through */
+ case 8:
+ output->initialTrackingArea.x1 = track_left;
+ output->initialTrackingArea.y1 = track_top;
+ output->initialTrackingArea.x2 = track_left + track_width;
+ output->initialTrackingArea.y2 = track_top + track_height;
+ /* fall through */
+ case 4:
+ output->initialTotalArea.x1 = left;
+ output->initialTotalArea.y1 = top;
+ /* fall through */
+ case 2:
+ output->initialTotalArea.x2 = output->initialTotalArea.x1 + width;
+ output->initialTotalArea.y2 = output->initialTotalArea.y1 + height;
+ break;
+ default:
+ xf86DrvMsg (scrn->scrnIndex, X_ERROR,
+ "Broken panning specification '%s' for output %s in config file\n",
+ panning, output->name);
+ }
+ }
+}
+
+/** Return - 0 + if a should be earlier, same or later than b in list
+ */
+static int
+xf86ModeCompare (DisplayModePtr a, DisplayModePtr b)
+{
+ int diff;
+
+ diff = ((b->type & M_T_PREFERRED) != 0) - ((a->type & M_T_PREFERRED) != 0);
+ if (diff)
+ return diff;
+ diff = b->HDisplay * b->VDisplay - a->HDisplay * a->VDisplay;
+ if (diff)
+ return diff;
+ diff = b->Clock - a->Clock;
+ return diff;
+}
+
+/**
+ * Insertion sort input in-place and return the resulting head
+ */
+static DisplayModePtr
+xf86SortModes (DisplayModePtr input)
+{
+ DisplayModePtr output = NULL, i, o, n, *op, prev;
+
+ /* sort by preferred status and pixel area */
+ while (input)
+ {
+ i = input;
+ input = input->next;
+ for (op = &output; (o = *op); op = &o->next)
+ if (xf86ModeCompare (o, i) > 0)
+ break;
+ i->next = *op;
+ *op = i;
+ }
+ /* prune identical modes */
+ for (o = output; o && (n = o->next); o = n)
+ {
+ if (!strcmp (o->name, n->name) && xf86ModesEqual (o, n))
+ {
+ o->next = n->next;
+ free(n->name);
+ free(n);
+ n = o;
+ }
+ }
+ /* hook up backward links */
+ prev = NULL;
+ for (o = output; o; o = o->next)
+ {
+ o->prev = prev;
+ prev = o;
+ }
+ return output;
+}
+
+static char *
+preferredMode(ScrnInfoPtr pScrn, xf86OutputPtr output)
+{
+ char *preferred_mode = NULL;
+
+ /* Check for a configured preference for a particular mode */
+ preferred_mode = xf86GetOptValString (output->options,
+ OPTION_PREFERRED_MODE);
+ if (preferred_mode)
+ return preferred_mode;
+
+ if (pScrn->display->modes && *pScrn->display->modes)
+ preferred_mode = *pScrn->display->modes;
+
+ return preferred_mode;
+}
+
+static void
+GuessRangeFromModes(MonPtr mon, DisplayModePtr mode)
+{
+ if (!mon || !mode)
+ return;
+
+ mon->nHsync = 1;
+ mon->hsync[0].lo = 1024.0;
+ mon->hsync[0].hi = 0.0;
+
+ mon->nVrefresh = 1;
+ mon->vrefresh[0].lo = 1024.0;
+ mon->vrefresh[0].hi = 0.0;
+
+ while (mode) {
+ if (!mode->HSync)
+ mode->HSync = ((float) mode->Clock ) / ((float) mode->HTotal);
+
+ if (!mode->VRefresh)
+ mode->VRefresh = (1000.0 * ((float) mode->Clock)) /
+ ((float) (mode->HTotal * mode->VTotal));
+
+ if (mode->HSync < mon->hsync[0].lo)
+ mon->hsync[0].lo = mode->HSync;
+
+ if (mode->HSync > mon->hsync[0].hi)
+ mon->hsync[0].hi = mode->HSync;
+
+ if (mode->VRefresh < mon->vrefresh[0].lo)
+ mon->vrefresh[0].lo = mode->VRefresh;
+
+ if (mode->VRefresh > mon->vrefresh[0].hi)
+ mon->vrefresh[0].hi = mode->VRefresh;
+
+ mode = mode->next;
+ }
+
+ /* stretch out the bottom to fit 640x480@60 */
+ if (mon->hsync[0].lo > 31.0)
+ mon->hsync[0].lo = 31.0;
+ if (mon->vrefresh[0].lo > 58.0)
+ mon->vrefresh[0].lo = 58.0;
+}
+
+enum det_monrec_source {
+ sync_config, sync_edid, sync_default
+};
+
+struct det_monrec_parameter {
+ MonRec *mon_rec;
+ int *max_clock;
+ Bool set_hsync;
+ Bool set_vrefresh;
+ enum det_monrec_source *sync_source;
+};
+
+static void handle_detailed_monrec(struct detailed_monitor_section *det_mon,
+ void *data)
+{
+ struct det_monrec_parameter *p;
+ p = (struct det_monrec_parameter *)data;
+
+ if (det_mon->type == DS_RANGES) {
+ struct monitor_ranges *ranges = &det_mon->section.ranges;
+ if (p->set_hsync && ranges->max_h) {
+ p->mon_rec->hsync[p->mon_rec->nHsync].lo = ranges->min_h;
+ p->mon_rec->hsync[p->mon_rec->nHsync].hi = ranges->max_h;
+ p->mon_rec->nHsync++;
+ if (*p->sync_source == sync_default)
+ *p->sync_source = sync_edid;
+ }
+ if (p->set_vrefresh && ranges->max_v) {
+ p->mon_rec->vrefresh[p->mon_rec->nVrefresh].lo = ranges->min_v;
+ p->mon_rec->vrefresh[p->mon_rec->nVrefresh].hi = ranges->max_v;
+ p->mon_rec->nVrefresh++;
+ if (*p->sync_source == sync_default)
+ *p->sync_source = sync_edid;
+ }
+ if (ranges->max_clock * 1000 > *p->max_clock)
+ *p->max_clock = ranges->max_clock * 1000;
+ }
+}
+
+void
+xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int o;
+
+ /* When canGrow was TRUE in the initial configuration we have to
+ * compare against the maximum values so that we don't drop modes.
+ * When canGrow was FALSE, the maximum values would have been clamped
+ * anyway.
+ */
+ if (maxX == 0 || maxY == 0) {
+ maxX = config->maxWidth;
+ maxY = config->maxHeight;
+ }
+
+ /* Probe the list of modes for each output. */
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+ DisplayModePtr mode;
+ DisplayModePtr config_modes = NULL, output_modes, default_modes = NULL;
+ char *preferred_mode;
+ xf86MonPtr edid_monitor;
+ XF86ConfMonitorPtr conf_monitor;
+ MonRec mon_rec;
+ int min_clock = 0;
+ int max_clock = 0;
+ double clock;
+ Bool add_default_modes;
+ Bool debug_modes = config->debug_modes ||
+ xf86Initialising;
+ enum det_monrec_source sync_source = sync_default;
+
+ while (output->probed_modes != NULL)
+ xf86DeleteMode(&output->probed_modes, output->probed_modes);
+
+ /*
+ * Check connection status
+ */
+ output->status = (*output->funcs->detect)(output);
+
+ if (output->status == XF86OutputStatusDisconnected &&
+ !xf86ReturnOptValBool(output->options, OPTION_ENABLE, FALSE))
+ {
+ xf86OutputSetEDID (output, NULL);
+ continue;
+ }
+
+ memset (&mon_rec, '\0', sizeof (mon_rec));
+
+ conf_monitor = output->conf_monitor;
+
+ if (conf_monitor)
+ {
+ int i;
+
+ for (i = 0; i < conf_monitor->mon_n_hsync; i++)
+ {
+ mon_rec.hsync[mon_rec.nHsync].lo = conf_monitor->mon_hsync[i].lo;
+ mon_rec.hsync[mon_rec.nHsync].hi = conf_monitor->mon_hsync[i].hi;
+ mon_rec.nHsync++;
+ sync_source = sync_config;
+ }
+ for (i = 0; i < conf_monitor->mon_n_vrefresh; i++)
+ {
+ mon_rec.vrefresh[mon_rec.nVrefresh].lo = conf_monitor->mon_vrefresh[i].lo;
+ mon_rec.vrefresh[mon_rec.nVrefresh].hi = conf_monitor->mon_vrefresh[i].hi;
+ mon_rec.nVrefresh++;
+ sync_source = sync_config;
+ }
+ config_modes = xf86GetMonitorModes (scrn, conf_monitor);
+ }
+
+ output_modes = (*output->funcs->get_modes) (output);
+
+ /*
+ * If the user has a preference, respect it.
+ * Otherwise, don't second-guess the driver.
+ */
+ if (!xf86GetOptValBool(output->options, OPTION_DEFAULT_MODES,
+ &add_default_modes))
+ add_default_modes = (output_modes == NULL);
+
+ edid_monitor = output->MonInfo;
+
+ if (edid_monitor)
+ {
+ struct det_monrec_parameter p;
+ struct disp_features *features = &edid_monitor->features;
+
+ /* if display is not continuous-frequency, don't add default modes */
+ if (!GTF_SUPPORTED(features->msc))
+ add_default_modes = FALSE;
+
+ p.mon_rec = &mon_rec;
+ p.max_clock = &max_clock;
+ p.set_hsync = mon_rec.nHsync == 0;
+ p.set_vrefresh = mon_rec.nVrefresh == 0;
+ p.sync_source = &sync_source;
+
+ xf86ForEachDetailedBlock(edid_monitor,
+ handle_detailed_monrec,
+ &p);
+ }
+
+ if (xf86GetOptValFreq (output->options, OPTION_MIN_CLOCK,
+ OPTUNITS_KHZ, &clock))
+ min_clock = (int) clock;
+ if (xf86GetOptValFreq (output->options, OPTION_MAX_CLOCK,
+ OPTUNITS_KHZ, &clock))
+ max_clock = (int) clock;
+
+ /* If we still don't have a sync range, guess wildly */
+ if (!mon_rec.nHsync || !mon_rec.nVrefresh)
+ GuessRangeFromModes(&mon_rec, output_modes);
+
+ /*
+ * These limits will end up setting a 1024x768@60Hz mode by default,
+ * which seems like a fairly good mode to use when nothing else is
+ * specified
+ */
+ if (mon_rec.nHsync == 0)
+ {
+ mon_rec.hsync[0].lo = 31.0;
+ mon_rec.hsync[0].hi = 55.0;
+ mon_rec.nHsync = 1;
+ }
+ if (mon_rec.nVrefresh == 0)
+ {
+ mon_rec.vrefresh[0].lo = 58.0;
+ mon_rec.vrefresh[0].hi = 62.0;
+ mon_rec.nVrefresh = 1;
+ }
+
+ if (add_default_modes)
+ default_modes = xf86GetDefaultModes ();
+
+ /*
+ * If this is not an RB monitor, remove RB modes from the default
+ * pool. RB modes from the config or the monitor itself are fine.
+ */
+ if (!mon_rec.reducedblanking)
+ xf86ValidateModesReducedBlanking (scrn, default_modes);
+
+ if (sync_source == sync_config)
+ {
+ /*
+ * Check output and config modes against sync range from config file
+ */
+ xf86ValidateModesSync (scrn, output_modes, &mon_rec);
+ xf86ValidateModesSync (scrn, config_modes, &mon_rec);
+ }
+ /*
+ * Check default modes against sync range
+ */
+ xf86ValidateModesSync (scrn, default_modes, &mon_rec);
+ /*
+ * Check default modes against monitor max clock
+ */
+ if (max_clock) {
+ xf86ValidateModesClocks(scrn, default_modes,
+ &min_clock, &max_clock, 1);
+ xf86ValidateModesClocks(scrn, output_modes,
+ &min_clock, &max_clock, 1);
+ }
+
+ output->probed_modes = NULL;
+ output->probed_modes = xf86ModesAdd (output->probed_modes, config_modes);
+ output->probed_modes = xf86ModesAdd (output->probed_modes, output_modes);
+ output->probed_modes = xf86ModesAdd (output->probed_modes, default_modes);
+
+ /*
+ * Check all modes against max size, interlace, and doublescan
+ */
+ if (maxX && maxY)
+ xf86ValidateModesSize (scrn, output->probed_modes,
+ maxX, maxY, 0);
+
+ {
+ int flags = (output->interlaceAllowed ? V_INTERLACE : 0) |
+ (output->doubleScanAllowed ? V_DBLSCAN : 0);
+ xf86ValidateModesFlags (scrn, output->probed_modes, flags);
+ }
+
+ /*
+ * Check all modes against output
+ */
+ for (mode = output->probed_modes; mode != NULL; mode = mode->next)
+ if (mode->status == MODE_OK)
+ mode->status = (*output->funcs->mode_valid)(output, mode);
+
+ xf86PruneInvalidModes(scrn, &output->probed_modes, debug_modes);
+
+ output->probed_modes = xf86SortModes (output->probed_modes);
+
+ /* Check for a configured preference for a particular mode */
+ preferred_mode = preferredMode(scrn, output);
+
+ if (preferred_mode)
+ {
+ for (mode = output->probed_modes; mode; mode = mode->next)
+ {
+ if (!strcmp (preferred_mode, mode->name))
+ {
+ if (mode != output->probed_modes)
+ {
+ if (mode->prev)
+ mode->prev->next = mode->next;
+ if (mode->next)
+ mode->next->prev = mode->prev;
+ mode->next = output->probed_modes;
+ output->probed_modes->prev = mode;
+ mode->prev = NULL;
+ output->probed_modes = mode;
+ }
+ mode->type |= (M_T_PREFERRED|M_T_USERPREF);
+ break;
+ }
+ }
+ }
+
+ output->initial_rotation = xf86OutputInitialRotation (output);
+
+ if (debug_modes) {
+ if (output->probed_modes != NULL) {
+ xf86DrvMsg(scrn->scrnIndex, X_INFO,
+ "Printing probed modes for output %s\n",
+ output->name);
+ } else {
+ xf86DrvMsg(scrn->scrnIndex, X_INFO,
+ "No remaining probed modes for output %s\n",
+ output->name);
+ }
+ }
+ for (mode = output->probed_modes; mode != NULL; mode = mode->next)
+ {
+ /* The code to choose the best mode per pipe later on will require
+ * VRefresh to be set.
+ */
+ mode->VRefresh = xf86ModeVRefresh(mode);
+ xf86SetModeCrtc(mode, INTERLACE_HALVE_V);
+
+ if (debug_modes)
+ xf86PrintModeline(scrn->scrnIndex, mode);
+ }
+ }
+}
+
+
+/**
+ * Copy one of the output mode lists to the ScrnInfo record
+ */
+
+/* XXX where does this function belong? Here? */
+void
+xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr scrn, int *x, int *y);
+
+static DisplayModePtr
+biggestMode(DisplayModePtr a, DisplayModePtr b)
+{
+ int A, B;
+
+ if (!a)
+ return b;
+ if (!b)
+ return a;
+
+ A = a->HDisplay * a->VDisplay;
+ B = b->HDisplay * b->VDisplay;
+
+ if (A > B)
+ return a;
+
+ return b;
+}
+
+static xf86OutputPtr
+SetCompatOutput(xf86CrtcConfigPtr config)
+{
+ xf86OutputPtr output = NULL, test = NULL;
+ DisplayModePtr maxmode = NULL, testmode, mode;
+ int o, compat = -1, count, mincount = 0;
+
+ /* Look for one that's definitely connected */
+ for (o = 0; o < config->num_output; o++)
+ {
+ test = config->output[o];
+ if (!test->crtc)
+ continue;
+ if (test->status != XF86OutputStatusConnected)
+ continue;
+ if (!test->probed_modes)
+ continue;
+
+ testmode = mode = test->probed_modes;
+ for (count = 0; mode; mode = mode->next, count++)
+ testmode = biggestMode(testmode, mode);
+
+ if (!output) {
+ output = test;
+ compat = o;
+ maxmode = testmode;
+ mincount = count;
+ } else if (maxmode == biggestMode(maxmode, testmode)) {
+ output = test;
+ compat = o;
+ maxmode = testmode;
+ mincount = count;
+ } else if ((maxmode->HDisplay == testmode->HDisplay) &&
+ (maxmode->VDisplay == testmode->VDisplay) &&
+ count <= mincount) {
+ output = test;
+ compat = o;
+ maxmode = testmode;
+ mincount = count;
+ }
+ }
+
+ /* If we didn't find one, take anything we can get */
+ if (!output)
+ {
+ for (o = 0; o < config->num_output; o++)
+ {
+ test = config->output[o];
+ if (!test->crtc)
+ continue;
+ if (!test->probed_modes)
+ continue;
+
+ if (!output) {
+ output = test;
+ compat = o;
+ } else if (test->probed_modes->HDisplay < output->probed_modes->HDisplay) {
+ output = test;
+ compat = o;
+ }
+ }
+ }
+
+ if (compat >= 0) {
+ config->compat_output = compat;
+ } else {
+ /* Don't change the compat output when no valid outputs found */
+ output = config->output[config->compat_output];
+ }
+
+ return output;
+}
+
+void
+xf86SetScrnInfoModes (ScrnInfoPtr scrn)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86OutputPtr output;
+ xf86CrtcPtr crtc;
+ DisplayModePtr last, mode = NULL;
+
+ output = SetCompatOutput(config);
+
+ if (!output)
+ return; /* punt */
+
+ crtc = output->crtc;
+
+ /* Clear any existing modes from scrn->modes */
+ while (scrn->modes != NULL)
+ xf86DeleteMode(&scrn->modes, scrn->modes);
+
+ /* Set scrn->modes to the mode list for the 'compat' output */
+ scrn->modes = xf86DuplicateModes(scrn, output->probed_modes);
+
+ if (crtc) {
+ for (mode = scrn->modes; mode; mode = mode->next)
+ if (xf86ModesEqual (mode, &crtc->desiredMode))
+ break;
+ }
+
+ if (scrn->modes != NULL) {
+ /* For some reason, scrn->modes is circular, unlike the other mode
+ * lists. How great is that?
+ */
+ for (last = scrn->modes; last && last->next; last = last->next)
+ ;
+ last->next = scrn->modes;
+ scrn->modes->prev = last;
+ if (mode) {
+ while (scrn->modes != mode)
+ scrn->modes = scrn->modes->next;
+ }
+ }
+ scrn->currentMode = scrn->modes;
+#ifdef XFreeXDGA
+ if (scrn->pScreen)
+ _xf86_di_dga_reinit_internal(scrn->pScreen);
+#endif
+}
+
+static Bool
+xf86CollectEnabledOutputs(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
+ Bool *enabled)
+{
+ Bool any_enabled = FALSE;
+ int o;
+
+ for (o = 0; o < config->num_output; o++)
+ any_enabled |= enabled[o] = xf86OutputEnabled(config->output[o], TRUE);
+
+ if (!any_enabled) {
+ xf86DrvMsg(scrn->scrnIndex, X_WARNING,
+ "No outputs definitely connected, trying again...\n");
+
+ for (o = 0; o < config->num_output; o++)
+ any_enabled |= enabled[o] = xf86OutputEnabled(config->output[o], FALSE);
+ }
+
+ return any_enabled;
+}
+
+static Bool
+nextEnabledOutput(xf86CrtcConfigPtr config, Bool *enabled, int *index)
+{
+ int o = *index;
+
+ for (o++; o < config->num_output; o++) {
+ if (enabled[o]) {
+ *index = o;
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+static Bool
+aspectMatch(float a, float b)
+{
+ return fabs(1 - (a / b)) < 0.05;
+}
+
+static DisplayModePtr
+nextAspectMode(xf86OutputPtr o, DisplayModePtr last, float aspect)
+{
+ DisplayModePtr m = NULL;
+
+ if (!o)
+ return NULL;
+
+ if (!last)
+ m = o->probed_modes;
+ else
+ m = last->next;
+
+ for (; m; m = m->next)
+ if (aspectMatch(aspect, (float)m->HDisplay / (float)m->VDisplay))
+ return m;
+
+ return NULL;
+}
+
+static DisplayModePtr
+bestModeForAspect(xf86CrtcConfigPtr config, Bool *enabled, float aspect)
+{
+ int o = -1, p;
+ DisplayModePtr mode = NULL, test = NULL, match = NULL;
+
+ if (!nextEnabledOutput(config, enabled, &o))
+ return NULL;
+ while ((mode = nextAspectMode(config->output[o], mode, aspect))) {
+ test = mode;
+ for (p = o; nextEnabledOutput(config, enabled, &p); ) {
+ test = xf86OutputFindClosestMode(config->output[p], mode);
+ if (!test)
+ break;
+ if (test->HDisplay != mode->HDisplay ||
+ test->VDisplay != mode->VDisplay) {
+ test = NULL;
+ break;
+ }
+ }
+
+ /* if we didn't match it on all outputs, try the next one */
+ if (!test)
+ continue;
+
+ /* if it's bigger than the last one, save it */
+ if (!match || (test->HDisplay > match->HDisplay))
+ match = test;
+ }
+
+ /* return the biggest one found */
+ return match;
+}
+
+static Bool
+xf86TargetPreferred(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
+ DisplayModePtr *modes, Bool *enabled,
+ int width, int height)
+{
+ int o, p;
+ int max_pref_width = 0, max_pref_height = 0;
+ DisplayModePtr *preferred, *preferred_match;
+ Bool ret = FALSE;
+
+ preferred = xnfcalloc(config->num_output, sizeof(DisplayModePtr));
+ preferred_match = xnfcalloc(config->num_output, sizeof(DisplayModePtr));
+
+ /* Check if the preferred mode is available on all outputs */
+ for (p = -1; nextEnabledOutput(config, enabled, &p); ) {
+ Rotation r = config->output[p]->initial_rotation;
+ DisplayModePtr mode;
+ if ((preferred[p] = xf86OutputHasPreferredMode(config->output[p],
+ width, height))) {
+ int pref_width = xf86ModeWidth(preferred[p], r);
+ int pref_height = xf86ModeHeight(preferred[p], r);
+ Bool all_match = TRUE;
+
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
+ Bool match = FALSE;
+ xf86OutputPtr output = config->output[o];
+ if (o == p)
+ continue;
+
+ for (mode = output->probed_modes; mode; mode = mode->next) {
+ Rotation r = output->initial_rotation;
+ if (xf86ModeWidth(mode, r) == pref_width &&
+ xf86ModeHeight(mode, r) == pref_height) {
+ preferred[o] = mode;
+ match = TRUE;
+ }
+ }
+
+ all_match &= match;
+ }
+
+ if (all_match &&
+ (pref_width*pref_height > max_pref_width*max_pref_height)) {
+ for (o = -1; nextEnabledOutput(config, enabled, &o); )
+ preferred_match[o] = preferred[o];
+ max_pref_width = pref_width;
+ max_pref_height = pref_height;
+ ret = TRUE;
+ }
+ }
+ }
+
+ /*
+ * If there's no preferred mode, but only one monitor, pick the
+ * biggest mode for its aspect ratio, assuming one exists.
+ */
+ if (!ret) do {
+ int i = 0;
+ float aspect = 0.0;
+
+ /* count the number of enabled outputs */
+ for (i = 0, p = -1; nextEnabledOutput(config, enabled, &p); i++) ;
+
+ if (i != 1)
+ break;
+
+ p = -1;
+ nextEnabledOutput(config, enabled, &p);
+ if (config->output[p]->mm_height)
+ aspect = (float)config->output[p]->mm_width /
+ (float)config->output[p]->mm_height;
+
+ if (aspect)
+ preferred_match[p] = bestModeForAspect(config, enabled, aspect);
+
+ if (preferred_match[p])
+ ret = TRUE;
+
+ } while (0);
+
+ if (ret) {
+ /* oh good, there is a match. stash the selected modes and return. */
+ memcpy(modes, preferred_match,
+ config->num_output * sizeof(DisplayModePtr));
+ }
+
+ free(preferred);
+ free(preferred_match);
+ return ret;
+}
+
+static Bool
+xf86TargetAspect(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
+ DisplayModePtr *modes, Bool *enabled,
+ int width, int height)
+{
+ int o;
+ float aspect = 0.0, *aspects;
+ xf86OutputPtr output;
+ Bool ret = FALSE;
+ DisplayModePtr guess = NULL, aspect_guess = NULL, base_guess = NULL;
+
+ aspects = xnfcalloc(config->num_output, sizeof(float));
+
+ /* collect the aspect ratios */
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
+ output = config->output[o];
+ if (output->mm_height)
+ aspects[o] = (float)output->mm_width / (float)output->mm_height;
+ else
+ aspects[o] = 4.0 / 3.0;
+ }
+
+ /* check that they're all the same */
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
+ output = config->output[o];
+ if (!aspect) {
+ aspect = aspects[o];
+ } else if (!aspectMatch(aspect, aspects[o])) {
+ goto no_aspect_match;
+ }
+ }
+
+ /* if they're all 4:3, just skip ahead and save effort */
+ if (!aspectMatch(aspect, 4.0/3.0))
+ aspect_guess = bestModeForAspect(config, enabled, aspect);
+
+no_aspect_match:
+ base_guess = bestModeForAspect(config, enabled, 4.0/3.0);
+
+ guess = biggestMode(base_guess, aspect_guess);
+
+ if (!guess)
+ goto out;
+
+ /* found a mode that works everywhere, now apply it */
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
+ modes[o] = xf86OutputFindClosestMode(config->output[o], guess);
+ }
+ ret = TRUE;
+
+out:
+ free(aspects);
+ return ret;
+}
+
+static Bool
+xf86TargetFallback(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
+ DisplayModePtr *modes, Bool *enabled,
+ int width, int height)
+{
+ DisplayModePtr target_mode = NULL;
+ Rotation target_rotation = RR_Rotate_0;
+ DisplayModePtr default_mode;
+ int default_preferred, target_preferred = 0, o;
+
+ /* User preferred > preferred > other modes */
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
+ default_mode = xf86DefaultMode (config->output[o], width, height);
+ if (!default_mode)
+ continue;
+
+ default_preferred = (((default_mode->type & M_T_PREFERRED) != 0) +
+ ((default_mode->type & M_T_USERPREF) != 0));
+
+ if (default_preferred > target_preferred || !target_mode) {
+ target_mode = default_mode;
+ target_preferred = default_preferred;
+ target_rotation = config->output[o]->initial_rotation;
+ config->compat_output = o;
+ }
+ }
+
+ if (target_mode)
+ modes[config->compat_output] = target_mode;
+
+ /* Fill in other output modes */
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
+ if (!modes[o])
+ modes[o] = xf86ClosestMode(config->output[o], target_mode,
+ target_rotation, width, height);
+ }
+
+ return target_mode != NULL;
+}
+
+static Bool
+xf86TargetUserpref(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
+ DisplayModePtr *modes, Bool *enabled,
+ int width, int height)
+{
+ int o;
+
+ if (xf86UserConfiguredOutputs(scrn, modes))
+ return xf86TargetFallback(scrn, config, modes, enabled, width, height);
+
+ for (o = -1; nextEnabledOutput(config, enabled, &o); )
+ if (xf86OutputHasUserPreferredMode(config->output[o]))
+ return
+ xf86TargetFallback(scrn, config, modes, enabled, width, height);
+
+ return FALSE;
+}
+
+static Bool
+xf86CrtcSetInitialGamma(xf86CrtcPtr crtc, float gamma_red, float gamma_green,
+ float gamma_blue)
+{
+ int i, size = 256;
+ CARD16 *red, *green, *blue;
+
+ red = malloc(3 * size * sizeof(CARD16));
+ green = red + size;
+ blue = green + size;
+
+ /* Only cause warning if user wanted gamma to be set. */
+ if (!crtc->funcs->gamma_set && (gamma_red != 1.0 || gamma_green != 1.0 || gamma_blue != 1.0)) {
+ free(red);
+ return FALSE;
+ } else if (!crtc->funcs->gamma_set) {
+ free(red);
+ return TRUE;
+ }
+
+ /* At this early stage none of the randr-interface stuff is up.
+ * So take the default gamma size for lack of something better.
+ */
+ for (i = 0; i < size; i++) {
+ if (gamma_red == 1.0)
+ red[i] = i << 8;
+ else
+ red[i] = (CARD16)(pow((double)i/(double)(size - 1),
+ 1. / (double)gamma_red) * (double)(size - 1) * 256);
+
+ if (gamma_green == 1.0)
+ green[i] = i << 8;
+ else
+ green[i] = (CARD16)(pow((double)i/(double)(size - 1),
+ 1. / (double)gamma_green) * (double)(size - 1) * 256);
+
+ if (gamma_blue == 1.0)
+ blue[i] = i << 8;
+ else
+ blue[i] = (CARD16)(pow((double)i/(double)(size - 1),
+ 1. / (double)gamma_blue) * (double)(size - 1) * 256);
+ }
+
+ /* Default size is 256, so anything else is failure. */
+ if (size != crtc->gamma_size) {
+ free(red);
+ return FALSE;
+ }
+
+ crtc->gamma_size = size;
+ memcpy (crtc->gamma_red, red, crtc->gamma_size * sizeof (CARD16));
+ memcpy (crtc->gamma_green, green, crtc->gamma_size * sizeof (CARD16));
+ memcpy (crtc->gamma_blue, blue, crtc->gamma_size * sizeof (CARD16));
+
+ /* Do not set gamma now, delay until the crtc is activated. */
+
+ free(red);
+
+ return TRUE;
+}
+
+static Bool
+xf86OutputSetInitialGamma(xf86OutputPtr output)
+{
+ XF86ConfMonitorPtr mon = output->conf_monitor;
+ float gamma_red = 1.0, gamma_green = 1.0, gamma_blue = 1.0;
+
+ if (!mon)
+ return TRUE;
+
+ if (!output->crtc)
+ return FALSE;
+
+ /* Get configured values, where they exist. */
+ if (mon->mon_gamma_red >= GAMMA_MIN &&
+ mon->mon_gamma_red <= GAMMA_MAX)
+ gamma_red = mon->mon_gamma_red;
+
+ if (mon->mon_gamma_green >= GAMMA_MIN &&
+ mon->mon_gamma_green <= GAMMA_MAX)
+ gamma_green = mon->mon_gamma_green;
+
+ if (mon->mon_gamma_blue >= GAMMA_MIN &&
+ mon->mon_gamma_blue <= GAMMA_MAX)
+ gamma_blue = mon->mon_gamma_blue;
+
+ /* This avoids setting gamma 1.0 in case another cloned output on this crtc has a specific gamma. */
+ if (gamma_red != 1.0 || gamma_green != 1.0 || gamma_blue != 1.0) {
+ xf86DrvMsg(output->scrn->scrnIndex, X_INFO, "Output %s wants gamma correction (%.1f, %.1f, %.1f)\n", output->name, gamma_red, gamma_green, gamma_blue);
+ return xf86CrtcSetInitialGamma(output->crtc, gamma_red, gamma_green, gamma_blue);
+ }else
+ return TRUE;
+}
+
+/**
+ * Construct default screen configuration
+ *
+ * Given auto-detected (and, eventually, configured) values,
+ * construct a usable configuration for the system
+ *
+ * canGrow indicates that the driver can resize the screen to larger than its
+ * initially configured size via the config->funcs->resize hook. If TRUE, this
+ * function will set virtualX and virtualY to match the initial configuration
+ * and leave config->max{Width,Height} alone. If FALSE, it will bloat
+ * virtual[XY] to include the largest modes and set config->max{Width,Height}
+ * accordingly.
+ */
+
+Bool
+xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int o, c;
+ xf86CrtcPtr *crtcs;
+ DisplayModePtr *modes;
+ Bool *enabled;
+ int width, height;
+ int i = scrn->scrnIndex;
+ Bool have_outputs = TRUE;
+ Bool ret;
+
+ /* Set up the device options */
+ config->options = xnfalloc (sizeof (xf86DeviceOptions));
+ memcpy (config->options, xf86DeviceOptions, sizeof (xf86DeviceOptions));
+ xf86ProcessOptions (scrn->scrnIndex,
+ scrn->options,
+ config->options);
+ config->debug_modes = xf86ReturnOptValBool (config->options,
+ OPTION_MODEDEBUG, FALSE);
+
+ if (scrn->display->virtualX)
+ width = scrn->display->virtualX;
+ else
+ width = config->maxWidth;
+ if (scrn->display->virtualY)
+ height = scrn->display->virtualY;
+ else
+ height = config->maxHeight;
+
+ xf86ProbeOutputModes (scrn, width, height);
+
+ crtcs = xnfcalloc (config->num_output, sizeof (xf86CrtcPtr));
+ modes = xnfcalloc (config->num_output, sizeof (DisplayModePtr));
+ enabled = xnfcalloc (config->num_output, sizeof (Bool));
+
+ ret = xf86CollectEnabledOutputs(scrn, config, enabled);
+ if (ret == FALSE && canGrow) {
+ xf86DrvMsg(i, X_WARNING, "Unable to find connected outputs - setting %dx%d initial framebuffer\n",
+ NO_OUTPUT_DEFAULT_WIDTH, NO_OUTPUT_DEFAULT_HEIGHT);
+ have_outputs = FALSE;
+ } else {
+ if (xf86TargetUserpref(scrn, config, modes, enabled, width, height))
+ xf86DrvMsg(i, X_INFO, "Using user preference for initial modes\n");
+ else if (xf86TargetPreferred(scrn, config, modes, enabled, width, height))
+ xf86DrvMsg(i, X_INFO, "Using exact sizes for initial modes\n");
+ else if (xf86TargetAspect(scrn, config, modes, enabled, width, height))
+ xf86DrvMsg(i, X_INFO, "Using fuzzy aspect match for initial modes\n");
+ else if (xf86TargetFallback(scrn, config, modes, enabled, width, height))
+ xf86DrvMsg(i, X_INFO, "Using sloppy heuristic for initial modes\n");
+ else
+ xf86DrvMsg(i, X_WARNING, "Unable to find initial modes\n");
+ }
+
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
+ if (!modes[o])
+ xf86DrvMsg (scrn->scrnIndex, X_ERROR,
+ "Output %s enabled but has no modes\n",
+ config->output[o]->name);
+ else
+ xf86DrvMsg (scrn->scrnIndex, X_INFO,
+ "Output %s using initial mode %s\n",
+ config->output[o]->name, modes[o]->name);
+ }
+
+ /*
+ * Set the position of each output
+ */
+ if (!xf86InitialOutputPositions (scrn, modes))
+ {
+ free(crtcs);
+ free(modes);
+ return FALSE;
+ }
+
+ /*
+ * Set initial panning of each output
+ */
+ xf86InitialPanning (scrn);
+
+ /*
+ * Assign CRTCs to fit output configuration
+ */
+ if (have_outputs && !xf86PickCrtcs (scrn, crtcs, modes, 0, width, height))
+ {
+ free(crtcs);
+ free(modes);
+ return FALSE;
+ }
+
+ /* XXX override xf86 common frame computation code */
+
+ scrn->display->frameX0 = 0;
+ scrn->display->frameY0 = 0;
+
+ for (c = 0; c < config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = config->crtc[c];
+
+ crtc->enabled = FALSE;
+ memset (&crtc->desiredMode, '\0', sizeof (crtc->desiredMode));
+ /* Set default gamma for all crtc's. */
+ /* This is done to avoid problems later on with cloned outputs. */
+ xf86CrtcSetInitialGamma(crtc, 1.0, 1.0, 1.0);
+ }
+
+ if (xf86_crtc_supports_gamma(scrn))
+ xf86DrvMsg(scrn->scrnIndex, X_INFO, "Using default gamma of (1.0, 1.0, 1.0) unless otherwise stated.\n");
+
+ /*
+ * Set initial configuration
+ */
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+ DisplayModePtr mode = modes[o];
+ xf86CrtcPtr crtc = crtcs[o];
+
+ if (mode && crtc)
+ {
+ crtc->desiredMode = *mode;
+ crtc->desiredRotation = output->initial_rotation;
+ crtc->desiredX = output->initial_x;
+ crtc->desiredY = output->initial_y;
+ crtc->desiredTransformPresent = FALSE;
+ crtc->enabled = TRUE;
+ memcpy (&crtc->panningTotalArea, &output->initialTotalArea, sizeof(BoxRec));
+ memcpy (&crtc->panningTrackingArea, &output->initialTrackingArea, sizeof(BoxRec));
+ memcpy (crtc->panningBorder, output->initialBorder, 4*sizeof(INT16));
+ output->crtc = crtc;
+ if (!xf86OutputSetInitialGamma(output))
+ xf86DrvMsg (scrn->scrnIndex, X_WARNING, "Initial gamma correction for output %s: failed.\n", output->name);
+ } else {
+ output->crtc = NULL;
+ }
+ }
+
+ if (scrn->display->virtualX == 0)
+ {
+ /*
+ * Expand virtual size to cover the current config and potential mode
+ * switches, if the driver can't enlarge the screen later.
+ */
+ xf86DefaultScreenLimits (scrn, &width, &height, canGrow);
+
+ if (have_outputs == FALSE) {
+ if (width < NO_OUTPUT_DEFAULT_WIDTH && height < NO_OUTPUT_DEFAULT_HEIGHT) {
+ width = NO_OUTPUT_DEFAULT_WIDTH;
+ height = NO_OUTPUT_DEFAULT_HEIGHT;
+ }
+ }
+
+ scrn->display->virtualX = width;
+ scrn->display->virtualY = height;
+ }
+
+ if (width > scrn->virtualX)
+ scrn->virtualX = width;
+ if (height > scrn->virtualY)
+ scrn->virtualY = height;
+
+ /*
+ * Make sure the configuration isn't too small.
+ */
+ if (width < config->minWidth || height < config->minHeight)
+ return FALSE;
+
+ /*
+ * Limit the crtc config to virtual[XY] if the driver can't grow the
+ * desktop.
+ */
+ if (!canGrow)
+ {
+ xf86CrtcSetSizeRange (scrn, config->minWidth, config->minHeight,
+ width, height);
+ }
+
+ if (have_outputs) {
+ /* Mirror output modes to scrn mode list */
+ xf86SetScrnInfoModes (scrn);
+ } else {
+ /* Clear any existing modes from scrn->modes */
+ while (scrn->modes != NULL)
+ xf86DeleteMode(&scrn->modes, scrn->modes);
+ scrn->modes = xf86ModesAdd(scrn->modes,
+ xf86CVTMode(width, height, 60, 0, 0));
+ }
+
+
+ free(crtcs);
+ free(modes);
+ return TRUE;
+}
+
+/*
+ * Check the CRTC we're going to map each output to vs. it's current
+ * CRTC. If they don't match, we have to disable the output and the CRTC
+ * since the driver will have to re-route things.
+ */
+static void
+xf86PrepareOutputs (ScrnInfoPtr scrn)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int o;
+
+ for (o = 0; o < config->num_output; o++) {
+ xf86OutputPtr output = config->output[o];
+#if RANDR_GET_CRTC_INTERFACE
+ /* Disable outputs that are unused or will be re-routed */
+ if (!output->funcs->get_crtc ||
+ output->crtc != (*output->funcs->get_crtc)(output) ||
+ output->crtc == NULL)
+#endif
+ (*output->funcs->dpms)(output, DPMSModeOff);
+ }
+}
+
+static void
+xf86PrepareCrtcs (ScrnInfoPtr scrn)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c;
+
+ for (c = 0; c < config->num_crtc; c++) {
+#if RANDR_GET_CRTC_INTERFACE
+ xf86CrtcPtr crtc = config->crtc[c];
+ xf86OutputPtr output = NULL;
+ uint32_t desired_outputs = 0, current_outputs = 0;
+ int o;
+
+ for (o = 0; o < config->num_output; o++) {
+ output = config->output[o];
+ if (output->crtc == crtc)
+ desired_outputs |= (1<<o);
+ /* If we can't tell where it's mapped, force it off */
+ if (!output->funcs->get_crtc) {
+ desired_outputs = 0;
+ break;
+ }
+ if ((*output->funcs->get_crtc)(output) == crtc)
+ current_outputs |= (1<<o);
+ }
+
+ /*
+ * If mappings are different or the CRTC is unused,
+ * we need to disable it
+ */
+ if (desired_outputs != current_outputs ||
+ !desired_outputs)
+ (*crtc->funcs->dpms)(crtc, DPMSModeOff);
+#else
+ (*crtc->funcs->dpms)(crtc, DPMSModeOff);
+#endif
+ }
+}
+
+/*
+ * Using the desired mode information in each crtc, set
+ * modes (used in EnterVT functions, or at server startup)
+ */
+
+Bool
+xf86SetDesiredModes (ScrnInfoPtr scrn)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CrtcPtr crtc = config->crtc[0];
+ int c;
+
+ /* A driver with this hook will take care of this */
+ if (!crtc->funcs->set_mode_major) {
+ xf86PrepareOutputs(scrn);
+ xf86PrepareCrtcs(scrn);
+ }
+
+ for (c = 0; c < config->num_crtc; c++)
+ {
+ xf86OutputPtr output = NULL;
+ int o;
+ RRTransformPtr transform;
+
+ crtc = config->crtc[c];
+
+ /* Skip disabled CRTCs */
+ if (!crtc->enabled)
+ continue;
+
+ if (xf86CompatOutput(scrn) && xf86CompatCrtc(scrn) == crtc)
+ output = xf86CompatOutput(scrn);
+ else
+ {
+ for (o = 0; o < config->num_output; o++)
+ if (config->output[o]->crtc == crtc)
+ {
+ output = config->output[o];
+ break;
+ }
+ }
+ /* paranoia */
+ if (!output)
+ continue;
+
+ /* Mark that we'll need to re-set the mode for sure */
+ memset(&crtc->mode, 0, sizeof(crtc->mode));
+ if (!crtc->desiredMode.CrtcHDisplay)
+ {
+ DisplayModePtr mode = xf86OutputFindClosestMode (output, scrn->currentMode);
+
+ if (!mode)
+ return FALSE;
+ crtc->desiredMode = *mode;
+ crtc->desiredRotation = RR_Rotate_0;
+ crtc->desiredTransformPresent = FALSE;
+ crtc->desiredX = 0;
+ crtc->desiredY = 0;
+ }
+
+ if (crtc->desiredTransformPresent)
+ transform = &crtc->desiredTransform;
+ else
+ transform = NULL;
+ if (!xf86CrtcSetModeTransform (crtc, &crtc->desiredMode, crtc->desiredRotation,
+ transform, crtc->desiredX, crtc->desiredY))
+ return FALSE;
+ }
+
+ xf86DisableUnusedFunctions(scrn);
+ return TRUE;
+}
+
+/**
+ * In the current world order, there are lists of modes per output, which may
+ * or may not include the mode that was asked to be set by XFree86's mode
+ * selection. Find the closest one, in the following preference order:
+ *
+ * - Equality
+ * - Closer in size to the requested mode, but no larger
+ * - Closer in refresh rate to the requested mode.
+ */
+
+DisplayModePtr
+xf86OutputFindClosestMode (xf86OutputPtr output, DisplayModePtr desired)
+{
+ DisplayModePtr best = NULL, scan = NULL;
+
+ for (scan = output->probed_modes; scan != NULL; scan = scan->next)
+ {
+ /* If there's an exact match, we're done. */
+ if (xf86ModesEqual(scan, desired)) {
+ best = desired;
+ break;
+ }
+
+ /* Reject if it's larger than the desired mode. */
+ if (scan->HDisplay > desired->HDisplay ||
+ scan->VDisplay > desired->VDisplay)
+ {
+ continue;
+ }
+
+ /*
+ * If we haven't picked a best mode yet, use the first
+ * one in the size range
+ */
+ if (best == NULL)
+ {
+ best = scan;
+ continue;
+ }
+
+ /* Find if it's closer to the right size than the current best
+ * option.
+ */
+ if ((scan->HDisplay > best->HDisplay &&
+ scan->VDisplay >= best->VDisplay) ||
+ (scan->HDisplay >= best->HDisplay &&
+ scan->VDisplay > best->VDisplay))
+ {
+ best = scan;
+ continue;
+ }
+
+ /* Find if it's still closer to the right refresh than the current
+ * best resolution.
+ */
+ if (scan->HDisplay == best->HDisplay &&
+ scan->VDisplay == best->VDisplay &&
+ (fabs(scan->VRefresh - desired->VRefresh) <
+ fabs(best->VRefresh - desired->VRefresh))) {
+ best = scan;
+ }
+ }
+ return best;
+}
+
+/**
+ * When setting a mode through XFree86-VidModeExtension or XFree86-DGA,
+ * take the specified mode and apply it to the crtc connected to the compat
+ * output. Then, find similar modes for the other outputs, as with the
+ * InitialConfiguration code above. The goal is to clone the desired
+ * mode across all outputs that are currently active.
+ */
+
+Bool
+xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ Bool ok = TRUE;
+ xf86OutputPtr compat_output;
+ DisplayModePtr compat_mode = NULL;
+ int c;
+
+ /*
+ * Let the compat output drive the final mode selection
+ */
+ compat_output = xf86CompatOutput(pScrn);
+ if (compat_output)
+ compat_mode = xf86OutputFindClosestMode (compat_output, desired);
+ if (compat_mode)
+ desired = compat_mode;
+
+ for (c = 0; c < config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = config->crtc[c];
+ DisplayModePtr crtc_mode = NULL;
+ int o;
+
+ if (!crtc->enabled)
+ continue;
+
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+ DisplayModePtr output_mode;
+
+ /* skip outputs not on this crtc */
+ if (output->crtc != crtc)
+ continue;
+
+ if (crtc_mode)
+ {
+ output_mode = xf86OutputFindClosestMode (output, crtc_mode);
+ if (output_mode != crtc_mode)
+ output->crtc = NULL;
+ }
+ else
+ crtc_mode = xf86OutputFindClosestMode (output, desired);
+ }
+ if (!crtc_mode)
+ {
+ crtc->enabled = FALSE;
+ continue;
+ }
+ if (!xf86CrtcSetModeTransform (crtc, crtc_mode, rotation, NULL, 0, 0))
+ ok = FALSE;
+ else
+ {
+ crtc->desiredMode = *crtc_mode;
+ crtc->desiredRotation = rotation;
+ crtc->desiredTransformPresent = FALSE;
+ crtc->desiredX = 0;
+ crtc->desiredY = 0;
+ }
+ }
+ xf86DisableUnusedFunctions(pScrn);
+#ifdef RANDR_12_INTERFACE
+ xf86RandR12TellChanged (pScrn->pScreen);
+#endif
+ return ok;
+}
+
+
+/**
+ * Set the DPMS power mode of all outputs and CRTCs.
+ *
+ * If the new mode is off, it will turn off outputs and then CRTCs.
+ * Otherwise, it will affect CRTCs before outputs.
+ */
+void
+xf86DPMSSet(ScrnInfoPtr scrn, int mode, int flags)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int i;
+
+ if (!scrn->vtSema)
+ return;
+
+ if (mode == DPMSModeOff) {
+ for (i = 0; i < config->num_output; i++) {
+ xf86OutputPtr output = config->output[i];
+ if (output->crtc != NULL)
+ (*output->funcs->dpms) (output, mode);
+ }
+ }
+
+ for (i = 0; i < config->num_crtc; i++) {
+ xf86CrtcPtr crtc = config->crtc[i];
+ if (crtc->enabled)
+ (*crtc->funcs->dpms) (crtc, mode);
+ }
+
+ if (mode != DPMSModeOff) {
+ for (i = 0; i < config->num_output; i++) {
+ xf86OutputPtr output = config->output[i];
+ if (output->crtc != NULL)
+ (*output->funcs->dpms) (output, mode);
+ }
+ }
+}
+
+/**
+ * Implement the screensaver by just calling down into the driver DPMS hooks.
+ *
+ * Even for monitors with no DPMS support, by the definition of our DPMS hooks,
+ * the outputs will still get disabled (blanked).
+ */
+Bool
+xf86SaveScreen(ScreenPtr pScreen, int mode)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+
+ if (xf86IsUnblank(mode))
+ xf86DPMSSet(pScrn, DPMSModeOn, 0);
+ else
+ xf86DPMSSet(pScrn, DPMSModeOff, 0);
+
+ return TRUE;
+}
+
+/**
+ * Disable all inactive crtcs and outputs
+ */
+void
+xf86DisableUnusedFunctions(ScrnInfoPtr pScrn)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int o, c;
+
+ for (o = 0; o < xf86_config->num_output; o++)
+ {
+ xf86OutputPtr output = xf86_config->output[o];
+ if (!output->crtc)
+ (*output->funcs->dpms)(output, DPMSModeOff);
+ }
+
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ if (!crtc->enabled)
+ {
+ crtc->funcs->dpms(crtc, DPMSModeOff);
+ memset(&crtc->mode, 0, sizeof(crtc->mode));
+ xf86RotateDestroy(crtc);
+ crtc->active = FALSE;
+ }
+ }
+ if (pScrn->pScreen)
+ xf86_crtc_notify(pScrn->pScreen);
+ if (pScrn->ModeSet)
+ pScrn->ModeSet(pScrn);
+}
+
+#ifdef RANDR_12_INTERFACE
+
+#define EDID_ATOM_NAME "EDID"
+
+/**
+ * Set the RandR EDID property
+ */
+static void
+xf86OutputSetEDIDProperty (xf86OutputPtr output, void *data, int data_len)
+{
+ Atom edid_atom = MakeAtom(EDID_ATOM_NAME, sizeof(EDID_ATOM_NAME) - 1, TRUE);
+
+ /* This may get called before the RandR resources have been created */
+ if (output->randr_output == NULL)
+ return;
+
+ if (data_len != 0) {
+ RRChangeOutputProperty(output->randr_output, edid_atom, XA_INTEGER, 8,
+ PropModeReplace, data_len, data, FALSE, TRUE);
+ } else {
+ RRDeleteOutputProperty(output->randr_output, edid_atom);
+ }
+}
+
+#endif
+
+/* Pull out a phyiscal size from a detailed timing if available. */
+struct det_phySize_parameter {
+ xf86OutputPtr output;
+ ddc_quirk_t quirks;
+ Bool ret;
+};
+
+static void handle_detailed_physical_size(struct detailed_monitor_section
+ *det_mon, void *data)
+{
+ struct det_phySize_parameter *p;
+ p = (struct det_phySize_parameter *)data;
+
+ if (p->ret == TRUE )
+ return ;
+
+ xf86DetTimingApplyQuirks(det_mon, p->quirks,
+ p->output->MonInfo->features.hsize,
+ p->output->MonInfo->features.vsize);
+ if (det_mon->type == DT &&
+ det_mon->section.d_timings.h_size != 0 &&
+ det_mon->section.d_timings.v_size != 0) {
+
+ p->output->mm_width = det_mon->section.d_timings.h_size;
+ p->output->mm_height = det_mon->section.d_timings.v_size;
+ p->ret = TRUE;
+ }
+}
+
+/**
+ * Set the EDID information for the specified output
+ */
+void
+xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon)
+{
+ ScrnInfoPtr scrn = output->scrn;
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ Bool debug_modes = config->debug_modes || xf86Initialising;
+#ifdef RANDR_12_INTERFACE
+ int size;
+#endif
+
+ free(output->MonInfo);
+
+ output->MonInfo = edid_mon;
+ output->mm_width = 0;
+ output->mm_height = 0;
+
+ if (debug_modes) {
+ xf86DrvMsg(scrn->scrnIndex, X_INFO, "EDID for output %s\n",
+ output->name);
+ xf86PrintEDID(edid_mon);
+ }
+
+ /* Set the DDC properties for the 'compat' output */
+ if (output == xf86CompatOutput(scrn))
+ xf86SetDDCproperties(scrn, edid_mon);
+
+#ifdef RANDR_12_INTERFACE
+ /* Set the RandR output properties */
+ size = 0;
+ if (edid_mon)
+ {
+ if (edid_mon->ver.version == 1) {
+ size = 128;
+ if (edid_mon->flags & EDID_COMPLETE_RAWDATA)
+ size += edid_mon->no_sections * 128;
+ } else if (edid_mon->ver.version == 2)
+ size = 256;
+ }
+ xf86OutputSetEDIDProperty (output, edid_mon ? edid_mon->rawData : NULL, size);
+#endif
+
+ if (edid_mon) {
+
+ struct det_phySize_parameter p;
+ p.output = output;
+ p.quirks = xf86DDCDetectQuirks(scrn->scrnIndex,edid_mon, FALSE);
+ p.ret = FALSE;
+ xf86ForEachDetailedBlock(edid_mon,
+ handle_detailed_physical_size, &p);
+
+ /* if no mm size is available from a detailed timing, check the max size field */
+ if ((!output->mm_width || !output->mm_height) &&
+ (edid_mon->features.hsize && edid_mon->features.vsize))
+ {
+ output->mm_width = edid_mon->features.hsize * 10;
+ output->mm_height = edid_mon->features.vsize * 10;
+ }
+ }
+}
+
+/**
+ * Return the list of modes supported by the EDID information
+ * stored in 'output'
+ */
+DisplayModePtr
+xf86OutputGetEDIDModes (xf86OutputPtr output)
+{
+ ScrnInfoPtr scrn = output->scrn;
+ xf86MonPtr edid_mon = output->MonInfo;
+
+ if (!edid_mon)
+ return NULL;
+ return xf86DDCGetModes(scrn->scrnIndex, edid_mon);
+}
+
+/* maybe we should care about DDC1? meh. */
+xf86MonPtr
+xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus)
+{
+ ScrnInfoPtr scrn = output->scrn;
+ xf86MonPtr mon;
+
+ mon = xf86DoEEDID(scrn->scrnIndex, pDDCBus, TRUE);
+ if (mon)
+ xf86DDCApplyQuirks(scrn->scrnIndex, mon);
+
+ return mon;
+}
+
+static char *_xf86ConnectorNames[] = {
+ "None", "VGA", "DVI-I", "DVI-D",
+ "DVI-A", "Composite", "S-Video",
+ "Component", "LFP", "Proprietary",
+ "HDMI", "DisplayPort",
+ };
+char *
+xf86ConnectorGetName(xf86ConnectorType connector)
+{
+ return _xf86ConnectorNames[connector];
+}
+
+static void
+x86_crtc_box_intersect(BoxPtr dest, BoxPtr a, BoxPtr b)
+{
+ dest->x1 = a->x1 > b->x1 ? a->x1 : b->x1;
+ dest->x2 = a->x2 < b->x2 ? a->x2 : b->x2;
+ dest->y1 = a->y1 > b->y1 ? a->y1 : b->y1;
+ dest->y2 = a->y2 < b->y2 ? a->y2 : b->y2;
+
+ if (dest->x1 >= dest->x2 || dest->y1 >= dest->y2)
+ dest->x1 = dest->x2 = dest->y1 = dest->y2 = 0;
+}
+
+static void
+x86_crtc_box(xf86CrtcPtr crtc, BoxPtr crtc_box)
+{
+ if (crtc->enabled) {
+ crtc_box->x1 = crtc->x;
+ crtc_box->x2 = crtc->x + xf86ModeWidth(&crtc->mode, crtc->rotation);
+ crtc_box->y1 = crtc->y;
+ crtc_box->y2 = crtc->y + xf86ModeHeight(&crtc->mode, crtc->rotation);
+ } else
+ crtc_box->x1 = crtc_box->x2 = crtc_box->y1 = crtc_box->y2 = 0;
+}
+
+static int
+xf86_crtc_box_area(BoxPtr box)
+{
+ return (int) (box->x2 - box->x1) * (int) (box->y2 - box->y1);
+}
+
+/*
+ * Return the crtc covering 'box'. If two crtcs cover a portion of
+ * 'box', then prefer 'desired'. If 'desired' is NULL, then prefer the crtc
+ * with greater coverage
+ */
+
+static xf86CrtcPtr
+xf86_covering_crtc(ScrnInfoPtr pScrn,
+ BoxPtr box,
+ xf86CrtcPtr desired,
+ BoxPtr crtc_box_ret)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ xf86CrtcPtr crtc, best_crtc;
+ int coverage, best_coverage;
+ int c;
+ BoxRec crtc_box, cover_box;
+
+ best_crtc = NULL;
+ best_coverage = 0;
+ crtc_box_ret->x1 = 0;
+ crtc_box_ret->x2 = 0;
+ crtc_box_ret->y1 = 0;
+ crtc_box_ret->y2 = 0;
+ for (c = 0; c < xf86_config->num_crtc; c++) {
+ crtc = xf86_config->crtc[c];
+ x86_crtc_box(crtc, &crtc_box);
+ x86_crtc_box_intersect(&cover_box, &crtc_box, box);
+ coverage = xf86_crtc_box_area(&cover_box);
+ if (coverage && crtc == desired) {
+ *crtc_box_ret = crtc_box;
+ return crtc;
+ } else if (coverage > best_coverage) {
+ *crtc_box_ret = crtc_box;
+ best_crtc = crtc;
+ best_coverage = coverage;
+ }
+ }
+ return best_crtc;
+}
+
+/*
+ * For overlay video, compute the relevant CRTC and
+ * clip video to that.
+ *
+ * returning FALSE means there was a memory failure of some kind,
+ * not that the video shouldn't be displayed
+ */
+
+Bool
+xf86_crtc_clip_video_helper(ScrnInfoPtr pScrn,
+ xf86CrtcPtr *crtc_ret,
+ xf86CrtcPtr desired_crtc,
+ BoxPtr dst,
+ INT32 *xa,
+ INT32 *xb,
+ INT32 *ya,
+ INT32 *yb,
+ RegionPtr reg,
+ INT32 width,
+ INT32 height)
+{
+ Bool ret;
+ RegionRec crtc_region_local;
+ RegionPtr crtc_region = reg;
+
+ if (crtc_ret) {
+ BoxRec crtc_box;
+ xf86CrtcPtr crtc = xf86_covering_crtc(pScrn, dst,
+ desired_crtc,
+ &crtc_box);
+
+ if (crtc) {
+ RegionInit(&crtc_region_local, &crtc_box, 1);
+ crtc_region = &crtc_region_local;
+ RegionIntersect(crtc_region, crtc_region, reg);
+ }
+ *crtc_ret = crtc;
+ }
+
+ ret = xf86XVClipVideoHelper(dst, xa, xb, ya, yb,
+ crtc_region, width, height);
+
+ if (crtc_region != reg)
+ RegionUninit(&crtc_region_local);
+
+ return ret;
+}
+
+xf86_crtc_notify_proc_ptr
+xf86_wrap_crtc_notify (ScreenPtr screen, xf86_crtc_notify_proc_ptr new)
+{
+ if (xf86CrtcConfigPrivateIndex != -1)
+ {
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86_crtc_notify_proc_ptr old;
+
+ old = config->xf86_crtc_notify;
+ config->xf86_crtc_notify = new;
+ return old;
+ }
+ return NULL;
+}
+
+void
+xf86_unwrap_crtc_notify(ScreenPtr screen, xf86_crtc_notify_proc_ptr old)
+{
+ if (xf86CrtcConfigPrivateIndex != -1)
+ {
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ config->xf86_crtc_notify = old;
+ }
+}
+
+void
+xf86_crtc_notify(ScreenPtr screen)
+{
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ if (config->xf86_crtc_notify)
+ config->xf86_crtc_notify(screen);
+}
+
+Bool
+xf86_crtc_supports_gamma(ScrnInfoPtr pScrn)
+{
+ if (xf86CrtcConfigPrivateIndex != -1) {
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ xf86CrtcPtr crtc;
+
+ /* for multiple drivers loaded we need this */
+ if (!xf86_config)
+ return FALSE;
+ if (xf86_config->num_crtc == 0)
+ return FALSE;
+ crtc = xf86_config->crtc[0];
+
+ return crtc->funcs->gamma_set != NULL;
+ }
+
+ return FALSE;
+}
diff --git a/xorg-server/hw/xfree86/modes/xf86Crtc.h b/xorg-server/hw/xfree86/modes/xf86Crtc.h
index e4037142f..68a968cc2 100644
--- a/xorg-server/hw/xfree86/modes/xf86Crtc.h
+++ b/xorg-server/hw/xfree86/modes/xf86Crtc.h
@@ -1,1075 +1,972 @@
-/*
- * Copyright © 2006 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting documentation, and
- * that the name of the copyright holders not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. The copyright holders make no representations
- * about the suitability of this software for any purpose. It is provided "as
- * is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
- * OF THIS SOFTWARE.
- */
-#ifndef _XF86CRTC_H_
-#define _XF86CRTC_H_
-
-#include <edid.h>
-#include "randrstr.h"
-#if XF86_MODES_RENAME
-#include "xf86Rename.h"
-#endif
-#include "xf86Modes.h"
-#include "xf86Cursor.h"
-#include "xf86i2c.h"
-#include "damage.h"
-#include "picturestr.h"
-
-/* Compat definitions for older X Servers. */
-#ifndef M_T_PREFERRED
-#define M_T_PREFERRED 0x08
-#endif
-#ifndef M_T_DRIVER
-#define M_T_DRIVER 0x40
-#endif
-#ifndef M_T_USERPREF
-#define M_T_USERPREF 0x80
-#endif
-#ifndef HARDWARE_CURSOR_ARGB
-#define HARDWARE_CURSOR_ARGB 0x00004000
-#endif
-
-typedef struct _xf86Crtc xf86CrtcRec, *xf86CrtcPtr;
-typedef struct _xf86Output xf86OutputRec, *xf86OutputPtr;
-
-/* define a standard for connector types */
-typedef enum _xf86ConnectorType {
- XF86ConnectorNone,
- XF86ConnectorVGA,
- XF86ConnectorDVI_I,
- XF86ConnectorDVI_D,
- XF86ConnectorDVI_A,
- XF86ConnectorComposite,
- XF86ConnectorSvideo,
- XF86ConnectorComponent,
- XF86ConnectorLFP,
- XF86ConnectorProprietary,
- XF86ConnectorHDMI,
- XF86ConnectorDisplayPort,
-} xf86ConnectorType;
-
-typedef enum _xf86OutputStatus {
- XF86OutputStatusConnected,
- XF86OutputStatusDisconnected,
- XF86OutputStatusUnknown
-} xf86OutputStatus;
-
-typedef enum _xf86CrtcSetFlags {
- XF86CrtcSetMode = 1, /* mode */
- XF86CrtcSetOutput = 2, /* outputs */
- XF86CrtcSetOrigin = 4, /* x/y */
- XF86CrtcSetTransform = 8, /* transform */
- XF86CrtcSetRotation = 16, /* rotation */
- XF86CrtcSetProperty = 32, /* output property */
- XF86CrtcSetScanoutPixmap = 64, /* scanout pixmap */
-} xf86CrtcSetFlags;
-
-typedef struct _xf86CrtcSet {
- xf86CrtcSetFlags flags;
- DisplayModePtr mode;
- Rotation rotation;
- RRTransformPtr transform;
- int x, y;
- PixmapPtr scanout_pixmap;
-} xf86CrtcSetRec;
-
-typedef struct _xf86CrtcFuncs {
- /**
- * Turns the crtc on/off, or sets intermediate power levels if available.
- *
- * Unsupported intermediate modes drop to the lower power setting. If the
- * mode is DPMSModeOff, the crtc must be disabled sufficiently for it to
- * be safe to call mode_set.
- */
- void
- (*dpms)(xf86CrtcPtr crtc,
- int mode);
-
- /**
- * Saves the crtc's state for restoration on VT switch.
- */
- void
- (*save)(xf86CrtcPtr crtc);
-
- /**
- * Restore's the crtc's state at VT switch.
- */
- void
- (*restore)(xf86CrtcPtr crtc);
-
- /**
- * Lock CRTC prior to mode setting, mostly for DRI.
- * Returns whether unlock is needed
- */
- Bool
- (*lock) (xf86CrtcPtr crtc);
-
- /**
- * Unlock CRTC after mode setting, mostly for DRI
- */
- void
- (*unlock) (xf86CrtcPtr crtc);
-
- /**
- * Callback to adjust the mode to be set in the CRTC.
- *
- * This allows a CRTC to adjust the clock or even the entire set of
- * timings, which is used for panels with fixed timings or for
- * buses with clock limitations.
- */
- Bool
- (*mode_fixup)(xf86CrtcPtr crtc,
- DisplayModePtr mode,
- DisplayModePtr adjusted_mode);
-
- /**
- * Prepare CRTC for an upcoming mode set.
- */
- void
- (*prepare)(xf86CrtcPtr crtc);
-
- /**
- * Callback for setting up a video mode after fixups have been made.
- */
- void
- (*mode_set)(xf86CrtcPtr crtc,
- DisplayModePtr mode,
- DisplayModePtr adjusted_mode,
- int x, int y);
-
- /**
- * Commit mode changes to a CRTC
- */
- void
- (*commit)(xf86CrtcPtr crtc);
-
- /* Set the color ramps for the CRTC to the given values. */
- void
- (*gamma_set)(xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue,
- int size);
-
- /**
- * Allocate the shadow area, delay the pixmap creation until needed
- */
- void *
- (*shadow_allocate) (xf86CrtcPtr crtc, int width, int height);
-
- /**
- * Create shadow pixmap for rotation support
- */
- PixmapPtr
- (*shadow_create) (xf86CrtcPtr crtc, void *data, int width, int height);
-
- /**
- * Destroy shadow pixmap
- */
- void
- (*shadow_destroy) (xf86CrtcPtr crtc, PixmapPtr pPixmap, void *data);
-
- /**
- * Set cursor colors
- */
- void
- (*set_cursor_colors) (xf86CrtcPtr crtc, int bg, int fg);
-
- /**
- * Set cursor position
- */
- void
- (*set_cursor_position) (xf86CrtcPtr crtc, int x, int y);
-
- /**
- * Show cursor
- */
- void
- (*show_cursor) (xf86CrtcPtr crtc);
-
- /**
- * Hide cursor
- */
- void
- (*hide_cursor) (xf86CrtcPtr crtc);
-
- /**
- * Load monochrome image
- */
- void
- (*load_cursor_image) (xf86CrtcPtr crtc, CARD8 *image);
-
- /**
- * Load ARGB image
- */
- void
- (*load_cursor_argb) (xf86CrtcPtr crtc, CARD32 *image);
-
- /**
- * Clean up driver-specific bits of the crtc
- */
- void
- (*destroy) (xf86CrtcPtr crtc);
-
- /**
- * Less fine-grained mode setting entry point for kernel modesetting
- */
- Bool
- (*set_mode_major)(xf86CrtcPtr crtc, DisplayModePtr mode,
- Rotation rotation, int x, int y);
-
- /**
- * Callback for panning. Doesn't change the mode.
- * Added in ABI version 2
- */
- void
- (*set_origin)(xf86CrtcPtr crtc, int x, int y);
-
- /**
- * General mode setting entry point that does everything
- */
- Bool
- (*set)(xf86CrtcPtr crtc, xf86CrtcSetFlags flags);
-
-} xf86CrtcFuncsRec, *xf86CrtcFuncsPtr;
-
-#define XF86_CRTC_VERSION 3
-
-struct _xf86Crtc {
- /**
- * ABI versioning
- */
- int version;
-
- /**
- * Associated ScrnInfo
- */
- ScrnInfoPtr scrn;
-
- /**
- * Desired state of this CRTC
- *
- * Set when this CRTC should be driving one or more outputs
- */
- Bool enabled;
-
- /**
- * Active mode
- *
- * This reflects the mode as set in the CRTC currently
- * It will be cleared when the VT is not active or
- * during server startup
- */
- DisplayModeRec mode;
- Rotation rotation;
- PixmapPtr rotatedPixmap;
- void *rotatedData;
- PixmapPtr scanoutPixmap;
-
- /**
- * Position on screen
- *
- * Locates this CRTC within the frame buffer
- */
- int x, y;
-
- /**
- * Desired mode
- *
- * This is set to the requested mode, independent of
- * whether the VT is active. In particular, it receives
- * the startup configured mode and saves the active mode
- * on VT switch.
- */
- DisplayModeRec desiredMode;
- Rotation desiredRotation;
- int desiredX, desiredY;
-
- /** crtc-specific functions */
- const xf86CrtcFuncsRec *funcs;
-
- /**
- * Driver private
- *
- * Holds driver-private information
- */
- void *driver_private;
-
-#ifdef RANDR_12_INTERFACE
- /**
- * RandR crtc
- *
- * When RandR 1.2 is available, this
- * points at the associated crtc object
- */
- RRCrtcPtr randr_crtc;
-#else
- void *randr_crtc;
-#endif
-
- /**
- * Current cursor is ARGB
- */
- Bool cursor_argb;
- /**
- * Track whether cursor is within CRTC range
- */
- Bool cursor_in_range;
- /**
- * Track state of cursor associated with this CRTC
- */
- Bool cursor_shown;
-
- /**
- * Current transformation matrix
- */
- PictTransform crtc_to_framebuffer;
- /* framebuffer_to_crtc was removed in ABI 2 */
- struct pict_f_transform f_crtc_to_framebuffer; /* ABI 2 */
- struct pict_f_transform f_framebuffer_to_crtc; /* ABI 2 */
- PictFilterPtr filter; /* ABI 2 */
- xFixed *params; /* ABI 2 */
- int nparams; /* ABI 2 */
- int filter_width; /* ABI 2 */
- int filter_height; /* ABI 2 */
- Bool transform_in_use;
- Bool sprite_transform_in_use;
- RRTransformRec transform; /* ABI 2 */
- Bool transformPresent; /* ABI 2 */
- RRTransformRec desiredTransform; /* ABI 2 */
- Bool desiredTransformPresent; /* ABI 2 */
- /**
- * Bounding box in screen space
- */
- BoxRec bounds;
- /**
- * Panning:
- * TotalArea: total panning area, larger than CRTC's size
- * TrackingArea: Area of the pointer for which the CRTC is panned
- * border: Borders of the displayed CRTC area which induces panning if the pointer reaches them
- * Added in ABI version 2
- */
- BoxRec panningTotalArea;
- BoxRec panningTrackingArea;
- INT16 panningBorder[4];
-
- /**
- * Current gamma, especially useful after initial config.
- * Added in ABI version 3
- */
- CARD16 *gamma_red;
- CARD16 *gamma_green;
- CARD16 *gamma_blue;
- int gamma_size;
-
- /**
- * Actual state of this CRTC
- *
- * Set to TRUE after modesetting, set to FALSE if no outputs are connected
- * Added in ABI version 3
- */
- Bool active;
- /**
- * Clear the shadow
- */
- Bool shadowClear;
-
- /**
- * Sprite position transforms
- */
-
- /* Transform a screen coordinate to a crtc coordinate */
- struct pixman_f_transform f_screen_to_crtc;
-
- /* The user-specified portion of the screen to crtc conversion */
- struct pixman_f_transform user_sprite_position_transform;
-
- /* Transform a hardware cursor coordinate to a cursor coordinate */
- struct pixman_f_transform f_crtc_to_cursor;
-
- /* The user-specified portion of the cursor to hardware transform */
- struct pixman_f_transform user_sprite_image_transform;
-};
-
-typedef struct _xf86OutputFuncs {
- /**
- * Called to allow the output a chance to create properties after the
- * RandR objects have been created.
- */
- void
- (*create_resources)(xf86OutputPtr output);
-
- /**
- * Turns the output on/off, or sets intermediate power levels if available.
- *
- * Unsupported intermediate modes drop to the lower power setting. If the
- * mode is DPMSModeOff, the output must be disabled, as the DPLL may be
- * disabled afterwards.
- */
- void
- (*dpms)(xf86OutputPtr output,
- int mode);
-
- /**
- * Saves the output's state for restoration on VT switch.
- */
- void
- (*save)(xf86OutputPtr output);
-
- /**
- * Restore's the output's state at VT switch.
- */
- void
- (*restore)(xf86OutputPtr output);
-
- /**
- * Callback for testing a video mode for a given output.
- *
- * This function should only check for cases where a mode can't be supported
- * on the output specifically, and not represent generic CRTC limitations.
- *
- * \return MODE_OK if the mode is valid, or another MODE_* otherwise.
- */
- int
- (*mode_valid)(xf86OutputPtr output,
- DisplayModePtr pMode);
-
- /**
- * Callback to adjust the mode to be set in the CRTC.
- *
- * This allows an output to adjust the clock or even the entire set of
- * timings, which is used for panels with fixed timings or for
- * buses with clock limitations.
- */
- Bool
- (*mode_fixup)(xf86OutputPtr output,
- DisplayModePtr mode,
- DisplayModePtr adjusted_mode);
-
- /**
- * Callback for preparing mode changes on an output
- */
- void
- (*prepare)(xf86OutputPtr output);
-
- /**
- * Callback for committing mode changes on an output
- */
- void
- (*commit)(xf86OutputPtr output);
-
- /**
- * Callback for setting up a video mode after fixups have been made.
- *
- * This is only called while the output is disabled. The dpms callback
- * must be all that's necessary for the output, to turn the output on
- * after this function is called.
- */
- void
- (*mode_set)(xf86OutputPtr output,
- DisplayModePtr mode,
- DisplayModePtr adjusted_mode);
-
- /**
- * Probe for a connected output, and return detect_status.
- */
- xf86OutputStatus
- (*detect)(xf86OutputPtr output);
-
- /**
- * Query the device for the modes it provides.
- *
- * This function may also update MonInfo, mm_width, and mm_height.
- *
- * \return singly-linked list of modes or NULL if no modes found.
- */
- DisplayModePtr
- (*get_modes)(xf86OutputPtr output);
-
-#ifdef RANDR_12_INTERFACE
- /**
- * Callback when an output's property has changed.
- */
- Bool
- (*set_property)(xf86OutputPtr output,
- Atom property,
- RRPropertyValuePtr value);
-#endif
-#ifdef RANDR_13_INTERFACE
- /**
- * Callback to get an updated property value
- */
- Bool
- (*get_property)(xf86OutputPtr output,
- Atom property);
-#endif
-#ifdef RANDR_GET_CRTC_INTERFACE
- /**
- * Callback to get current CRTC for a given output
- */
- xf86CrtcPtr
- (*get_crtc)(xf86OutputPtr output);
-#endif
- /**
- * Clean up driver-specific bits of the output
- */
- void
- (*destroy) (xf86OutputPtr output);
-} xf86OutputFuncsRec, *xf86OutputFuncsPtr;
-
-
-#define XF86_OUTPUT_VERSION 2
-
-struct _xf86Output {
- /**
- * ABI versioning
- */
- int version;
-
- /**
- * Associated ScrnInfo
- */
- ScrnInfoPtr scrn;
-
- /**
- * Currently connected crtc (if any)
- *
- * If this output is not in use, this field will be NULL.
- */
- xf86CrtcPtr crtc;
-
- /**
- * Possible CRTCs for this output as a mask of crtc indices
- */
- CARD32 possible_crtcs;
-
- /**
- * Possible outputs to share the same CRTC as a mask of output indices
- */
- CARD32 possible_clones;
-
- /**
- * Whether this output can support interlaced modes
- */
- Bool interlaceAllowed;
-
- /**
- * Whether this output can support double scan modes
- */
- Bool doubleScanAllowed;
-
- /**
- * List of available modes on this output.
- *
- * This should be the list from get_modes(), plus perhaps additional
- * compatible modes added later.
- */
- DisplayModePtr probed_modes;
-
- /**
- * Options parsed from the related monitor section
- */
- OptionInfoPtr options;
-
- /**
- * Configured monitor section
- */
- XF86ConfMonitorPtr conf_monitor;
-
- /**
- * Desired initial position
- */
- int initial_x, initial_y;
-
- /**
- * Desired initial rotation
- */
- Rotation initial_rotation;
-
- /**
- * Current connection status
- *
- * This indicates whether a monitor is known to be connected
- * to this output or not, or whether there is no way to tell
- */
- xf86OutputStatus status;
-
- /** EDID monitor information */
- xf86MonPtr MonInfo;
-
- /** subpixel order */
- int subpixel_order;
-
- /** Physical size of the currently attached output device. */
- int mm_width, mm_height;
-
- /** Output name */
- char *name;
-
- /** output-specific functions */
- const xf86OutputFuncsRec *funcs;
-
- /** driver private information */
- void *driver_private;
-
- /** Whether to use the old per-screen Monitor config section */
- Bool use_screen_monitor;
-
-#ifdef RANDR_12_INTERFACE
- /**
- * RandR 1.2 output structure.
- *
- * When RandR 1.2 is available, this points at the associated
- * RandR output structure and is created when this output is created
- */
- RROutputPtr randr_output;
-#else
- void *randr_output;
-#endif
- /**
- * Desired initial panning
- * Added in ABI version 2
- */
- BoxRec initialTotalArea;
- BoxRec initialTrackingArea;
- INT16 initialBorder[4];
-};
-
-typedef enum _xf86SetConfigResponse {
- xf86SetConfigFailed, /* set_config failed */
- xf86SetConfigChecked, /* set_config validated the configuration */
- xf86SetConfigDone, /* set_config finished the work */
-} xf86SetConfigResponse;
-
-typedef struct _xf86CrtcSetConfig {
- xf86CrtcPtr crtc;
- int x, y;
- DisplayModeRec mode;
- Rotation rotation;
- int numOutputs;
- xf86OutputPtr *outputs;
- struct pict_f_transform sprite_position_transform;
- struct pict_f_transform sprite_image_transform;
-
- /* Probably want some internal structure for the pixmap so that
- * this can be set before the server is running
- */
- PixmapPtr pixmap;
- int pixmap_x, pixmap_y;
-} xf86CrtcSetConfigRec, *xf86CrtcSetConfigPtr;
-
-typedef struct _xf86CrtcScanoutFormat {
- int depth;
- int bitsPerPixel;
- int maxWidth, maxHeight;
- Rotation rotations;
- PictFormatShort format;
-} xf86CrtcScanoutFormat;
-
-typedef struct _xf86CrtcConfigFuncs {
- /**
- * Requests that the driver resize the screen.
- *
- * The driver is responsible for updating scrn->virtualX and scrn->virtualY.
- * If the requested size cannot be set, the driver should leave those values
- * alone and return FALSE.
- *
- * A naive driver that cannot reallocate the screen may simply change
- * virtual[XY]. A more advanced driver will want to also change the
- * devPrivate.ptr and devKind of the screen pixmap, update any offscreen
- * pixmaps it may have moved, and change pScrn->displayWidth.
- */
- Bool
- (*resize)(ScrnInfoPtr scrn,
- int width,
- int height);
-
- xf86SetConfigResponse
- (*set_config) (ScrnInfoPtr scrn,
- RRScreenConfigPtr screen_config,
- xf86CrtcSetConfigPtr crtc_configs,
- int num_configs);
-
- /**
- * Create a scanout pixmap
- */
- PixmapPtr
- (*create_scanout_pixmap)(ScrnInfoPtr scrn,
- int width,
- int height,
- Rotation rotations,
- xf86CrtcScanoutFormat *format);
-
-} xf86CrtcConfigFuncsRec, *xf86CrtcConfigFuncsPtr;
-
-typedef void (*xf86_crtc_notify_proc_ptr) (ScreenPtr pScreen);
-
-typedef struct _xf86CrtcConfig {
- int num_output;
- xf86OutputPtr *output;
- /**
- * compat_output is used whenever we deal
- * with legacy code that only understands a single
- * output. pScrn->modes will be loaded from this output,
- * adjust frame will whack this output, etc.
- */
- int compat_output;
-
- int num_crtc;
- xf86CrtcPtr *crtc;
-
- int minWidth, minHeight;
- int maxWidth, maxHeight;
-
- /* For crtc-based rotation */
- DamagePtr rotation_damage;
- Bool rotation_damage_registered;
-
- /* DGA */
- unsigned int dga_flags;
- unsigned long dga_address;
- DGAModePtr dga_modes;
- int dga_nmode;
- int dga_width, dga_height, dga_stride;
- DisplayModePtr dga_save_mode;
-
- const xf86CrtcConfigFuncsRec *funcs;
-
- CreateScreenResourcesProcPtr CreateScreenResources;
-
- CloseScreenProcPtr CloseScreen;
-
- /* Cursor information */
- xf86CursorInfoPtr cursor_info;
- CursorPtr cursor;
- CARD8 *cursor_image;
- Bool cursor_on;
- CARD32 cursor_fg, cursor_bg;
-
- /**
- * Options parsed from the related device section
- */
- OptionInfoPtr options;
-
- Bool debug_modes;
-
- /* wrap screen BlockHandler for rotation */
- ScreenBlockHandlerProcPtr BlockHandler;
-
- /* callback when crtc configuration changes */
- xf86_crtc_notify_proc_ptr xf86_crtc_notify;
-
- /*
- * Supported scanout pixmap formats
- */
- int num_scanout_formats;
- xf86CrtcScanoutFormat *scanout_formats;
-} xf86CrtcConfigRec, *xf86CrtcConfigPtr;
-
-extern _X_EXPORT int xf86CrtcConfigPrivateIndex;
-
-#define XF86_CRTC_CONFIG_PTR(p) ((xf86CrtcConfigPtr) ((p)->privates[xf86CrtcConfigPrivateIndex].ptr))
-
-static _X_INLINE xf86OutputPtr
-xf86CompatOutput(ScrnInfoPtr pScrn)
-{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
- return config->output[config->compat_output];
-}
-
-static _X_INLINE xf86CrtcPtr
-xf86CompatCrtc(ScrnInfoPtr pScrn)
-{
- xf86OutputPtr compat_output = xf86CompatOutput(pScrn);
- if (!compat_output)
- return NULL;
- return compat_output->crtc;
-}
-
-static _X_INLINE RRCrtcPtr
-xf86CompatRRCrtc(ScrnInfoPtr pScrn)
-{
- xf86CrtcPtr compat_crtc = xf86CompatCrtc(pScrn);
- if (!compat_crtc)
- return NULL;
- return compat_crtc->randr_crtc;
-}
-
-
-/*
- * Initialize xf86CrtcConfig structure
- */
-
-extern _X_EXPORT void
-xf86CrtcConfigInit (ScrnInfoPtr scrn,
- const xf86CrtcConfigFuncsRec *funcs);
-
-extern _X_EXPORT void
-xf86CrtcSetSizeRange (ScrnInfoPtr scrn,
- int minWidth, int minHeight,
- int maxWidth, int maxHeight);
-
-extern _X_EXPORT void
-xf86CrtcSetScanoutFormats (ScrnInfoPtr scrn,
- int num_formats,
- xf86CrtcScanoutFormat *formats);
-
-/*
- * Crtc functions
- */
-extern _X_EXPORT xf86CrtcPtr
-xf86CrtcCreate (ScrnInfoPtr scrn,
- const xf86CrtcFuncsRec *funcs);
-
-extern _X_EXPORT void
-xf86CrtcDestroy (xf86CrtcPtr crtc);
-
-/**
- * Change a crtc configuration (modes, outputs, etc)
- */
-
-extern _X_EXPORT Bool
-xf86CrtcSet (xf86CrtcPtr crtc, xf86CrtcSetRec *set);
-
-extern _X_EXPORT void
-xf86CrtcSetOrigin (xf86CrtcPtr crtc, int x, int y);
-
-/*
- * Assign crtc rotation during mode set
- */
-extern _X_EXPORT Bool
-xf86CrtcRotate (xf86CrtcPtr crtc);
-
-
-/*
- * Update cursor transform matrices after user changes
- * This is just the cursor subset of xf86CrtcRotate
- */
-extern _X_EXPORT void
-xf86CrtcRotateCursor (xf86CrtcPtr crtc);
-
-/*
- * Clean up any rotation data, used when a crtc is turned off
- * as well as when rotation is disabled.
- */
-extern _X_EXPORT void
-xf86RotateDestroy (xf86CrtcPtr crtc);
-
-/*
- * free shadow memory allocated for all crtcs
- */
-extern _X_EXPORT void
-xf86RotateFreeShadow(ScrnInfoPtr pScrn);
-
-/*
- * Clean up rotation during CloseScreen
- */
-extern _X_EXPORT void
-xf86RotateCloseScreen (ScreenPtr pScreen);
-
-/**
- * Return whether any output is assigned to the crtc
- */
-extern _X_EXPORT Bool
-xf86CrtcInUse (xf86CrtcPtr crtc);
-
-/*
- * Output functions
- */
-extern _X_EXPORT xf86OutputPtr
-xf86OutputCreate (ScrnInfoPtr scrn,
- const xf86OutputFuncsRec *funcs,
- const char *name);
-
-extern _X_EXPORT void
-xf86OutputUseScreenMonitor (xf86OutputPtr output, Bool use_screen_monitor);
-
-extern _X_EXPORT Bool
-xf86OutputRename (xf86OutputPtr output, const char *name);
-
-extern _X_EXPORT void
-xf86OutputDestroy (xf86OutputPtr output);
-
-extern _X_EXPORT void
-xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY);
-
-extern _X_EXPORT void
-xf86SetScrnInfoModes (ScrnInfoPtr pScrn);
-
-#ifdef RANDR_13_INTERFACE
-# define ScreenInitRetType int
-#else
-# define ScreenInitRetType Bool
-#endif
-
-extern _X_EXPORT ScreenInitRetType
-xf86CrtcScreenInit (ScreenPtr pScreen);
-
-extern _X_EXPORT Bool
-xf86InitialConfiguration (ScrnInfoPtr pScrn, Bool canGrow);
-
-extern _X_EXPORT void
-xf86DPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags);
-
-extern _X_EXPORT Bool
-xf86SaveScreen(ScreenPtr pScreen, int mode);
-
-extern _X_EXPORT void
-xf86DisableUnusedFunctions(ScrnInfoPtr pScrn);
-
-extern _X_EXPORT DisplayModePtr
-xf86OutputFindClosestMode (xf86OutputPtr output, DisplayModePtr desired);
-
-extern _X_EXPORT Bool
-xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation);
-
-/**
- * Set the EDID information for the specified output
- */
-extern _X_EXPORT void
-xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon);
-
-/**
- * Return the list of modes supported by the EDID information
- * stored in 'output'
- */
-extern _X_EXPORT DisplayModePtr
-xf86OutputGetEDIDModes (xf86OutputPtr output);
-
-extern _X_EXPORT xf86MonPtr
-xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus);
-
-/**
- * Initialize dga for this screen
- */
-
-#ifdef XFreeXDGA
-extern _X_EXPORT Bool
-xf86DiDGAInit (ScreenPtr pScreen, unsigned long dga_address);
-
-/* this is the real function, used only internally */
-_X_INTERNAL Bool
-_xf86_di_dga_init_internal (ScreenPtr pScreen);
-
-/**
- * Re-initialize dga for this screen (as when the set of modes changes)
- */
-
-extern _X_EXPORT Bool
-xf86DiDGAReInit (ScreenPtr pScreen);
-#endif
-
-/* This is the real function, used only internally */
-_X_INTERNAL Bool
-_xf86_di_dga_reinit_internal (ScreenPtr pScreen);
-
-/*
- * Set the subpixel order reported for the screen using
- * the information from the outputs
- */
-
-extern _X_EXPORT void
-xf86CrtcSetScreenSubpixelOrder (ScreenPtr pScreen);
-
-/*
- * Get a standard string name for a connector type
- */
-extern _X_EXPORT char *
-xf86ConnectorGetName(xf86ConnectorType connector);
-
-/*
- * Using the desired mode information in each crtc, set
- * modes (used in EnterVT functions, or at server startup)
- */
-
-extern _X_EXPORT Bool
-xf86SetDesiredModes (ScrnInfoPtr pScrn);
-
-/**
- * Initialize the CRTC-based cursor code. CRTC function vectors must
- * contain relevant cursor setting functions.
- *
- * Driver should call this from ScreenInit function
- */
-extern _X_EXPORT Bool
-xf86_cursors_init (ScreenPtr screen, int max_width, int max_height, int flags);
-
-/**
- * Called when anything on the screen is reconfigured.
- *
- * Reloads cursor images as needed, then adjusts cursor positions.
- *
- * Driver should call this from crtc commit function.
- */
-extern _X_EXPORT void
-xf86_reload_cursors (ScreenPtr screen);
-
-/**
- * Called from EnterVT to turn the cursors back on
- */
-extern _X_EXPORT void
-xf86_show_cursors (ScrnInfoPtr scrn);
-
-/**
- * Called by the driver to turn cursors off
- */
-extern _X_EXPORT void
-xf86_hide_cursors (ScrnInfoPtr scrn);
-
-/**
- * Clean up CRTC-based cursor code. Driver must call this at CloseScreen time.
- */
-extern _X_EXPORT void
-xf86_cursors_fini (ScreenPtr screen);
-
-/*
- * For overlay video, compute the relevant CRTC and
- * clip video to that.
- * wraps xf86XVClipVideoHelper()
- */
-
-extern _X_EXPORT Bool
-xf86_crtc_clip_video_helper(ScrnInfoPtr pScrn,
- xf86CrtcPtr *crtc_ret,
- xf86CrtcPtr desired_crtc,
- BoxPtr dst,
- INT32 *xa,
- INT32 *xb,
- INT32 *ya,
- INT32 *yb,
- RegionPtr reg,
- INT32 width,
- INT32 height);
-
-extern _X_EXPORT xf86_crtc_notify_proc_ptr
-xf86_wrap_crtc_notify (ScreenPtr pScreen, xf86_crtc_notify_proc_ptr new);
-
-extern _X_EXPORT void
-xf86_unwrap_crtc_notify(ScreenPtr pScreen, xf86_crtc_notify_proc_ptr old);
-
-extern _X_EXPORT void
-xf86_crtc_notify(ScreenPtr pScreen);
-
-/**
- * Gamma
- */
-
-extern _X_EXPORT Bool
-xf86_crtc_supports_gamma(ScrnInfoPtr pScrn);
-
-#endif /* _XF86CRTC_H_ */
+/*
+ * Copyright © 2006 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+#ifndef _XF86CRTC_H_
+#define _XF86CRTC_H_
+
+#include <edid.h>
+#include "randrstr.h"
+#if XF86_MODES_RENAME
+#include "xf86Rename.h"
+#endif
+#include "xf86Modes.h"
+#include "xf86Cursor.h"
+#include "xf86i2c.h"
+#include "damage.h"
+#include "picturestr.h"
+
+/* Compat definitions for older X Servers. */
+#ifndef M_T_PREFERRED
+#define M_T_PREFERRED 0x08
+#endif
+#ifndef M_T_DRIVER
+#define M_T_DRIVER 0x40
+#endif
+#ifndef M_T_USERPREF
+#define M_T_USERPREF 0x80
+#endif
+#ifndef HARDWARE_CURSOR_ARGB
+#define HARDWARE_CURSOR_ARGB 0x00004000
+#endif
+
+typedef struct _xf86Crtc xf86CrtcRec, *xf86CrtcPtr;
+typedef struct _xf86Output xf86OutputRec, *xf86OutputPtr;
+
+/* define a standard for connector types */
+typedef enum _xf86ConnectorType {
+ XF86ConnectorNone,
+ XF86ConnectorVGA,
+ XF86ConnectorDVI_I,
+ XF86ConnectorDVI_D,
+ XF86ConnectorDVI_A,
+ XF86ConnectorComposite,
+ XF86ConnectorSvideo,
+ XF86ConnectorComponent,
+ XF86ConnectorLFP,
+ XF86ConnectorProprietary,
+ XF86ConnectorHDMI,
+ XF86ConnectorDisplayPort,
+} xf86ConnectorType;
+
+typedef enum _xf86OutputStatus {
+ XF86OutputStatusConnected,
+ XF86OutputStatusDisconnected,
+ XF86OutputStatusUnknown
+} xf86OutputStatus;
+
+typedef struct _xf86CrtcFuncs {
+ /**
+ * Turns the crtc on/off, or sets intermediate power levels if available.
+ *
+ * Unsupported intermediate modes drop to the lower power setting. If the
+ * mode is DPMSModeOff, the crtc must be disabled sufficiently for it to
+ * be safe to call mode_set.
+ */
+ void
+ (*dpms)(xf86CrtcPtr crtc,
+ int mode);
+
+ /**
+ * Saves the crtc's state for restoration on VT switch.
+ */
+ void
+ (*save)(xf86CrtcPtr crtc);
+
+ /**
+ * Restore's the crtc's state at VT switch.
+ */
+ void
+ (*restore)(xf86CrtcPtr crtc);
+
+ /**
+ * Lock CRTC prior to mode setting, mostly for DRI.
+ * Returns whether unlock is needed
+ */
+ Bool
+ (*lock) (xf86CrtcPtr crtc);
+
+ /**
+ * Unlock CRTC after mode setting, mostly for DRI
+ */
+ void
+ (*unlock) (xf86CrtcPtr crtc);
+
+ /**
+ * Callback to adjust the mode to be set in the CRTC.
+ *
+ * This allows a CRTC to adjust the clock or even the entire set of
+ * timings, which is used for panels with fixed timings or for
+ * buses with clock limitations.
+ */
+ Bool
+ (*mode_fixup)(xf86CrtcPtr crtc,
+ DisplayModePtr mode,
+ DisplayModePtr adjusted_mode);
+
+ /**
+ * Prepare CRTC for an upcoming mode set.
+ */
+ void
+ (*prepare)(xf86CrtcPtr crtc);
+
+ /**
+ * Callback for setting up a video mode after fixups have been made.
+ */
+ void
+ (*mode_set)(xf86CrtcPtr crtc,
+ DisplayModePtr mode,
+ DisplayModePtr adjusted_mode,
+ int x, int y);
+
+ /**
+ * Commit mode changes to a CRTC
+ */
+ void
+ (*commit)(xf86CrtcPtr crtc);
+
+ /* Set the color ramps for the CRTC to the given values. */
+ void
+ (*gamma_set)(xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue,
+ int size);
+
+ /**
+ * Allocate the shadow area, delay the pixmap creation until needed
+ */
+ void *
+ (*shadow_allocate) (xf86CrtcPtr crtc, int width, int height);
+
+ /**
+ * Create shadow pixmap for rotation support
+ */
+ PixmapPtr
+ (*shadow_create) (xf86CrtcPtr crtc, void *data, int width, int height);
+
+ /**
+ * Destroy shadow pixmap
+ */
+ void
+ (*shadow_destroy) (xf86CrtcPtr crtc, PixmapPtr pPixmap, void *data);
+
+ /**
+ * Set cursor colors
+ */
+ void
+ (*set_cursor_colors) (xf86CrtcPtr crtc, int bg, int fg);
+
+ /**
+ * Set cursor position
+ */
+ void
+ (*set_cursor_position) (xf86CrtcPtr crtc, int x, int y);
+
+ /**
+ * Show cursor
+ */
+ void
+ (*show_cursor) (xf86CrtcPtr crtc);
+
+ /**
+ * Hide cursor
+ */
+ void
+ (*hide_cursor) (xf86CrtcPtr crtc);
+
+ /**
+ * Load monochrome image
+ */
+ void
+ (*load_cursor_image) (xf86CrtcPtr crtc, CARD8 *image);
+
+ /**
+ * Load ARGB image
+ */
+ void
+ (*load_cursor_argb) (xf86CrtcPtr crtc, CARD32 *image);
+
+ /**
+ * Clean up driver-specific bits of the crtc
+ */
+ void
+ (*destroy) (xf86CrtcPtr crtc);
+
+ /**
+ * Less fine-grained mode setting entry point for kernel modesetting
+ */
+ Bool
+ (*set_mode_major)(xf86CrtcPtr crtc, DisplayModePtr mode,
+ Rotation rotation, int x, int y);
+
+ /**
+ * Callback for panning. Doesn't change the mode.
+ * Added in ABI version 2
+ */
+ void
+ (*set_origin)(xf86CrtcPtr crtc, int x, int y);
+
+} xf86CrtcFuncsRec, *xf86CrtcFuncsPtr;
+
+#define XF86_CRTC_VERSION 3
+
+struct _xf86Crtc {
+ /**
+ * ABI versioning
+ */
+ int version;
+
+ /**
+ * Associated ScrnInfo
+ */
+ ScrnInfoPtr scrn;
+
+ /**
+ * Desired state of this CRTC
+ *
+ * Set when this CRTC should be driving one or more outputs
+ */
+ Bool enabled;
+
+ /**
+ * Active mode
+ *
+ * This reflects the mode as set in the CRTC currently
+ * It will be cleared when the VT is not active or
+ * during server startup
+ */
+ DisplayModeRec mode;
+ Rotation rotation;
+ PixmapPtr rotatedPixmap;
+ void *rotatedData;
+
+ /**
+ * Position on screen
+ *
+ * Locates this CRTC within the frame buffer
+ */
+ int x, y;
+
+ /**
+ * Desired mode
+ *
+ * This is set to the requested mode, independent of
+ * whether the VT is active. In particular, it receives
+ * the startup configured mode and saves the active mode
+ * on VT switch.
+ */
+ DisplayModeRec desiredMode;
+ Rotation desiredRotation;
+ int desiredX, desiredY;
+
+ /** crtc-specific functions */
+ const xf86CrtcFuncsRec *funcs;
+
+ /**
+ * Driver private
+ *
+ * Holds driver-private information
+ */
+ void *driver_private;
+
+#ifdef RANDR_12_INTERFACE
+ /**
+ * RandR crtc
+ *
+ * When RandR 1.2 is available, this
+ * points at the associated crtc object
+ */
+ RRCrtcPtr randr_crtc;
+#else
+ void *randr_crtc;
+#endif
+
+ /**
+ * Current cursor is ARGB
+ */
+ Bool cursor_argb;
+ /**
+ * Track whether cursor is within CRTC range
+ */
+ Bool cursor_in_range;
+ /**
+ * Track state of cursor associated with this CRTC
+ */
+ Bool cursor_shown;
+
+ /**
+ * Current transformation matrix
+ */
+ PictTransform crtc_to_framebuffer;
+ /* framebuffer_to_crtc was removed in ABI 2 */
+ struct pict_f_transform f_crtc_to_framebuffer; /* ABI 2 */
+ struct pict_f_transform f_framebuffer_to_crtc; /* ABI 2 */
+ PictFilterPtr filter; /* ABI 2 */
+ xFixed *params; /* ABI 2 */
+ int nparams; /* ABI 2 */
+ int filter_width; /* ABI 2 */
+ int filter_height; /* ABI 2 */
+ Bool transform_in_use;
+ RRTransformRec transform; /* ABI 2 */
+ Bool transformPresent; /* ABI 2 */
+ RRTransformRec desiredTransform; /* ABI 2 */
+ Bool desiredTransformPresent; /* ABI 2 */
+ /**
+ * Bounding box in screen space
+ */
+ BoxRec bounds;
+ /**
+ * Panning:
+ * TotalArea: total panning area, larger than CRTC's size
+ * TrackingArea: Area of the pointer for which the CRTC is panned
+ * border: Borders of the displayed CRTC area which induces panning if the pointer reaches them
+ * Added in ABI version 2
+ */
+ BoxRec panningTotalArea;
+ BoxRec panningTrackingArea;
+ INT16 panningBorder[4];
+
+ /**
+ * Current gamma, especially useful after initial config.
+ * Added in ABI version 3
+ */
+ CARD16 *gamma_red;
+ CARD16 *gamma_green;
+ CARD16 *gamma_blue;
+ int gamma_size;
+
+ /**
+ * Actual state of this CRTC
+ *
+ * Set to TRUE after modesetting, set to FALSE if no outputs are connected
+ * Added in ABI version 3
+ */
+ Bool active;
+ /**
+ * Clear the shadow
+ */
+ Bool shadowClear;
+};
+
+typedef struct _xf86OutputFuncs {
+ /**
+ * Called to allow the output a chance to create properties after the
+ * RandR objects have been created.
+ */
+ void
+ (*create_resources)(xf86OutputPtr output);
+
+ /**
+ * Turns the output on/off, or sets intermediate power levels if available.
+ *
+ * Unsupported intermediate modes drop to the lower power setting. If the
+ * mode is DPMSModeOff, the output must be disabled, as the DPLL may be
+ * disabled afterwards.
+ */
+ void
+ (*dpms)(xf86OutputPtr output,
+ int mode);
+
+ /**
+ * Saves the output's state for restoration on VT switch.
+ */
+ void
+ (*save)(xf86OutputPtr output);
+
+ /**
+ * Restore's the output's state at VT switch.
+ */
+ void
+ (*restore)(xf86OutputPtr output);
+
+ /**
+ * Callback for testing a video mode for a given output.
+ *
+ * This function should only check for cases where a mode can't be supported
+ * on the output specifically, and not represent generic CRTC limitations.
+ *
+ * \return MODE_OK if the mode is valid, or another MODE_* otherwise.
+ */
+ int
+ (*mode_valid)(xf86OutputPtr output,
+ DisplayModePtr pMode);
+
+ /**
+ * Callback to adjust the mode to be set in the CRTC.
+ *
+ * This allows an output to adjust the clock or even the entire set of
+ * timings, which is used for panels with fixed timings or for
+ * buses with clock limitations.
+ */
+ Bool
+ (*mode_fixup)(xf86OutputPtr output,
+ DisplayModePtr mode,
+ DisplayModePtr adjusted_mode);
+
+ /**
+ * Callback for preparing mode changes on an output
+ */
+ void
+ (*prepare)(xf86OutputPtr output);
+
+ /**
+ * Callback for committing mode changes on an output
+ */
+ void
+ (*commit)(xf86OutputPtr output);
+
+ /**
+ * Callback for setting up a video mode after fixups have been made.
+ *
+ * This is only called while the output is disabled. The dpms callback
+ * must be all that's necessary for the output, to turn the output on
+ * after this function is called.
+ */
+ void
+ (*mode_set)(xf86OutputPtr output,
+ DisplayModePtr mode,
+ DisplayModePtr adjusted_mode);
+
+ /**
+ * Probe for a connected output, and return detect_status.
+ */
+ xf86OutputStatus
+ (*detect)(xf86OutputPtr output);
+
+ /**
+ * Query the device for the modes it provides.
+ *
+ * This function may also update MonInfo, mm_width, and mm_height.
+ *
+ * \return singly-linked list of modes or NULL if no modes found.
+ */
+ DisplayModePtr
+ (*get_modes)(xf86OutputPtr output);
+
+#ifdef RANDR_12_INTERFACE
+ /**
+ * Callback when an output's property has changed.
+ */
+ Bool
+ (*set_property)(xf86OutputPtr output,
+ Atom property,
+ RRPropertyValuePtr value);
+#endif
+#ifdef RANDR_13_INTERFACE
+ /**
+ * Callback to get an updated property value
+ */
+ Bool
+ (*get_property)(xf86OutputPtr output,
+ Atom property);
+#endif
+#ifdef RANDR_GET_CRTC_INTERFACE
+ /**
+ * Callback to get current CRTC for a given output
+ */
+ xf86CrtcPtr
+ (*get_crtc)(xf86OutputPtr output);
+#endif
+ /**
+ * Clean up driver-specific bits of the output
+ */
+ void
+ (*destroy) (xf86OutputPtr output);
+} xf86OutputFuncsRec, *xf86OutputFuncsPtr;
+
+
+#define XF86_OUTPUT_VERSION 2
+
+struct _xf86Output {
+ /**
+ * ABI versioning
+ */
+ int version;
+
+ /**
+ * Associated ScrnInfo
+ */
+ ScrnInfoPtr scrn;
+
+ /**
+ * Currently connected crtc (if any)
+ *
+ * If this output is not in use, this field will be NULL.
+ */
+ xf86CrtcPtr crtc;
+
+ /**
+ * Possible CRTCs for this output as a mask of crtc indices
+ */
+ CARD32 possible_crtcs;
+
+ /**
+ * Possible outputs to share the same CRTC as a mask of output indices
+ */
+ CARD32 possible_clones;
+
+ /**
+ * Whether this output can support interlaced modes
+ */
+ Bool interlaceAllowed;
+
+ /**
+ * Whether this output can support double scan modes
+ */
+ Bool doubleScanAllowed;
+
+ /**
+ * List of available modes on this output.
+ *
+ * This should be the list from get_modes(), plus perhaps additional
+ * compatible modes added later.
+ */
+ DisplayModePtr probed_modes;
+
+ /**
+ * Options parsed from the related monitor section
+ */
+ OptionInfoPtr options;
+
+ /**
+ * Configured monitor section
+ */
+ XF86ConfMonitorPtr conf_monitor;
+
+ /**
+ * Desired initial position
+ */
+ int initial_x, initial_y;
+
+ /**
+ * Desired initial rotation
+ */
+ Rotation initial_rotation;
+
+ /**
+ * Current connection status
+ *
+ * This indicates whether a monitor is known to be connected
+ * to this output or not, or whether there is no way to tell
+ */
+ xf86OutputStatus status;
+
+ /** EDID monitor information */
+ xf86MonPtr MonInfo;
+
+ /** subpixel order */
+ int subpixel_order;
+
+ /** Physical size of the currently attached output device. */
+ int mm_width, mm_height;
+
+ /** Output name */
+ char *name;
+
+ /** output-specific functions */
+ const xf86OutputFuncsRec *funcs;
+
+ /** driver private information */
+ void *driver_private;
+
+ /** Whether to use the old per-screen Monitor config section */
+ Bool use_screen_monitor;
+
+#ifdef RANDR_12_INTERFACE
+ /**
+ * RandR 1.2 output structure.
+ *
+ * When RandR 1.2 is available, this points at the associated
+ * RandR output structure and is created when this output is created
+ */
+ RROutputPtr randr_output;
+#else
+ void *randr_output;
+#endif
+ /**
+ * Desired initial panning
+ * Added in ABI version 2
+ */
+ BoxRec initialTotalArea;
+ BoxRec initialTrackingArea;
+ INT16 initialBorder[4];
+};
+
+typedef struct _xf86CrtcConfigFuncs {
+ /**
+ * Requests that the driver resize the screen.
+ *
+ * The driver is responsible for updating scrn->virtualX and scrn->virtualY.
+ * If the requested size cannot be set, the driver should leave those values
+ * alone and return FALSE.
+ *
+ * A naive driver that cannot reallocate the screen may simply change
+ * virtual[XY]. A more advanced driver will want to also change the
+ * devPrivate.ptr and devKind of the screen pixmap, update any offscreen
+ * pixmaps it may have moved, and change pScrn->displayWidth.
+ */
+ Bool
+ (*resize)(ScrnInfoPtr scrn,
+ int width,
+ int height);
+} xf86CrtcConfigFuncsRec, *xf86CrtcConfigFuncsPtr;
+
+typedef void (*xf86_crtc_notify_proc_ptr) (ScreenPtr pScreen);
+
+typedef struct _xf86CrtcConfig {
+ int num_output;
+ xf86OutputPtr *output;
+ /**
+ * compat_output is used whenever we deal
+ * with legacy code that only understands a single
+ * output. pScrn->modes will be loaded from this output,
+ * adjust frame will whack this output, etc.
+ */
+ int compat_output;
+
+ int num_crtc;
+ xf86CrtcPtr *crtc;
+
+ int minWidth, minHeight;
+ int maxWidth, maxHeight;
+
+ /* For crtc-based rotation */
+ DamagePtr rotation_damage;
+ Bool rotation_damage_registered;
+
+ /* DGA */
+ unsigned int dga_flags;
+ unsigned long dga_address;
+ DGAModePtr dga_modes;
+ int dga_nmode;
+ int dga_width, dga_height, dga_stride;
+ DisplayModePtr dga_save_mode;
+
+ const xf86CrtcConfigFuncsRec *funcs;
+
+ CreateScreenResourcesProcPtr CreateScreenResources;
+
+ CloseScreenProcPtr CloseScreen;
+
+ /* Cursor information */
+ xf86CursorInfoPtr cursor_info;
+ CursorPtr cursor;
+ CARD8 *cursor_image;
+ Bool cursor_on;
+ CARD32 cursor_fg, cursor_bg;
+
+ /**
+ * Options parsed from the related device section
+ */
+ OptionInfoPtr options;
+
+ Bool debug_modes;
+
+ /* wrap screen BlockHandler for rotation */
+ ScreenBlockHandlerProcPtr BlockHandler;
+
+ /* callback when crtc configuration changes */
+ xf86_crtc_notify_proc_ptr xf86_crtc_notify;
+
+} xf86CrtcConfigRec, *xf86CrtcConfigPtr;
+
+extern _X_EXPORT int xf86CrtcConfigPrivateIndex;
+
+#define XF86_CRTC_CONFIG_PTR(p) ((xf86CrtcConfigPtr) ((p)->privates[xf86CrtcConfigPrivateIndex].ptr))
+
+static _X_INLINE xf86OutputPtr
+xf86CompatOutput(ScrnInfoPtr pScrn)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ return config->output[config->compat_output];
+}
+
+static _X_INLINE xf86CrtcPtr
+xf86CompatCrtc(ScrnInfoPtr pScrn)
+{
+ xf86OutputPtr compat_output = xf86CompatOutput(pScrn);
+ if (!compat_output)
+ return NULL;
+ return compat_output->crtc;
+}
+
+static _X_INLINE RRCrtcPtr
+xf86CompatRRCrtc(ScrnInfoPtr pScrn)
+{
+ xf86CrtcPtr compat_crtc = xf86CompatCrtc(pScrn);
+ if (!compat_crtc)
+ return NULL;
+ return compat_crtc->randr_crtc;
+}
+
+
+/*
+ * Initialize xf86CrtcConfig structure
+ */
+
+extern _X_EXPORT void
+xf86CrtcConfigInit (ScrnInfoPtr scrn,
+ const xf86CrtcConfigFuncsRec *funcs);
+
+extern _X_EXPORT void
+xf86CrtcSetSizeRange (ScrnInfoPtr scrn,
+ int minWidth, int minHeight,
+ int maxWidth, int maxHeight);
+
+/*
+ * Crtc functions
+ */
+extern _X_EXPORT xf86CrtcPtr
+xf86CrtcCreate (ScrnInfoPtr scrn,
+ const xf86CrtcFuncsRec *funcs);
+
+extern _X_EXPORT void
+xf86CrtcDestroy (xf86CrtcPtr crtc);
+
+
+/**
+ * Sets the given video mode on the given crtc
+ */
+
+extern _X_EXPORT Bool
+xf86CrtcSetModeTransform (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
+ RRTransformPtr transform, int x, int y);
+
+extern _X_EXPORT Bool
+xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
+ int x, int y);
+
+extern _X_EXPORT void
+xf86CrtcSetOrigin (xf86CrtcPtr crtc, int x, int y);
+
+/*
+ * Assign crtc rotation during mode set
+ */
+extern _X_EXPORT Bool
+xf86CrtcRotate (xf86CrtcPtr crtc);
+
+/*
+ * Clean up any rotation data, used when a crtc is turned off
+ * as well as when rotation is disabled.
+ */
+extern _X_EXPORT void
+xf86RotateDestroy (xf86CrtcPtr crtc);
+
+/*
+ * free shadow memory allocated for all crtcs
+ */
+extern _X_EXPORT void
+xf86RotateFreeShadow(ScrnInfoPtr pScrn);
+
+/*
+ * Clean up rotation during CloseScreen
+ */
+extern _X_EXPORT void
+xf86RotateCloseScreen (ScreenPtr pScreen);
+
+/**
+ * Return whether any output is assigned to the crtc
+ */
+extern _X_EXPORT Bool
+xf86CrtcInUse (xf86CrtcPtr crtc);
+
+/*
+ * Output functions
+ */
+extern _X_EXPORT xf86OutputPtr
+xf86OutputCreate (ScrnInfoPtr scrn,
+ const xf86OutputFuncsRec *funcs,
+ const char *name);
+
+extern _X_EXPORT void
+xf86OutputUseScreenMonitor (xf86OutputPtr output, Bool use_screen_monitor);
+
+extern _X_EXPORT Bool
+xf86OutputRename (xf86OutputPtr output, const char *name);
+
+extern _X_EXPORT void
+xf86OutputDestroy (xf86OutputPtr output);
+
+extern _X_EXPORT void
+xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY);
+
+extern _X_EXPORT void
+xf86SetScrnInfoModes (ScrnInfoPtr pScrn);
+
+#ifdef RANDR_13_INTERFACE
+# define ScreenInitRetType int
+#else
+# define ScreenInitRetType Bool
+#endif
+
+extern _X_EXPORT ScreenInitRetType
+xf86CrtcScreenInit (ScreenPtr pScreen);
+
+extern _X_EXPORT Bool
+xf86InitialConfiguration (ScrnInfoPtr pScrn, Bool canGrow);
+
+extern _X_EXPORT void
+xf86DPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags);
+
+extern _X_EXPORT Bool
+xf86SaveScreen(ScreenPtr pScreen, int mode);
+
+extern _X_EXPORT void
+xf86DisableUnusedFunctions(ScrnInfoPtr pScrn);
+
+extern _X_EXPORT DisplayModePtr
+xf86OutputFindClosestMode (xf86OutputPtr output, DisplayModePtr desired);
+
+extern _X_EXPORT Bool
+xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation);
+
+/**
+ * Set the EDID information for the specified output
+ */
+extern _X_EXPORT void
+xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon);
+
+/**
+ * Return the list of modes supported by the EDID information
+ * stored in 'output'
+ */
+extern _X_EXPORT DisplayModePtr
+xf86OutputGetEDIDModes (xf86OutputPtr output);
+
+extern _X_EXPORT xf86MonPtr
+xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus);
+
+/**
+ * Initialize dga for this screen
+ */
+
+#ifdef XFreeXDGA
+extern _X_EXPORT Bool
+xf86DiDGAInit (ScreenPtr pScreen, unsigned long dga_address);
+
+/* this is the real function, used only internally */
+_X_INTERNAL Bool
+_xf86_di_dga_init_internal (ScreenPtr pScreen);
+
+/**
+ * Re-initialize dga for this screen (as when the set of modes changes)
+ */
+
+extern _X_EXPORT Bool
+xf86DiDGAReInit (ScreenPtr pScreen);
+#endif
+
+/* This is the real function, used only internally */
+_X_INTERNAL Bool
+_xf86_di_dga_reinit_internal (ScreenPtr pScreen);
+
+/*
+ * Set the subpixel order reported for the screen using
+ * the information from the outputs
+ */
+
+extern _X_EXPORT void
+xf86CrtcSetScreenSubpixelOrder (ScreenPtr pScreen);
+
+/*
+ * Get a standard string name for a connector type
+ */
+extern _X_EXPORT char *
+xf86ConnectorGetName(xf86ConnectorType connector);
+
+/*
+ * Using the desired mode information in each crtc, set
+ * modes (used in EnterVT functions, or at server startup)
+ */
+
+extern _X_EXPORT Bool
+xf86SetDesiredModes (ScrnInfoPtr pScrn);
+
+/**
+ * Initialize the CRTC-based cursor code. CRTC function vectors must
+ * contain relevant cursor setting functions.
+ *
+ * Driver should call this from ScreenInit function
+ */
+extern _X_EXPORT Bool
+xf86_cursors_init (ScreenPtr screen, int max_width, int max_height, int flags);
+
+/**
+ * Called when anything on the screen is reconfigured.
+ *
+ * Reloads cursor images as needed, then adjusts cursor positions.
+ *
+ * Driver should call this from crtc commit function.
+ */
+extern _X_EXPORT void
+xf86_reload_cursors (ScreenPtr screen);
+
+/**
+ * Called from EnterVT to turn the cursors back on
+ */
+extern _X_EXPORT void
+xf86_show_cursors (ScrnInfoPtr scrn);
+
+/**
+ * Called by the driver to turn cursors off
+ */
+extern _X_EXPORT void
+xf86_hide_cursors (ScrnInfoPtr scrn);
+
+/**
+ * Clean up CRTC-based cursor code. Driver must call this at CloseScreen time.
+ */
+extern _X_EXPORT void
+xf86_cursors_fini (ScreenPtr screen);
+
+/*
+ * For overlay video, compute the relevant CRTC and
+ * clip video to that.
+ * wraps xf86XVClipVideoHelper()
+ */
+
+extern _X_EXPORT Bool
+xf86_crtc_clip_video_helper(ScrnInfoPtr pScrn,
+ xf86CrtcPtr *crtc_ret,
+ xf86CrtcPtr desired_crtc,
+ BoxPtr dst,
+ INT32 *xa,
+ INT32 *xb,
+ INT32 *ya,
+ INT32 *yb,
+ RegionPtr reg,
+ INT32 width,
+ INT32 height);
+
+extern _X_EXPORT xf86_crtc_notify_proc_ptr
+xf86_wrap_crtc_notify (ScreenPtr pScreen, xf86_crtc_notify_proc_ptr new);
+
+extern _X_EXPORT void
+xf86_unwrap_crtc_notify(ScreenPtr pScreen, xf86_crtc_notify_proc_ptr old);
+
+extern _X_EXPORT void
+xf86_crtc_notify(ScreenPtr pScreen);
+
+/**
+ * Gamma
+ */
+
+extern _X_EXPORT Bool
+xf86_crtc_supports_gamma(ScrnInfoPtr pScrn);
+
+#endif /* _XF86CRTC_H_ */
diff --git a/xorg-server/hw/xfree86/modes/xf86Cursors.c b/xorg-server/hw/xfree86/modes/xf86Cursors.c
index 3c2958743..066744744 100644
--- a/xorg-server/hw/xfree86/modes/xf86Cursors.c
+++ b/xorg-server/hw/xfree86/modes/xf86Cursors.c
@@ -1,688 +1,688 @@
-/*
- * Copyright © 2007 Keith Packard
- * Copyright © 2010 Aaron Plattner
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting documentation, and
- * that the name of the copyright holders not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. The copyright holders make no representations
- * about the suitability of this software for any purpose. It is provided "as
- * is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
- * OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#else
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#endif
-
-#include <stddef.h>
-#include <string.h>
-#include <stdio.h>
-
-#include "xf86.h"
-#include "xf86DDC.h"
-#include "xf86Crtc.h"
-#include "xf86Modes.h"
-#include "xf86RandR12.h"
-#include "xf86CursorPriv.h"
-#include "X11/extensions/render.h"
-#include "X11/extensions/dpmsconst.h"
-#include "X11/Xatom.h"
-#include "picturestr.h"
-#include "cursorstr.h"
-#include "inputstr.h"
-
-/*
- * Given a screen coordinate, rotate back to a cursor source coordinate
- */
-static void
-xf86_crtc_rotate_coord (Rotation rotation,
- int width,
- int height,
- int x_dst,
- int y_dst,
- int *x_src,
- int *y_src)
-{
- int t;
-
- switch (rotation & 0xf) {
- case RR_Rotate_0:
- break;
- case RR_Rotate_90:
- t = x_dst;
- x_dst = height - y_dst - 1;
- y_dst = t;
- break;
- case RR_Rotate_180:
- x_dst = width - x_dst - 1;
- y_dst = height - y_dst - 1;
- break;
- case RR_Rotate_270:
- t = x_dst;
- x_dst = y_dst;
- y_dst = width - t - 1;
- break;
- }
- if (rotation & RR_Reflect_X)
- x_dst = width - x_dst - 1;
- if (rotation & RR_Reflect_Y)
- y_dst = height - y_dst - 1;
- *x_src = x_dst;
- *y_src = y_dst;
-}
-
-/*
- * Given a cursor source coordinate, rotate to a screen coordinate
- */
-static void
-xf86_crtc_rotate_coord_back (Rotation rotation,
- int width,
- int height,
- int x_dst,
- int y_dst,
- int *x_src,
- int *y_src)
-{
- int t;
-
- if (rotation & RR_Reflect_X)
- x_dst = width - x_dst - 1;
- if (rotation & RR_Reflect_Y)
- y_dst = height - y_dst - 1;
-
- switch (rotation & 0xf) {
- case RR_Rotate_0:
- break;
- case RR_Rotate_90:
- t = x_dst;
- x_dst = y_dst;
- y_dst = width - t - 1;
- break;
- case RR_Rotate_180:
- x_dst = width - x_dst - 1;
- y_dst = height - y_dst - 1;
- break;
- case RR_Rotate_270:
- t = x_dst;
- x_dst = height - y_dst - 1;
- y_dst = t;
- break;
- }
- *x_src = x_dst;
- *y_src = y_dst;
-}
-
-struct cursor_bit {
- CARD8 *byte;
- char bitpos;
-};
-
-/*
- * Convert an x coordinate to a position within the cursor bitmap
- */
-static struct cursor_bit
-cursor_bitpos (CARD8 *image, xf86CursorInfoPtr cursor_info, int x, int y,
- Bool mask)
-{
- const int flags = cursor_info->Flags;
- const Bool interleaved =
- !!(flags & (HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1 |
- HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_8 |
- HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_16 |
- HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32 |
- HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64));
- const int width = cursor_info->MaxWidth;
- const int height = cursor_info->MaxHeight;
- const int stride = interleaved ? width / 4 : width / 8;
-
- struct cursor_bit ret;
-
- image += y * stride;
-
- if (flags & HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK)
- mask = !mask;
- if (flags & HARDWARE_CURSOR_NIBBLE_SWAPPED)
- x = (x & ~3) | (3 - (x & 3));
- if (((flags & HARDWARE_CURSOR_BIT_ORDER_MSBFIRST) == 0) ==
- (X_BYTE_ORDER == X_BIG_ENDIAN))
- x = (x & ~7) | (7 - (x & 7));
- if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1)
- x = (x << 1) + mask;
- else if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_8)
- x = ((x & ~7) << 1) | (mask << 3) | (x & 7);
- else if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_16)
- x = ((x & ~15) << 1) | (mask << 4) | (x & 15);
- else if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32)
- x = ((x & ~31) << 1) | (mask << 5) | (x & 31);
- else if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64)
- x = ((x & ~63) << 1) | (mask << 6) | (x & 63);
- else if (mask)
- image += stride * height;
-
- ret.byte = image + (x / 8);
- ret.bitpos = x & 7;
-
- return ret;
-}
-
-/*
- * Fetch one bit from a cursor bitmap
- */
-static CARD8
-get_bit (CARD8 *image, xf86CursorInfoPtr cursor_info, int x, int y, Bool mask)
-{
- struct cursor_bit bit = cursor_bitpos(image, cursor_info, x, y, mask);
- return (*bit.byte >> bit.bitpos) & 1;
-}
-
-/*
- * Set one bit in a cursor bitmap
- */
-static void
-set_bit (CARD8 *image, xf86CursorInfoPtr cursor_info, int x, int y, Bool mask)
-{
- struct cursor_bit bit = cursor_bitpos(image, cursor_info, x, y, mask);
- *bit.byte |= 1 << bit.bitpos;
-}
-
-/*
- * Load a two color cursor into a driver that supports only ARGB cursors
- */
-static void
-xf86_crtc_convert_cursor_to_argb (xf86CrtcPtr crtc, unsigned char *src)
-{
- ScrnInfoPtr scrn = crtc->scrn;
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
- CARD32 *cursor_image = (CARD32 *) xf86_config->cursor_image;
- int x, y;
- int xin, yin;
- int flags = cursor_info->Flags;
- CARD32 bits;
-
-#ifdef ARGB_CURSOR
- crtc->cursor_argb = FALSE;
-#endif
-
- for (y = 0; y < cursor_info->MaxHeight; y++)
- for (x = 0; x < cursor_info->MaxWidth; x++)
- {
- xf86_crtc_rotate_coord (crtc->rotation,
- cursor_info->MaxWidth,
- cursor_info->MaxHeight,
- x, y, &xin, &yin);
- if (get_bit (src, cursor_info, xin, yin, TRUE) ==
- ((flags & HARDWARE_CURSOR_INVERT_MASK) == 0))
- {
- if (get_bit (src, cursor_info, xin, yin, FALSE))
- bits = xf86_config->cursor_fg;
- else
- bits = xf86_config->cursor_bg;
- }
- else
- bits = 0;
- cursor_image[y * cursor_info->MaxWidth + x] = bits;
- }
- crtc->funcs->load_cursor_argb (crtc, cursor_image);
-}
-
-/*
- * Set the colors for a two-color cursor (ignore for ARGB cursors)
- */
-static void
-xf86_set_cursor_colors (ScrnInfoPtr scrn, int bg, int fg)
-{
- ScreenPtr screen = scrn->pScreen;
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- CursorPtr cursor = xf86_config->cursor;
- int c;
- CARD8 *bits = cursor ?
- dixLookupPrivate(&cursor->devPrivates, CursorScreenKey(screen))
- : NULL;
-
- /* Save ARGB versions of these colors */
- xf86_config->cursor_fg = (CARD32) fg | 0xff000000;
- xf86_config->cursor_bg = (CARD32) bg | 0xff000000;
-
- for (c = 0; c < xf86_config->num_crtc; c++)
- {
- xf86CrtcPtr crtc = xf86_config->crtc[c];
-
- if (crtc->enabled && !crtc->cursor_argb)
- {
- if (crtc->funcs->load_cursor_image)
- crtc->funcs->set_cursor_colors (crtc, bg, fg);
- else if (bits)
- xf86_crtc_convert_cursor_to_argb (crtc, bits);
- }
- }
-}
-
-static void
-xf86_crtc_hide_cursor (xf86CrtcPtr crtc)
-{
- if (crtc->cursor_shown)
- {
- crtc->funcs->hide_cursor (crtc);
- crtc->cursor_shown = FALSE;
- }
-}
-
-void
-xf86_hide_cursors (ScrnInfoPtr scrn)
-{
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- int c;
-
- xf86_config->cursor_on = FALSE;
- for (c = 0; c < xf86_config->num_crtc; c++)
- {
- xf86CrtcPtr crtc = xf86_config->crtc[c];
-
- if (crtc->enabled)
- xf86_crtc_hide_cursor (crtc);
- }
-}
-
-static void
-xf86_crtc_show_cursor (xf86CrtcPtr crtc)
-{
- if (!crtc->cursor_shown && crtc->cursor_in_range)
- {
- crtc->funcs->show_cursor (crtc);
- crtc->cursor_shown = TRUE;
- }
-}
-
-void
-xf86_show_cursors (ScrnInfoPtr scrn)
-{
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- int c;
-
- xf86_config->cursor_on = TRUE;
- for (c = 0; c < xf86_config->num_crtc; c++)
- {
- xf86CrtcPtr crtc = xf86_config->crtc[c];
-
- if (crtc->enabled)
- xf86_crtc_show_cursor (crtc);
- }
-}
-
-static void
-xf86_crtc_set_cursor_position (xf86CrtcPtr crtc, int x, int y)
-{
- ScrnInfoPtr scrn = crtc->scrn;
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
- DisplayModePtr mode = &crtc->mode;
- Bool in_range;
- int dx, dy;
-
- /*
- * Transform position of cursor on screen
- */
- if (crtc->sprite_transform_in_use)
- {
- ScreenPtr screen = scrn->pScreen;
- xf86CursorScreenPtr ScreenPriv =
- (xf86CursorScreenPtr)dixLookupPrivate(&screen->devPrivates,
- xf86CursorScreenKey);
- struct pict_f_vector v;
-
- v.v[0] = (x + ScreenPriv->HotX) + 0.5;
- v.v[1] = (y + ScreenPriv->HotY) + 0.5;
- v.v[2] = 1;
- pixman_f_transform_point (&crtc->f_screen_to_crtc, &v);
- /* cursor will have 0.5 added to it already so floor is sufficent */
- x = floor (v.v[0]);
- y = floor (v.v[1]);
- /*
- * Transform position of cursor upper left corner
- */
- xf86_crtc_rotate_coord_back (crtc->rotation,
- cursor_info->MaxWidth,
- cursor_info->MaxHeight,
- ScreenPriv->HotX, ScreenPriv->HotY, &dx, &dy);
- x -= dx;
- y -= dy;
- }
- else
- {
- x -= crtc->x;
- y -= crtc->y;
- }
-
- /*
- * Disable the cursor when it is outside the viewport
- */
- in_range = TRUE;
- if (x >= mode->HDisplay || y >= mode->VDisplay ||
- x <= -cursor_info->MaxWidth || y <= -cursor_info->MaxHeight)
- {
- in_range = FALSE;
- x = 0;
- y = 0;
- }
-
- crtc->cursor_in_range = in_range;
-
- if (in_range)
- {
- crtc->funcs->set_cursor_position (crtc, x, y);
- xf86_crtc_show_cursor (crtc);
- }
- else
- xf86_crtc_hide_cursor (crtc);
-}
-
-static void
-xf86_set_cursor_position (ScrnInfoPtr scrn, int x, int y)
-{
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- int c;
-
- /* undo what xf86HWCurs did to the coordinates */
- x += scrn->frameX0;
- y += scrn->frameY0;
- for (c = 0; c < xf86_config->num_crtc; c++)
- {
- xf86CrtcPtr crtc = xf86_config->crtc[c];
-
- if (crtc->enabled)
- xf86_crtc_set_cursor_position (crtc, x, y);
- }
-}
-
-/*
- * Load a two-color cursor into a crtc, performing rotation as needed
- */
-static void
-xf86_crtc_load_cursor_image (xf86CrtcPtr crtc, CARD8 *src)
-{
- ScrnInfoPtr scrn = crtc->scrn;
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
- CARD8 *cursor_image;
-
-#ifdef ARGB_CURSOR
- crtc->cursor_argb = FALSE;
-#endif
-
- if (crtc->rotation == RR_Rotate_0)
- cursor_image = src;
- else
- {
- int x, y;
- int xin, yin;
- int stride = cursor_info->MaxWidth >> 2;
-
- cursor_image = xf86_config->cursor_image;
- memset(cursor_image, 0, cursor_info->MaxHeight * stride);
-
- for (y = 0; y < cursor_info->MaxHeight; y++)
- for (x = 0; x < cursor_info->MaxWidth; x++)
- {
- xf86_crtc_rotate_coord (crtc->rotation,
- cursor_info->MaxWidth,
- cursor_info->MaxHeight,
- x, y, &xin, &yin);
- if (get_bit(src, cursor_info, xin, yin, FALSE))
- set_bit(cursor_image, cursor_info, x, y, FALSE);
- if (get_bit(src, cursor_info, xin, yin, TRUE))
- set_bit(cursor_image, cursor_info, x, y, TRUE);
- }
- }
- crtc->funcs->load_cursor_image (crtc, cursor_image);
-}
-
-/*
- * Load a cursor image into all active CRTCs
- */
-static void
-xf86_load_cursor_image (ScrnInfoPtr scrn, unsigned char *src)
-{
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- int c;
-
- for (c = 0; c < xf86_config->num_crtc; c++)
- {
- xf86CrtcPtr crtc = xf86_config->crtc[c];
-
- if (crtc->enabled)
- {
- if (crtc->funcs->load_cursor_image)
- xf86_crtc_load_cursor_image (crtc, src);
- else if (crtc->funcs->load_cursor_argb)
- xf86_crtc_convert_cursor_to_argb (crtc, src);
- }
- }
-}
-
-static Bool
-xf86_use_hw_cursor (ScreenPtr screen, CursorPtr cursor)
-{
- ScrnInfoPtr scrn = xf86Screens[screen->myNum];
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
-
- ++cursor->refcnt;
- if (xf86_config->cursor)
- FreeCursor (xf86_config->cursor, None);
- xf86_config->cursor = cursor;
-
- if (cursor->bits->width > cursor_info->MaxWidth ||
- cursor->bits->height> cursor_info->MaxHeight)
- return FALSE;
-
- return TRUE;
-}
-
-static Bool
-xf86_use_hw_cursor_argb (ScreenPtr screen, CursorPtr cursor)
-{
- ScrnInfoPtr scrn = xf86Screens[screen->myNum];
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
-
- ++cursor->refcnt;
- if (xf86_config->cursor)
- FreeCursor (xf86_config->cursor, None);
- xf86_config->cursor = cursor;
-
- /* Make sure ARGB support is available */
- if ((cursor_info->Flags & HARDWARE_CURSOR_ARGB) == 0)
- return FALSE;
-
- if (cursor->bits->width > cursor_info->MaxWidth ||
- cursor->bits->height> cursor_info->MaxHeight)
- return FALSE;
-
- return TRUE;
-}
-
-static void
-xf86_crtc_load_cursor_argb (xf86CrtcPtr crtc, CursorPtr cursor)
-{
- ScrnInfoPtr scrn = crtc->scrn;
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
- CARD32 *cursor_image = (CARD32 *) xf86_config->cursor_image;
- CARD32 *cursor_source = (CARD32 *) cursor->bits->argb;
- int x, y;
- int xin, yin;
- CARD32 bits;
- int source_width = cursor->bits->width;
- int source_height = cursor->bits->height;
- int image_width = cursor_info->MaxWidth;
- int image_height = cursor_info->MaxHeight;
-
- for (y = 0; y < image_height; y++)
- for (x = 0; x < image_width; x++)
- {
- xf86_crtc_rotate_coord (crtc->rotation, image_width, image_height,
- x, y, &xin, &yin);
- if (xin < source_width && yin < source_height)
- bits = cursor_source[yin * source_width + xin];
- else
- bits = 0;
- cursor_image[y * image_width + x] = bits;
- }
-
- crtc->funcs->load_cursor_argb (crtc, cursor_image);
-}
-
-static void
-xf86_load_cursor_argb (ScrnInfoPtr scrn, CursorPtr cursor)
-{
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- int c;
-
- for (c = 0; c < xf86_config->num_crtc; c++)
- {
- xf86CrtcPtr crtc = xf86_config->crtc[c];
-
- if (crtc->enabled)
- xf86_crtc_load_cursor_argb (crtc, cursor);
- }
-}
-
-Bool
-xf86_cursors_init (ScreenPtr screen, int max_width, int max_height, int flags)
-{
- ScrnInfoPtr scrn = xf86Screens[screen->myNum];
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- xf86CursorInfoPtr cursor_info;
-
- cursor_info = xf86CreateCursorInfoRec();
- if (!cursor_info)
- return FALSE;
-
- xf86_config->cursor_image = malloc(max_width * max_height * 4);
-
- if (!xf86_config->cursor_image)
- {
- xf86DestroyCursorInfoRec (cursor_info);
- return FALSE;
- }
-
- xf86_config->cursor_info = cursor_info;
-
- cursor_info->MaxWidth = max_width;
- cursor_info->MaxHeight = max_height;
- cursor_info->Flags = flags;
-
- cursor_info->SetCursorColors = xf86_set_cursor_colors;
- cursor_info->SetCursorPosition = xf86_set_cursor_position;
- cursor_info->LoadCursorImage = xf86_load_cursor_image;
- cursor_info->HideCursor = xf86_hide_cursors;
- cursor_info->ShowCursor = xf86_show_cursors;
- cursor_info->UseHWCursor = xf86_use_hw_cursor;
-#ifdef ARGB_CURSOR
- if (flags & HARDWARE_CURSOR_ARGB)
- {
- cursor_info->UseHWCursorARGB = xf86_use_hw_cursor_argb;
- cursor_info->LoadCursorARGB = xf86_load_cursor_argb;
- }
-#endif
-
- xf86_config->cursor = NULL;
- xf86_hide_cursors (scrn);
-
- return xf86InitCursor (screen, cursor_info);
-}
-
-/**
- * Called when anything on the screen is reconfigured.
- *
- * Reloads cursor images as needed, then adjusts cursor positions
- */
-
-void
-xf86_reload_cursors (ScreenPtr screen)
-{
- ScrnInfoPtr scrn;
- xf86CrtcConfigPtr xf86_config;
- xf86CursorInfoPtr cursor_info;
- CursorPtr cursor;
- int x, y;
- xf86CursorScreenPtr cursor_screen_priv;
-
- /* initial mode setting will not have set a screen yet.
- May be called before the devices are initialised.
- */
- if (!screen || !inputInfo.pointer)
- return;
- cursor_screen_priv = dixLookupPrivate(&screen->devPrivates,
- xf86CursorScreenKey);
- /* return if HW cursor is inactive, to avoid displaying two cursors */
- if (!cursor_screen_priv || !cursor_screen_priv->isUp)
- return;
-
- scrn = xf86Screens[screen->myNum];
- xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
-
- /* make sure the cursor code has been initialized */
- cursor_info = xf86_config->cursor_info;
- if (!cursor_info)
- return;
-
- cursor = xf86_config->cursor;
- GetSpritePosition (inputInfo.pointer, &x, &y);
- if (!(cursor_info->Flags & HARDWARE_CURSOR_UPDATE_UNHIDDEN))
- (*cursor_info->HideCursor)(scrn);
-
- if (cursor)
- {
- void *src = dixLookupPrivate(&cursor->devPrivates, CursorScreenKey(screen));
-#ifdef ARGB_CURSOR
- if (cursor->bits->argb && cursor_info->LoadCursorARGB)
- (*cursor_info->LoadCursorARGB) (scrn, cursor);
- else if (src)
-#endif
- (*cursor_info->LoadCursorImage)(scrn, src);
-
- x += scrn->frameX0 + cursor_screen_priv->HotX;
- y += scrn->frameY0 + cursor_screen_priv->HotY;
- (*cursor_info->SetCursorPosition)(scrn, x, y);
- }
-}
-
-/**
- * Clean up CRTC-based cursor code
- */
-void
-xf86_cursors_fini (ScreenPtr screen)
-{
- ScrnInfoPtr scrn = xf86Screens[screen->myNum];
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
-
- if (xf86_config->cursor_info)
- {
- xf86DestroyCursorInfoRec (xf86_config->cursor_info);
- xf86_config->cursor_info = NULL;
- }
- free(xf86_config->cursor_image);
- xf86_config->cursor_image = NULL;
- if (xf86_config->cursor)
- {
- FreeCursor (xf86_config->cursor, None);
- xf86_config->cursor = NULL;
- }
-}
+/*
+ * Copyright © 2007 Keith Packard
+ * Copyright © 2010 Aaron Plattner
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#else
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#endif
+
+#include <stddef.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "xf86.h"
+#include "xf86DDC.h"
+#include "xf86Crtc.h"
+#include "xf86Modes.h"
+#include "xf86RandR12.h"
+#include "xf86CursorPriv.h"
+#include "X11/extensions/render.h"
+#include "X11/extensions/dpmsconst.h"
+#include "X11/Xatom.h"
+#include "picturestr.h"
+#include "cursorstr.h"
+#include "inputstr.h"
+
+/*
+ * Given a screen coordinate, rotate back to a cursor source coordinate
+ */
+static void
+xf86_crtc_rotate_coord (Rotation rotation,
+ int width,
+ int height,
+ int x_dst,
+ int y_dst,
+ int *x_src,
+ int *y_src)
+{
+ int t;
+
+ switch (rotation & 0xf) {
+ case RR_Rotate_0:
+ break;
+ case RR_Rotate_90:
+ t = x_dst;
+ x_dst = height - y_dst - 1;
+ y_dst = t;
+ break;
+ case RR_Rotate_180:
+ x_dst = width - x_dst - 1;
+ y_dst = height - y_dst - 1;
+ break;
+ case RR_Rotate_270:
+ t = x_dst;
+ x_dst = y_dst;
+ y_dst = width - t - 1;
+ break;
+ }
+ if (rotation & RR_Reflect_X)
+ x_dst = width - x_dst - 1;
+ if (rotation & RR_Reflect_Y)
+ y_dst = height - y_dst - 1;
+ *x_src = x_dst;
+ *y_src = y_dst;
+}
+
+/*
+ * Given a cursor source coordinate, rotate to a screen coordinate
+ */
+static void
+xf86_crtc_rotate_coord_back (Rotation rotation,
+ int width,
+ int height,
+ int x_dst,
+ int y_dst,
+ int *x_src,
+ int *y_src)
+{
+ int t;
+
+ if (rotation & RR_Reflect_X)
+ x_dst = width - x_dst - 1;
+ if (rotation & RR_Reflect_Y)
+ y_dst = height - y_dst - 1;
+
+ switch (rotation & 0xf) {
+ case RR_Rotate_0:
+ break;
+ case RR_Rotate_90:
+ t = x_dst;
+ x_dst = y_dst;
+ y_dst = width - t - 1;
+ break;
+ case RR_Rotate_180:
+ x_dst = width - x_dst - 1;
+ y_dst = height - y_dst - 1;
+ break;
+ case RR_Rotate_270:
+ t = x_dst;
+ x_dst = height - y_dst - 1;
+ y_dst = t;
+ break;
+ }
+ *x_src = x_dst;
+ *y_src = y_dst;
+}
+
+struct cursor_bit {
+ CARD8 *byte;
+ char bitpos;
+};
+
+/*
+ * Convert an x coordinate to a position within the cursor bitmap
+ */
+static struct cursor_bit
+cursor_bitpos (CARD8 *image, xf86CursorInfoPtr cursor_info, int x, int y,
+ Bool mask)
+{
+ const int flags = cursor_info->Flags;
+ const Bool interleaved =
+ !!(flags & (HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1 |
+ HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_8 |
+ HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_16 |
+ HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32 |
+ HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64));
+ const int width = cursor_info->MaxWidth;
+ const int height = cursor_info->MaxHeight;
+ const int stride = interleaved ? width / 4 : width / 8;
+
+ struct cursor_bit ret;
+
+ image += y * stride;
+
+ if (flags & HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK)
+ mask = !mask;
+ if (flags & HARDWARE_CURSOR_NIBBLE_SWAPPED)
+ x = (x & ~3) | (3 - (x & 3));
+ if (((flags & HARDWARE_CURSOR_BIT_ORDER_MSBFIRST) == 0) ==
+ (X_BYTE_ORDER == X_BIG_ENDIAN))
+ x = (x & ~7) | (7 - (x & 7));
+ if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1)
+ x = (x << 1) + mask;
+ else if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_8)
+ x = ((x & ~7) << 1) | (mask << 3) | (x & 7);
+ else if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_16)
+ x = ((x & ~15) << 1) | (mask << 4) | (x & 15);
+ else if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32)
+ x = ((x & ~31) << 1) | (mask << 5) | (x & 31);
+ else if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64)
+ x = ((x & ~63) << 1) | (mask << 6) | (x & 63);
+ else if (mask)
+ image += stride * height;
+
+ ret.byte = image + (x / 8);
+ ret.bitpos = x & 7;
+
+ return ret;
+}
+
+/*
+ * Fetch one bit from a cursor bitmap
+ */
+static CARD8
+get_bit (CARD8 *image, xf86CursorInfoPtr cursor_info, int x, int y, Bool mask)
+{
+ struct cursor_bit bit = cursor_bitpos(image, cursor_info, x, y, mask);
+ return (*bit.byte >> bit.bitpos) & 1;
+}
+
+/*
+ * Set one bit in a cursor bitmap
+ */
+static void
+set_bit (CARD8 *image, xf86CursorInfoPtr cursor_info, int x, int y, Bool mask)
+{
+ struct cursor_bit bit = cursor_bitpos(image, cursor_info, x, y, mask);
+ *bit.byte |= 1 << bit.bitpos;
+}
+
+/*
+ * Load a two color cursor into a driver that supports only ARGB cursors
+ */
+static void
+xf86_crtc_convert_cursor_to_argb (xf86CrtcPtr crtc, unsigned char *src)
+{
+ ScrnInfoPtr scrn = crtc->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
+ CARD32 *cursor_image = (CARD32 *) xf86_config->cursor_image;
+ int x, y;
+ int xin, yin;
+ int flags = cursor_info->Flags;
+ CARD32 bits;
+
+#ifdef ARGB_CURSOR
+ crtc->cursor_argb = FALSE;
+#endif
+
+ for (y = 0; y < cursor_info->MaxHeight; y++)
+ for (x = 0; x < cursor_info->MaxWidth; x++)
+ {
+ xf86_crtc_rotate_coord (crtc->rotation,
+ cursor_info->MaxWidth,
+ cursor_info->MaxHeight,
+ x, y, &xin, &yin);
+ if (get_bit (src, cursor_info, xin, yin, TRUE) ==
+ ((flags & HARDWARE_CURSOR_INVERT_MASK) == 0))
+ {
+ if (get_bit (src, cursor_info, xin, yin, FALSE))
+ bits = xf86_config->cursor_fg;
+ else
+ bits = xf86_config->cursor_bg;
+ }
+ else
+ bits = 0;
+ cursor_image[y * cursor_info->MaxWidth + x] = bits;
+ }
+ crtc->funcs->load_cursor_argb (crtc, cursor_image);
+}
+
+/*
+ * Set the colors for a two-color cursor (ignore for ARGB cursors)
+ */
+static void
+xf86_set_cursor_colors (ScrnInfoPtr scrn, int bg, int fg)
+{
+ ScreenPtr screen = scrn->pScreen;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ CursorPtr cursor = xf86_config->cursor;
+ int c;
+ CARD8 *bits = cursor ?
+ dixLookupPrivate(&cursor->devPrivates, CursorScreenKey(screen))
+ : NULL;
+
+ /* Save ARGB versions of these colors */
+ xf86_config->cursor_fg = (CARD32) fg | 0xff000000;
+ xf86_config->cursor_bg = (CARD32) bg | 0xff000000;
+
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ if (crtc->enabled && !crtc->cursor_argb)
+ {
+ if (crtc->funcs->load_cursor_image)
+ crtc->funcs->set_cursor_colors (crtc, bg, fg);
+ else if (bits)
+ xf86_crtc_convert_cursor_to_argb (crtc, bits);
+ }
+ }
+}
+
+static void
+xf86_crtc_hide_cursor (xf86CrtcPtr crtc)
+{
+ if (crtc->cursor_shown)
+ {
+ crtc->funcs->hide_cursor (crtc);
+ crtc->cursor_shown = FALSE;
+ }
+}
+
+void
+xf86_hide_cursors (ScrnInfoPtr scrn)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c;
+
+ xf86_config->cursor_on = FALSE;
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ if (crtc->enabled)
+ xf86_crtc_hide_cursor (crtc);
+ }
+}
+
+static void
+xf86_crtc_show_cursor (xf86CrtcPtr crtc)
+{
+ if (!crtc->cursor_shown && crtc->cursor_in_range)
+ {
+ crtc->funcs->show_cursor (crtc);
+ crtc->cursor_shown = TRUE;
+ }
+}
+
+void
+xf86_show_cursors (ScrnInfoPtr scrn)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c;
+
+ xf86_config->cursor_on = TRUE;
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ if (crtc->enabled)
+ xf86_crtc_show_cursor (crtc);
+ }
+}
+
+static void
+xf86_crtc_set_cursor_position (xf86CrtcPtr crtc, int x, int y)
+{
+ ScrnInfoPtr scrn = crtc->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
+ DisplayModePtr mode = &crtc->mode;
+ Bool in_range;
+ int dx, dy;
+
+ /*
+ * Transform position of cursor on screen
+ */
+ if (crtc->transform_in_use)
+ {
+ ScreenPtr screen = scrn->pScreen;
+ xf86CursorScreenPtr ScreenPriv =
+ (xf86CursorScreenPtr)dixLookupPrivate(&screen->devPrivates,
+ xf86CursorScreenKey);
+ struct pict_f_vector v;
+
+ v.v[0] = (x + ScreenPriv->HotX) + 0.5;
+ v.v[1] = (y + ScreenPriv->HotY) + 0.5;
+ v.v[2] = 1;
+ pixman_f_transform_point (&crtc->f_framebuffer_to_crtc, &v);
+ /* cursor will have 0.5 added to it already so floor is sufficent */
+ x = floor (v.v[0]);
+ y = floor (v.v[1]);
+ /*
+ * Transform position of cursor upper left corner
+ */
+ xf86_crtc_rotate_coord_back (crtc->rotation,
+ cursor_info->MaxWidth,
+ cursor_info->MaxHeight,
+ ScreenPriv->HotX, ScreenPriv->HotY, &dx, &dy);
+ x -= dx;
+ y -= dy;
+ }
+ else
+ {
+ x -= crtc->x;
+ y -= crtc->y;
+ }
+
+ /*
+ * Disable the cursor when it is outside the viewport
+ */
+ in_range = TRUE;
+ if (x >= mode->HDisplay || y >= mode->VDisplay ||
+ x <= -cursor_info->MaxWidth || y <= -cursor_info->MaxHeight)
+ {
+ in_range = FALSE;
+ x = 0;
+ y = 0;
+ }
+
+ crtc->cursor_in_range = in_range;
+
+ if (in_range)
+ {
+ crtc->funcs->set_cursor_position (crtc, x, y);
+ xf86_crtc_show_cursor (crtc);
+ }
+ else
+ xf86_crtc_hide_cursor (crtc);
+}
+
+static void
+xf86_set_cursor_position (ScrnInfoPtr scrn, int x, int y)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c;
+
+ /* undo what xf86HWCurs did to the coordinates */
+ x += scrn->frameX0;
+ y += scrn->frameY0;
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ if (crtc->enabled)
+ xf86_crtc_set_cursor_position (crtc, x, y);
+ }
+}
+
+/*
+ * Load a two-color cursor into a crtc, performing rotation as needed
+ */
+static void
+xf86_crtc_load_cursor_image (xf86CrtcPtr crtc, CARD8 *src)
+{
+ ScrnInfoPtr scrn = crtc->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
+ CARD8 *cursor_image;
+
+#ifdef ARGB_CURSOR
+ crtc->cursor_argb = FALSE;
+#endif
+
+ if (crtc->rotation == RR_Rotate_0)
+ cursor_image = src;
+ else
+ {
+ int x, y;
+ int xin, yin;
+ int stride = cursor_info->MaxWidth >> 2;
+
+ cursor_image = xf86_config->cursor_image;
+ memset(cursor_image, 0, cursor_info->MaxHeight * stride);
+
+ for (y = 0; y < cursor_info->MaxHeight; y++)
+ for (x = 0; x < cursor_info->MaxWidth; x++)
+ {
+ xf86_crtc_rotate_coord (crtc->rotation,
+ cursor_info->MaxWidth,
+ cursor_info->MaxHeight,
+ x, y, &xin, &yin);
+ if (get_bit(src, cursor_info, xin, yin, FALSE))
+ set_bit(cursor_image, cursor_info, x, y, FALSE);
+ if (get_bit(src, cursor_info, xin, yin, TRUE))
+ set_bit(cursor_image, cursor_info, x, y, TRUE);
+ }
+ }
+ crtc->funcs->load_cursor_image (crtc, cursor_image);
+}
+
+/*
+ * Load a cursor image into all active CRTCs
+ */
+static void
+xf86_load_cursor_image (ScrnInfoPtr scrn, unsigned char *src)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c;
+
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ if (crtc->enabled)
+ {
+ if (crtc->funcs->load_cursor_image)
+ xf86_crtc_load_cursor_image (crtc, src);
+ else if (crtc->funcs->load_cursor_argb)
+ xf86_crtc_convert_cursor_to_argb (crtc, src);
+ }
+ }
+}
+
+static Bool
+xf86_use_hw_cursor (ScreenPtr screen, CursorPtr cursor)
+{
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
+
+ ++cursor->refcnt;
+ if (xf86_config->cursor)
+ FreeCursor (xf86_config->cursor, None);
+ xf86_config->cursor = cursor;
+
+ if (cursor->bits->width > cursor_info->MaxWidth ||
+ cursor->bits->height> cursor_info->MaxHeight)
+ return FALSE;
+
+ return TRUE;
+}
+
+static Bool
+xf86_use_hw_cursor_argb (ScreenPtr screen, CursorPtr cursor)
+{
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
+
+ ++cursor->refcnt;
+ if (xf86_config->cursor)
+ FreeCursor (xf86_config->cursor, None);
+ xf86_config->cursor = cursor;
+
+ /* Make sure ARGB support is available */
+ if ((cursor_info->Flags & HARDWARE_CURSOR_ARGB) == 0)
+ return FALSE;
+
+ if (cursor->bits->width > cursor_info->MaxWidth ||
+ cursor->bits->height> cursor_info->MaxHeight)
+ return FALSE;
+
+ return TRUE;
+}
+
+static void
+xf86_crtc_load_cursor_argb (xf86CrtcPtr crtc, CursorPtr cursor)
+{
+ ScrnInfoPtr scrn = crtc->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
+ CARD32 *cursor_image = (CARD32 *) xf86_config->cursor_image;
+ CARD32 *cursor_source = (CARD32 *) cursor->bits->argb;
+ int x, y;
+ int xin, yin;
+ CARD32 bits;
+ int source_width = cursor->bits->width;
+ int source_height = cursor->bits->height;
+ int image_width = cursor_info->MaxWidth;
+ int image_height = cursor_info->MaxHeight;
+
+ for (y = 0; y < image_height; y++)
+ for (x = 0; x < image_width; x++)
+ {
+ xf86_crtc_rotate_coord (crtc->rotation, image_width, image_height,
+ x, y, &xin, &yin);
+ if (xin < source_width && yin < source_height)
+ bits = cursor_source[yin * source_width + xin];
+ else
+ bits = 0;
+ cursor_image[y * image_width + x] = bits;
+ }
+
+ crtc->funcs->load_cursor_argb (crtc, cursor_image);
+}
+
+static void
+xf86_load_cursor_argb (ScrnInfoPtr scrn, CursorPtr cursor)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c;
+
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ if (crtc->enabled)
+ xf86_crtc_load_cursor_argb (crtc, cursor);
+ }
+}
+
+Bool
+xf86_cursors_init (ScreenPtr screen, int max_width, int max_height, int flags)
+{
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CursorInfoPtr cursor_info;
+
+ cursor_info = xf86CreateCursorInfoRec();
+ if (!cursor_info)
+ return FALSE;
+
+ xf86_config->cursor_image = malloc(max_width * max_height * 4);
+
+ if (!xf86_config->cursor_image)
+ {
+ xf86DestroyCursorInfoRec (cursor_info);
+ return FALSE;
+ }
+
+ xf86_config->cursor_info = cursor_info;
+
+ cursor_info->MaxWidth = max_width;
+ cursor_info->MaxHeight = max_height;
+ cursor_info->Flags = flags;
+
+ cursor_info->SetCursorColors = xf86_set_cursor_colors;
+ cursor_info->SetCursorPosition = xf86_set_cursor_position;
+ cursor_info->LoadCursorImage = xf86_load_cursor_image;
+ cursor_info->HideCursor = xf86_hide_cursors;
+ cursor_info->ShowCursor = xf86_show_cursors;
+ cursor_info->UseHWCursor = xf86_use_hw_cursor;
+#ifdef ARGB_CURSOR
+ if (flags & HARDWARE_CURSOR_ARGB)
+ {
+ cursor_info->UseHWCursorARGB = xf86_use_hw_cursor_argb;
+ cursor_info->LoadCursorARGB = xf86_load_cursor_argb;
+ }
+#endif
+
+ xf86_config->cursor = NULL;
+ xf86_hide_cursors (scrn);
+
+ return xf86InitCursor (screen, cursor_info);
+}
+
+/**
+ * Called when anything on the screen is reconfigured.
+ *
+ * Reloads cursor images as needed, then adjusts cursor positions
+ */
+
+void
+xf86_reload_cursors (ScreenPtr screen)
+{
+ ScrnInfoPtr scrn;
+ xf86CrtcConfigPtr xf86_config;
+ xf86CursorInfoPtr cursor_info;
+ CursorPtr cursor;
+ int x, y;
+ xf86CursorScreenPtr cursor_screen_priv;
+
+ /* initial mode setting will not have set a screen yet.
+ May be called before the devices are initialised.
+ */
+ if (!screen || !inputInfo.pointer)
+ return;
+ cursor_screen_priv = dixLookupPrivate(&screen->devPrivates,
+ xf86CursorScreenKey);
+ /* return if HW cursor is inactive, to avoid displaying two cursors */
+ if (!cursor_screen_priv || !cursor_screen_priv->isUp)
+ return;
+
+ scrn = xf86Screens[screen->myNum];
+ xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ /* make sure the cursor code has been initialized */
+ cursor_info = xf86_config->cursor_info;
+ if (!cursor_info)
+ return;
+
+ cursor = xf86_config->cursor;
+ GetSpritePosition (inputInfo.pointer, &x, &y);
+ if (!(cursor_info->Flags & HARDWARE_CURSOR_UPDATE_UNHIDDEN))
+ (*cursor_info->HideCursor)(scrn);
+
+ if (cursor)
+ {
+ void *src = dixLookupPrivate(&cursor->devPrivates, CursorScreenKey(screen));
+#ifdef ARGB_CURSOR
+ if (cursor->bits->argb && cursor_info->LoadCursorARGB)
+ (*cursor_info->LoadCursorARGB) (scrn, cursor);
+ else if (src)
+#endif
+ (*cursor_info->LoadCursorImage)(scrn, src);
+
+ x += scrn->frameX0 + cursor_screen_priv->HotX;
+ y += scrn->frameY0 + cursor_screen_priv->HotY;
+ (*cursor_info->SetCursorPosition)(scrn, x, y);
+ }
+}
+
+/**
+ * Clean up CRTC-based cursor code
+ */
+void
+xf86_cursors_fini (ScreenPtr screen)
+{
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ if (xf86_config->cursor_info)
+ {
+ xf86DestroyCursorInfoRec (xf86_config->cursor_info);
+ xf86_config->cursor_info = NULL;
+ }
+ free(xf86_config->cursor_image);
+ xf86_config->cursor_image = NULL;
+ if (xf86_config->cursor)
+ {
+ FreeCursor (xf86_config->cursor, None);
+ xf86_config->cursor = NULL;
+ }
+}
diff --git a/xorg-server/hw/xfree86/modes/xf86RandR12.c b/xorg-server/hw/xfree86/modes/xf86RandR12.c
index 7bfb6fa47..2fe0c47e6 100644
--- a/xorg-server/hw/xfree86/modes/xf86RandR12.c
+++ b/xorg-server/hw/xfree86/modes/xf86RandR12.c
@@ -1,2029 +1,1802 @@
-/*
- * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting documentation, and
- * that the name of the copyright holders not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. The copyright holders make no representations
- * about the suitability of this software for any purpose. It is provided "as
- * is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
- * OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#else
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#endif
-
-#include "xf86.h"
-#include "os.h"
-#include "globals.h"
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86DDC.h"
-#include "mipointer.h"
-#include "windowstr.h"
-#include "inputstr.h"
-#include <randrstr.h>
-#include <X11/extensions/render.h>
-
-#include "xf86Crtc.h"
-#include "xf86RandR12.h"
-
-typedef struct _xf86RandR12Info {
- int virtualX;
- int virtualY;
- int mmWidth;
- int mmHeight;
- int maxX;
- int maxY;
- int pointerX;
- int pointerY;
- Rotation rotation; /* current mode */
- Rotation supported_rotations; /* driver supported */
-
- /* Used to wrap EnterVT so we can re-probe the outputs when a laptop unsuspends
- * (actually, any time that we switch back into our VT).
- *
- * See https://bugs.freedesktop.org/show_bug.cgi?id=21554
- */
- xf86EnterVTProc *orig_EnterVT;
-} XF86RandRInfoRec, *XF86RandRInfoPtr;
-
-#ifdef RANDR_12_INTERFACE
-static Bool xf86RandR12Init12 (ScreenPtr pScreen);
-static Bool xf86RandR12CreateScreenResources12 (ScreenPtr pScreen);
-#endif
-
-static int xf86RandR12Generation;
-
-static DevPrivateKeyRec xf86RandR12KeyRec;
-static DevPrivateKey xf86RandR12Key;
-#define XF86RANDRINFO(p) ((XF86RandRInfoPtr) \
- dixLookupPrivate(&(p)->devPrivates, xf86RandR12Key))
-
-
-static int
-xf86RandR12ModeRefresh (DisplayModePtr mode)
-{
- if (mode->VRefresh)
- return (int) (mode->VRefresh + 0.5);
- else
- return (int) (mode->Clock * 1000.0 / mode->HTotal / mode->VTotal + 0.5);
-}
-
-/* Adapt panning area; return TRUE if panning area was valid without adaption */
-static int
-xf86RandR13VerifyPanningArea (xf86CrtcPtr crtc, int screenWidth, int screenHeight)
-{
- int ret = TRUE;
-
- if (crtc->version < 2)
- return FALSE;
-
- if (crtc->panningTotalArea.x2 <= crtc->panningTotalArea.x1) {
- /* Panning in X is disabled */
- if (crtc->panningTotalArea.x1 || crtc->panningTotalArea.x2)
- /* Illegal configuration -> fail/disable */
- ret = FALSE;
- crtc->panningTotalArea.x1 = crtc->panningTotalArea.x2 = 0;
- crtc->panningTrackingArea.x1 = crtc->panningTrackingArea.x2 = 0;
- crtc->panningBorder[0] = crtc->panningBorder[2] = 0;
- } else {
- /* Panning in X is enabled */
- if (crtc->panningTotalArea.x1 < 0) {
- /* Panning region outside screen -> move inside */
- crtc->panningTotalArea.x2 -= crtc->panningTotalArea.x1;
- crtc->panningTotalArea.x1 = 0;
- ret = FALSE;
- }
- if (crtc->panningTotalArea.x2 < crtc->panningTotalArea.x1 + crtc->mode.HDisplay) {
- /* Panning region smaller than displayed area -> crop to displayed area */
- crtc->panningTotalArea.x2 = crtc->panningTotalArea.x1 + crtc->mode.HDisplay;
- ret = FALSE;
- }
- if (crtc->panningTotalArea.x2 > screenWidth) {
- /* Panning region larger than screen -> move inside, then crop to screen */
- crtc->panningTotalArea.x1 -= crtc->panningTotalArea.x2 - screenWidth;
- crtc->panningTotalArea.x2 = screenWidth;
- ret = FALSE;
- if (crtc->panningTotalArea.x1 < 0)
- crtc->panningTotalArea.x1 = 0;
- }
- if (crtc->panningBorder[0] + crtc->panningBorder[2] > crtc->mode.HDisplay) {
- /* Borders too large -> set to 0 */
- crtc->panningBorder[0] = crtc->panningBorder[2] = 0;
- ret = FALSE;
- }
- }
-
- if (crtc->panningTotalArea.y2 <= crtc->panningTotalArea.y1) {
- /* Panning in Y is disabled */
- if (crtc->panningTotalArea.y1 || crtc->panningTotalArea.y2)
- /* Illegal configuration -> fail/disable */
- ret = FALSE;
- crtc->panningTotalArea.y1 = crtc->panningTotalArea.y2 = 0;
- crtc->panningTrackingArea.y1 = crtc->panningTrackingArea.y2 = 0;
- crtc->panningBorder[1] = crtc->panningBorder[3] = 0;
- } else {
- /* Panning in Y is enabled */
- if (crtc->panningTotalArea.y1 < 0) {
- /* Panning region outside screen -> move inside */
- crtc->panningTotalArea.y2 -= crtc->panningTotalArea.y1;
- crtc->panningTotalArea.y1 = 0;
- ret = FALSE;
- }
- if (crtc->panningTotalArea.y2 < crtc->panningTotalArea.y1 + crtc->mode.VDisplay) {
- /* Panning region smaller than displayed area -> crop to displayed area */
- crtc->panningTotalArea.y2 = crtc->panningTotalArea.y1 + crtc->mode.VDisplay;
- ret = FALSE;
- }
- if (crtc->panningTotalArea.y2 > screenHeight) {
- /* Panning region larger than screen -> move inside, then crop to screen */
- crtc->panningTotalArea.y1 -= crtc->panningTotalArea.y2 - screenHeight;
- crtc->panningTotalArea.y2 = screenHeight;
- ret = FALSE;
- if (crtc->panningTotalArea.y1 < 0)
- crtc->panningTotalArea.y1 = 0;
- }
- if (crtc->panningBorder[1] + crtc->panningBorder[3] > crtc->mode.VDisplay) {
- /* Borders too large -> set to 0 */
- crtc->panningBorder[1] = crtc->panningBorder[3] = 0;
- ret = FALSE;
- }
- }
-
- return ret;
-}
-
-/*
- * The heart of the panning operation:
- *
- * Given a frame buffer position (fb_x, fb_y),
- * and a crtc position (crtc_x, crtc_y),
- * and a transform matrix which maps frame buffer to crtc,
- * compute a panning position (pan_x, pan_y) that
- * makes the resulting transform line those two up
- */
-
-static void
-xf86ComputeCrtcPan (Bool sprite_transform_in_use,
- struct pixman_f_transform *m,
- double screen_x, double screen_y,
- double crtc_x, double crtc_y,
- int old_pan_x, int old_pan_y,
- int *new_pan_x, int *new_pan_y)
-{
- if (sprite_transform_in_use) {
- /*
- * Given the current transform, M, the current position
- * on the Screen, S, and the desired position on the CRTC,
- * C, compute a translation, T, such that:
- *
- * M T S = C
- *
- * where T is of the form
- *
- * | 1 0 dx |
- * | 0 1 dy |
- * | 0 0 1 |
- *
- * M T S =
- * | M00 Sx + M01 Sy + M00 dx + M01 dy + M02 | | Cx F |
- * | M10 Sx + M11 Sy + M10 dx + M11 dy + M12 | = | Cy F |
- * | M20 Sx + M21 Sy + M20 dx + M21 dy + M22 | | F |
- *
- * R = M S
- *
- * Cx F = M00 dx + M01 dy + R0
- * Cy F = M10 dx + M11 dy + R1
- * F = M20 dx + M21 dy + R2
- *
- * Zero out dx, then dy
- *
- * F (Cx M10 - Cy M00) =
- * (M10 M01 - M00 M11) dy + M10 R0 - M00 R1
- * F (M10 - Cy M20) =
- * (M10 M21 - M20 M11) dy + M10 R2 - M20 R1
- *
- * F (Cx M11 - Cy M01) =
- * (M11 M00 - M01 M10) dx + M11 R0 - M01 R1
- * F (M11 - Cy M21) =
- * (M11 M20 - M21 M10) dx + M11 R2 - M21 R1
- *
- * Make some temporaries
- *
- * T = | Cx M10 - Cy M00 |
- * | Cx M11 - Cy M01 |
- *
- * U = | M10 M01 - M00 M11 |
- * | M11 M00 - M01 M10 |
- *
- * Q = | M10 R0 - M00 R1 |
- * | M11 R0 - M01 R1 |
- *
- * P = | M10 - Cy M20 |
- * | M11 - Cy M21 |
- *
- * W = | M10 M21 - M20 M11 |
- * | M11 M20 - M21 M10 |
- *
- * V = | M10 R2 - M20 R1 |
- * | M11 R2 - M21 R1 |
- *
- * Rewrite:
- *
- * F T0 = U0 dy + Q0
- * F P0 = W0 dy + V0
- * F T1 = U1 dx + Q1
- * F P1 = W1 dx + V1
- *
- * Solve for F (two ways)
- *
- * F (W0 T0 - U0 P0) = W0 Q0 - U0 V0
- *
- * W0 Q0 - U0 V0
- * F = -------------
- * W0 T0 - U0 P0
- *
- * F (W1 T1 - U1 P1) = W1 Q1 - U1 V1
- *
- * W1 Q1 - U1 V1
- * F = -------------
- * W1 T1 - U1 P1
- *
- * We'll use which ever solution works (denominator != 0)
- *
- * Finally, solve for dx and dy:
- *
- * dx = (F T1 - Q1) / U1
- * dx = (F P1 - V1) / W1
- *
- * dy = (F T0 - Q0) / U0
- * dy = (F P0 - V0) / W0
- */
- double r[3];
- double q[2], u[2], t[2], v[2], w[2], p[2];
- double f;
- struct pict_f_vector d;
- int i;
-
- /* Get the un-normalized crtc coordinates again */
- for (i = 0; i < 3; i++)
- r[i] = m->m[i][0] * screen_x + m->m[i][1] * screen_y + m->m[i][2];
-
- /* Combine values into temporaries */
- for (i = 0; i < 2; i++) {
- q[i] = m->m[1][i] * r[0] - m->m[0][i] * r[1];
- u[i] = m->m[1][i] * m->m[0][1-i] - m->m[0][i] * m->m[1][1-i];
- t[i] = m->m[1][i] * crtc_x - m->m[0][i] * crtc_y;
-
- v[i] = m->m[1][i] * r[2] - m->m[2][i] * r[1];
- w[i] = m->m[1][i] * m->m[2][1-i] - m->m[2][i] * m->m[1][1-i];
- p[i] = m->m[1][i] - m->m[2][i] * crtc_y;
- }
-
- /* Find a way to compute f */
- f = 0;
- for (i = 0; i < 2; i++) {
- double a = w[i] * q[i] - u[i] * v[i];
- double b = w[i] * t[i] - u[i] * p[i];
- if (b != 0) {
- f = a/b;
- break;
- }
- }
-
- /* Solve for the resulting transform vector */
- for (i = 0; i < 2; i++) {
- if (u[i])
- d.v[1-i] = (t[i] * f - q[i]) / u[i];
- else if (w[1])
- d.v[1-i] = (p[i] * f - v[i]) / w[i];
- else
- d.v[1-i] = 0;
- }
- *new_pan_x = old_pan_x - floor (d.v[0] + 0.5);
- *new_pan_y = old_pan_y - floor (d.v[1] + 0.5);
- } else {
- *new_pan_x = screen_x - crtc_x;
- *new_pan_y = screen_y - crtc_y;
- }
-}
-
-static void
-xf86RandR13Pan (xf86CrtcPtr crtc, int x, int y)
-{
- int newX, newY;
- int width, height;
- Bool panned = FALSE;
-
- if (crtc->version < 2)
- return;
-
- if (! crtc->enabled ||
- (crtc->panningTotalArea.x2 <= crtc->panningTotalArea.x1 &&
- crtc->panningTotalArea.y2 <= crtc->panningTotalArea.y1))
- return;
-
- newX = crtc->x;
- newY = crtc->y;
- width = crtc->mode.HDisplay;
- height = crtc->mode.VDisplay;
-
- if ((crtc->panningTrackingArea.x2 <= crtc->panningTrackingArea.x1 ||
- (x >= crtc->panningTrackingArea.x1 && x < crtc->panningTrackingArea.x2)) &&
- (crtc->panningTrackingArea.y2 <= crtc->panningTrackingArea.y1 ||
- (y >= crtc->panningTrackingArea.y1 && y < crtc->panningTrackingArea.y2)))
- {
- struct pict_f_vector c;
-
- /*
- * Pre-clip the mouse position to the panning area so that we don't
- * push the crtc outside. This doesn't deal with changes to the
- * panning values, only mouse position changes.
- */
- if (crtc->panningTotalArea.x2 > crtc->panningTotalArea.x1)
- {
- if (x < crtc->panningTotalArea.x1)
- x = crtc->panningTotalArea.x1;
- if (x >= crtc->panningTotalArea.x2)
- x = crtc->panningTotalArea.x2 - 1;
- }
- if (crtc->panningTotalArea.y2 > crtc->panningTotalArea.y1)
- {
- if (y < crtc->panningTotalArea.y1)
- y = crtc->panningTotalArea.y1;
- if (y >= crtc->panningTotalArea.y2)
- y = crtc->panningTotalArea.y2 - 1;
- }
-
- c.v[0] = x;
- c.v[1] = y;
- c.v[2] = 1.0;
- if (crtc->sprite_transform_in_use) {
- pixman_f_transform_point(&crtc->f_screen_to_crtc, &c);
- } else {
- c.v[0] -= crtc->x;
- c.v[1] -= crtc->y;
- }
-
- if (crtc->panningTotalArea.x2 > crtc->panningTotalArea.x1) {
- if (c.v[0] < crtc->panningBorder[0]) {
- c.v[0] = crtc->panningBorder[0];
- panned = TRUE;
- }
- if (c.v[0] >= width - crtc->panningBorder[2]) {
- c.v[0] = width - crtc->panningBorder[2] - 1;
- panned = TRUE;
- }
- }
- if (crtc->panningTotalArea.y2 > crtc->panningTotalArea.y1) {
- if (c.v[1] < crtc->panningBorder[1]) {
- c.v[1] = crtc->panningBorder[1];
- panned = TRUE;
- }
- if (c.v[1] >= height - crtc->panningBorder[3]) {
- c.v[1] = height - crtc->panningBorder[3] - 1;
- panned = TRUE;
- }
- }
- if (panned)
- xf86ComputeCrtcPan (crtc->sprite_transform_in_use,
- &crtc->f_screen_to_crtc,
- x, y, c.v[0], c.v[1],
- newX, newY, &newX, &newY);
- }
-
- /*
- * Ensure that the crtc is within the panning region.
- *
- * XXX This computation only works when we do not have a transform
- * in use.
- */
- if (!crtc->sprite_transform_in_use)
- {
- /* Validate against [xy]1 after [xy]2, to be sure that results are > 0 for [xy]1 > 0 */
- if (crtc->panningTotalArea.x2 > crtc->panningTotalArea.x1) {
- if (newX > crtc->panningTotalArea.x2 - width)
- newX = crtc->panningTotalArea.x2 - width;
- if (newX < crtc->panningTotalArea.x1)
- newX = crtc->panningTotalArea.x1;
- }
- if (crtc->panningTotalArea.y2 > crtc->panningTotalArea.y1) {
- if (newY > crtc->panningTotalArea.y2 - height)
- newY = crtc->panningTotalArea.y2 - height;
- if (newY < crtc->panningTotalArea.y1)
- newY = crtc->panningTotalArea.y1;
- }
- }
- if (newX != crtc->x || newY != crtc->y)
- xf86CrtcSetOrigin (crtc, newX, newY);
-}
-
-static Bool
-xf86RandR12GetInfo (ScreenPtr pScreen, Rotation *rotations)
-{
- RRScreenSizePtr pSize;
- ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
- XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
- DisplayModePtr mode;
- int refresh0 = 60;
- int maxX = 0, maxY = 0;
-
- *rotations = randrp->supported_rotations;
-
- if (randrp->virtualX == -1 || randrp->virtualY == -1)
- {
- randrp->virtualX = scrp->virtualX;
- randrp->virtualY = scrp->virtualY;
- }
-
- /* Re-probe the outputs for new monitors or modes */
- if (scrp->vtSema)
- {
- xf86ProbeOutputModes (scrp, 0, 0);
- xf86SetScrnInfoModes (scrp);
- }
-
- for (mode = scrp->modes; ; mode = mode->next)
- {
- int refresh = xf86RandR12ModeRefresh (mode);
- if (randrp->maxX == 0 || randrp->maxY == 0)
- {
- if (maxX < mode->HDisplay)
- maxX = mode->HDisplay;
- if (maxY < mode->VDisplay)
- maxY = mode->VDisplay;
- }
- if (mode == scrp->modes)
- refresh0 = refresh;
- pSize = RRRegisterSize (pScreen,
- mode->HDisplay, mode->VDisplay,
- randrp->mmWidth, randrp->mmHeight);
- if (!pSize)
- return FALSE;
- RRRegisterRate (pScreen, pSize, refresh);
-
- if (xf86ModesEqual(mode, scrp->currentMode))
- {
- RRSetCurrentConfig (pScreen, randrp->rotation, refresh, pSize);
- }
- if (mode->next == scrp->modes)
- break;
- }
-
- if (randrp->maxX == 0 || randrp->maxY == 0)
- {
- randrp->maxX = maxX;
- randrp->maxY = maxY;
- }
-
- return TRUE;
-}
-
-static Bool
-xf86RandR12SetMode (ScreenPtr pScreen,
- DisplayModePtr mode,
- Bool useVirtual,
- int mmWidth,
- int mmHeight)
-{
- ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
- XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
- int oldWidth = pScreen->width;
- int oldHeight = pScreen->height;
- int oldmmWidth = pScreen->mmWidth;
- int oldmmHeight = pScreen->mmHeight;
- WindowPtr pRoot = pScreen->root;
- DisplayModePtr currentMode = NULL;
- Bool ret = TRUE;
-
- if (pRoot)
- (*scrp->EnableDisableFBAccess) (pScreen->myNum, FALSE);
- if (useVirtual)
- {
- scrp->virtualX = randrp->virtualX;
- scrp->virtualY = randrp->virtualY;
- }
- else
- {
- scrp->virtualX = mode->HDisplay;
- scrp->virtualY = mode->VDisplay;
- }
-
- if(randrp->rotation & (RR_Rotate_90 | RR_Rotate_270))
- {
- /* If the screen is rotated 90 or 270 degrees, swap the sizes. */
- pScreen->width = scrp->virtualY;
- pScreen->height = scrp->virtualX;
- pScreen->mmWidth = mmHeight;
- pScreen->mmHeight = mmWidth;
- }
- else
- {
- pScreen->width = scrp->virtualX;
- pScreen->height = scrp->virtualY;
- pScreen->mmWidth = mmWidth;
- pScreen->mmHeight = mmHeight;
- }
- if (scrp->currentMode == mode) {
- /* Save current mode */
- currentMode = scrp->currentMode;
- /* Reset, just so we ensure the drivers SwitchMode is called */
- scrp->currentMode = NULL;
- }
- /*
- * We know that if the driver failed to SwitchMode to the rotated
- * version, then it should revert back to it's prior mode.
- */
- if (!xf86SwitchMode (pScreen, mode))
- {
- ret = FALSE;
- scrp->virtualX = pScreen->width = oldWidth;
- scrp->virtualY = pScreen->height = oldHeight;
- pScreen->mmWidth = oldmmWidth;
- pScreen->mmHeight = oldmmHeight;
- scrp->currentMode = currentMode;
- }
-
- /*
- * Make sure the layout is correct
- */
- xf86ReconfigureLayout();
-
- /*
- * Make sure the whole screen is visible
- */
- xf86SetViewport (pScreen, pScreen->width, pScreen->height);
- xf86SetViewport (pScreen, 0, 0);
- if (pRoot)
- (*scrp->EnableDisableFBAccess) (pScreen->myNum, TRUE);
- return ret;
-}
-
-Bool
-xf86RandR12SetConfig (ScreenPtr pScreen,
- Rotation rotation,
- int rate,
- RRScreenSizePtr pSize)
-{
- ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
- XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
- DisplayModePtr mode;
- int px, py;
- Bool useVirtual = FALSE;
- int maxX = 0, maxY = 0;
- Rotation oldRotation = randrp->rotation;
-
- randrp->rotation = rotation;
-
- if (randrp->virtualX == -1 || randrp->virtualY == -1)
- {
- randrp->virtualX = scrp->virtualX;
- randrp->virtualY = scrp->virtualY;
- }
-
- miPointerGetPosition (inputInfo.pointer, &px, &py);
- for (mode = scrp->modes; ; mode = mode->next)
- {
- if (randrp->maxX == 0 || randrp->maxY == 0)
- {
- if (maxX < mode->HDisplay)
- maxX = mode->HDisplay;
- if (maxY < mode->VDisplay)
- maxY = mode->VDisplay;
- }
- if (mode->HDisplay == pSize->width &&
- mode->VDisplay == pSize->height &&
- (rate == 0 || xf86RandR12ModeRefresh (mode) == rate))
- break;
- if (mode->next == scrp->modes)
- {
- if (pSize->width == randrp->virtualX &&
- pSize->height == randrp->virtualY)
- {
- mode = scrp->modes;
- useVirtual = TRUE;
- break;
- }
- if (randrp->maxX == 0 || randrp->maxY == 0)
- {
- randrp->maxX = maxX;
- randrp->maxY = maxY;
- }
- return FALSE;
- }
- }
-
- if (randrp->maxX == 0 || randrp->maxY == 0)
- {
- randrp->maxX = maxX;
- randrp->maxY = maxY;
- }
-
- if (!xf86RandR12SetMode (pScreen, mode, useVirtual, pSize->mmWidth,
- pSize->mmHeight)) {
- randrp->rotation = oldRotation;
- return FALSE;
- }
-
- /*
- * Move the cursor back where it belongs; SwitchMode repositions it
- */
- if (pScreen == miPointerGetScreen(inputInfo.pointer))
- {
- px = (px >= pScreen->width ? (pScreen->width - 1) : px);
- py = (py >= pScreen->height ? (pScreen->height - 1) : py);
-
- xf86SetViewport(pScreen, px, py);
-
- (*pScreen->SetCursorPosition) (inputInfo.pointer, pScreen, px, py, FALSE);
- }
-
- return TRUE;
-}
-
-static Bool
-xf86RandR12ScreenSetSize (ScreenPtr pScreen,
- CARD16 width,
- CARD16 height,
- CARD16 pixWidth,
- CARD16 pixHeight,
- CARD32 mmWidth,
- CARD32 mmHeight)
-{
- XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
- ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
- WindowPtr pRoot = pScreen->root;
- PixmapPtr pScrnPix;
- Bool ret = FALSE;
- Bool pixSizeChanged = FALSE;
- Bool winSizeChanged = FALSE;
- int c;
-
- if (xf86RandR12Key) {
- if (randrp->virtualX == -1 || randrp->virtualY == -1)
- {
- randrp->virtualX = pScrn->virtualX;
- randrp->virtualY = pScrn->virtualY;
- pixSizeChanged = TRUE;
- }
- }
-
- pScrnPix = (*pScreen->GetScreenPixmap)(pScreen);
- if (pixWidth != pScrnPix->drawable.width ||
- pixHeight != pScrnPix->drawable.height)
- pixSizeChanged = TRUE;
-
- if (width != pScreen->width || height != pScreen->height)
- winSizeChanged = TRUE;
-
- if (pixSizeChanged)
- {
- if (pRoot && pScrn->vtSema)
- (*pScrn->EnableDisableFBAccess) (pScreen->myNum, FALSE);
-
- /* Let the driver update virtualX and virtualY */
- if (!(*config->funcs->resize)(pScrn, pixWidth, pixHeight))
- goto finish;
- }
-
- ret = TRUE;
-
- if (winSizeChanged)
- {
- /* Update panning information */
- for (c = 0; c < config->num_crtc; c++) {
- xf86CrtcPtr crtc = config->crtc[c];
- if (crtc->panningTotalArea.x2 > crtc->panningTotalArea.x1 ||
- crtc->panningTotalArea.y2 > crtc->panningTotalArea.y1) {
- if (crtc->panningTotalArea.x2 > crtc->panningTrackingArea.x1)
- crtc->panningTotalArea.x2 += width - pScreen->width;
- if (crtc->panningTotalArea.y2 > crtc->panningTrackingArea.y1)
- crtc->panningTotalArea.y2 += height - pScreen->height;
- if (crtc->panningTrackingArea.x2 > crtc->panningTrackingArea.x1)
- crtc->panningTrackingArea.x2 += width - pScreen->width;
- if (crtc->panningTrackingArea.y2 > crtc->panningTrackingArea.y1)
- crtc->panningTrackingArea.y2 += height - pScreen->height;
- xf86RandR13VerifyPanningArea (crtc, width, height);
- xf86RandR13Pan (crtc, randrp->pointerX, randrp->pointerY);
- }
- }
- }
-
- pScrnPix = (*pScreen->GetScreenPixmap)(pScreen);
- pScreen->width = width;
- pScreen->height = height;
- if (pRoot)
- {
- BoxRec box;
-
- pRoot->drawable.width = width;
- pRoot->drawable.height = height;
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = width;
- box.y2 = height;
- RegionInit(&pRoot->winSize, &box, 1);
- RegionInit(&pRoot->borderSize, &box, 1);
- }
- pScrnPix->drawable.width = pixWidth;
- pScrnPix->drawable.height = pixHeight;
- randrp->mmWidth = pScreen->mmWidth = mmWidth;
- randrp->mmHeight = pScreen->mmHeight = mmHeight;
-
- if (winSizeChanged)
- {
- xf86SetViewport (pScreen, pScreen->width-1, pScreen->height-1);
- xf86SetViewport (pScreen, 0, 0);
- }
-
-finish:
- if (pixSizeChanged)
- {
- if (pRoot && pScrn->vtSema)
- (*pScrn->EnableDisableFBAccess) (pScreen->myNum, TRUE);
- }
-
-#if RANDR_12_INTERFACE
- if (xf86RandR12Key && pScreen->root && ret)
- RRScreenSizeNotify (pScreen);
-#endif
- return ret;
-}
-
-Rotation
-xf86RandR12GetRotation(ScreenPtr pScreen)
-{
- XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
-
- return randrp->rotation;
-}
-
-Bool
-xf86RandR12CreateScreenResources (ScreenPtr pScreen)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- xf86CrtcConfigPtr config;
- XF86RandRInfoPtr randrp;
- int c;
- int width, height;
- int mmWidth, mmHeight;
-#ifdef PANORAMIX
- /* XXX disable RandR when using Xinerama */
- if (!noPanoramiXExtension)
- return TRUE;
-#endif
-
- config = XF86_CRTC_CONFIG_PTR(pScrn);
- randrp = XF86RANDRINFO(pScreen);
- /*
- * Compute size of screen
- */
- width = 0; height = 0;
- for (c = 0; c < config->num_crtc; c++)
- {
- xf86CrtcPtr crtc = config->crtc[c];
- int crtc_width = crtc->x + xf86ModeWidth (&crtc->mode, crtc->rotation);
- int crtc_height = crtc->y + xf86ModeHeight (&crtc->mode, crtc->rotation);
-
- if (crtc->enabled) {
- if (crtc_width > width)
- width = crtc_width;
- if (crtc_height > height)
- height = crtc_height;
- if (crtc->panningTotalArea.x2 > width)
- width = crtc->panningTotalArea.x2;
- if (crtc->panningTotalArea.y2 > height)
- height = crtc->panningTotalArea.y2;
- }
- }
-
- if (width && height)
- {
- /*
- * Compute physical size of screen
- */
- if (monitorResolution)
- {
- mmWidth = width * 25.4 / monitorResolution;
- mmHeight = height * 25.4 / monitorResolution;
- }
- else
- {
- xf86OutputPtr output = xf86CompatOutput(pScrn);
-
- if (output &&
- output->conf_monitor &&
- (output->conf_monitor->mon_width > 0 &&
- output->conf_monitor->mon_height > 0))
- {
- /*
- * Prefer user configured DisplaySize
- */
- mmWidth = output->conf_monitor->mon_width;
- mmHeight = output->conf_monitor->mon_height;
- }
- else
- {
- /*
- * Otherwise, just set the screen to DEFAULT_DPI
- */
- mmWidth = width * 25.4 / DEFAULT_DPI;
- mmHeight = height * 25.4 / DEFAULT_DPI;
- }
- }
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Setting screen physical size to %d x %d\n",
- mmWidth, mmHeight);
- /*
- * This is the initial setting of the screen size.
- * We have to pre-set it here, otherwise panning would be adapted
- * to the new screen size.
- */
- pScreen->width = width;
- pScreen->height = height;
- xf86RandR12ScreenSetSize (pScreen,
- width,
- height,
- width,
- height,
- mmWidth,
- mmHeight);
- }
-
- if (xf86RandR12Key == NULL)
- return TRUE;
-
- if (randrp->virtualX == -1 || randrp->virtualY == -1)
- {
- randrp->virtualX = pScrn->virtualX;
- randrp->virtualY = pScrn->virtualY;
- }
- xf86CrtcSetScreenSubpixelOrder (pScreen);
-#if RANDR_12_INTERFACE
- if (xf86RandR12CreateScreenResources12 (pScreen))
- return TRUE;
-#endif
- return TRUE;
-}
-
-
-Bool
-xf86RandR12Init (ScreenPtr pScreen)
-{
- rrScrPrivPtr rp;
- XF86RandRInfoPtr randrp;
-
-#ifdef PANORAMIX
- /* XXX disable RandR when using Xinerama */
- if (!noPanoramiXExtension)
- {
- if (xf86NumScreens == 1)
- noPanoramiXExtension = TRUE;
- else
- return TRUE;
- }
-#endif
-
- if (xf86RandR12Generation != serverGeneration)
- xf86RandR12Generation = serverGeneration;
-
- xf86RandR12Key = &xf86RandR12KeyRec;
- if (!dixRegisterPrivateKey(&xf86RandR12KeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
-
- randrp = malloc(sizeof (XF86RandRInfoRec));
- if (!randrp)
- return FALSE;
-
- if (!RRScreenInit(pScreen))
- {
- free(randrp);
- return FALSE;
- }
- rp = rrGetScrPriv(pScreen);
- rp->rrGetInfo = xf86RandR12GetInfo;
- rp->rrSetConfig = xf86RandR12SetConfig;
-
- randrp->virtualX = -1;
- randrp->virtualY = -1;
- randrp->mmWidth = pScreen->mmWidth;
- randrp->mmHeight = pScreen->mmHeight;
-
- randrp->rotation = RR_Rotate_0; /* initial rotated mode */
-
- randrp->supported_rotations = RR_Rotate_0;
-
- randrp->maxX = randrp->maxY = 0;
-
- dixSetPrivate(&pScreen->devPrivates, xf86RandR12Key, randrp);
-
-#if RANDR_12_INTERFACE
- if (!xf86RandR12Init12 (pScreen))
- return FALSE;
-#endif
- return TRUE;
-}
-
-void
-xf86RandR12CloseScreen (ScreenPtr pScreen)
-{
- XF86RandRInfoPtr randrp;
-
- if (xf86RandR12Key == NULL)
- return;
-
- randrp = XF86RANDRINFO(pScreen);
-#if RANDR_12_INTERFACE
- xf86Screens[pScreen->myNum]->EnterVT = randrp->orig_EnterVT;
-#endif
-
- free(randrp);
-}
-
-void
-xf86RandR12SetRotations (ScreenPtr pScreen, Rotation rotations)
-{
- XF86RandRInfoPtr randrp;
-#if RANDR_12_INTERFACE
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- int c;
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
-#endif
-
- if (xf86RandR12Key == NULL)
- return;
-
- randrp = XF86RANDRINFO(pScreen);
-#if RANDR_12_INTERFACE
- for (c = 0; c < config->num_crtc; c++) {
- xf86CrtcPtr crtc = config->crtc[c];
-
- RRCrtcSetRotations (crtc->randr_crtc, rotations);
- }
-#endif
- randrp->supported_rotations = rotations;
-}
-
-void
-xf86RandR12SetTransformSupport (ScreenPtr pScreen, Bool transforms)
-{
- XF86RandRInfoPtr randrp;
-#if RANDR_13_INTERFACE
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- int c;
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
-#endif
-
- if (xf86RandR12Key == NULL)
- return;
-
- randrp = XF86RANDRINFO(pScreen);
-#if RANDR_13_INTERFACE
- for (c = 0; c < config->num_crtc; c++) {
- xf86CrtcPtr crtc = config->crtc[c];
-
- RRCrtcSetTransformSupport (crtc->randr_crtc, transforms);
- }
-#endif
-}
-
-void
-xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr pScrn, int *x, int *y)
-{
- ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
-
- if (xf86RandR12Generation != serverGeneration ||
- XF86RANDRINFO(pScreen)->virtualX == -1)
- {
- *x = pScrn->virtualX;
- *y = pScrn->virtualY;
- } else {
- XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
-
- *x = randrp->virtualX;
- *y = randrp->virtualY;
- }
-}
-
-#if RANDR_12_INTERFACE
-
-#define FLAG_BITS (RR_HSyncPositive | \
- RR_HSyncNegative | \
- RR_VSyncPositive | \
- RR_VSyncNegative | \
- RR_Interlace | \
- RR_DoubleScan | \
- RR_CSync | \
- RR_CSyncPositive | \
- RR_CSyncNegative | \
- RR_HSkewPresent | \
- RR_BCast | \
- RR_PixelMultiplex | \
- RR_DoubleClock | \
- RR_ClockDivideBy2)
-
-static Bool
-xf86RandRModeMatches (RRModePtr randr_mode,
- DisplayModePtr mode)
-{
-#if 0
- if (match_name)
- {
- /* check for same name */
- int len = strlen (mode->name);
- if (randr_mode->mode.nameLength != len) return FALSE;
- if (memcmp (randr_mode->name, mode->name, len) != 0) return FALSE;
- }
-#endif
-
- /* check for same timings */
- if (randr_mode->mode.dotClock / 1000 != mode->Clock) return FALSE;
- if (randr_mode->mode.width != mode->HDisplay) return FALSE;
- if (randr_mode->mode.hSyncStart != mode->HSyncStart) return FALSE;
- if (randr_mode->mode.hSyncEnd != mode->HSyncEnd) return FALSE;
- if (randr_mode->mode.hTotal != mode->HTotal) return FALSE;
- if (randr_mode->mode.hSkew != mode->HSkew) return FALSE;
- if (randr_mode->mode.height != mode->VDisplay) return FALSE;
- if (randr_mode->mode.vSyncStart != mode->VSyncStart) return FALSE;
- if (randr_mode->mode.vSyncEnd != mode->VSyncEnd) return FALSE;
- if (randr_mode->mode.vTotal != mode->VTotal) return FALSE;
-
- /* check for same flags (using only the XF86 valid flag bits) */
- if ((randr_mode->mode.modeFlags & FLAG_BITS) != (mode->Flags & FLAG_BITS))
- return FALSE;
-
- /* everything matches */
- return TRUE;
-}
-
-static Bool
-xf86RandR12CrtcNotify (RRCrtcPtr randr_crtc)
-{
- ScreenPtr pScreen = randr_crtc->pScreen;
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
- RRModePtr randr_mode = NULL;
- int x;
- int y;
- Rotation rotation;
- int numOutputs;
- RROutputPtr *randr_outputs;
- RROutputPtr randr_output;
- xf86CrtcPtr crtc = randr_crtc->devPrivate;
- xf86OutputPtr output;
- int i, j;
- DisplayModePtr mode = &crtc->mode;
- Bool ret;
-
- randr_outputs = malloc(config->num_output * sizeof (RROutputPtr));
- if (!randr_outputs)
- return FALSE;
- x = crtc->x;
- y = crtc->y;
- rotation = crtc->rotation;
- numOutputs = 0;
- randr_mode = NULL;
- for (i = 0; i < config->num_output; i++)
- {
- output = config->output[i];
- if (output->crtc == crtc)
- {
- randr_output = output->randr_output;
- randr_outputs[numOutputs++] = randr_output;
- /*
- * We make copies of modes, so pointer equality
- * isn't sufficient
- */
- for (j = 0; j < randr_output->numModes + randr_output->numUserModes; j++)
- {
- RRModePtr m = (j < randr_output->numModes ?
- randr_output->modes[j] :
- randr_output->userModes[j-randr_output->numModes]);
-
- if (xf86RandRModeMatches (m, mode))
- {
- randr_mode = m;
- break;
- }
- }
- }
- }
- ret = RRCrtcNotify (randr_crtc, randr_mode, x, y,
- rotation,
- crtc->transformPresent ? &crtc->transform : NULL,
- numOutputs, randr_outputs, crtc->scanoutPixmap);
- free(randr_outputs);
- return ret;
-}
-
-/*
- * Convert a RandR mode to a DisplayMode
- */
-static void
-xf86RandRModeConvert (ScrnInfoPtr scrn,
- RRModePtr randr_mode,
- DisplayModePtr mode)
-{
- memset(mode, 0, sizeof(DisplayModeRec));
- mode->status = MODE_OK;
-
- mode->Clock = randr_mode->mode.dotClock / 1000;
-
- mode->HDisplay = randr_mode->mode.width;
- mode->HSyncStart = randr_mode->mode.hSyncStart;
- mode->HSyncEnd = randr_mode->mode.hSyncEnd;
- mode->HTotal = randr_mode->mode.hTotal;
- mode->HSkew = randr_mode->mode.hSkew;
-
- mode->VDisplay = randr_mode->mode.height;
- mode->VSyncStart = randr_mode->mode.vSyncStart;
- mode->VSyncEnd = randr_mode->mode.vSyncEnd;
- mode->VTotal = randr_mode->mode.vTotal;
- mode->VScan = 0;
-
- mode->Flags = randr_mode->mode.modeFlags & FLAG_BITS;
-
- xf86SetModeCrtc (mode, scrn->adjustFlags);
-}
-
-static Bool
-xf86RandR12CrtcSet (ScreenPtr pScreen,
- RRCrtcPtr randr_crtc,
- RRModePtr randr_mode,
- int x,
- int y,
- Rotation rotation,
- int num_randr_outputs,
- RROutputPtr *randr_outputs,
- PixmapPtr scanout_pixmap)
-{
- XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
- xf86CrtcPtr crtc = randr_crtc->devPrivate;
- RRTransformPtr transform;
- xf86CrtcSetFlags flags = 0;
- int o, ro;
- xf86CrtcPtr *save_crtcs;
- Bool save_enabled = crtc->enabled;
-
- if (!crtc->scrn->vtSema)
- return FALSE;
-
- save_crtcs = malloc(config->num_output * sizeof (xf86CrtcPtr));
- if ((randr_mode != NULL) != crtc->enabled)
- flags |= XF86CrtcSetMode;
- else if (randr_mode && !xf86RandRModeMatches (randr_mode, &crtc->mode))
- flags |= XF86CrtcSetMode;
-
- if (rotation != crtc->rotation)
- flags |= XF86CrtcSetRotation;
-
- transform = RRCrtcGetTransform (randr_crtc);
- if ((transform != NULL) != crtc->transformPresent)
- flags |= XF86CrtcSetTransform;
- else if (transform && memcmp (&transform->transform, &crtc->transform.transform,
- sizeof (transform->transform)) != 0)
- flags |= XF86CrtcSetTransform;
-
- if (scanout_pixmap != crtc->scanoutPixmap)
- flags |= XF86CrtcSetScanoutPixmap;
-
- if (x != crtc->x || y != crtc->y)
- flags |= XF86CrtcSetOrigin;
- for (o = 0; o < config->num_output; o++)
- {
- xf86OutputPtr output = config->output[o];
- xf86CrtcPtr new_crtc;
-
- save_crtcs[o] = output->crtc;
-
- if (output->crtc == crtc)
- new_crtc = NULL;
- else
- new_crtc = output->crtc;
- for (ro = 0; ro < num_randr_outputs; ro++)
- if (output->randr_output == randr_outputs[ro])
- {
- new_crtc = crtc;
- break;
- }
- if (new_crtc != output->crtc)
- {
- flags |= XF86CrtcSetOutput;
- output->crtc = new_crtc;
- }
- }
- for (ro = 0; ro < num_randr_outputs; ro++)
- if (randr_outputs[ro]->pendingProperties)
- flags |= XF86CrtcSetProperty;
-
- /* XXX need device-independent mode setting code through an API */
- if (flags)
- {
- crtc->enabled = randr_mode != NULL;
-
- if (randr_mode)
- {
- DisplayModeRec mode;
- RRTransformPtr transform = RRCrtcGetTransform (randr_crtc);
- xf86CrtcSetRec set;
-
- xf86RandRModeConvert (pScrn, randr_mode, &mode);
- set.mode = &mode;
- set.rotation = rotation;
- set.transform = transform;
- set.x = x;
- set.y = y;
- set.scanout_pixmap = scanout_pixmap;
- set.flags = flags;
- if (!xf86CrtcSet(crtc, &set))
- {
- crtc->enabled = save_enabled;
- for (o = 0; o < config->num_output; o++)
- {
- xf86OutputPtr output = config->output[o];
- output->crtc = save_crtcs[o];
- }
- free(save_crtcs);
- return FALSE;
- }
- xf86RandR13VerifyPanningArea (crtc, pScreen->width, pScreen->height);
- xf86RandR13Pan (crtc, randrp->pointerX, randrp->pointerY);
- /*
- * Save the last successful setting for EnterVT
- */
- crtc->desiredMode = mode;
- crtc->desiredRotation = rotation;
- if (transform) {
- crtc->desiredTransform = *transform;
- crtc->desiredTransformPresent = TRUE;
- } else
- crtc->desiredTransformPresent = FALSE;
-
- crtc->desiredX = x;
- crtc->desiredY = y;
- }
- xf86DisableUnusedFunctions (pScrn);
- }
- free(save_crtcs);
- return xf86RandR12CrtcNotify (randr_crtc);
-}
-
-static Bool
-xf86RandR12CrtcSetGamma (ScreenPtr pScreen,
- RRCrtcPtr randr_crtc)
-{
- xf86CrtcPtr crtc = randr_crtc->devPrivate;
-
- if (crtc->funcs->gamma_set == NULL)
- return FALSE;
-
- if (!crtc->scrn->vtSema)
- return TRUE;
-
- /* Realloc local gamma if needed. */
- if (randr_crtc->gammaSize != crtc->gamma_size) {
- CARD16 *tmp_ptr;
- tmp_ptr = realloc(crtc->gamma_red, 3 * crtc->gamma_size * sizeof (CARD16));
- if (!tmp_ptr)
- return FALSE;
- crtc->gamma_red = tmp_ptr;
- crtc->gamma_green = crtc->gamma_red + crtc->gamma_size;
- crtc->gamma_blue = crtc->gamma_green + crtc->gamma_size;
- }
-
- crtc->gamma_size = randr_crtc->gammaSize;
- memcpy (crtc->gamma_red, randr_crtc->gammaRed, crtc->gamma_size * sizeof (CARD16));
- memcpy (crtc->gamma_green, randr_crtc->gammaGreen, crtc->gamma_size * sizeof (CARD16));
- memcpy (crtc->gamma_blue, randr_crtc->gammaBlue, crtc->gamma_size * sizeof (CARD16));
-
- /* Only set it when the crtc is actually running.
- * Otherwise it will be set when it's activated.
- */
- if (crtc->active)
- crtc->funcs->gamma_set(crtc, crtc->gamma_red, crtc->gamma_green,
- crtc->gamma_blue, crtc->gamma_size);
-
- return TRUE;
-}
-
-static Bool
-xf86RandR12CrtcGetGamma (ScreenPtr pScreen,
- RRCrtcPtr randr_crtc)
-{
- xf86CrtcPtr crtc = randr_crtc->devPrivate;
-
- if (!crtc->gamma_size)
- return FALSE;
-
- if (!crtc->gamma_red || !crtc->gamma_green || !crtc->gamma_blue)
- return FALSE;
-
- /* Realloc randr gamma if needed. */
- if (randr_crtc->gammaSize != crtc->gamma_size) {
- CARD16 *tmp_ptr;
- tmp_ptr = realloc(randr_crtc->gammaRed, 3 * crtc->gamma_size * sizeof (CARD16));
- if (!tmp_ptr)
- return FALSE;
- randr_crtc->gammaRed = tmp_ptr;
- randr_crtc->gammaGreen = randr_crtc->gammaRed + crtc->gamma_size;
- randr_crtc->gammaBlue = randr_crtc->gammaGreen + crtc->gamma_size;
- }
- randr_crtc->gammaSize = crtc->gamma_size;
- memcpy (randr_crtc->gammaRed, crtc->gamma_red, crtc->gamma_size * sizeof (CARD16));
- memcpy (randr_crtc->gammaGreen, crtc->gamma_green, crtc->gamma_size * sizeof (CARD16));
- memcpy (randr_crtc->gammaBlue, crtc->gamma_blue, crtc->gamma_size * sizeof (CARD16));
-
- return TRUE;
-}
-
-static Bool
-xf86RandR12OutputSetProperty (ScreenPtr pScreen,
- RROutputPtr randr_output,
- Atom property,
- RRPropertyValuePtr value)
-{
- xf86OutputPtr output = randr_output->devPrivate;
-
- /* If we don't have any property handler, then we don't care what the
- * user is setting properties to.
- */
- if (output->funcs->set_property == NULL)
- return TRUE;
-
- /*
- * This function gets called even when vtSema is FALSE, as
- * drivers will need to remember the correct value to apply
- * when the VT switch occurs
- */
- return output->funcs->set_property(output, property, value);
-}
-
-static Bool
-xf86RandR13OutputGetProperty (ScreenPtr pScreen,
- RROutputPtr randr_output,
- Atom property)
-{
- xf86OutputPtr output = randr_output->devPrivate;
-
- if (output->funcs->get_property == NULL)
- return TRUE;
-
- /* Should be safe even w/o vtSema */
- return output->funcs->get_property(output, property);
-}
-
-static Bool
-xf86RandR12OutputValidateMode (ScreenPtr pScreen,
- RROutputPtr randr_output,
- RRModePtr randr_mode)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- xf86OutputPtr output = randr_output->devPrivate;
- DisplayModeRec mode;
-
- xf86RandRModeConvert (pScrn, randr_mode, &mode);
- /*
- * This function may be called when vtSema is FALSE, so
- * the underlying function must either avoid touching the hardware
- * or return FALSE when vtSema is FALSE
- */
- if (output->funcs->mode_valid (output, &mode) != MODE_OK)
- return FALSE;
- return TRUE;
-}
-
-static void
-xf86RandR12ModeDestroy (ScreenPtr pScreen, RRModePtr randr_mode)
-{
-}
-
-/**
- * Given a list of xf86 modes and a RandR Output object, construct
- * RandR modes and assign them to the output
- */
-static Bool
-xf86RROutputSetModes (RROutputPtr randr_output, DisplayModePtr modes)
-{
- DisplayModePtr mode;
- RRModePtr *rrmodes = NULL;
- int nmode = 0;
- int npreferred = 0;
- Bool ret = TRUE;
- int pref;
-
- for (mode = modes; mode; mode = mode->next)
- nmode++;
-
- if (nmode) {
- rrmodes = malloc(nmode * sizeof (RRModePtr));
-
- if (!rrmodes)
- return FALSE;
- nmode = 0;
-
- for (pref = 1; pref >= 0; pref--) {
- for (mode = modes; mode; mode = mode->next) {
- if ((pref != 0) == ((mode->type & M_T_PREFERRED) != 0)) {
- xRRModeInfo modeInfo;
- RRModePtr rrmode;
-
- modeInfo.nameLength = strlen (mode->name);
- modeInfo.width = mode->HDisplay;
- modeInfo.dotClock = mode->Clock * 1000;
- modeInfo.hSyncStart = mode->HSyncStart;
- modeInfo.hSyncEnd = mode->HSyncEnd;
- modeInfo.hTotal = mode->HTotal;
- modeInfo.hSkew = mode->HSkew;
-
- modeInfo.height = mode->VDisplay;
- modeInfo.vSyncStart = mode->VSyncStart;
- modeInfo.vSyncEnd = mode->VSyncEnd;
- modeInfo.vTotal = mode->VTotal;
- modeInfo.modeFlags = mode->Flags;
-
- rrmode = RRModeGet (&modeInfo, mode->name);
- if (rrmode) {
- rrmodes[nmode++] = rrmode;
- npreferred += pref;
- }
- }
- }
- }
- }
-
- ret = RROutputSetModes (randr_output, rrmodes, nmode, npreferred);
- free(rrmodes);
- return ret;
-}
-
-/*
- * Mirror the current mode configuration to RandR
- */
-static Bool
-xf86RandR12SetInfo12 (ScreenPtr pScreen)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
- RROutputPtr *clones;
- RRCrtcPtr *crtcs;
- int ncrtc;
- int o, c, l;
- RRCrtcPtr randr_crtc;
- int nclone;
-
- clones = malloc(config->num_output * sizeof (RROutputPtr));
- crtcs = malloc(config->num_crtc * sizeof (RRCrtcPtr));
- for (o = 0; o < config->num_output; o++)
- {
- xf86OutputPtr output = config->output[o];
-
- ncrtc = 0;
- for (c = 0; c < config->num_crtc; c++)
- if (output->possible_crtcs & (1 << c))
- crtcs[ncrtc++] = config->crtc[c]->randr_crtc;
-
- if (output->crtc)
- randr_crtc = output->crtc->randr_crtc;
- else
- randr_crtc = NULL;
-
- if (!RROutputSetCrtcs (output->randr_output, crtcs, ncrtc))
- {
- free(crtcs);
- free(clones);
- return FALSE;
- }
-
- RROutputSetPhysicalSize(output->randr_output,
- output->mm_width,
- output->mm_height);
- xf86RROutputSetModes (output->randr_output, output->probed_modes);
-
- switch (output->status) {
- case XF86OutputStatusConnected:
- RROutputSetConnection (output->randr_output, RR_Connected);
- break;
- case XF86OutputStatusDisconnected:
- RROutputSetConnection (output->randr_output, RR_Disconnected);
- break;
- case XF86OutputStatusUnknown:
- RROutputSetConnection (output->randr_output, RR_UnknownConnection);
- break;
- }
-
- RROutputSetSubpixelOrder (output->randr_output, output->subpixel_order);
-
- /*
- * Valid clones
- */
- nclone = 0;
- for (l = 0; l < config->num_output; l++)
- {
- xf86OutputPtr clone = config->output[l];
-
- if (l != o && (output->possible_clones & (1 << l)))
- clones[nclone++] = clone->randr_output;
- }
- if (!RROutputSetClones (output->randr_output, clones, nclone))
- {
- free(crtcs);
- free(clones);
- return FALSE;
- }
- }
- free(crtcs);
- free(clones);
- return TRUE;
-}
-
-
-
-/*
- * Query the hardware for the current state, then mirror
- * that to RandR
- */
-static Bool
-xf86RandR12GetInfo12 (ScreenPtr pScreen, Rotation *rotations)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-
- if (!pScrn->vtSema)
- return TRUE;
- xf86ProbeOutputModes (pScrn, 0, 0);
- xf86SetScrnInfoModes (pScrn);
- return xf86RandR12SetInfo12 (pScreen);
-}
-
-static Bool
-xf86RandR12CreateObjects12 (ScreenPtr pScreen)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
- int c;
- int o;
-
- if (!RRInit ())
- return FALSE;
-
- /*
- * Configure crtcs
- */
- for (c = 0; c < config->num_crtc; c++)
- {
- xf86CrtcPtr crtc = config->crtc[c];
-
- crtc->randr_crtc = RRCrtcCreate (pScreen, crtc);
- RRCrtcGammaSetSize (crtc->randr_crtc, 256);
- }
- /*
- * Configure outputs
- */
- for (o = 0; o < config->num_output; o++)
- {
- xf86OutputPtr output = config->output[o];
-
- output->randr_output = RROutputCreate (pScreen, output->name,
- strlen (output->name),
- output);
-
- if (output->funcs->create_resources != NULL)
- output->funcs->create_resources(output);
- RRPostPendingProperties (output->randr_output);
- }
- return TRUE;
-}
-
-static Bool
-xf86RandR12CreateScreenResources12 (ScreenPtr pScreen)
-{
- int c;
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
-
- if (xf86RandR12Key == NULL)
- return TRUE;
-
- for (c = 0; c < config->num_crtc; c++)
- xf86RandR12CrtcNotify (config->crtc[c]->randr_crtc);
-
- RRScreenSetSizeRange (pScreen, config->minWidth, config->minHeight,
- config->maxWidth, config->maxHeight);
- return TRUE;
-}
-
-/*
- * Something happened within the screen configuration due
- * to DGA, VidMode or hot key. Tell RandR
- */
-
-void
-xf86RandR12TellChanged (ScreenPtr pScreen)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
- int c;
-
- if (xf86RandR12Key == NULL)
- return;
-
- xf86RandR12SetInfo12 (pScreen);
- for (c = 0; c < config->num_crtc; c++)
- xf86RandR12CrtcNotify (config->crtc[c]->randr_crtc);
-
- RRTellChanged (pScreen);
-}
-
-static void
-xf86RandR12PointerMoved (int scrnIndex, int x, int y)
-{
- ScreenPtr pScreen = screenInfo.screens[scrnIndex];
- ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
- XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
- int c;
-
- randrp->pointerX = x;
- randrp->pointerY = y;
- for (c = 0; c < config->num_crtc; c++)
- xf86RandR13Pan (config->crtc[c], x, y);
-}
-
-static Bool
-xf86RandR13GetPanning (ScreenPtr pScreen,
- RRCrtcPtr randr_crtc,
- BoxPtr totalArea,
- BoxPtr trackingArea,
- INT16 *border)
-{
- xf86CrtcPtr crtc = randr_crtc->devPrivate;
-
- if (crtc->version < 2)
- return FALSE;
- if (totalArea)
- memcpy (totalArea, &crtc->panningTotalArea, sizeof(BoxRec));
- if (trackingArea)
- memcpy (trackingArea, &crtc->panningTrackingArea, sizeof(BoxRec));
- if (border)
- memcpy (border, crtc->panningBorder, 4*sizeof(INT16));
-
- return TRUE;
-}
-
-static Bool
-xf86RandR13SetPanning (ScreenPtr pScreen,
- RRCrtcPtr randr_crtc,
- BoxPtr totalArea,
- BoxPtr trackingArea,
- INT16 *border)
-{
- XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
- xf86CrtcPtr crtc = randr_crtc->devPrivate;
- BoxRec oldTotalArea;
- BoxRec oldTrackingArea;
- INT16 oldBorder[4];
-
-
- if (crtc->version < 2)
- return FALSE;
-
- memcpy (&oldTotalArea, &crtc->panningTotalArea, sizeof(BoxRec));
- memcpy (&oldTrackingArea, &crtc->panningTrackingArea, sizeof(BoxRec));
- memcpy (oldBorder, crtc->panningBorder, 4*sizeof(INT16));
-
- if (totalArea)
- memcpy (&crtc->panningTotalArea, totalArea, sizeof(BoxRec));
- if (trackingArea)
- memcpy (&crtc->panningTrackingArea, trackingArea, sizeof(BoxRec));
- if (border)
- memcpy (crtc->panningBorder, border, 4*sizeof(INT16));
-
- if (xf86RandR13VerifyPanningArea (crtc, pScreen->width, pScreen->height)) {
- xf86RandR13Pan (crtc, randrp->pointerX, randrp->pointerY);
- return TRUE;
- } else {
- /* Restore old settings */
- memcpy (&crtc->panningTotalArea, &oldTotalArea, sizeof(BoxRec));
- memcpy (&crtc->panningTrackingArea, &oldTrackingArea, sizeof(BoxRec));
- memcpy (crtc->panningBorder, oldBorder, 4*sizeof(INT16));
- return FALSE;
- }
-}
-
-/*
- * Compatibility with XF86VidMode's gamma changer. This necessarily clobbers
- * any per-crtc setup. You asked for it...
- */
-
-static void
-gamma_to_ramp(float gamma, CARD16 *ramp, int size)
-{
- int i;
-
- for (i = 0; i < size; i++) {
- if (gamma == 1.0)
- ramp[i] = i << 8;
- else
- ramp[i] = (CARD16)(pow((double)i / (double)(size - 1), 1. / gamma)
- * (double)(size - 1) * 256);
- }
-}
-
-static int
-xf86RandR12ChangeGamma(int scrnIndex, Gamma gamma)
-{
- CARD16 *points, *red, *green, *blue;
- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
- RRCrtcPtr crtc = xf86CompatRRCrtc(pScrn);
- int size;
-
- if (!crtc)
- return Success;
-
- size = max(0, crtc->gammaSize);
- if (!size)
- return Success;
-
- points = calloc(size, 3 * sizeof(CARD16));
- if (!points)
- return BadAlloc;
-
- red = points;
- green = points + size;
- blue = points + 2 * size;
-
- gamma_to_ramp(gamma.red, red, size);
- gamma_to_ramp(gamma.green, green, size);
- gamma_to_ramp(gamma.blue, blue, size);
- RRCrtcGammaSet(crtc, red, green, blue);
-
- free(points);
-
- pScrn->gamma = gamma;
-
- return Success;
-}
-
-static RRScanoutPixmapInfo *
-xf86RRQueryScanoutPixmaps(ScreenPtr screen, int *n_info)
-{
- ScrnInfoPtr scrn = xf86Screens[screen->myNum];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- RRScanoutPixmapInfo *info;
- int f;
-
- info = calloc(config->num_scanout_formats, sizeof (RRScanoutPixmapInfo));
- if (config->num_scanout_formats && !info) {
- *n_info = 0;
- return NULL;
- }
- for (f = 0; f < config->num_scanout_formats; f++) {
- info[f].maxWidth = config->scanout_formats[f].maxWidth;
- info[f].maxHeight = config->scanout_formats[f].maxHeight;
- info[f].depth = config->scanout_formats[f].depth;
- info[f].rotations = config->scanout_formats[f].rotations;
- info[f].format = PictureMatchFormat (screen, info[f].depth,
- config->scanout_formats[f].format);
- }
- *n_info = config->num_scanout_formats;
- return info;
-}
-
-static PixmapPtr
-xf86RRCreateScanoutPixmap(ScreenPtr screen,
- int width, int height, int depth,
- Rotation rotations,
- PictFormatPtr format)
-{
- ScrnInfoPtr scrn = xf86Screens[screen->myNum];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
- int f;
-
- if (!config->funcs->create_scanout_pixmap)
- return NullPixmap;
-
- for (f = 0; f < config->num_scanout_formats; f++)
- if (config->scanout_formats[f].depth == depth &&
- (config->scanout_formats[f].format & 0xffffff) == format->format) {
- return (*config->funcs->create_scanout_pixmap) (scrn, width, height,
- rotations,
- &config->scanout_formats[f]);
- }
- return NullPixmap;
-}
-
-static void
-xf86RandR14SetCrtcSpriteTransform(ScreenPtr pScreen,
- RRCrtcPtr randr_crtc,
- struct pixman_f_transform *f_position_transform,
- struct pixman_f_transform *f_image_transform)
-{
- xf86CrtcPtr crtc = randr_crtc->devPrivate;
-
- crtc->user_sprite_position_transform = *f_position_transform;
- crtc->user_sprite_image_transform = *f_image_transform;
- xf86CrtcRotateCursor(crtc);
- xf86_reload_cursors(pScreen);
-}
-
-static Bool
-xf86RRConvertCrtcConfig(xf86CrtcSetConfigPtr xf86_config,
- RRCrtcConfigPtr rr_config)
-{
- RRCrtcPtr rr_crtc = rr_config->crtc;
- xf86CrtcPtr crtc = rr_crtc->devPrivate;
- ScrnInfoPtr scrn = xf86Screens[rr_crtc->pScreen->myNum];
- int o;
-
- xf86_config->crtc = crtc;
- xf86_config->x = rr_config->x;
- xf86_config->y = rr_config->y;
- xf86RandRModeConvert(scrn, rr_config->mode, &xf86_config->mode);
- xf86_config->rotation = rr_config->rotation;
- xf86_config->numOutputs = rr_config->numOutputs;
- xf86_config->outputs = calloc(rr_config->numOutputs, sizeof (xf86OutputPtr));
- if (!xf86_config->outputs)
- return FALSE;
- for (o = 0; o < rr_config->numOutputs; o++)
- xf86_config->outputs[o] = rr_config->outputs[o]->devPrivate;
- xf86_config->sprite_position_transform = rr_config->sprite_position_f_transform;
- xf86_config->sprite_image_transform = rr_config->sprite_image_f_transform;
- xf86_config->pixmap = rr_config->pixmap;
- xf86_config->pixmap_x = rr_config->pixmap_x;
- xf86_config->pixmap_y = rr_config->pixmap_y;
- return TRUE;
-}
-
-static void
-xf86FreeCrtcSetConfigs(xf86CrtcSetConfigPtr xf86_crtc_configs, int num_configs)
-{
- int i;
-
- for (i = 0; i < num_configs; i++)
- free(xf86_crtc_configs[i].outputs);
- free(xf86_crtc_configs);
-}
-
-static Bool
-xf86RRSetCrtcConfigs(ScreenPtr screen,
- RRScreenConfigPtr screen_config,
- RRCrtcConfigPtr crtc_configs,
- int num_configs)
-{
- ScrnInfoPtr scrn = xf86Screens[screen->myNum];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
-
- if (config->funcs->set_config) {
- xf86CrtcSetConfigPtr xf86_crtc_configs;
- int i;
- xf86SetConfigResponse response;
-
- /*
- * Convert RRCrtcConfigRecs to xf86CrtcSetConfigs
- */
- xf86_crtc_configs = calloc(num_configs, sizeof (xf86CrtcSetConfigRec));
- if (!xf86_crtc_configs)
- return FALSE;
- for (i = 0; i < num_configs; i++)
- if (!xf86RRConvertCrtcConfig(&xf86_crtc_configs[i], &crtc_configs[i])) {
- xf86FreeCrtcSetConfigs(xf86_crtc_configs, num_configs);
- return FALSE;
- }
-
- /*
- * Ask the driver to set the configuration
- */
- response = (*config->funcs->set_config)(scrn,
- screen_config,
- xf86_crtc_configs,
- num_configs);
- xf86FreeCrtcSetConfigs(xf86_crtc_configs, num_configs);
-
- /*
- * The driver is allowed to answer with one of three
- * responses:
- */
- switch (response) {
- case xf86SetConfigFailed:
-
- /* The configuration isn't usable, or some error
- * occurred while setting it. Everything has been
- * cleaned up and we're ready to return an error
- * back to the client
- */
- return FALSE;
- case xf86SetConfigDone:
-
- /* The configuration was acceptable, and the whole
- * mode setting experience is over. Nothing more to do
- * here.
- */
- return TRUE;
- case xf86SetConfigChecked:
-
- /* The configuration was acceptable, but the driver
- * didn't actually do anything. Go ask the DIX code
- * to do the mode setting operation using the simpler
- * interfaces
- */
- break;
- }
- }
- return miRRSetCrtcConfigs(screen, screen_config, crtc_configs, num_configs);
-}
-
-static Bool
-xf86RandR12EnterVT (int screen_index, int flags)
-{
- ScreenPtr pScreen = screenInfo.screens[screen_index];
- ScrnInfoPtr pScrn = xf86Screens[screen_index];
- XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
- rrScrPrivPtr rp = rrGetScrPriv(pScreen);
- Bool ret;
- int i;
-
- if (randrp->orig_EnterVT) {
- pScrn->EnterVT = randrp->orig_EnterVT;
- ret = pScrn->EnterVT (screen_index, flags);
- randrp->orig_EnterVT = pScrn->EnterVT;
- pScrn->EnterVT = xf86RandR12EnterVT;
- if (!ret)
- return FALSE;
- }
-
- /* reload gamma */
- for (i = 0; i < rp->numCrtcs; i++)
- xf86RandR12CrtcSetGamma(pScreen, rp->crtcs[i]);
-
- return RRGetInfo (pScreen, TRUE); /* force a re-probe of outputs and notify clients about changes */
-}
-
-static Bool
-xf86RandR12Init12 (ScreenPtr pScreen)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- rrScrPrivPtr rp = rrGetScrPriv(pScreen);
- XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
- int i;
-
- rp->rrGetInfo = xf86RandR12GetInfo12;
- rp->rrScreenSetSize = xf86RandR12ScreenSetSize;
- rp->rrCrtcSet = xf86RandR12CrtcSet;
- rp->rrCrtcSetGamma = xf86RandR12CrtcSetGamma;
- rp->rrCrtcGetGamma = xf86RandR12CrtcGetGamma;
- rp->rrOutputSetProperty = xf86RandR12OutputSetProperty;
- rp->rrOutputValidateMode = xf86RandR12OutputValidateMode;
- rp->rrOutputGetProperty = xf86RandR13OutputGetProperty;
- rp->rrGetPanning = xf86RandR13GetPanning;
- rp->rrSetPanning = xf86RandR13SetPanning;
- rp->rrModeDestroy = xf86RandR12ModeDestroy;
- rp->rrSetConfig = NULL;
- pScrn->PointerMoved = xf86RandR12PointerMoved;
- pScrn->ChangeGamma = xf86RandR12ChangeGamma;
- rp->rrSetCrtcSpriteTransform = xf86RandR14SetCrtcSpriteTransform;
- rp->rrSetCrtcConfigs = xf86RRSetCrtcConfigs;
- rp->rrQueryScanoutPixmaps = xf86RRQueryScanoutPixmaps;
- rp->rrCreateScanoutPixmap = xf86RRCreateScanoutPixmap;
-
- randrp->orig_EnterVT = pScrn->EnterVT;
- pScrn->EnterVT = xf86RandR12EnterVT;
-
- if (!xf86RandR12CreateObjects12 (pScreen))
- return FALSE;
-
- /*
- * Configure output modes
- */
- if (!xf86RandR12SetInfo12 (pScreen))
- return FALSE;
- for (i = 0; i < rp->numCrtcs; i++) {
- xf86RandR12CrtcGetGamma(pScreen, rp->crtcs[i]);
- }
- return TRUE;
-}
-
-#endif
-
-Bool
-xf86RandR12PreInit (ScrnInfoPtr pScrn)
-{
- return TRUE;
-}
+/*
+ * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#else
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#endif
+
+#include "xf86.h"
+#include "os.h"
+#include "globals.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86DDC.h"
+#include "mipointer.h"
+#include "windowstr.h"
+#include "inputstr.h"
+#include <randrstr.h>
+#include <X11/extensions/render.h>
+
+#include "xf86Crtc.h"
+#include "xf86RandR12.h"
+
+typedef struct _xf86RandR12Info {
+ int virtualX;
+ int virtualY;
+ int mmWidth;
+ int mmHeight;
+ int maxX;
+ int maxY;
+ int pointerX;
+ int pointerY;
+ Rotation rotation; /* current mode */
+ Rotation supported_rotations; /* driver supported */
+
+ /* Used to wrap EnterVT so we can re-probe the outputs when a laptop unsuspends
+ * (actually, any time that we switch back into our VT).
+ *
+ * See https://bugs.freedesktop.org/show_bug.cgi?id=21554
+ */
+ xf86EnterVTProc *orig_EnterVT;
+} XF86RandRInfoRec, *XF86RandRInfoPtr;
+
+#ifdef RANDR_12_INTERFACE
+static Bool xf86RandR12Init12 (ScreenPtr pScreen);
+static Bool xf86RandR12CreateScreenResources12 (ScreenPtr pScreen);
+#endif
+
+static int xf86RandR12Generation;
+
+static DevPrivateKeyRec xf86RandR12KeyRec;
+static DevPrivateKey xf86RandR12Key;
+#define XF86RANDRINFO(p) ((XF86RandRInfoPtr) \
+ dixLookupPrivate(&(p)->devPrivates, xf86RandR12Key))
+
+
+static int
+xf86RandR12ModeRefresh (DisplayModePtr mode)
+{
+ if (mode->VRefresh)
+ return (int) (mode->VRefresh + 0.5);
+ else
+ return (int) (mode->Clock * 1000.0 / mode->HTotal / mode->VTotal + 0.5);
+}
+
+/* Adapt panning area; return TRUE if panning area was valid without adaption */
+static int
+xf86RandR13VerifyPanningArea (xf86CrtcPtr crtc, int screenWidth, int screenHeight)
+{
+ int ret = TRUE;
+
+ if (crtc->version < 2)
+ return FALSE;
+
+ if (crtc->panningTotalArea.x2 <= crtc->panningTotalArea.x1) {
+ /* Panning in X is disabled */
+ if (crtc->panningTotalArea.x1 || crtc->panningTotalArea.x2)
+ /* Illegal configuration -> fail/disable */
+ ret = FALSE;
+ crtc->panningTotalArea.x1 = crtc->panningTotalArea.x2 = 0;
+ crtc->panningTrackingArea.x1 = crtc->panningTrackingArea.x2 = 0;
+ crtc->panningBorder[0] = crtc->panningBorder[2] = 0;
+ } else {
+ /* Panning in X is enabled */
+ if (crtc->panningTotalArea.x1 < 0) {
+ /* Panning region outside screen -> move inside */
+ crtc->panningTotalArea.x2 -= crtc->panningTotalArea.x1;
+ crtc->panningTotalArea.x1 = 0;
+ ret = FALSE;
+ }
+ if (crtc->panningTotalArea.x2 < crtc->panningTotalArea.x1 + crtc->mode.HDisplay) {
+ /* Panning region smaller than displayed area -> crop to displayed area */
+ crtc->panningTotalArea.x2 = crtc->panningTotalArea.x1 + crtc->mode.HDisplay;
+ ret = FALSE;
+ }
+ if (crtc->panningTotalArea.x2 > screenWidth) {
+ /* Panning region larger than screen -> move inside, then crop to screen */
+ crtc->panningTotalArea.x1 -= crtc->panningTotalArea.x2 - screenWidth;
+ crtc->panningTotalArea.x2 = screenWidth;
+ ret = FALSE;
+ if (crtc->panningTotalArea.x1 < 0)
+ crtc->panningTotalArea.x1 = 0;
+ }
+ if (crtc->panningBorder[0] + crtc->panningBorder[2] > crtc->mode.HDisplay) {
+ /* Borders too large -> set to 0 */
+ crtc->panningBorder[0] = crtc->panningBorder[2] = 0;
+ ret = FALSE;
+ }
+ }
+
+ if (crtc->panningTotalArea.y2 <= crtc->panningTotalArea.y1) {
+ /* Panning in Y is disabled */
+ if (crtc->panningTotalArea.y1 || crtc->panningTotalArea.y2)
+ /* Illegal configuration -> fail/disable */
+ ret = FALSE;
+ crtc->panningTotalArea.y1 = crtc->panningTotalArea.y2 = 0;
+ crtc->panningTrackingArea.y1 = crtc->panningTrackingArea.y2 = 0;
+ crtc->panningBorder[1] = crtc->panningBorder[3] = 0;
+ } else {
+ /* Panning in Y is enabled */
+ if (crtc->panningTotalArea.y1 < 0) {
+ /* Panning region outside screen -> move inside */
+ crtc->panningTotalArea.y2 -= crtc->panningTotalArea.y1;
+ crtc->panningTotalArea.y1 = 0;
+ ret = FALSE;
+ }
+ if (crtc->panningTotalArea.y2 < crtc->panningTotalArea.y1 + crtc->mode.VDisplay) {
+ /* Panning region smaller than displayed area -> crop to displayed area */
+ crtc->panningTotalArea.y2 = crtc->panningTotalArea.y1 + crtc->mode.VDisplay;
+ ret = FALSE;
+ }
+ if (crtc->panningTotalArea.y2 > screenHeight) {
+ /* Panning region larger than screen -> move inside, then crop to screen */
+ crtc->panningTotalArea.y1 -= crtc->panningTotalArea.y2 - screenHeight;
+ crtc->panningTotalArea.y2 = screenHeight;
+ ret = FALSE;
+ if (crtc->panningTotalArea.y1 < 0)
+ crtc->panningTotalArea.y1 = 0;
+ }
+ if (crtc->panningBorder[1] + crtc->panningBorder[3] > crtc->mode.VDisplay) {
+ /* Borders too large -> set to 0 */
+ crtc->panningBorder[1] = crtc->panningBorder[3] = 0;
+ ret = FALSE;
+ }
+ }
+
+ return ret;
+}
+
+/*
+ * The heart of the panning operation:
+ *
+ * Given a frame buffer position (fb_x, fb_y),
+ * and a crtc position (crtc_x, crtc_y),
+ * and a transform matrix which maps frame buffer to crtc,
+ * compute a panning position (pan_x, pan_y) that
+ * makes the resulting transform line those two up
+ */
+
+static void
+xf86ComputeCrtcPan (Bool transform_in_use,
+ struct pixman_f_transform *m,
+ double screen_x, double screen_y,
+ double crtc_x, double crtc_y,
+ int old_pan_x, int old_pan_y,
+ int *new_pan_x, int *new_pan_y)
+{
+ if (transform_in_use) {
+ /*
+ * Given the current transform, M, the current position
+ * on the Screen, S, and the desired position on the CRTC,
+ * C, compute a translation, T, such that:
+ *
+ * M T S = C
+ *
+ * where T is of the form
+ *
+ * | 1 0 dx |
+ * | 0 1 dy |
+ * | 0 0 1 |
+ *
+ * M T S =
+ * | M00 Sx + M01 Sy + M00 dx + M01 dy + M02 | | Cx F |
+ * | M10 Sx + M11 Sy + M10 dx + M11 dy + M12 | = | Cy F |
+ * | M20 Sx + M21 Sy + M20 dx + M21 dy + M22 | | F |
+ *
+ * R = M S
+ *
+ * Cx F = M00 dx + M01 dy + R0
+ * Cy F = M10 dx + M11 dy + R1
+ * F = M20 dx + M21 dy + R2
+ *
+ * Zero out dx, then dy
+ *
+ * F (Cx M10 - Cy M00) =
+ * (M10 M01 - M00 M11) dy + M10 R0 - M00 R1
+ * F (M10 - Cy M20) =
+ * (M10 M21 - M20 M11) dy + M10 R2 - M20 R1
+ *
+ * F (Cx M11 - Cy M01) =
+ * (M11 M00 - M01 M10) dx + M11 R0 - M01 R1
+ * F (M11 - Cy M21) =
+ * (M11 M20 - M21 M10) dx + M11 R2 - M21 R1
+ *
+ * Make some temporaries
+ *
+ * T = | Cx M10 - Cy M00 |
+ * | Cx M11 - Cy M01 |
+ *
+ * U = | M10 M01 - M00 M11 |
+ * | M11 M00 - M01 M10 |
+ *
+ * Q = | M10 R0 - M00 R1 |
+ * | M11 R0 - M01 R1 |
+ *
+ * P = | M10 - Cy M20 |
+ * | M11 - Cy M21 |
+ *
+ * W = | M10 M21 - M20 M11 |
+ * | M11 M20 - M21 M10 |
+ *
+ * V = | M10 R2 - M20 R1 |
+ * | M11 R2 - M21 R1 |
+ *
+ * Rewrite:
+ *
+ * F T0 = U0 dy + Q0
+ * F P0 = W0 dy + V0
+ * F T1 = U1 dx + Q1
+ * F P1 = W1 dx + V1
+ *
+ * Solve for F (two ways)
+ *
+ * F (W0 T0 - U0 P0) = W0 Q0 - U0 V0
+ *
+ * W0 Q0 - U0 V0
+ * F = -------------
+ * W0 T0 - U0 P0
+ *
+ * F (W1 T1 - U1 P1) = W1 Q1 - U1 V1
+ *
+ * W1 Q1 - U1 V1
+ * F = -------------
+ * W1 T1 - U1 P1
+ *
+ * We'll use which ever solution works (denominator != 0)
+ *
+ * Finally, solve for dx and dy:
+ *
+ * dx = (F T1 - Q1) / U1
+ * dx = (F P1 - V1) / W1
+ *
+ * dy = (F T0 - Q0) / U0
+ * dy = (F P0 - V0) / W0
+ */
+ double r[3];
+ double q[2], u[2], t[2], v[2], w[2], p[2];
+ double f;
+ struct pict_f_vector d;
+ int i;
+
+ /* Get the un-normalized crtc coordinates again */
+ for (i = 0; i < 3; i++)
+ r[i] = m->m[i][0] * screen_x + m->m[i][1] * screen_y + m->m[i][2];
+
+ /* Combine values into temporaries */
+ for (i = 0; i < 2; i++) {
+ q[i] = m->m[1][i] * r[0] - m->m[0][i] * r[1];
+ u[i] = m->m[1][i] * m->m[0][1-i] - m->m[0][i] * m->m[1][1-i];
+ t[i] = m->m[1][i] * crtc_x - m->m[0][i] * crtc_y;
+
+ v[i] = m->m[1][i] * r[2] - m->m[2][i] * r[1];
+ w[i] = m->m[1][i] * m->m[2][1-i] - m->m[2][i] * m->m[1][1-i];
+ p[i] = m->m[1][i] - m->m[2][i] * crtc_y;
+ }
+
+ /* Find a way to compute f */
+ f = 0;
+ for (i = 0; i < 2; i++) {
+ double a = w[i] * q[i] - u[i] * v[i];
+ double b = w[i] * t[i] - u[i] * p[i];
+ if (b != 0) {
+ f = a/b;
+ break;
+ }
+ }
+
+ /* Solve for the resulting transform vector */
+ for (i = 0; i < 2; i++) {
+ if (u[i])
+ d.v[1-i] = (t[i] * f - q[i]) / u[i];
+ else if (w[1])
+ d.v[1-i] = (p[i] * f - v[i]) / w[i];
+ else
+ d.v[1-i] = 0;
+ }
+ *new_pan_x = old_pan_x - floor (d.v[0] + 0.5);
+ *new_pan_y = old_pan_y - floor (d.v[1] + 0.5);
+ } else {
+ *new_pan_x = screen_x - crtc_x;
+ *new_pan_y = screen_y - crtc_y;
+ }
+}
+
+static void
+xf86RandR13Pan (xf86CrtcPtr crtc, int x, int y)
+{
+ int newX, newY;
+ int width, height;
+ Bool panned = FALSE;
+
+ if (crtc->version < 2)
+ return;
+
+ if (! crtc->enabled ||
+ (crtc->panningTotalArea.x2 <= crtc->panningTotalArea.x1 &&
+ crtc->panningTotalArea.y2 <= crtc->panningTotalArea.y1))
+ return;
+
+ newX = crtc->x;
+ newY = crtc->y;
+ width = crtc->mode.HDisplay;
+ height = crtc->mode.VDisplay;
+
+ if ((crtc->panningTrackingArea.x2 <= crtc->panningTrackingArea.x1 ||
+ (x >= crtc->panningTrackingArea.x1 && x < crtc->panningTrackingArea.x2)) &&
+ (crtc->panningTrackingArea.y2 <= crtc->panningTrackingArea.y1 ||
+ (y >= crtc->panningTrackingArea.y1 && y < crtc->panningTrackingArea.y2)))
+ {
+ struct pict_f_vector c;
+
+ /*
+ * Pre-clip the mouse position to the panning area so that we don't
+ * push the crtc outside. This doesn't deal with changes to the
+ * panning values, only mouse position changes.
+ */
+ if (crtc->panningTotalArea.x2 > crtc->panningTotalArea.x1)
+ {
+ if (x < crtc->panningTotalArea.x1)
+ x = crtc->panningTotalArea.x1;
+ if (x >= crtc->panningTotalArea.x2)
+ x = crtc->panningTotalArea.x2 - 1;
+ }
+ if (crtc->panningTotalArea.y2 > crtc->panningTotalArea.y1)
+ {
+ if (y < crtc->panningTotalArea.y1)
+ y = crtc->panningTotalArea.y1;
+ if (y >= crtc->panningTotalArea.y2)
+ y = crtc->panningTotalArea.y2 - 1;
+ }
+
+ c.v[0] = x;
+ c.v[1] = y;
+ c.v[2] = 1.0;
+ if (crtc->transform_in_use) {
+ pixman_f_transform_point(&crtc->f_framebuffer_to_crtc, &c);
+ } else {
+ c.v[0] -= crtc->x;
+ c.v[1] -= crtc->y;
+ }
+
+ if (crtc->panningTotalArea.x2 > crtc->panningTotalArea.x1) {
+ if (c.v[0] < crtc->panningBorder[0]) {
+ c.v[0] = crtc->panningBorder[0];
+ panned = TRUE;
+ }
+ if (c.v[0] >= width - crtc->panningBorder[2]) {
+ c.v[0] = width - crtc->panningBorder[2] - 1;
+ panned = TRUE;
+ }
+ }
+ if (crtc->panningTotalArea.y2 > crtc->panningTotalArea.y1) {
+ if (c.v[1] < crtc->panningBorder[1]) {
+ c.v[1] = crtc->panningBorder[1];
+ panned = TRUE;
+ }
+ if (c.v[1] >= height - crtc->panningBorder[3]) {
+ c.v[1] = height - crtc->panningBorder[3] - 1;
+ panned = TRUE;
+ }
+ }
+ if (panned)
+ xf86ComputeCrtcPan (crtc->transform_in_use,
+ &crtc->f_framebuffer_to_crtc,
+ x, y, c.v[0], c.v[1],
+ newX, newY, &newX, &newY);
+ }
+
+ /*
+ * Ensure that the crtc is within the panning region.
+ *
+ * XXX This computation only works when we do not have a transform
+ * in use.
+ */
+ if (!crtc->transform_in_use)
+ {
+ /* Validate against [xy]1 after [xy]2, to be sure that results are > 0 for [xy]1 > 0 */
+ if (crtc->panningTotalArea.x2 > crtc->panningTotalArea.x1) {
+ if (newX > crtc->panningTotalArea.x2 - width)
+ newX = crtc->panningTotalArea.x2 - width;
+ if (newX < crtc->panningTotalArea.x1)
+ newX = crtc->panningTotalArea.x1;
+ }
+ if (crtc->panningTotalArea.y2 > crtc->panningTotalArea.y1) {
+ if (newY > crtc->panningTotalArea.y2 - height)
+ newY = crtc->panningTotalArea.y2 - height;
+ if (newY < crtc->panningTotalArea.y1)
+ newY = crtc->panningTotalArea.y1;
+ }
+ }
+ if (newX != crtc->x || newY != crtc->y)
+ xf86CrtcSetOrigin (crtc, newX, newY);
+}
+
+static Bool
+xf86RandR12GetInfo (ScreenPtr pScreen, Rotation *rotations)
+{
+ RRScreenSizePtr pSize;
+ ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ DisplayModePtr mode;
+ int refresh0 = 60;
+ int maxX = 0, maxY = 0;
+
+ *rotations = randrp->supported_rotations;
+
+ if (randrp->virtualX == -1 || randrp->virtualY == -1)
+ {
+ randrp->virtualX = scrp->virtualX;
+ randrp->virtualY = scrp->virtualY;
+ }
+
+ /* Re-probe the outputs for new monitors or modes */
+ if (scrp->vtSema)
+ {
+ xf86ProbeOutputModes (scrp, 0, 0);
+ xf86SetScrnInfoModes (scrp);
+ }
+
+ for (mode = scrp->modes; ; mode = mode->next)
+ {
+ int refresh = xf86RandR12ModeRefresh (mode);
+ if (randrp->maxX == 0 || randrp->maxY == 0)
+ {
+ if (maxX < mode->HDisplay)
+ maxX = mode->HDisplay;
+ if (maxY < mode->VDisplay)
+ maxY = mode->VDisplay;
+ }
+ if (mode == scrp->modes)
+ refresh0 = refresh;
+ pSize = RRRegisterSize (pScreen,
+ mode->HDisplay, mode->VDisplay,
+ randrp->mmWidth, randrp->mmHeight);
+ if (!pSize)
+ return FALSE;
+ RRRegisterRate (pScreen, pSize, refresh);
+
+ if (xf86ModesEqual(mode, scrp->currentMode))
+ {
+ RRSetCurrentConfig (pScreen, randrp->rotation, refresh, pSize);
+ }
+ if (mode->next == scrp->modes)
+ break;
+ }
+
+ if (randrp->maxX == 0 || randrp->maxY == 0)
+ {
+ randrp->maxX = maxX;
+ randrp->maxY = maxY;
+ }
+
+ return TRUE;
+}
+
+static Bool
+xf86RandR12SetMode (ScreenPtr pScreen,
+ DisplayModePtr mode,
+ Bool useVirtual,
+ int mmWidth,
+ int mmHeight)
+{
+ ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ int oldWidth = pScreen->width;
+ int oldHeight = pScreen->height;
+ int oldmmWidth = pScreen->mmWidth;
+ int oldmmHeight = pScreen->mmHeight;
+ WindowPtr pRoot = pScreen->root;
+ DisplayModePtr currentMode = NULL;
+ Bool ret = TRUE;
+
+ if (pRoot)
+ (*scrp->EnableDisableFBAccess) (pScreen->myNum, FALSE);
+ if (useVirtual)
+ {
+ scrp->virtualX = randrp->virtualX;
+ scrp->virtualY = randrp->virtualY;
+ }
+ else
+ {
+ scrp->virtualX = mode->HDisplay;
+ scrp->virtualY = mode->VDisplay;
+ }
+
+ if(randrp->rotation & (RR_Rotate_90 | RR_Rotate_270))
+ {
+ /* If the screen is rotated 90 or 270 degrees, swap the sizes. */
+ pScreen->width = scrp->virtualY;
+ pScreen->height = scrp->virtualX;
+ pScreen->mmWidth = mmHeight;
+ pScreen->mmHeight = mmWidth;
+ }
+ else
+ {
+ pScreen->width = scrp->virtualX;
+ pScreen->height = scrp->virtualY;
+ pScreen->mmWidth = mmWidth;
+ pScreen->mmHeight = mmHeight;
+ }
+ if (scrp->currentMode == mode) {
+ /* Save current mode */
+ currentMode = scrp->currentMode;
+ /* Reset, just so we ensure the drivers SwitchMode is called */
+ scrp->currentMode = NULL;
+ }
+ /*
+ * We know that if the driver failed to SwitchMode to the rotated
+ * version, then it should revert back to it's prior mode.
+ */
+ if (!xf86SwitchMode (pScreen, mode))
+ {
+ ret = FALSE;
+ scrp->virtualX = pScreen->width = oldWidth;
+ scrp->virtualY = pScreen->height = oldHeight;
+ pScreen->mmWidth = oldmmWidth;
+ pScreen->mmHeight = oldmmHeight;
+ scrp->currentMode = currentMode;
+ }
+
+ /*
+ * Make sure the layout is correct
+ */
+ xf86ReconfigureLayout();
+
+ /*
+ * Make sure the whole screen is visible
+ */
+ xf86SetViewport (pScreen, pScreen->width, pScreen->height);
+ xf86SetViewport (pScreen, 0, 0);
+ if (pRoot)
+ (*scrp->EnableDisableFBAccess) (pScreen->myNum, TRUE);
+ return ret;
+}
+
+Bool
+xf86RandR12SetConfig (ScreenPtr pScreen,
+ Rotation rotation,
+ int rate,
+ RRScreenSizePtr pSize)
+{
+ ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ DisplayModePtr mode;
+ int px, py;
+ Bool useVirtual = FALSE;
+ int maxX = 0, maxY = 0;
+ Rotation oldRotation = randrp->rotation;
+
+ randrp->rotation = rotation;
+
+ if (randrp->virtualX == -1 || randrp->virtualY == -1)
+ {
+ randrp->virtualX = scrp->virtualX;
+ randrp->virtualY = scrp->virtualY;
+ }
+
+ miPointerGetPosition (inputInfo.pointer, &px, &py);
+ for (mode = scrp->modes; ; mode = mode->next)
+ {
+ if (randrp->maxX == 0 || randrp->maxY == 0)
+ {
+ if (maxX < mode->HDisplay)
+ maxX = mode->HDisplay;
+ if (maxY < mode->VDisplay)
+ maxY = mode->VDisplay;
+ }
+ if (mode->HDisplay == pSize->width &&
+ mode->VDisplay == pSize->height &&
+ (rate == 0 || xf86RandR12ModeRefresh (mode) == rate))
+ break;
+ if (mode->next == scrp->modes)
+ {
+ if (pSize->width == randrp->virtualX &&
+ pSize->height == randrp->virtualY)
+ {
+ mode = scrp->modes;
+ useVirtual = TRUE;
+ break;
+ }
+ if (randrp->maxX == 0 || randrp->maxY == 0)
+ {
+ randrp->maxX = maxX;
+ randrp->maxY = maxY;
+ }
+ return FALSE;
+ }
+ }
+
+ if (randrp->maxX == 0 || randrp->maxY == 0)
+ {
+ randrp->maxX = maxX;
+ randrp->maxY = maxY;
+ }
+
+ if (!xf86RandR12SetMode (pScreen, mode, useVirtual, pSize->mmWidth,
+ pSize->mmHeight)) {
+ randrp->rotation = oldRotation;
+ return FALSE;
+ }
+
+ /*
+ * Move the cursor back where it belongs; SwitchMode repositions it
+ */
+ if (pScreen == miPointerGetScreen(inputInfo.pointer))
+ {
+ px = (px >= pScreen->width ? (pScreen->width - 1) : px);
+ py = (py >= pScreen->height ? (pScreen->height - 1) : py);
+
+ xf86SetViewport(pScreen, px, py);
+
+ (*pScreen->SetCursorPosition) (inputInfo.pointer, pScreen, px, py, FALSE);
+ }
+
+ return TRUE;
+}
+
+static Bool
+xf86RandR12ScreenSetSize (ScreenPtr pScreen,
+ CARD16 width,
+ CARD16 height,
+ CARD32 mmWidth,
+ CARD32 mmHeight)
+{
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ WindowPtr pRoot = pScreen->root;
+ PixmapPtr pScrnPix;
+ Bool ret = FALSE;
+ int c;
+
+ if (xf86RandR12Key) {
+ if (randrp->virtualX == -1 || randrp->virtualY == -1)
+ {
+ randrp->virtualX = pScrn->virtualX;
+ randrp->virtualY = pScrn->virtualY;
+ }
+ }
+ if (pRoot && pScrn->vtSema)
+ (*pScrn->EnableDisableFBAccess) (pScreen->myNum, FALSE);
+
+ /* Let the driver update virtualX and virtualY */
+ if (!(*config->funcs->resize)(pScrn, width, height))
+ goto finish;
+
+ ret = TRUE;
+ /* Update panning information */
+ for (c = 0; c < config->num_crtc; c++) {
+ xf86CrtcPtr crtc = config->crtc[c];
+ if (crtc->panningTotalArea.x2 > crtc->panningTotalArea.x1 ||
+ crtc->panningTotalArea.y2 > crtc->panningTotalArea.y1) {
+ if (crtc->panningTotalArea.x2 > crtc->panningTrackingArea.x1)
+ crtc->panningTotalArea.x2 += width - pScreen->width;
+ if (crtc->panningTotalArea.y2 > crtc->panningTrackingArea.y1)
+ crtc->panningTotalArea.y2 += height - pScreen->height;
+ if (crtc->panningTrackingArea.x2 > crtc->panningTrackingArea.x1)
+ crtc->panningTrackingArea.x2 += width - pScreen->width;
+ if (crtc->panningTrackingArea.y2 > crtc->panningTrackingArea.y1)
+ crtc->panningTrackingArea.y2 += height - pScreen->height;
+ xf86RandR13VerifyPanningArea (crtc, width, height);
+ xf86RandR13Pan (crtc, randrp->pointerX, randrp->pointerY);
+ }
+ }
+
+ pScrnPix = (*pScreen->GetScreenPixmap)(pScreen);
+ pScreen->width = pScrnPix->drawable.width = width;
+ pScreen->height = pScrnPix->drawable.height = height;
+ randrp->mmWidth = pScreen->mmWidth = mmWidth;
+ randrp->mmHeight = pScreen->mmHeight = mmHeight;
+
+ xf86SetViewport (pScreen, pScreen->width-1, pScreen->height-1);
+ xf86SetViewport (pScreen, 0, 0);
+
+finish:
+ if (pRoot && pScrn->vtSema)
+ (*pScrn->EnableDisableFBAccess) (pScreen->myNum, TRUE);
+#if RANDR_12_INTERFACE
+ if (xf86RandR12Key && pScreen->root && ret)
+ RRScreenSizeNotify (pScreen);
+#endif
+ return ret;
+}
+
+Rotation
+xf86RandR12GetRotation(ScreenPtr pScreen)
+{
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+
+ return randrp->rotation;
+}
+
+Bool
+xf86RandR12CreateScreenResources (ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr config;
+ XF86RandRInfoPtr randrp;
+ int c;
+ int width, height;
+ int mmWidth, mmHeight;
+#ifdef PANORAMIX
+ /* XXX disable RandR when using Xinerama */
+ if (!noPanoramiXExtension)
+ return TRUE;
+#endif
+
+ config = XF86_CRTC_CONFIG_PTR(pScrn);
+ randrp = XF86RANDRINFO(pScreen);
+ /*
+ * Compute size of screen
+ */
+ width = 0; height = 0;
+ for (c = 0; c < config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = config->crtc[c];
+ int crtc_width = crtc->x + xf86ModeWidth (&crtc->mode, crtc->rotation);
+ int crtc_height = crtc->y + xf86ModeHeight (&crtc->mode, crtc->rotation);
+
+ if (crtc->enabled) {
+ if (crtc_width > width)
+ width = crtc_width;
+ if (crtc_height > height)
+ height = crtc_height;
+ if (crtc->panningTotalArea.x2 > width)
+ width = crtc->panningTotalArea.x2;
+ if (crtc->panningTotalArea.y2 > height)
+ height = crtc->panningTotalArea.y2;
+ }
+ }
+
+ if (width && height)
+ {
+ /*
+ * Compute physical size of screen
+ */
+ if (monitorResolution)
+ {
+ mmWidth = width * 25.4 / monitorResolution;
+ mmHeight = height * 25.4 / monitorResolution;
+ }
+ else
+ {
+ xf86OutputPtr output = xf86CompatOutput(pScrn);
+
+ if (output &&
+ output->conf_monitor &&
+ (output->conf_monitor->mon_width > 0 &&
+ output->conf_monitor->mon_height > 0))
+ {
+ /*
+ * Prefer user configured DisplaySize
+ */
+ mmWidth = output->conf_monitor->mon_width;
+ mmHeight = output->conf_monitor->mon_height;
+ }
+ else
+ {
+ /*
+ * Otherwise, just set the screen to DEFAULT_DPI
+ */
+ mmWidth = width * 25.4 / DEFAULT_DPI;
+ mmHeight = height * 25.4 / DEFAULT_DPI;
+ }
+ }
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Setting screen physical size to %d x %d\n",
+ mmWidth, mmHeight);
+ /*
+ * This is the initial setting of the screen size.
+ * We have to pre-set it here, otherwise panning would be adapted
+ * to the new screen size.
+ */
+ pScreen->width = width;
+ pScreen->height = height;
+ xf86RandR12ScreenSetSize (pScreen,
+ width,
+ height,
+ mmWidth,
+ mmHeight);
+ }
+
+ if (xf86RandR12Key == NULL)
+ return TRUE;
+
+ if (randrp->virtualX == -1 || randrp->virtualY == -1)
+ {
+ randrp->virtualX = pScrn->virtualX;
+ randrp->virtualY = pScrn->virtualY;
+ }
+ xf86CrtcSetScreenSubpixelOrder (pScreen);
+#if RANDR_12_INTERFACE
+ if (xf86RandR12CreateScreenResources12 (pScreen))
+ return TRUE;
+#endif
+ return TRUE;
+}
+
+
+Bool
+xf86RandR12Init (ScreenPtr pScreen)
+{
+ rrScrPrivPtr rp;
+ XF86RandRInfoPtr randrp;
+
+#ifdef PANORAMIX
+ /* XXX disable RandR when using Xinerama */
+ if (!noPanoramiXExtension)
+ {
+ if (xf86NumScreens == 1)
+ noPanoramiXExtension = TRUE;
+ else
+ return TRUE;
+ }
+#endif
+
+ if (xf86RandR12Generation != serverGeneration)
+ xf86RandR12Generation = serverGeneration;
+
+ xf86RandR12Key = &xf86RandR12KeyRec;
+ if (!dixRegisterPrivateKey(&xf86RandR12KeyRec, PRIVATE_SCREEN, 0))
+ return FALSE;
+
+ randrp = malloc(sizeof (XF86RandRInfoRec));
+ if (!randrp)
+ return FALSE;
+
+ if (!RRScreenInit(pScreen))
+ {
+ free(randrp);
+ return FALSE;
+ }
+ rp = rrGetScrPriv(pScreen);
+ rp->rrGetInfo = xf86RandR12GetInfo;
+ rp->rrSetConfig = xf86RandR12SetConfig;
+
+ randrp->virtualX = -1;
+ randrp->virtualY = -1;
+ randrp->mmWidth = pScreen->mmWidth;
+ randrp->mmHeight = pScreen->mmHeight;
+
+ randrp->rotation = RR_Rotate_0; /* initial rotated mode */
+
+ randrp->supported_rotations = RR_Rotate_0;
+
+ randrp->maxX = randrp->maxY = 0;
+
+ dixSetPrivate(&pScreen->devPrivates, xf86RandR12Key, randrp);
+
+#if RANDR_12_INTERFACE
+ if (!xf86RandR12Init12 (pScreen))
+ return FALSE;
+#endif
+ return TRUE;
+}
+
+void
+xf86RandR12CloseScreen (ScreenPtr pScreen)
+{
+ XF86RandRInfoPtr randrp;
+
+ if (xf86RandR12Key == NULL)
+ return;
+
+ randrp = XF86RANDRINFO(pScreen);
+#if RANDR_12_INTERFACE
+ xf86Screens[pScreen->myNum]->EnterVT = randrp->orig_EnterVT;
+#endif
+
+ free(randrp);
+}
+
+void
+xf86RandR12SetRotations (ScreenPtr pScreen, Rotation rotations)
+{
+ XF86RandRInfoPtr randrp;
+#if RANDR_12_INTERFACE
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ int c;
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+#endif
+
+ if (xf86RandR12Key == NULL)
+ return;
+
+ randrp = XF86RANDRINFO(pScreen);
+#if RANDR_12_INTERFACE
+ for (c = 0; c < config->num_crtc; c++) {
+ xf86CrtcPtr crtc = config->crtc[c];
+
+ RRCrtcSetRotations (crtc->randr_crtc, rotations);
+ }
+#endif
+ randrp->supported_rotations = rotations;
+}
+
+void
+xf86RandR12SetTransformSupport (ScreenPtr pScreen, Bool transforms)
+{
+ XF86RandRInfoPtr randrp;
+#if RANDR_13_INTERFACE
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ int c;
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+#endif
+
+ if (xf86RandR12Key == NULL)
+ return;
+
+ randrp = XF86RANDRINFO(pScreen);
+#if RANDR_13_INTERFACE
+ for (c = 0; c < config->num_crtc; c++) {
+ xf86CrtcPtr crtc = config->crtc[c];
+
+ RRCrtcSetTransformSupport (crtc->randr_crtc, transforms);
+ }
+#endif
+}
+
+void
+xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr pScrn, int *x, int *y)
+{
+ ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
+
+ if (xf86RandR12Generation != serverGeneration ||
+ XF86RANDRINFO(pScreen)->virtualX == -1)
+ {
+ *x = pScrn->virtualX;
+ *y = pScrn->virtualY;
+ } else {
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+
+ *x = randrp->virtualX;
+ *y = randrp->virtualY;
+ }
+}
+
+#if RANDR_12_INTERFACE
+
+#define FLAG_BITS (RR_HSyncPositive | \
+ RR_HSyncNegative | \
+ RR_VSyncPositive | \
+ RR_VSyncNegative | \
+ RR_Interlace | \
+ RR_DoubleScan | \
+ RR_CSync | \
+ RR_CSyncPositive | \
+ RR_CSyncNegative | \
+ RR_HSkewPresent | \
+ RR_BCast | \
+ RR_PixelMultiplex | \
+ RR_DoubleClock | \
+ RR_ClockDivideBy2)
+
+static Bool
+xf86RandRModeMatches (RRModePtr randr_mode,
+ DisplayModePtr mode)
+{
+#if 0
+ if (match_name)
+ {
+ /* check for same name */
+ int len = strlen (mode->name);
+ if (randr_mode->mode.nameLength != len) return FALSE;
+ if (memcmp (randr_mode->name, mode->name, len) != 0) return FALSE;
+ }
+#endif
+
+ /* check for same timings */
+ if (randr_mode->mode.dotClock / 1000 != mode->Clock) return FALSE;
+ if (randr_mode->mode.width != mode->HDisplay) return FALSE;
+ if (randr_mode->mode.hSyncStart != mode->HSyncStart) return FALSE;
+ if (randr_mode->mode.hSyncEnd != mode->HSyncEnd) return FALSE;
+ if (randr_mode->mode.hTotal != mode->HTotal) return FALSE;
+ if (randr_mode->mode.hSkew != mode->HSkew) return FALSE;
+ if (randr_mode->mode.height != mode->VDisplay) return FALSE;
+ if (randr_mode->mode.vSyncStart != mode->VSyncStart) return FALSE;
+ if (randr_mode->mode.vSyncEnd != mode->VSyncEnd) return FALSE;
+ if (randr_mode->mode.vTotal != mode->VTotal) return FALSE;
+
+ /* check for same flags (using only the XF86 valid flag bits) */
+ if ((randr_mode->mode.modeFlags & FLAG_BITS) != (mode->Flags & FLAG_BITS))
+ return FALSE;
+
+ /* everything matches */
+ return TRUE;
+}
+
+static Bool
+xf86RandR12CrtcNotify (RRCrtcPtr randr_crtc)
+{
+ ScreenPtr pScreen = randr_crtc->pScreen;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ RRModePtr randr_mode = NULL;
+ int x;
+ int y;
+ Rotation rotation;
+ int numOutputs;
+ RROutputPtr *randr_outputs;
+ RROutputPtr randr_output;
+ xf86CrtcPtr crtc = randr_crtc->devPrivate;
+ xf86OutputPtr output;
+ int i, j;
+ DisplayModePtr mode = &crtc->mode;
+ Bool ret;
+
+ randr_outputs = malloc(config->num_output * sizeof (RROutputPtr));
+ if (!randr_outputs)
+ return FALSE;
+ x = crtc->x;
+ y = crtc->y;
+ rotation = crtc->rotation;
+ numOutputs = 0;
+ randr_mode = NULL;
+ for (i = 0; i < config->num_output; i++)
+ {
+ output = config->output[i];
+ if (output->crtc == crtc)
+ {
+ randr_output = output->randr_output;
+ randr_outputs[numOutputs++] = randr_output;
+ /*
+ * We make copies of modes, so pointer equality
+ * isn't sufficient
+ */
+ for (j = 0; j < randr_output->numModes + randr_output->numUserModes; j++)
+ {
+ RRModePtr m = (j < randr_output->numModes ?
+ randr_output->modes[j] :
+ randr_output->userModes[j-randr_output->numModes]);
+
+ if (xf86RandRModeMatches (m, mode))
+ {
+ randr_mode = m;
+ break;
+ }
+ }
+ }
+ }
+ ret = RRCrtcNotify (randr_crtc, randr_mode, x, y,
+ rotation,
+ crtc->transformPresent ? &crtc->transform : NULL,
+ numOutputs, randr_outputs);
+ free(randr_outputs);
+ return ret;
+}
+
+/*
+ * Convert a RandR mode to a DisplayMode
+ */
+static void
+xf86RandRModeConvert (ScrnInfoPtr scrn,
+ RRModePtr randr_mode,
+ DisplayModePtr mode)
+{
+ memset(mode, 0, sizeof(DisplayModeRec));
+ mode->status = MODE_OK;
+
+ mode->Clock = randr_mode->mode.dotClock / 1000;
+
+ mode->HDisplay = randr_mode->mode.width;
+ mode->HSyncStart = randr_mode->mode.hSyncStart;
+ mode->HSyncEnd = randr_mode->mode.hSyncEnd;
+ mode->HTotal = randr_mode->mode.hTotal;
+ mode->HSkew = randr_mode->mode.hSkew;
+
+ mode->VDisplay = randr_mode->mode.height;
+ mode->VSyncStart = randr_mode->mode.vSyncStart;
+ mode->VSyncEnd = randr_mode->mode.vSyncEnd;
+ mode->VTotal = randr_mode->mode.vTotal;
+ mode->VScan = 0;
+
+ mode->Flags = randr_mode->mode.modeFlags & FLAG_BITS;
+
+ xf86SetModeCrtc (mode, scrn->adjustFlags);
+}
+
+static Bool
+xf86RandR12CrtcSet (ScreenPtr pScreen,
+ RRCrtcPtr randr_crtc,
+ RRModePtr randr_mode,
+ int x,
+ int y,
+ Rotation rotation,
+ int num_randr_outputs,
+ RROutputPtr *randr_outputs)
+{
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ xf86CrtcPtr crtc = randr_crtc->devPrivate;
+ RRTransformPtr transform;
+ Bool changed = FALSE;
+ int o, ro;
+ xf86CrtcPtr *save_crtcs;
+ Bool save_enabled = crtc->enabled;
+
+ if (!crtc->scrn->vtSema)
+ return FALSE;
+
+ save_crtcs = malloc(config->num_output * sizeof (xf86CrtcPtr));
+ if ((randr_mode != NULL) != crtc->enabled)
+ changed = TRUE;
+ else if (randr_mode && !xf86RandRModeMatches (randr_mode, &crtc->mode))
+ changed = TRUE;
+
+ if (rotation != crtc->rotation)
+ changed = TRUE;
+
+ transform = RRCrtcGetTransform (randr_crtc);
+ if ((transform != NULL) != crtc->transformPresent)
+ changed = TRUE;
+ else if (transform && memcmp (&transform->transform, &crtc->transform.transform,
+ sizeof (transform->transform)) != 0)
+ changed = TRUE;
+
+ if (x != crtc->x || y != crtc->y)
+ changed = TRUE;
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+ xf86CrtcPtr new_crtc;
+
+ save_crtcs[o] = output->crtc;
+
+ if (output->crtc == crtc)
+ new_crtc = NULL;
+ else
+ new_crtc = output->crtc;
+ for (ro = 0; ro < num_randr_outputs; ro++)
+ if (output->randr_output == randr_outputs[ro])
+ {
+ new_crtc = crtc;
+ break;
+ }
+ if (new_crtc != output->crtc)
+ {
+ changed = TRUE;
+ output->crtc = new_crtc;
+ }
+ }
+ for (ro = 0; ro < num_randr_outputs; ro++)
+ if (randr_outputs[ro]->pendingProperties)
+ changed = TRUE;
+
+ /* XXX need device-independent mode setting code through an API */
+ if (changed)
+ {
+ crtc->enabled = randr_mode != NULL;
+
+ if (randr_mode)
+ {
+ DisplayModeRec mode;
+ RRTransformPtr transform = RRCrtcGetTransform (randr_crtc);
+
+ xf86RandRModeConvert (pScrn, randr_mode, &mode);
+ if (!xf86CrtcSetModeTransform (crtc, &mode, rotation, transform, x, y))
+ {
+ crtc->enabled = save_enabled;
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+ output->crtc = save_crtcs[o];
+ }
+ free(save_crtcs);
+ return FALSE;
+ }
+ xf86RandR13VerifyPanningArea (crtc, pScreen->width, pScreen->height);
+ xf86RandR13Pan (crtc, randrp->pointerX, randrp->pointerY);
+ /*
+ * Save the last successful setting for EnterVT
+ */
+ crtc->desiredMode = mode;
+ crtc->desiredRotation = rotation;
+ if (transform) {
+ crtc->desiredTransform = *transform;
+ crtc->desiredTransformPresent = TRUE;
+ } else
+ crtc->desiredTransformPresent = FALSE;
+
+ crtc->desiredX = x;
+ crtc->desiredY = y;
+ }
+ xf86DisableUnusedFunctions (pScrn);
+ }
+ free(save_crtcs);
+ return xf86RandR12CrtcNotify (randr_crtc);
+}
+
+static Bool
+xf86RandR12CrtcSetGamma (ScreenPtr pScreen,
+ RRCrtcPtr randr_crtc)
+{
+ xf86CrtcPtr crtc = randr_crtc->devPrivate;
+
+ if (crtc->funcs->gamma_set == NULL)
+ return FALSE;
+
+ if (!crtc->scrn->vtSema)
+ return TRUE;
+
+ /* Realloc local gamma if needed. */
+ if (randr_crtc->gammaSize != crtc->gamma_size) {
+ CARD16 *tmp_ptr;
+ tmp_ptr = realloc(crtc->gamma_red, 3 * crtc->gamma_size * sizeof (CARD16));
+ if (!tmp_ptr)
+ return FALSE;
+ crtc->gamma_red = tmp_ptr;
+ crtc->gamma_green = crtc->gamma_red + crtc->gamma_size;
+ crtc->gamma_blue = crtc->gamma_green + crtc->gamma_size;
+ }
+
+ crtc->gamma_size = randr_crtc->gammaSize;
+ memcpy (crtc->gamma_red, randr_crtc->gammaRed, crtc->gamma_size * sizeof (CARD16));
+ memcpy (crtc->gamma_green, randr_crtc->gammaGreen, crtc->gamma_size * sizeof (CARD16));
+ memcpy (crtc->gamma_blue, randr_crtc->gammaBlue, crtc->gamma_size * sizeof (CARD16));
+
+ /* Only set it when the crtc is actually running.
+ * Otherwise it will be set when it's activated.
+ */
+ if (crtc->active)
+ crtc->funcs->gamma_set(crtc, crtc->gamma_red, crtc->gamma_green,
+ crtc->gamma_blue, crtc->gamma_size);
+
+ return TRUE;
+}
+
+static Bool
+xf86RandR12CrtcGetGamma (ScreenPtr pScreen,
+ RRCrtcPtr randr_crtc)
+{
+ xf86CrtcPtr crtc = randr_crtc->devPrivate;
+
+ if (!crtc->gamma_size)
+ return FALSE;
+
+ if (!crtc->gamma_red || !crtc->gamma_green || !crtc->gamma_blue)
+ return FALSE;
+
+ /* Realloc randr gamma if needed. */
+ if (randr_crtc->gammaSize != crtc->gamma_size) {
+ CARD16 *tmp_ptr;
+ tmp_ptr = realloc(randr_crtc->gammaRed, 3 * crtc->gamma_size * sizeof (CARD16));
+ if (!tmp_ptr)
+ return FALSE;
+ randr_crtc->gammaRed = tmp_ptr;
+ randr_crtc->gammaGreen = randr_crtc->gammaRed + crtc->gamma_size;
+ randr_crtc->gammaBlue = randr_crtc->gammaGreen + crtc->gamma_size;
+ }
+ randr_crtc->gammaSize = crtc->gamma_size;
+ memcpy (randr_crtc->gammaRed, crtc->gamma_red, crtc->gamma_size * sizeof (CARD16));
+ memcpy (randr_crtc->gammaGreen, crtc->gamma_green, crtc->gamma_size * sizeof (CARD16));
+ memcpy (randr_crtc->gammaBlue, crtc->gamma_blue, crtc->gamma_size * sizeof (CARD16));
+
+ return TRUE;
+}
+
+static Bool
+xf86RandR12OutputSetProperty (ScreenPtr pScreen,
+ RROutputPtr randr_output,
+ Atom property,
+ RRPropertyValuePtr value)
+{
+ xf86OutputPtr output = randr_output->devPrivate;
+
+ /* If we don't have any property handler, then we don't care what the
+ * user is setting properties to.
+ */
+ if (output->funcs->set_property == NULL)
+ return TRUE;
+
+ /*
+ * This function gets called even when vtSema is FALSE, as
+ * drivers will need to remember the correct value to apply
+ * when the VT switch occurs
+ */
+ return output->funcs->set_property(output, property, value);
+}
+
+static Bool
+xf86RandR13OutputGetProperty (ScreenPtr pScreen,
+ RROutputPtr randr_output,
+ Atom property)
+{
+ xf86OutputPtr output = randr_output->devPrivate;
+
+ if (output->funcs->get_property == NULL)
+ return TRUE;
+
+ /* Should be safe even w/o vtSema */
+ return output->funcs->get_property(output, property);
+}
+
+static Bool
+xf86RandR12OutputValidateMode (ScreenPtr pScreen,
+ RROutputPtr randr_output,
+ RRModePtr randr_mode)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86OutputPtr output = randr_output->devPrivate;
+ DisplayModeRec mode;
+
+ xf86RandRModeConvert (pScrn, randr_mode, &mode);
+ /*
+ * This function may be called when vtSema is FALSE, so
+ * the underlying function must either avoid touching the hardware
+ * or return FALSE when vtSema is FALSE
+ */
+ if (output->funcs->mode_valid (output, &mode) != MODE_OK)
+ return FALSE;
+ return TRUE;
+}
+
+static void
+xf86RandR12ModeDestroy (ScreenPtr pScreen, RRModePtr randr_mode)
+{
+}
+
+/**
+ * Given a list of xf86 modes and a RandR Output object, construct
+ * RandR modes and assign them to the output
+ */
+static Bool
+xf86RROutputSetModes (RROutputPtr randr_output, DisplayModePtr modes)
+{
+ DisplayModePtr mode;
+ RRModePtr *rrmodes = NULL;
+ int nmode = 0;
+ int npreferred = 0;
+ Bool ret = TRUE;
+ int pref;
+
+ for (mode = modes; mode; mode = mode->next)
+ nmode++;
+
+ if (nmode) {
+ rrmodes = malloc(nmode * sizeof (RRModePtr));
+
+ if (!rrmodes)
+ return FALSE;
+ nmode = 0;
+
+ for (pref = 1; pref >= 0; pref--) {
+ for (mode = modes; mode; mode = mode->next) {
+ if ((pref != 0) == ((mode->type & M_T_PREFERRED) != 0)) {
+ xRRModeInfo modeInfo;
+ RRModePtr rrmode;
+
+ modeInfo.nameLength = strlen (mode->name);
+ modeInfo.width = mode->HDisplay;
+ modeInfo.dotClock = mode->Clock * 1000;
+ modeInfo.hSyncStart = mode->HSyncStart;
+ modeInfo.hSyncEnd = mode->HSyncEnd;
+ modeInfo.hTotal = mode->HTotal;
+ modeInfo.hSkew = mode->HSkew;
+
+ modeInfo.height = mode->VDisplay;
+ modeInfo.vSyncStart = mode->VSyncStart;
+ modeInfo.vSyncEnd = mode->VSyncEnd;
+ modeInfo.vTotal = mode->VTotal;
+ modeInfo.modeFlags = mode->Flags;
+
+ rrmode = RRModeGet (&modeInfo, mode->name);
+ if (rrmode) {
+ rrmodes[nmode++] = rrmode;
+ npreferred += pref;
+ }
+ }
+ }
+ }
+ }
+
+ ret = RROutputSetModes (randr_output, rrmodes, nmode, npreferred);
+ free(rrmodes);
+ return ret;
+}
+
+/*
+ * Mirror the current mode configuration to RandR
+ */
+static Bool
+xf86RandR12SetInfo12 (ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ RROutputPtr *clones;
+ RRCrtcPtr *crtcs;
+ int ncrtc;
+ int o, c, l;
+ RRCrtcPtr randr_crtc;
+ int nclone;
+
+ clones = malloc(config->num_output * sizeof (RROutputPtr));
+ crtcs = malloc(config->num_crtc * sizeof (RRCrtcPtr));
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+
+ ncrtc = 0;
+ for (c = 0; c < config->num_crtc; c++)
+ if (output->possible_crtcs & (1 << c))
+ crtcs[ncrtc++] = config->crtc[c]->randr_crtc;
+
+ if (output->crtc)
+ randr_crtc = output->crtc->randr_crtc;
+ else
+ randr_crtc = NULL;
+
+ if (!RROutputSetCrtcs (output->randr_output, crtcs, ncrtc))
+ {
+ free(crtcs);
+ free(clones);
+ return FALSE;
+ }
+
+ RROutputSetPhysicalSize(output->randr_output,
+ output->mm_width,
+ output->mm_height);
+ xf86RROutputSetModes (output->randr_output, output->probed_modes);
+
+ switch (output->status) {
+ case XF86OutputStatusConnected:
+ RROutputSetConnection (output->randr_output, RR_Connected);
+ break;
+ case XF86OutputStatusDisconnected:
+ RROutputSetConnection (output->randr_output, RR_Disconnected);
+ break;
+ case XF86OutputStatusUnknown:
+ RROutputSetConnection (output->randr_output, RR_UnknownConnection);
+ break;
+ }
+
+ RROutputSetSubpixelOrder (output->randr_output, output->subpixel_order);
+
+ /*
+ * Valid clones
+ */
+ nclone = 0;
+ for (l = 0; l < config->num_output; l++)
+ {
+ xf86OutputPtr clone = config->output[l];
+
+ if (l != o && (output->possible_clones & (1 << l)))
+ clones[nclone++] = clone->randr_output;
+ }
+ if (!RROutputSetClones (output->randr_output, clones, nclone))
+ {
+ free(crtcs);
+ free(clones);
+ return FALSE;
+ }
+ }
+ free(crtcs);
+ free(clones);
+ return TRUE;
+}
+
+
+
+/*
+ * Query the hardware for the current state, then mirror
+ * that to RandR
+ */
+static Bool
+xf86RandR12GetInfo12 (ScreenPtr pScreen, Rotation *rotations)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+
+ if (!pScrn->vtSema)
+ return TRUE;
+ xf86ProbeOutputModes (pScrn, 0, 0);
+ xf86SetScrnInfoModes (pScrn);
+ return xf86RandR12SetInfo12 (pScreen);
+}
+
+static Bool
+xf86RandR12CreateObjects12 (ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int c;
+ int o;
+
+ if (!RRInit ())
+ return FALSE;
+
+ /*
+ * Configure crtcs
+ */
+ for (c = 0; c < config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = config->crtc[c];
+
+ crtc->randr_crtc = RRCrtcCreate (pScreen, crtc);
+ RRCrtcGammaSetSize (crtc->randr_crtc, 256);
+ }
+ /*
+ * Configure outputs
+ */
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+
+ output->randr_output = RROutputCreate (pScreen, output->name,
+ strlen (output->name),
+ output);
+
+ if (output->funcs->create_resources != NULL)
+ output->funcs->create_resources(output);
+ RRPostPendingProperties (output->randr_output);
+ }
+ return TRUE;
+}
+
+static Bool
+xf86RandR12CreateScreenResources12 (ScreenPtr pScreen)
+{
+ int c;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+
+ if (xf86RandR12Key == NULL)
+ return TRUE;
+
+ for (c = 0; c < config->num_crtc; c++)
+ xf86RandR12CrtcNotify (config->crtc[c]->randr_crtc);
+
+ RRScreenSetSizeRange (pScreen, config->minWidth, config->minHeight,
+ config->maxWidth, config->maxHeight);
+ return TRUE;
+}
+
+/*
+ * Something happened within the screen configuration due
+ * to DGA, VidMode or hot key. Tell RandR
+ */
+
+void
+xf86RandR12TellChanged (ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int c;
+
+ if (xf86RandR12Key == NULL)
+ return;
+
+ xf86RandR12SetInfo12 (pScreen);
+ for (c = 0; c < config->num_crtc; c++)
+ xf86RandR12CrtcNotify (config->crtc[c]->randr_crtc);
+
+ RRTellChanged (pScreen);
+}
+
+static void
+xf86RandR12PointerMoved (int scrnIndex, int x, int y)
+{
+ ScreenPtr pScreen = screenInfo.screens[scrnIndex];
+ ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ int c;
+
+ randrp->pointerX = x;
+ randrp->pointerY = y;
+ for (c = 0; c < config->num_crtc; c++)
+ xf86RandR13Pan (config->crtc[c], x, y);
+}
+
+static Bool
+xf86RandR13GetPanning (ScreenPtr pScreen,
+ RRCrtcPtr randr_crtc,
+ BoxPtr totalArea,
+ BoxPtr trackingArea,
+ INT16 *border)
+{
+ xf86CrtcPtr crtc = randr_crtc->devPrivate;
+
+ if (crtc->version < 2)
+ return FALSE;
+ if (totalArea)
+ memcpy (totalArea, &crtc->panningTotalArea, sizeof(BoxRec));
+ if (trackingArea)
+ memcpy (trackingArea, &crtc->panningTrackingArea, sizeof(BoxRec));
+ if (border)
+ memcpy (border, crtc->panningBorder, 4*sizeof(INT16));
+
+ return TRUE;
+}
+
+static Bool
+xf86RandR13SetPanning (ScreenPtr pScreen,
+ RRCrtcPtr randr_crtc,
+ BoxPtr totalArea,
+ BoxPtr trackingArea,
+ INT16 *border)
+{
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ xf86CrtcPtr crtc = randr_crtc->devPrivate;
+ BoxRec oldTotalArea;
+ BoxRec oldTrackingArea;
+ INT16 oldBorder[4];
+
+
+ if (crtc->version < 2)
+ return FALSE;
+
+ memcpy (&oldTotalArea, &crtc->panningTotalArea, sizeof(BoxRec));
+ memcpy (&oldTrackingArea, &crtc->panningTrackingArea, sizeof(BoxRec));
+ memcpy (oldBorder, crtc->panningBorder, 4*sizeof(INT16));
+
+ if (totalArea)
+ memcpy (&crtc->panningTotalArea, totalArea, sizeof(BoxRec));
+ if (trackingArea)
+ memcpy (&crtc->panningTrackingArea, trackingArea, sizeof(BoxRec));
+ if (border)
+ memcpy (crtc->panningBorder, border, 4*sizeof(INT16));
+
+ if (xf86RandR13VerifyPanningArea (crtc, pScreen->width, pScreen->height)) {
+ xf86RandR13Pan (crtc, randrp->pointerX, randrp->pointerY);
+ return TRUE;
+ } else {
+ /* Restore old settings */
+ memcpy (&crtc->panningTotalArea, &oldTotalArea, sizeof(BoxRec));
+ memcpy (&crtc->panningTrackingArea, &oldTrackingArea, sizeof(BoxRec));
+ memcpy (crtc->panningBorder, oldBorder, 4*sizeof(INT16));
+ return FALSE;
+ }
+}
+
+/*
+ * Compatibility with XF86VidMode's gamma changer. This necessarily clobbers
+ * any per-crtc setup. You asked for it...
+ */
+
+static void
+gamma_to_ramp(float gamma, CARD16 *ramp, int size)
+{
+ int i;
+
+ for (i = 0; i < size; i++) {
+ if (gamma == 1.0)
+ ramp[i] = i << 8;
+ else
+ ramp[i] = (CARD16)(pow((double)i / (double)(size - 1), 1. / gamma)
+ * (double)(size - 1) * 256);
+ }
+}
+
+static int
+xf86RandR12ChangeGamma(int scrnIndex, Gamma gamma)
+{
+ CARD16 *points, *red, *green, *blue;
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ RRCrtcPtr crtc = xf86CompatRRCrtc(pScrn);
+ int size;
+
+ if (!crtc)
+ return Success;
+
+ size = max(0, crtc->gammaSize);
+ if (!size)
+ return Success;
+
+ points = calloc(size, 3 * sizeof(CARD16));
+ if (!points)
+ return BadAlloc;
+
+ red = points;
+ green = points + size;
+ blue = points + 2 * size;
+
+ gamma_to_ramp(gamma.red, red, size);
+ gamma_to_ramp(gamma.green, green, size);
+ gamma_to_ramp(gamma.blue, blue, size);
+ RRCrtcGammaSet(crtc, red, green, blue);
+
+ free(points);
+
+ pScrn->gamma = gamma;
+
+ return Success;
+}
+
+static Bool
+xf86RandR12EnterVT (int screen_index, int flags)
+{
+ ScreenPtr pScreen = screenInfo.screens[screen_index];
+ ScrnInfoPtr pScrn = xf86Screens[screen_index];
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ rrScrPrivPtr rp = rrGetScrPriv(pScreen);
+ Bool ret;
+
+ if (randrp->orig_EnterVT) {
+ pScrn->EnterVT = randrp->orig_EnterVT;
+ ret = pScrn->EnterVT (screen_index, flags);
+ randrp->orig_EnterVT = pScrn->EnterVT;
+ pScrn->EnterVT = xf86RandR12EnterVT;
+ if (!ret)
+ return FALSE;
+ }
+
+ /* reload gamma */
+ int i;
+ for (i = 0; i < rp->numCrtcs; i++)
+ xf86RandR12CrtcSetGamma(pScreen, rp->crtcs[i]);
+
+ return RRGetInfo (pScreen, TRUE); /* force a re-probe of outputs and notify clients about changes */
+}
+
+static Bool
+xf86RandR12Init12 (ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ rrScrPrivPtr rp = rrGetScrPriv(pScreen);
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ int i;
+
+ rp->rrGetInfo = xf86RandR12GetInfo12;
+ rp->rrScreenSetSize = xf86RandR12ScreenSetSize;
+ rp->rrCrtcSet = xf86RandR12CrtcSet;
+ rp->rrCrtcSetGamma = xf86RandR12CrtcSetGamma;
+ rp->rrCrtcGetGamma = xf86RandR12CrtcGetGamma;
+ rp->rrOutputSetProperty = xf86RandR12OutputSetProperty;
+ rp->rrOutputValidateMode = xf86RandR12OutputValidateMode;
+#if RANDR_13_INTERFACE
+ rp->rrOutputGetProperty = xf86RandR13OutputGetProperty;
+ rp->rrGetPanning = xf86RandR13GetPanning;
+ rp->rrSetPanning = xf86RandR13SetPanning;
+#endif
+ rp->rrModeDestroy = xf86RandR12ModeDestroy;
+ rp->rrSetConfig = NULL;
+ pScrn->PointerMoved = xf86RandR12PointerMoved;
+ pScrn->ChangeGamma = xf86RandR12ChangeGamma;
+
+ randrp->orig_EnterVT = pScrn->EnterVT;
+ pScrn->EnterVT = xf86RandR12EnterVT;
+
+ if (!xf86RandR12CreateObjects12 (pScreen))
+ return FALSE;
+
+ /*
+ * Configure output modes
+ */
+ if (!xf86RandR12SetInfo12 (pScreen))
+ return FALSE;
+ for (i = 0; i < rp->numCrtcs; i++) {
+ xf86RandR12CrtcGetGamma(pScreen, rp->crtcs[i]);
+ }
+ return TRUE;
+}
+
+#endif
+
+Bool
+xf86RandR12PreInit (ScrnInfoPtr pScrn)
+{
+ return TRUE;
+}
diff --git a/xorg-server/hw/xfree86/modes/xf86Rotate.c b/xorg-server/hw/xfree86/modes/xf86Rotate.c
index 0181bc381..57c3499ac 100644
--- a/xorg-server/hw/xfree86/modes/xf86Rotate.c
+++ b/xorg-server/hw/xfree86/modes/xf86Rotate.c
@@ -1,565 +1,525 @@
-/*
- * Copyright © 2006 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting documentation, and
- * that the name of the copyright holders not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. The copyright holders make no representations
- * about the suitability of this software for any purpose. It is provided "as
- * is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
- * OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#else
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#endif
-
-#include <stddef.h>
-#include <string.h>
-#include <stdio.h>
-
-#include "xf86.h"
-#include "xf86DDC.h"
-#include "fb.h"
-#include "windowstr.h"
-#include "xf86Crtc.h"
-#include "xf86Modes.h"
-#include "xf86RandR12.h"
-#include "X11/extensions/render.h"
-#include "X11/extensions/dpmsconst.h"
-#include "X11/Xatom.h"
-
-/* borrowed from composite extension, move to Render and publish? */
-
-static VisualPtr
-compGetWindowVisual (WindowPtr pWin)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- VisualID vid = wVisual (pWin);
- int i;
-
- for (i = 0; i < pScreen->numVisuals; i++)
- if (pScreen->visuals[i].vid == vid)
- return &pScreen->visuals[i];
- return 0;
-}
-
-static PictFormatPtr
-compWindowFormat (WindowPtr pWin)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
-
- return PictureMatchVisual (pScreen, pWin->drawable.depth,
- compGetWindowVisual (pWin));
-}
-
-#define F(x) IntToxFixed(x)
-
-#define toF(x) ((float) (x) / 65536.0f)
-
-static void
-xf86RotateCrtcRedisplay (xf86CrtcPtr crtc, RegionPtr region)
-{
- ScrnInfoPtr scrn = crtc->scrn;
- ScreenPtr screen = scrn->pScreen;
- WindowPtr root = screen->root;
- PixmapPtr dst_pixmap = crtc->rotatedPixmap;
- PictFormatPtr format = compWindowFormat (screen->root);
- int error;
- PicturePtr src, dst;
- int n = RegionNumRects(region);
- BoxPtr b = RegionRects(region);
- XID include_inferiors = IncludeInferiors;
-
- src = CreatePicture (None,
- &root->drawable,
- format,
- CPSubwindowMode,
- &include_inferiors,
- serverClient,
- &error);
- if (!src)
- return;
-
- dst = CreatePicture (None,
- &dst_pixmap->drawable,
- format,
- 0L,
- NULL,
- serverClient,
- &error);
- if (!dst)
- return;
-
- error = SetPictureTransform (src, &crtc->crtc_to_framebuffer);
- if (error)
- return;
- if (crtc->transform_in_use && crtc->filter)
- SetPicturePictFilter (src, crtc->filter,
- crtc->params, crtc->nparams);
-
- if (crtc->shadowClear)
- {
- CompositePicture (PictOpSrc,
- src, NULL, dst,
- 0, 0, 0, 0, 0, 0,
- crtc->mode.HDisplay, crtc->mode.VDisplay);
- crtc->shadowClear = FALSE;
- }
- else
- {
- while (n--)
- {
- BoxRec dst_box;
-
- dst_box = *b;
- dst_box.x1 -= crtc->filter_width >> 1;
- dst_box.x2 += crtc->filter_width >> 1;
- dst_box.y1 -= crtc->filter_height >> 1;
- dst_box.y2 += crtc->filter_height >> 1;
- pixman_f_transform_bounds (&crtc->f_framebuffer_to_crtc, &dst_box);
- CompositePicture (PictOpSrc,
- src, NULL, dst,
- dst_box.x1, dst_box.y1, 0, 0, dst_box.x1, dst_box.y1,
- dst_box.x2 - dst_box.x1,
- dst_box.y2 - dst_box.y1);
- b++;
- }
- }
- FreePicture (src, None);
- FreePicture (dst, None);
-}
-
-static void
-xf86CrtcDamageShadow (xf86CrtcPtr crtc)
-{
- ScrnInfoPtr pScrn = crtc->scrn;
- BoxRec damage_box;
- RegionRec damage_region;
- ScreenPtr pScreen = pScrn->pScreen;
-
- damage_box.x1 = 0;
- damage_box.x2 = crtc->mode.HDisplay;
- damage_box.y1 = 0;
- damage_box.y2 = crtc->mode.VDisplay;
- if (!pixman_transform_bounds (&crtc->crtc_to_framebuffer, &damage_box))
- {
- damage_box.x1 = 0;
- damage_box.y1 = 0;
- damage_box.x2 = pScreen->width;
- damage_box.y2 = pScreen->height;
- }
- if (damage_box.x1 < 0) damage_box.x1 = 0;
- if (damage_box.y1 < 0) damage_box.y1 = 0;
- if (damage_box.x2 > pScreen->width) damage_box.x2 = pScreen->width;
- if (damage_box.y2 > pScreen->height) damage_box.y2 = pScreen->height;
- RegionInit(&damage_region, &damage_box, 1);
- DamageDamageRegion (&(*pScreen->GetScreenPixmap)(pScreen)->drawable,
- &damage_region);
- RegionUninit(&damage_region);
- crtc->shadowClear = TRUE;
-}
-
-static void
-xf86RotatePrepare (ScreenPtr pScreen)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
- int c;
-
- for (c = 0; c < xf86_config->num_crtc; c++)
- {
- xf86CrtcPtr crtc = xf86_config->crtc[c];
-
- if (crtc->rotatedData && !crtc->rotatedPixmap)
- {
- crtc->rotatedPixmap = crtc->funcs->shadow_create (crtc,
- crtc->rotatedData,
- crtc->mode.HDisplay,
- crtc->mode.VDisplay);
- if (!xf86_config->rotation_damage_registered)
- {
- /* Hook damage to screen pixmap */
- DamageRegister (&(*pScreen->GetScreenPixmap)(pScreen)->drawable,
- xf86_config->rotation_damage);
- xf86_config->rotation_damage_registered = TRUE;
- EnableLimitedSchedulingLatency();
- }
-
- xf86CrtcDamageShadow (crtc);
- }
- }
-}
-
-static Bool
-xf86RotateRedisplay(ScreenPtr pScreen)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
- DamagePtr damage = xf86_config->rotation_damage;
- RegionPtr region;
-
- if (!damage)
- return FALSE;
- xf86RotatePrepare (pScreen);
- region = DamageRegion(damage);
- if (RegionNotEmpty(region))
- {
- int c;
- SourceValidateProcPtr SourceValidate;
-
- /*
- * SourceValidate is used by the software cursor code
- * to pull the cursor off of the screen when reading
- * bits from the frame buffer. Bypassing this function
- * leaves the software cursor in place
- */
- SourceValidate = pScreen->SourceValidate;
- pScreen->SourceValidate = NULL;
-
- for (c = 0; c < xf86_config->num_crtc; c++)
- {
- xf86CrtcPtr crtc = xf86_config->crtc[c];
-
- if (crtc->transform_in_use && crtc->enabled)
- {
- RegionRec crtc_damage;
-
- /* compute portion of damage that overlaps crtc */
- RegionInit(&crtc_damage, &crtc->bounds, 1);
- RegionIntersect(&crtc_damage, &crtc_damage, region);
-
- /* update damaged region */
- if (RegionNotEmpty(&crtc_damage))
- xf86RotateCrtcRedisplay (crtc, &crtc_damage);
-
- RegionUninit(&crtc_damage);
- }
- }
- pScreen->SourceValidate = SourceValidate;
- DamageEmpty(damage);
- }
- return TRUE;
-}
-
-static void
-xf86RotateBlockHandler(int screenNum, pointer blockData,
- pointer pTimeout, pointer pReadmask)
-{
- ScreenPtr pScreen = screenInfo.screens[screenNum];
- ScrnInfoPtr pScrn = xf86Screens[screenNum];
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
- Bool rotation_active;
-
- rotation_active = xf86RotateRedisplay(pScreen);
- pScreen->BlockHandler = xf86_config->BlockHandler;
- (*pScreen->BlockHandler) (screenNum, blockData, pTimeout, pReadmask);
- /* cannot avoid re-wrapping until all wrapping is audited */
- xf86_config->BlockHandler = pScreen->BlockHandler;
- pScreen->BlockHandler = xf86RotateBlockHandler;
-}
-
-void
-xf86RotateDestroy (xf86CrtcPtr crtc)
-{
- ScrnInfoPtr pScrn = crtc->scrn;
- ScreenPtr pScreen = pScrn->pScreen;
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
- int c;
-
- /* Free memory from rotation */
- if (crtc->rotatedPixmap || crtc->rotatedData)
- {
- crtc->funcs->shadow_destroy (crtc, crtc->rotatedPixmap, crtc->rotatedData);
- crtc->rotatedPixmap = NULL;
- crtc->rotatedData = NULL;
- }
-
- for (c = 0; c < xf86_config->num_crtc; c++)
- if (xf86_config->crtc[c]->transform_in_use)
- return;
-
- /*
- * Clean up damage structures when no crtcs are rotated
- */
- if (xf86_config->rotation_damage)
- {
- /* Free damage structure */
- if (xf86_config->rotation_damage_registered)
- {
- DamageUnregister (&(*pScreen->GetScreenPixmap)(pScreen)->drawable,
- xf86_config->rotation_damage);
- xf86_config->rotation_damage_registered = FALSE;
- DisableLimitedSchedulingLatency();
- }
- DamageDestroy (xf86_config->rotation_damage);
- xf86_config->rotation_damage = NULL;
- }
-}
-
-void
-xf86RotateFreeShadow(ScrnInfoPtr pScrn)
-{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
- int c;
-
- for (c = 0; c < config->num_crtc; c++) {
- xf86CrtcPtr crtc = config->crtc[c];
-
- if (crtc->rotatedPixmap || crtc->rotatedData) {
- crtc->funcs->shadow_destroy(crtc, crtc->rotatedPixmap,
- crtc->rotatedData);
- crtc->rotatedPixmap = NULL;
- crtc->rotatedData = NULL;
- }
- }
-}
-
-void
-xf86RotateCloseScreen (ScreenPtr screen)
-{
- ScrnInfoPtr scrn = xf86Screens[screen->myNum];
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- int c;
-
- for (c = 0; c < xf86_config->num_crtc; c++)
- xf86RotateDestroy (xf86_config->crtc[c]);
-}
-
-static Bool
-xf86CrtcFitsScreen (xf86CrtcPtr crtc, struct pict_f_transform *crtc_to_fb)
-{
- ScrnInfoPtr pScrn = crtc->scrn;
- BoxRec b;
-
- /* When called before PreInit, the driver is
- * presumably doing load detect
- */
- if (pScrn->virtualX == 0 || pScrn->virtualY == 0)
- return TRUE;
-
- b.x1 = 0;
- b.y1 = 0;
- b.x2 = crtc->mode.HDisplay;
- b.y2 = crtc->mode.VDisplay;
- if (crtc_to_fb)
- pixman_f_transform_bounds (crtc_to_fb, &b);
- else {
- b.x1 += crtc->x;
- b.y1 += crtc->y;
- b.x2 += crtc->x;
- b.y2 += crtc->y;
- }
-
- return (0 <= b.x1 && b.x2 <= pScrn->virtualX &&
- 0 <= b.y1 && b.y2 <= pScrn->virtualY);
-}
-
-/*
- * A subset of xf86CrtcRotate that just deals with
- * cursor image/position transforms. Used when changing
- * the cursor transform
- */
-void
-xf86CrtcRotateCursor (xf86CrtcPtr crtc)
-{
- /* if this is called during ScreenInit() we don't have pScrn->pScreen yet */
- RRTransformPtr transform = NULL;
- PictTransform crtc_to_fb;
- struct pict_f_transform f_crtc_to_fb, f_fb_to_crtc, f_screen_to_crtc, f_crtc_to_cursor;
-
- if (crtc->transformPresent)
- transform = &crtc->transform;
-
- (void) RRTransformCompute (crtc->x, crtc->y,
- crtc->mode.HDisplay, crtc->mode.VDisplay,
- crtc->rotation,
- transform,
- &crtc->user_sprite_position_transform,
- &crtc->user_sprite_image_transform,
-
- &crtc_to_fb,
- &f_crtc_to_fb,
- &f_fb_to_crtc,
- &f_screen_to_crtc,
- &f_crtc_to_cursor,
- &crtc->sprite_transform_in_use);
- crtc->f_screen_to_crtc = f_screen_to_crtc;
- crtc->f_crtc_to_cursor = f_crtc_to_cursor;
-}
-
-Bool
-xf86CrtcRotate (xf86CrtcPtr crtc)
-{
- ScrnInfoPtr pScrn = crtc->scrn;
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
- /* if this is called during ScreenInit() we don't have pScrn->pScreen yet */
- ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
- PictTransform crtc_to_fb;
- struct pict_f_transform f_crtc_to_fb, f_fb_to_crtc, f_screen_to_crtc, f_crtc_to_cursor;
- xFixed *new_params = NULL;
- int new_nparams = 0;
- PictFilterPtr new_filter = NULL;
- int new_width = 0;
- int new_height = 0;
- RRTransformPtr transform = NULL;
- Bool damage = FALSE;
-
- if (crtc->transformPresent)
- transform = &crtc->transform;
-
- if (!RRTransformCompute (crtc->x, crtc->y,
- crtc->mode.HDisplay, crtc->mode.VDisplay,
- crtc->rotation,
- transform,
- &crtc->user_sprite_position_transform,
- &crtc->user_sprite_image_transform,
-
- &crtc_to_fb,
- &f_crtc_to_fb,
- &f_fb_to_crtc,
- &f_screen_to_crtc,
- &f_crtc_to_cursor,
- &crtc->sprite_transform_in_use) &&
- xf86CrtcFitsScreen (crtc, &f_crtc_to_fb))
- {
- /*
- * If the untranslated transformation is the identity,
- * disable the shadow buffer
- */
- xf86RotateDestroy (crtc);
- crtc->transform_in_use = FALSE;
- free(new_params);
- new_params = NULL;
- new_nparams = 0;
- new_filter = NULL;
- new_width = 0;
- new_height = 0;
- }
- else
- {
- /*
- * these are the size of the shadow pixmap, which
- * matches the mode, not the pre-rotated copy in the
- * frame buffer
- */
- int width = crtc->mode.HDisplay;
- int height = crtc->mode.VDisplay;
- void *shadowData = crtc->rotatedData;
- PixmapPtr shadow = crtc->rotatedPixmap;
- int old_width = shadow ? shadow->drawable.width : 0;
- int old_height = shadow ? shadow->drawable.height : 0;
-
- /* Allocate memory for rotation */
- if (old_width != width || old_height != height)
- {
- if (shadow || shadowData)
- {
- crtc->funcs->shadow_destroy (crtc, shadow, shadowData);
- crtc->rotatedPixmap = NULL;
- crtc->rotatedData = NULL;
- }
- shadowData = crtc->funcs->shadow_allocate (crtc, width, height);
- if (!shadowData)
- goto bail1;
- crtc->rotatedData = shadowData;
- /* shadow will be damaged in xf86RotatePrepare */
- }
- else
- {
- /* mark shadowed area as damaged so it will be repainted */
- damage = TRUE;
- }
-
- if (!xf86_config->rotation_damage)
- {
- /* Create damage structure */
- xf86_config->rotation_damage = DamageCreate (NULL, NULL,
- DamageReportNone,
- TRUE, pScreen, pScreen);
- if (!xf86_config->rotation_damage)
- goto bail2;
-
- /* Wrap block handler */
- if (!xf86_config->BlockHandler) {
- xf86_config->BlockHandler = pScreen->BlockHandler;
- pScreen->BlockHandler = xf86RotateBlockHandler;
- }
- }
-#ifdef RANDR_12_INTERFACE
- if (transform)
- {
- if (transform->nparams) {
- new_params = malloc(transform->nparams * sizeof (xFixed));
- if (new_params) {
- memcpy (new_params, transform->params,
- transform->nparams * sizeof (xFixed));
- new_nparams = transform->nparams;
- new_filter = transform->filter;
- }
- } else
- new_filter = transform->filter;
- if (new_filter)
- {
- new_width = new_filter->width;
- new_height = new_filter->height;
- }
- }
-#endif
-
- if (0)
- {
- bail2:
- if (shadow || shadowData)
- {
- crtc->funcs->shadow_destroy (crtc, shadow, shadowData);
- crtc->rotatedPixmap = NULL;
- crtc->rotatedData = NULL;
- }
- bail1:
- if (old_width && old_height)
- crtc->rotatedPixmap = crtc->funcs->shadow_create (crtc,
- NULL,
- old_width,
- old_height);
- return FALSE;
- }
- crtc->transform_in_use = TRUE;
- }
- crtc->crtc_to_framebuffer = crtc_to_fb;
- crtc->f_crtc_to_framebuffer = f_crtc_to_fb;
- crtc->f_framebuffer_to_crtc = f_fb_to_crtc;
- crtc->f_screen_to_crtc = f_screen_to_crtc;
- crtc->f_crtc_to_cursor = f_crtc_to_cursor;
- free(crtc->params);
- crtc->params = new_params;
- crtc->nparams = new_nparams;
- crtc->filter = new_filter;
- crtc->filter_width = new_width;
- crtc->filter_height = new_height;
- crtc->bounds.x1 = 0;
- crtc->bounds.x2 = crtc->mode.HDisplay;
- crtc->bounds.y1 = 0;
- crtc->bounds.y2 = crtc->mode.VDisplay;
- pixman_f_transform_bounds (&f_crtc_to_fb, &crtc->bounds);
-
- if (damage)
- xf86CrtcDamageShadow (crtc);
-
- /* All done */
- return TRUE;
-}
+/*
+ * Copyright © 2006 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#else
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#endif
+
+#include <stddef.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "xf86.h"
+#include "xf86DDC.h"
+#include "fb.h"
+#include "windowstr.h"
+#include "xf86Crtc.h"
+#include "xf86Modes.h"
+#include "xf86RandR12.h"
+#include "X11/extensions/render.h"
+#include "X11/extensions/dpmsconst.h"
+#include "X11/Xatom.h"
+
+/* borrowed from composite extension, move to Render and publish? */
+
+static VisualPtr
+compGetWindowVisual (WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ VisualID vid = wVisual (pWin);
+ int i;
+
+ for (i = 0; i < pScreen->numVisuals; i++)
+ if (pScreen->visuals[i].vid == vid)
+ return &pScreen->visuals[i];
+ return 0;
+}
+
+static PictFormatPtr
+compWindowFormat (WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ return PictureMatchVisual (pScreen, pWin->drawable.depth,
+ compGetWindowVisual (pWin));
+}
+
+#define F(x) IntToxFixed(x)
+
+#define toF(x) ((float) (x) / 65536.0f)
+
+static void
+xf86RotateCrtcRedisplay (xf86CrtcPtr crtc, RegionPtr region)
+{
+ ScrnInfoPtr scrn = crtc->scrn;
+ ScreenPtr screen = scrn->pScreen;
+ WindowPtr root = screen->root;
+ PixmapPtr dst_pixmap = crtc->rotatedPixmap;
+ PictFormatPtr format = compWindowFormat (screen->root);
+ int error;
+ PicturePtr src, dst;
+ int n = RegionNumRects(region);
+ BoxPtr b = RegionRects(region);
+ XID include_inferiors = IncludeInferiors;
+
+ src = CreatePicture (None,
+ &root->drawable,
+ format,
+ CPSubwindowMode,
+ &include_inferiors,
+ serverClient,
+ &error);
+ if (!src)
+ return;
+
+ dst = CreatePicture (None,
+ &dst_pixmap->drawable,
+ format,
+ 0L,
+ NULL,
+ serverClient,
+ &error);
+ if (!dst)
+ return;
+
+ error = SetPictureTransform (src, &crtc->crtc_to_framebuffer);
+ if (error)
+ return;
+ if (crtc->transform_in_use && crtc->filter)
+ SetPicturePictFilter (src, crtc->filter,
+ crtc->params, crtc->nparams);
+
+ if (crtc->shadowClear)
+ {
+ CompositePicture (PictOpSrc,
+ src, NULL, dst,
+ 0, 0, 0, 0, 0, 0,
+ crtc->mode.HDisplay, crtc->mode.VDisplay);
+ crtc->shadowClear = FALSE;
+ }
+ else
+ {
+ while (n--)
+ {
+ BoxRec dst_box;
+
+ dst_box = *b;
+ dst_box.x1 -= crtc->filter_width >> 1;
+ dst_box.x2 += crtc->filter_width >> 1;
+ dst_box.y1 -= crtc->filter_height >> 1;
+ dst_box.y2 += crtc->filter_height >> 1;
+ pixman_f_transform_bounds (&crtc->f_framebuffer_to_crtc, &dst_box);
+ CompositePicture (PictOpSrc,
+ src, NULL, dst,
+ dst_box.x1, dst_box.y1, 0, 0, dst_box.x1, dst_box.y1,
+ dst_box.x2 - dst_box.x1,
+ dst_box.y2 - dst_box.y1);
+ b++;
+ }
+ }
+ FreePicture (src, None);
+ FreePicture (dst, None);
+}
+
+static void
+xf86CrtcDamageShadow (xf86CrtcPtr crtc)
+{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ BoxRec damage_box;
+ RegionRec damage_region;
+ ScreenPtr pScreen = pScrn->pScreen;
+
+ damage_box.x1 = 0;
+ damage_box.x2 = crtc->mode.HDisplay;
+ damage_box.y1 = 0;
+ damage_box.y2 = crtc->mode.VDisplay;
+ if (!pixman_transform_bounds (&crtc->crtc_to_framebuffer, &damage_box))
+ {
+ damage_box.x1 = 0;
+ damage_box.y1 = 0;
+ damage_box.x2 = pScreen->width;
+ damage_box.y2 = pScreen->height;
+ }
+ if (damage_box.x1 < 0) damage_box.x1 = 0;
+ if (damage_box.y1 < 0) damage_box.y1 = 0;
+ if (damage_box.x2 > pScreen->width) damage_box.x2 = pScreen->width;
+ if (damage_box.y2 > pScreen->height) damage_box.y2 = pScreen->height;
+ RegionInit(&damage_region, &damage_box, 1);
+ DamageDamageRegion (&(*pScreen->GetScreenPixmap)(pScreen)->drawable,
+ &damage_region);
+ RegionUninit(&damage_region);
+ crtc->shadowClear = TRUE;
+}
+
+static void
+xf86RotatePrepare (ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int c;
+
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ if (crtc->rotatedData && !crtc->rotatedPixmap)
+ {
+ crtc->rotatedPixmap = crtc->funcs->shadow_create (crtc,
+ crtc->rotatedData,
+ crtc->mode.HDisplay,
+ crtc->mode.VDisplay);
+ if (!xf86_config->rotation_damage_registered)
+ {
+ /* Hook damage to screen pixmap */
+ DamageRegister (&(*pScreen->GetScreenPixmap)(pScreen)->drawable,
+ xf86_config->rotation_damage);
+ xf86_config->rotation_damage_registered = TRUE;
+ EnableLimitedSchedulingLatency();
+ }
+
+ xf86CrtcDamageShadow (crtc);
+ }
+ }
+}
+
+static Bool
+xf86RotateRedisplay(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ DamagePtr damage = xf86_config->rotation_damage;
+ RegionPtr region;
+
+ if (!damage)
+ return FALSE;
+ xf86RotatePrepare (pScreen);
+ region = DamageRegion(damage);
+ if (RegionNotEmpty(region))
+ {
+ int c;
+ SourceValidateProcPtr SourceValidate;
+
+ /*
+ * SourceValidate is used by the software cursor code
+ * to pull the cursor off of the screen when reading
+ * bits from the frame buffer. Bypassing this function
+ * leaves the software cursor in place
+ */
+ SourceValidate = pScreen->SourceValidate;
+ pScreen->SourceValidate = NULL;
+
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ if (crtc->transform_in_use && crtc->enabled)
+ {
+ RegionRec crtc_damage;
+
+ /* compute portion of damage that overlaps crtc */
+ RegionInit(&crtc_damage, &crtc->bounds, 1);
+ RegionIntersect(&crtc_damage, &crtc_damage, region);
+
+ /* update damaged region */
+ if (RegionNotEmpty(&crtc_damage))
+ xf86RotateCrtcRedisplay (crtc, &crtc_damage);
+
+ RegionUninit(&crtc_damage);
+ }
+ }
+ pScreen->SourceValidate = SourceValidate;
+ DamageEmpty(damage);
+ }
+ return TRUE;
+}
+
+static void
+xf86RotateBlockHandler(int screenNum, pointer blockData,
+ pointer pTimeout, pointer pReadmask)
+{
+ ScreenPtr pScreen = screenInfo.screens[screenNum];
+ ScrnInfoPtr pScrn = xf86Screens[screenNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ Bool rotation_active;
+
+ rotation_active = xf86RotateRedisplay(pScreen);
+ pScreen->BlockHandler = xf86_config->BlockHandler;
+ (*pScreen->BlockHandler) (screenNum, blockData, pTimeout, pReadmask);
+ /* cannot avoid re-wrapping until all wrapping is audited */
+ xf86_config->BlockHandler = pScreen->BlockHandler;
+ pScreen->BlockHandler = xf86RotateBlockHandler;
+}
+
+void
+xf86RotateDestroy (xf86CrtcPtr crtc)
+{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ ScreenPtr pScreen = pScrn->pScreen;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int c;
+
+ /* Free memory from rotation */
+ if (crtc->rotatedPixmap || crtc->rotatedData)
+ {
+ crtc->funcs->shadow_destroy (crtc, crtc->rotatedPixmap, crtc->rotatedData);
+ crtc->rotatedPixmap = NULL;
+ crtc->rotatedData = NULL;
+ }
+
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ if (xf86_config->crtc[c]->transform_in_use)
+ return;
+
+ /*
+ * Clean up damage structures when no crtcs are rotated
+ */
+ if (xf86_config->rotation_damage)
+ {
+ /* Free damage structure */
+ if (xf86_config->rotation_damage_registered)
+ {
+ DamageUnregister (&(*pScreen->GetScreenPixmap)(pScreen)->drawable,
+ xf86_config->rotation_damage);
+ xf86_config->rotation_damage_registered = FALSE;
+ DisableLimitedSchedulingLatency();
+ }
+ DamageDestroy (xf86_config->rotation_damage);
+ xf86_config->rotation_damage = NULL;
+ }
+}
+
+void
+xf86RotateFreeShadow(ScrnInfoPtr pScrn)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int c;
+
+ for (c = 0; c < config->num_crtc; c++) {
+ xf86CrtcPtr crtc = config->crtc[c];
+
+ if (crtc->rotatedPixmap || crtc->rotatedData) {
+ crtc->funcs->shadow_destroy(crtc, crtc->rotatedPixmap,
+ crtc->rotatedData);
+ crtc->rotatedPixmap = NULL;
+ crtc->rotatedData = NULL;
+ }
+ }
+}
+
+void
+xf86RotateCloseScreen (ScreenPtr screen)
+{
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c;
+
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ xf86RotateDestroy (xf86_config->crtc[c]);
+}
+
+static Bool
+xf86CrtcFitsScreen (xf86CrtcPtr crtc, struct pict_f_transform *crtc_to_fb)
+{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ BoxRec b;
+
+ /* When called before PreInit, the driver is
+ * presumably doing load detect
+ */
+ if (pScrn->virtualX == 0 || pScrn->virtualY == 0)
+ return TRUE;
+
+ b.x1 = 0;
+ b.y1 = 0;
+ b.x2 = crtc->mode.HDisplay;
+ b.y2 = crtc->mode.VDisplay;
+ if (crtc_to_fb)
+ pixman_f_transform_bounds (crtc_to_fb, &b);
+ else {
+ b.x1 += crtc->x;
+ b.y1 += crtc->y;
+ b.x2 += crtc->x;
+ b.y2 += crtc->y;
+ }
+
+ return (0 <= b.x1 && b.x2 <= pScrn->virtualX &&
+ 0 <= b.y1 && b.y2 <= pScrn->virtualY);
+}
+
+Bool
+xf86CrtcRotate (xf86CrtcPtr crtc)
+{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ /* if this is called during ScreenInit() we don't have pScrn->pScreen yet */
+ ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
+ PictTransform crtc_to_fb;
+ struct pict_f_transform f_crtc_to_fb, f_fb_to_crtc;
+ xFixed *new_params = NULL;
+ int new_nparams = 0;
+ PictFilterPtr new_filter = NULL;
+ int new_width = 0;
+ int new_height = 0;
+ RRTransformPtr transform = NULL;
+ Bool damage = FALSE;
+
+ if (crtc->transformPresent)
+ transform = &crtc->transform;
+
+ if (!RRTransformCompute (crtc->x, crtc->y,
+ crtc->mode.HDisplay, crtc->mode.VDisplay,
+ crtc->rotation,
+ transform,
+
+ &crtc_to_fb,
+ &f_crtc_to_fb,
+ &f_fb_to_crtc) &&
+ xf86CrtcFitsScreen (crtc, &f_crtc_to_fb))
+ {
+ /*
+ * If the untranslated transformation is the identity,
+ * disable the shadow buffer
+ */
+ xf86RotateDestroy (crtc);
+ crtc->transform_in_use = FALSE;
+ free(new_params);
+ new_params = NULL;
+ new_nparams = 0;
+ new_filter = NULL;
+ new_width = 0;
+ new_height = 0;
+ }
+ else
+ {
+ /*
+ * these are the size of the shadow pixmap, which
+ * matches the mode, not the pre-rotated copy in the
+ * frame buffer
+ */
+ int width = crtc->mode.HDisplay;
+ int height = crtc->mode.VDisplay;
+ void *shadowData = crtc->rotatedData;
+ PixmapPtr shadow = crtc->rotatedPixmap;
+ int old_width = shadow ? shadow->drawable.width : 0;
+ int old_height = shadow ? shadow->drawable.height : 0;
+
+ /* Allocate memory for rotation */
+ if (old_width != width || old_height != height)
+ {
+ if (shadow || shadowData)
+ {
+ crtc->funcs->shadow_destroy (crtc, shadow, shadowData);
+ crtc->rotatedPixmap = NULL;
+ crtc->rotatedData = NULL;
+ }
+ shadowData = crtc->funcs->shadow_allocate (crtc, width, height);
+ if (!shadowData)
+ goto bail1;
+ crtc->rotatedData = shadowData;
+ /* shadow will be damaged in xf86RotatePrepare */
+ }
+ else
+ {
+ /* mark shadowed area as damaged so it will be repainted */
+ damage = TRUE;
+ }
+
+ if (!xf86_config->rotation_damage)
+ {
+ /* Create damage structure */
+ xf86_config->rotation_damage = DamageCreate (NULL, NULL,
+ DamageReportNone,
+ TRUE, pScreen, pScreen);
+ if (!xf86_config->rotation_damage)
+ goto bail2;
+
+ /* Wrap block handler */
+ if (!xf86_config->BlockHandler) {
+ xf86_config->BlockHandler = pScreen->BlockHandler;
+ pScreen->BlockHandler = xf86RotateBlockHandler;
+ }
+ }
+#ifdef RANDR_12_INTERFACE
+ if (transform)
+ {
+ if (transform->nparams) {
+ new_params = malloc(transform->nparams * sizeof (xFixed));
+ if (new_params) {
+ memcpy (new_params, transform->params,
+ transform->nparams * sizeof (xFixed));
+ new_nparams = transform->nparams;
+ new_filter = transform->filter;
+ }
+ } else
+ new_filter = transform->filter;
+ if (new_filter)
+ {
+ new_width = new_filter->width;
+ new_height = new_filter->height;
+ }
+ }
+#endif
+
+ if (0)
+ {
+ bail2:
+ if (shadow || shadowData)
+ {
+ crtc->funcs->shadow_destroy (crtc, shadow, shadowData);
+ crtc->rotatedPixmap = NULL;
+ crtc->rotatedData = NULL;
+ }
+ bail1:
+ if (old_width && old_height)
+ crtc->rotatedPixmap = crtc->funcs->shadow_create (crtc,
+ NULL,
+ old_width,
+ old_height);
+ return FALSE;
+ }
+ crtc->transform_in_use = TRUE;
+ }
+ crtc->crtc_to_framebuffer = crtc_to_fb;
+ crtc->f_crtc_to_framebuffer = f_crtc_to_fb;
+ crtc->f_framebuffer_to_crtc = f_fb_to_crtc;
+ free(crtc->params);
+ crtc->params = new_params;
+ crtc->nparams = new_nparams;
+ crtc->filter = new_filter;
+ crtc->filter_width = new_width;
+ crtc->filter_height = new_height;
+ crtc->bounds.x1 = 0;
+ crtc->bounds.x2 = crtc->mode.HDisplay;
+ crtc->bounds.y1 = 0;
+ crtc->bounds.y2 = crtc->mode.VDisplay;
+ pixman_f_transform_bounds (&f_crtc_to_fb, &crtc->bounds);
+
+ if (damage)
+ xf86CrtcDamageShadow (crtc);
+
+ /* All done */
+ return TRUE;
+}
diff --git a/xorg-server/hw/xfree86/os-support/bsd/bsd_init.c b/xorg-server/hw/xfree86/os-support/bsd/bsd_init.c
index 62618afd8..123eb17d1 100644
--- a/xorg-server/hw/xfree86/os-support/bsd/bsd_init.c
+++ b/xorg-server/hw/xfree86/os-support/bsd/bsd_init.c
@@ -1,760 +1,756 @@
-/*
- * Copyright 1992 by Rich Murphey <Rich@Rice.edu>
- * Copyright 1993 by David Wexelblat <dwex@goblin.org>
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the names of Rich Murphey and David Wexelblat
- * not be used in advertising or publicity pertaining to distribution of
- * the software without specific, written prior permission. Rich Murphey and
- * David Wexelblat make no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * RICH MURPHEY AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD TO
- * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID WEXELBLAT BE LIABLE FOR
- * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
- * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
- * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-
-#include <sys/utsname.h>
-#include <sys/ioctl.h>
-#include <stdlib.h>
-#include <errno.h>
-
-static Bool KeepTty = FALSE;
-static int devConsoleFd = -1;
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
-static int VTnum = -1;
-static int initialVT = -1;
-static Bool ShareVTs = FALSE;
-#endif
-
-#ifdef PCCONS_SUPPORT
-/* Stock 0.1 386bsd pccons console driver interface */
-#ifndef __OpenBSD__
-# define PCCONS_CONSOLE_DEV1 "/dev/ttyv0"
-#else
-# define PCCONS_CONSOLE_DEV1 "/dev/ttyC0"
-#endif
-#define PCCONS_CONSOLE_DEV2 "/dev/vga"
-#define PCCONS_CONSOLE_MODE O_RDWR|O_NDELAY
-#endif
-
-#ifdef SYSCONS_SUPPORT
-/* The FreeBSD 1.1 version syscons driver uses /dev/ttyv0 */
-#define SYSCONS_CONSOLE_DEV1 "/dev/ttyv0"
-#define SYSCONS_CONSOLE_DEV2 "/dev/vga"
-#define SYSCONS_CONSOLE_MODE O_RDWR|O_NDELAY
-#endif
-
-#ifdef PCVT_SUPPORT
-/* Hellmuth Michaelis' pcvt driver */
-#ifndef __OpenBSD__
-# define PCVT_CONSOLE_DEV "/dev/ttyv0"
-#else
-# define PCVT_CONSOLE_DEV "/dev/ttyC0"
-#endif
-#define PCVT_CONSOLE_MODE O_RDWR|O_NDELAY
-#endif
-
-#if defined(WSCONS_SUPPORT) && defined(__NetBSD__)
-/* NetBSD's new console driver */
-#define WSCONS_PCVT_COMPAT_CONSOLE_DEV "/dev/ttyE0"
-#endif
-
-#ifdef __GLIBC__
-#define setpgrp setpgid
-#endif
-
-#define CHECK_DRIVER_MSG \
- "Check your kernel's console driver configuration and /dev entries"
-
-static char *supported_drivers[] = {
-#ifdef PCCONS_SUPPORT
- "pccons (with X support)",
-#endif
-#ifdef SYSCONS_SUPPORT
- "syscons",
-#endif
-#ifdef PCVT_SUPPORT
- "pcvt",
-#endif
-#ifdef WSCONS_SUPPORT
- "wscons",
-#endif
-};
-
-
-/*
- * Functions to probe for the existance of a supported console driver.
- * Any function returns either a valid file descriptor (driver probed
- * succesfully), -1 (driver not found), or uses FatalError() if the
- * driver was found but proved to not support the required mode to run
- * an X server.
- */
-
-typedef int (*xf86ConsOpen_t)(void);
-
-#ifdef PCCONS_SUPPORT
-static int xf86OpenPccons(void);
-#endif /* PCCONS_SUPPORT */
-
-#ifdef SYSCONS_SUPPORT
-static int xf86OpenSyscons(void);
-#endif /* SYSCONS_SUPPORT */
-
-#ifdef PCVT_SUPPORT
-static int xf86OpenPcvt(void);
-#endif /* PCVT_SUPPORT */
-
-#ifdef WSCONS_SUPPORT
-static int xf86OpenWScons(void);
-#endif
-
-/*
- * The sequence of the driver probes is important; start with the
- * driver that is best distinguishable, and end with the most generic
- * driver. (Otherwise, pcvt would also probe as syscons, and either
- * pcvt or syscons might succesfully probe as pccons.)
- */
-static xf86ConsOpen_t xf86ConsTab[] = {
-#ifdef PCVT_SUPPORT
- xf86OpenPcvt,
-#endif
-#ifdef SYSCONS_SUPPORT
- xf86OpenSyscons,
-#endif
-#ifdef PCCONS_SUPPORT
- xf86OpenPccons,
-#endif
-#ifdef WSCONS_SUPPORT
- xf86OpenWScons,
-#endif
- (xf86ConsOpen_t)NULL
-};
-
-
-void
-xf86OpenConsole()
-{
- int i, fd = -1;
- xf86ConsOpen_t *driver;
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- int result;
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- struct utsname uts;
-#endif
- vtmode_t vtmode;
-#endif
-
- if (serverGeneration == 1)
- {
- /* check if we are run with euid==0 */
- if (geteuid() != 0)
- {
- FatalError("xf86OpenConsole: Server must be suid root");
- }
-
- if (!KeepTty)
- {
- /*
- * detaching the controlling tty solves problems of kbd character
- * loss. This is not interesting for CO driver, because it is
- * exclusive.
- */
- setpgrp(0, getpid());
- if ((i = open("/dev/tty",O_RDWR)) >= 0)
- {
- ioctl(i,TIOCNOTTY,(char *)0);
- close(i);
- }
- }
-
- /* detect which driver we are running on */
- for (driver = xf86ConsTab; *driver; driver++)
- {
- if ((fd = (*driver)()) >= 0)
- break;
- }
-
- /* Check that a supported console driver was found */
- if (fd < 0)
- {
- char cons_drivers[80] = {0, };
- for (i = 0; i < sizeof(supported_drivers) / sizeof(char *); i++)
- {
- if (i)
- {
- strcat(cons_drivers, ", ");
- }
- strcat(cons_drivers, supported_drivers[i]);
- }
- FatalError(
- "%s: No console driver found\n\tSupported drivers: %s\n\t%s",
- "xf86OpenConsole", cons_drivers, CHECK_DRIVER_MSG);
- }
-#if 0 /* stdin is already closed in OsInit() */
- fclose(stdin);
-#endif
- xf86Info.consoleFd = fd;
- xf86Info.screenFd = fd;
-
- switch (xf86Info.consType)
- {
-#ifdef PCCONS_SUPPORT
- case PCCONS:
- if (ioctl (xf86Info.consoleFd, CONSOLE_X_MODE_ON, 0) < 0)
- {
- FatalError("%s: CONSOLE_X_MODE_ON failed (%s)\n%s",
- "xf86OpenConsole", strerror(errno),
- CHECK_DRIVER_MSG);
- }
- /*
- * Hack to prevent keyboard hanging when syslogd closes
- * /dev/console
- */
- if ((devConsoleFd = open("/dev/console", O_WRONLY,0)) < 0)
- {
- xf86Msg(X_WARNING,
- "xf86OpenConsole: couldn't open /dev/console (%s)\n",
- strerror(errno));
- }
- break;
-#endif
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- case SYSCONS:
- /* as of FreeBSD 2.2.8, syscons driver does not need the #1 vt
- * switching anymore. Here we check for FreeBSD 3.1 and up.
- * Add cases for other *BSD that behave the same.
- */
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- uname (&uts);
- i = atof(uts.release) * 100;
- if (i >= 310) goto acquire_vt;
-#endif
- /* otherwise fall through */
- case PCVT:
-#if !(defined(__NetBSD__) && (__NetBSD_Version__ >= 200000000))
- /*
- * First activate the #1 VT. This is a hack to allow a server
- * to be started while another one is active. There should be
- * a better way.
- */
- if (initialVT != 1) {
-
- if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, 1) != 0)
- {
- xf86Msg(X_WARNING,
- "xf86OpenConsole: VT_ACTIVATE failed\n");
- }
- sleep(1);
- }
-#endif
-acquire_vt:
- if (!ShareVTs) {
- /*
- * now get the VT
- */
- SYSCALL(result =
- ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno));
- if (result != 0)
- {
- xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
- }
- SYSCALL(result =
- ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno));
- if (result != 0)
- {
- xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n");
- }
-
- signal(SIGUSR1, xf86VTRequest);
-
- vtmode.mode = VT_PROCESS;
- vtmode.relsig = SIGUSR1;
- vtmode.acqsig = SIGUSR1;
- vtmode.frsig = SIGUSR1;
- if (ioctl(xf86Info.consoleFd, VT_SETMODE, &vtmode) < 0)
- {
- FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed");
- }
- #if !defined(USE_DEV_IO) && !defined(USE_I386_IOPL)
- if (ioctl(xf86Info.consoleFd, KDENABIO, 0) < 0)
- {
- FatalError("xf86OpenConsole: KDENABIO failed (%s)",
- strerror(errno));
- }
- #endif
- if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0)
- {
- FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed");
- }
- } else { /* ShareVTs */
- close(xf86Info.consoleFd);
- }
- break;
-#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
-#ifdef WSCONS_SUPPORT
- case WSCONS:
- /* Nothing to do */
- break;
-#endif
- }
- }
- else
- {
- /* serverGeneration != 1 */
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- if (!ShareVTs) if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT)
- {
- if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0)
- {
- xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
- }
- }
-#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
- }
- return;
-}
-
-
-#ifdef PCCONS_SUPPORT
-
-static int
-xf86OpenPccons()
-{
- int fd = -1;
-
- if ((fd = open(PCCONS_CONSOLE_DEV1, PCCONS_CONSOLE_MODE, 0))
- >= 0 ||
- (fd = open(PCCONS_CONSOLE_DEV2, PCCONS_CONSOLE_MODE, 0))
- >= 0)
- {
- if (ioctl(fd, CONSOLE_X_MODE_OFF, 0) < 0)
- {
- FatalError(
- "%s: CONSOLE_X_MODE_OFF failed (%s)\n%s\n%s",
- "xf86OpenPccons",
- strerror(errno),
- "Was expecting pccons driver with X support",
- CHECK_DRIVER_MSG);
- }
- xf86Info.consType = PCCONS;
- xf86Msg(X_PROBED, "Using pccons driver with X support\n");
- }
- return fd;
-}
-
-#endif /* PCCONS_SUPPORT */
-
-#ifdef SYSCONS_SUPPORT
-
-static int
-xf86OpenSyscons()
-{
- int fd = -1;
- vtmode_t vtmode;
- char vtname[12];
- struct stat status;
- long syscons_version;
- MessageType from;
-
- /* Check for syscons */
- if ((fd = open(SYSCONS_CONSOLE_DEV1, SYSCONS_CONSOLE_MODE, 0)) >= 0
- || (fd = open(SYSCONS_CONSOLE_DEV2, SYSCONS_CONSOLE_MODE, 0)) >= 0)
- {
- if (ioctl(fd, VT_GETMODE, &vtmode) >= 0)
- {
- /* Get syscons version */
- if (ioctl(fd, CONS_GETVERS, &syscons_version) < 0)
- {
- syscons_version = 0;
- }
-
- xf86Info.vtno = VTnum;
- from = X_CMDLINE;
-
-#ifdef VT_GETACTIVE
- if (ioctl(fd, VT_GETACTIVE, &initialVT) < 0)
- initialVT = -1;
-#endif
- if (ShareVTs)
- xf86Info.vtno = initialVT;
-
- if (xf86Info.vtno == -1)
- {
- /*
- * For old syscons versions (<0x100), VT_OPENQRY returns
- * the current VT rather than the next free VT. In this
- * case, the server gets started on the current VT instead
- * of the next free VT.
- */
-
-#if 0
- /* check for the fixed VT_OPENQRY */
- if (syscons_version >= 0x100)
- {
-#endif
- if (ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0)
- {
- /* No free VTs */
- xf86Info.vtno = -1;
- }
-#if 0
- }
-#endif
-
- if (xf86Info.vtno == -1)
- {
- /*
- * All VTs are in use. If initialVT was found, use it.
- * Otherwise, if stdin is a VT, use that one.
- * XXX stdin is already closed, so this won't work.
- */
- if (initialVT != -1)
- {
- xf86Info.vtno = initialVT;
- }
- else if ((fstat(0, &status) >= 0)
- && S_ISCHR(status.st_mode)
- && (ioctl(0, VT_GETMODE, &vtmode) >= 0))
- {
- /* stdin is a VT */
- xf86Info.vtno = minor(status.st_rdev) + 1;
- }
- else
- {
- if (syscons_version >= 0x100)
- {
- FatalError("%s: Cannot find a free VT",
- "xf86OpenSyscons");
- }
- /* Should no longer reach here */
- FatalError("%s: %s %s\n\t%s %s",
- "xf86OpenSyscons",
- "syscons versions prior to 1.0 require",
- "either the",
- "server's stdin be a VT",
- "or the use of the vtxx server option");
- }
- }
- from = X_PROBED;
- }
-
- close(fd);
-#ifndef __OpenBSD__
- sprintf(vtname, "/dev/ttyv%01x", xf86Info.vtno - 1);
-#else
- sprintf(vtname, "/dev/ttyC%01x", xf86Info.vtno - 1);
-#endif
- if ((fd = open(vtname, SYSCONS_CONSOLE_MODE, 0)) < 0)
- {
- FatalError("xf86OpenSyscons: Cannot open %s (%s)",
- vtname, strerror(errno));
- }
- if (ioctl(fd, VT_GETMODE, &vtmode) < 0)
- {
- FatalError("xf86OpenSyscons: VT_GETMODE failed");
- }
- xf86Info.consType = SYSCONS;
- xf86Msg(X_PROBED, "Using syscons driver with X support");
- if (syscons_version >= 0x100)
- {
- xf86ErrorF(" (version %ld.%ld)\n", syscons_version >> 8,
- syscons_version & 0xFF);
- }
- else
- {
- xf86ErrorF(" (version 0.x)\n");
- }
- xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno);
- }
- else
- {
- /* VT_GETMODE failed, probably not syscons */
- close(fd);
- fd = -1;
- }
- }
- return fd;
-}
-
-#endif /* SYSCONS_SUPPORT */
-
-
-#ifdef PCVT_SUPPORT
-
-static int
-xf86OpenPcvt()
-{
- /* This looks much like syscons, since pcvt is API compatible */
- int fd = -1;
- vtmode_t vtmode;
- char vtname[12], *vtprefix;
- struct stat status;
- struct pcvtid pcvt_version;
-
-#ifndef __OpenBSD__
- vtprefix = "/dev/ttyv";
-#else
- vtprefix = "/dev/ttyC";
-#endif
-
- fd = open(PCVT_CONSOLE_DEV, PCVT_CONSOLE_MODE, 0);
-#ifdef WSCONS_PCVT_COMPAT_CONSOLE_DEV
- if (fd < 0)
- {
- fd = open(WSCONS_PCVT_COMPAT_CONSOLE_DEV, PCVT_CONSOLE_MODE, 0);
- vtprefix = "/dev/ttyE";
- }
-#endif
- if (fd >= 0)
- {
- if (ioctl(fd, VGAPCVTID, &pcvt_version) >= 0)
- {
- if(ioctl(fd, VT_GETMODE, &vtmode) < 0)
- {
- FatalError("%s: VT_GETMODE failed\n%s%s\n%s",
- "xf86OpenPcvt",
- "Found pcvt driver but X11 seems to be",
- " not supported.", CHECK_DRIVER_MSG);
- }
-
- xf86Info.vtno = VTnum;
-
- if (ioctl(fd, VT_GETACTIVE, &initialVT) < 0)
- initialVT = -1;
-
- if (xf86Info.vtno == -1)
- {
- if (ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0)
- {
- /* No free VTs */
- xf86Info.vtno = -1;
- }
-
- if (xf86Info.vtno == -1)
- {
- /*
- * All VTs are in use. If initialVT was found, use it.
- * Otherwise, if stdin is a VT, use that one.
- * XXX stdin is already closed, so this won't work.
- */
- if (initialVT != -1)
- {
- xf86Info.vtno = initialVT;
- }
- else if ((fstat(0, &status) >= 0)
- && S_ISCHR(status.st_mode)
- && (ioctl(0, VT_GETMODE, &vtmode) >= 0))
- {
- /* stdin is a VT */
- xf86Info.vtno = minor(status.st_rdev) + 1;
- }
- else
- {
- FatalError("%s: Cannot find a free VT",
- "xf86OpenPcvt");
- }
- }
- }
-
- close(fd);
- sprintf(vtname, "%s%01x", vtprefix, xf86Info.vtno - 1);
- if ((fd = open(vtname, PCVT_CONSOLE_MODE, 0)) < 0)
- {
- ErrorF("xf86OpenPcvt: Cannot open %s (%s)",
- vtname, strerror(errno));
- xf86Info.vtno = initialVT;
- sprintf(vtname, "%s%01x", vtprefix, xf86Info.vtno - 1);
- if ((fd = open(vtname, PCVT_CONSOLE_MODE, 0)) < 0) {
- FatalError("xf86OpenPcvt: Cannot open %s (%s)",
- vtname, strerror(errno));
- }
- }
- if (ioctl(fd, VT_GETMODE, &vtmode) < 0)
- {
- FatalError("xf86OpenPcvt: VT_GETMODE failed");
- }
- xf86Info.consType = PCVT;
-#ifdef WSCONS_SUPPORT
- xf86Msg(X_PROBED,
- "Using wscons driver on %s in pcvt compatibility mode "
- "(version %d.%d)\n", vtname,
- pcvt_version.rmajor, pcvt_version.rminor);
-#else
- xf86Msg(X_PROBED, "Using pcvt driver (version %d.%d)\n",
- pcvt_version.rmajor, pcvt_version.rminor);
-#endif
- }
- else
- {
- /* Not pcvt */
- close(fd);
- fd = -1;
- }
- }
- return fd;
-}
-
-#endif /* PCVT_SUPPORT */
-
-#ifdef WSCONS_SUPPORT
-
-static int
-xf86OpenWScons()
-{
- int fd = -1;
- int mode = WSDISPLAYIO_MODE_MAPPED;
- int i;
- char ttyname[16];
-
- /* XXX Is this ok? */
- for (i = 0; i < 8; i++) {
-#if defined(__NetBSD__)
- sprintf(ttyname, "/dev/ttyE%d", i);
-#elif defined(__OpenBSD__)
- sprintf(ttyname, "/dev/ttyC%x", i);
-#endif
- if ((fd = open(ttyname, 2)) != -1)
- break;
- }
- if (fd != -1) {
- if (ioctl(fd, WSDISPLAYIO_SMODE, &mode) < 0) {
- FatalError("%s: WSDISPLAYIO_MODE_MAPPED failed (%s)\n%s",
- "xf86OpenConsole", strerror(errno),
- CHECK_DRIVER_MSG);
- }
- xf86Info.consType = WSCONS;
- xf86Msg(X_PROBED, "Using wscons driver\n");
- }
- return fd;
-}
-
-#endif /* WSCONS_SUPPORT */
-
-void
-xf86CloseConsole()
-{
-#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)
- struct vt_mode VT;
-#endif
-
- if (ShareVTs) return;
-
- switch (xf86Info.consType)
- {
-#ifdef PCCONS_SUPPORT
- case PCCONS:
- ioctl (xf86Info.consoleFd, CONSOLE_X_MODE_OFF, 0);
- break;
-#endif /* PCCONS_SUPPORT */
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- case SYSCONS:
- case PCVT:
- ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT); /* Back to text mode */
- if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1)
- {
- VT.mode = VT_AUTO;
- ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* dflt vt handling */
- }
-#if !defined(OpenBSD) && !defined(USE_DEV_IO) && !defined(USE_I386_IOPL)
- if (ioctl(xf86Info.consoleFd, KDDISABIO, 0) < 0)
- {
- xf86FatalError("xf86CloseConsole: KDDISABIO failed (%s)",
- strerror(errno));
- }
-#endif
- if (initialVT != -1)
- ioctl(xf86Info.consoleFd, VT_ACTIVATE, initialVT);
- break;
-#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
-#ifdef WSCONS_SUPPORT
- case WSCONS:
- {
- int mode = WSDISPLAYIO_MODE_EMUL;
- ioctl(xf86Info.screenFd, WSDISPLAYIO_SMODE, &mode);
- break;
- }
-#endif
- }
-
- if (xf86Info.screenFd != xf86Info.consoleFd)
- {
- close(xf86Info.screenFd);
- close(xf86Info.consoleFd);
- if ((xf86Info.consoleFd = open("/dev/console",O_RDONLY,0)) <0)
- {
- xf86FatalError("xf86CloseConsole: Cannot open /dev/console (%s)",
- strerror(errno));
- }
- }
- close(xf86Info.consoleFd);
- if (devConsoleFd >= 0)
- close(devConsoleFd);
- return;
-}
-
-int
-xf86ProcessArgument(int argc, char *argv[], int i)
-{
- /*
- * Keep server from detaching from controlling tty. This is useful
- * when debugging (so the server can receive keyboard signals.
- */
- if (!strcmp(argv[i], "-keeptty"))
- {
- KeepTty = TRUE;
- return 1;
- }
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- if (!strcmp(argv[i], "-sharevts"))
- {
- ShareVTs = TRUE;
- return 1;
- }
- if ((argv[i][0] == 'v') && (argv[i][1] == 't'))
- {
- if (sscanf(argv[i], "vt%2d", &VTnum) == 0 ||
- VTnum < 1 || VTnum > 12)
- {
- UseMsg();
- VTnum = -1;
- return 0;
- }
- return 1;
- }
-#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
- return 0;
-}
-
-void
-xf86UseMsg()
-{
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- ErrorF("vtXX use the specified VT number (1-12)\n");
- ErrorF("-sharevts share VTs with another X server\n");
-#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
- ErrorF("-keeptty ");
- ErrorF("don't detach controlling tty (for debugging only)\n");
- return;
-}
+/*
+ * Copyright 1992 by Rich Murphey <Rich@Rice.edu>
+ * Copyright 1993 by David Wexelblat <dwex@goblin.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of Rich Murphey and David Wexelblat
+ * not be used in advertising or publicity pertaining to distribution of
+ * the software without specific, written prior permission. Rich Murphey and
+ * David Wexelblat make no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * RICH MURPHEY AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD TO
+ * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID WEXELBLAT BE LIABLE FOR
+ * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+
+#include "compiler.h"
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+#include <sys/utsname.h>
+#include <sys/ioctl.h>
+#include <stdlib.h>
+#include <errno.h>
+
+static Bool KeepTty = FALSE;
+static int devConsoleFd = -1;
+#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
+static int VTnum = -1;
+static int initialVT = -1;
+static Bool ShareVTs = FALSE;
+#endif
+
+#ifdef PCCONS_SUPPORT
+/* Stock 0.1 386bsd pccons console driver interface */
+#define PCCONS_CONSOLE_DEV1 "/dev/ttyv0"
+#define PCCONS_CONSOLE_DEV2 "/dev/vga"
+#define PCCONS_CONSOLE_MODE O_RDWR|O_NDELAY
+#endif
+
+#ifdef SYSCONS_SUPPORT
+/* The FreeBSD 1.1 version syscons driver uses /dev/ttyv0 */
+#define SYSCONS_CONSOLE_DEV1 "/dev/ttyv0"
+#define SYSCONS_CONSOLE_DEV2 "/dev/vga"
+#define SYSCONS_CONSOLE_MODE O_RDWR|O_NDELAY
+#endif
+
+#ifdef PCVT_SUPPORT
+/* Hellmuth Michaelis' pcvt driver */
+#ifndef __OpenBSD__
+# define PCVT_CONSOLE_DEV "/dev/ttyv0"
+#else
+# define PCVT_CONSOLE_DEV "/dev/ttyC0"
+#endif
+#define PCVT_CONSOLE_MODE O_RDWR|O_NDELAY
+#endif
+
+#if defined(WSCONS_SUPPORT) && defined(__NetBSD__)
+/* NetBSD's new console driver */
+#define WSCONS_PCVT_COMPAT_CONSOLE_DEV "/dev/ttyE0"
+#endif
+
+#ifdef __GLIBC__
+#define setpgrp setpgid
+#endif
+
+#define CHECK_DRIVER_MSG \
+ "Check your kernel's console driver configuration and /dev entries"
+
+static char *supported_drivers[] = {
+#ifdef PCCONS_SUPPORT
+ "pccons (with X support)",
+#endif
+#ifdef SYSCONS_SUPPORT
+ "syscons",
+#endif
+#ifdef PCVT_SUPPORT
+ "pcvt",
+#endif
+#ifdef WSCONS_SUPPORT
+ "wscons",
+#endif
+};
+
+
+/*
+ * Functions to probe for the existance of a supported console driver.
+ * Any function returns either a valid file descriptor (driver probed
+ * succesfully), -1 (driver not found), or uses FatalError() if the
+ * driver was found but proved to not support the required mode to run
+ * an X server.
+ */
+
+typedef int (*xf86ConsOpen_t)(void);
+
+#ifdef PCCONS_SUPPORT
+static int xf86OpenPccons(void);
+#endif /* PCCONS_SUPPORT */
+
+#ifdef SYSCONS_SUPPORT
+static int xf86OpenSyscons(void);
+#endif /* SYSCONS_SUPPORT */
+
+#ifdef PCVT_SUPPORT
+static int xf86OpenPcvt(void);
+#endif /* PCVT_SUPPORT */
+
+#ifdef WSCONS_SUPPORT
+static int xf86OpenWScons(void);
+#endif
+
+/*
+ * The sequence of the driver probes is important; start with the
+ * driver that is best distinguishable, and end with the most generic
+ * driver. (Otherwise, pcvt would also probe as syscons, and either
+ * pcvt or syscons might succesfully probe as pccons.)
+ */
+static xf86ConsOpen_t xf86ConsTab[] = {
+#ifdef PCVT_SUPPORT
+ xf86OpenPcvt,
+#endif
+#ifdef SYSCONS_SUPPORT
+ xf86OpenSyscons,
+#endif
+#ifdef PCCONS_SUPPORT
+ xf86OpenPccons,
+#endif
+#ifdef WSCONS_SUPPORT
+ xf86OpenWScons,
+#endif
+ (xf86ConsOpen_t)NULL
+};
+
+
+void
+xf86OpenConsole()
+{
+ int i, fd = -1;
+ xf86ConsOpen_t *driver;
+#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
+ int result;
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+ struct utsname uts;
+#endif
+ vtmode_t vtmode;
+#endif
+
+ if (serverGeneration == 1)
+ {
+ /* check if we are run with euid==0 */
+ if (geteuid() != 0)
+ {
+ FatalError("xf86OpenConsole: Server must be suid root");
+ }
+
+ if (!KeepTty)
+ {
+ /*
+ * detaching the controlling tty solves problems of kbd character
+ * loss. This is not interesting for CO driver, because it is
+ * exclusive.
+ */
+ setpgrp(0, getpid());
+ if ((i = open("/dev/tty",O_RDWR)) >= 0)
+ {
+ ioctl(i,TIOCNOTTY,(char *)0);
+ close(i);
+ }
+ }
+
+ /* detect which driver we are running on */
+ for (driver = xf86ConsTab; *driver; driver++)
+ {
+ if ((fd = (*driver)()) >= 0)
+ break;
+ }
+
+ /* Check that a supported console driver was found */
+ if (fd < 0)
+ {
+ char cons_drivers[80] = {0, };
+ for (i = 0; i < sizeof(supported_drivers) / sizeof(char *); i++)
+ {
+ if (i)
+ {
+ strcat(cons_drivers, ", ");
+ }
+ strcat(cons_drivers, supported_drivers[i]);
+ }
+ FatalError(
+ "%s: No console driver found\n\tSupported drivers: %s\n\t%s",
+ "xf86OpenConsole", cons_drivers, CHECK_DRIVER_MSG);
+ }
+#if 0 /* stdin is already closed in OsInit() */
+ fclose(stdin);
+#endif
+ xf86Info.consoleFd = fd;
+ xf86Info.screenFd = fd;
+
+ switch (xf86Info.consType)
+ {
+#ifdef PCCONS_SUPPORT
+ case PCCONS:
+ if (ioctl (xf86Info.consoleFd, CONSOLE_X_MODE_ON, 0) < 0)
+ {
+ FatalError("%s: CONSOLE_X_MODE_ON failed (%s)\n%s",
+ "xf86OpenConsole", strerror(errno),
+ CHECK_DRIVER_MSG);
+ }
+ /*
+ * Hack to prevent keyboard hanging when syslogd closes
+ * /dev/console
+ */
+ if ((devConsoleFd = open("/dev/console", O_WRONLY,0)) < 0)
+ {
+ xf86Msg(X_WARNING,
+ "xf86OpenConsole: couldn't open /dev/console (%s)\n",
+ strerror(errno));
+ }
+ break;
+#endif
+#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
+ case SYSCONS:
+ /* as of FreeBSD 2.2.8, syscons driver does not need the #1 vt
+ * switching anymore. Here we check for FreeBSD 3.1 and up.
+ * Add cases for other *BSD that behave the same.
+ */
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+ uname (&uts);
+ i = atof(uts.release) * 100;
+ if (i >= 310) goto acquire_vt;
+#endif
+ /* otherwise fall through */
+ case PCVT:
+#if !(defined(__NetBSD__) && (__NetBSD_Version__ >= 200000000))
+ /*
+ * First activate the #1 VT. This is a hack to allow a server
+ * to be started while another one is active. There should be
+ * a better way.
+ */
+ if (initialVT != 1) {
+
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, 1) != 0)
+ {
+ xf86Msg(X_WARNING,
+ "xf86OpenConsole: VT_ACTIVATE failed\n");
+ }
+ sleep(1);
+ }
+#endif
+acquire_vt:
+ if (!ShareVTs) {
+ /*
+ * now get the VT
+ */
+ SYSCALL(result =
+ ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno));
+ if (result != 0)
+ {
+ xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
+ }
+ SYSCALL(result =
+ ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno));
+ if (result != 0)
+ {
+ xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n");
+ }
+
+ signal(SIGUSR1, xf86VTRequest);
+
+ vtmode.mode = VT_PROCESS;
+ vtmode.relsig = SIGUSR1;
+ vtmode.acqsig = SIGUSR1;
+ vtmode.frsig = SIGUSR1;
+ if (ioctl(xf86Info.consoleFd, VT_SETMODE, &vtmode) < 0)
+ {
+ FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed");
+ }
+ #if !defined(USE_DEV_IO) && !defined(USE_I386_IOPL)
+ if (ioctl(xf86Info.consoleFd, KDENABIO, 0) < 0)
+ {
+ FatalError("xf86OpenConsole: KDENABIO failed (%s)",
+ strerror(errno));
+ }
+ #endif
+ if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0)
+ {
+ FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed");
+ }
+ } else { /* ShareVTs */
+ close(xf86Info.consoleFd);
+ }
+ break;
+#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
+#ifdef WSCONS_SUPPORT
+ case WSCONS:
+ /* Nothing to do */
+ break;
+#endif
+ }
+ }
+ else
+ {
+ /* serverGeneration != 1 */
+#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
+ if (!ShareVTs) if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT)
+ {
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0)
+ {
+ xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
+ }
+ }
+#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
+ }
+ return;
+}
+
+
+#ifdef PCCONS_SUPPORT
+
+static int
+xf86OpenPccons()
+{
+ int fd = -1;
+
+ if ((fd = open(PCCONS_CONSOLE_DEV1, PCCONS_CONSOLE_MODE, 0))
+ >= 0 ||
+ (fd = open(PCCONS_CONSOLE_DEV2, PCCONS_CONSOLE_MODE, 0))
+ >= 0)
+ {
+ if (ioctl(fd, CONSOLE_X_MODE_OFF, 0) < 0)
+ {
+ FatalError(
+ "%s: CONSOLE_X_MODE_OFF failed (%s)\n%s\n%s",
+ "xf86OpenPccons",
+ strerror(errno),
+ "Was expecting pccons driver with X support",
+ CHECK_DRIVER_MSG);
+ }
+ xf86Info.consType = PCCONS;
+ xf86Msg(X_PROBED, "Using pccons driver with X support\n");
+ }
+ return fd;
+}
+
+#endif /* PCCONS_SUPPORT */
+
+#ifdef SYSCONS_SUPPORT
+
+static int
+xf86OpenSyscons()
+{
+ int fd = -1;
+ vtmode_t vtmode;
+ char vtname[12];
+ struct stat status;
+ long syscons_version;
+ MessageType from;
+
+ /* Check for syscons */
+ if ((fd = open(SYSCONS_CONSOLE_DEV1, SYSCONS_CONSOLE_MODE, 0)) >= 0
+ || (fd = open(SYSCONS_CONSOLE_DEV2, SYSCONS_CONSOLE_MODE, 0)) >= 0)
+ {
+ if (ioctl(fd, VT_GETMODE, &vtmode) >= 0)
+ {
+ /* Get syscons version */
+ if (ioctl(fd, CONS_GETVERS, &syscons_version) < 0)
+ {
+ syscons_version = 0;
+ }
+
+ xf86Info.vtno = VTnum;
+ from = X_CMDLINE;
+
+#ifdef VT_GETACTIVE
+ if (ioctl(fd, VT_GETACTIVE, &initialVT) < 0)
+ initialVT = -1;
+#endif
+ if (ShareVTs)
+ xf86Info.vtno = initialVT;
+
+ if (xf86Info.vtno == -1)
+ {
+ /*
+ * For old syscons versions (<0x100), VT_OPENQRY returns
+ * the current VT rather than the next free VT. In this
+ * case, the server gets started on the current VT instead
+ * of the next free VT.
+ */
+
+#if 0
+ /* check for the fixed VT_OPENQRY */
+ if (syscons_version >= 0x100)
+ {
+#endif
+ if (ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0)
+ {
+ /* No free VTs */
+ xf86Info.vtno = -1;
+ }
+#if 0
+ }
+#endif
+
+ if (xf86Info.vtno == -1)
+ {
+ /*
+ * All VTs are in use. If initialVT was found, use it.
+ * Otherwise, if stdin is a VT, use that one.
+ * XXX stdin is already closed, so this won't work.
+ */
+ if (initialVT != -1)
+ {
+ xf86Info.vtno = initialVT;
+ }
+ else if ((fstat(0, &status) >= 0)
+ && S_ISCHR(status.st_mode)
+ && (ioctl(0, VT_GETMODE, &vtmode) >= 0))
+ {
+ /* stdin is a VT */
+ xf86Info.vtno = minor(status.st_rdev) + 1;
+ }
+ else
+ {
+ if (syscons_version >= 0x100)
+ {
+ FatalError("%s: Cannot find a free VT",
+ "xf86OpenSyscons");
+ }
+ /* Should no longer reach here */
+ FatalError("%s: %s %s\n\t%s %s",
+ "xf86OpenSyscons",
+ "syscons versions prior to 1.0 require",
+ "either the",
+ "server's stdin be a VT",
+ "or the use of the vtxx server option");
+ }
+ }
+ from = X_PROBED;
+ }
+
+ close(fd);
+#ifndef __OpenBSD__
+ sprintf(vtname, "/dev/ttyv%01x", xf86Info.vtno - 1);
+#else
+ sprintf(vtname, "/dev/ttyC%01x", xf86Info.vtno - 1);
+#endif
+ if ((fd = open(vtname, SYSCONS_CONSOLE_MODE, 0)) < 0)
+ {
+ FatalError("xf86OpenSyscons: Cannot open %s (%s)",
+ vtname, strerror(errno));
+ }
+ if (ioctl(fd, VT_GETMODE, &vtmode) < 0)
+ {
+ FatalError("xf86OpenSyscons: VT_GETMODE failed");
+ }
+ xf86Info.consType = SYSCONS;
+ xf86Msg(X_PROBED, "Using syscons driver with X support");
+ if (syscons_version >= 0x100)
+ {
+ xf86ErrorF(" (version %ld.%ld)\n", syscons_version >> 8,
+ syscons_version & 0xFF);
+ }
+ else
+ {
+ xf86ErrorF(" (version 0.x)\n");
+ }
+ xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno);
+ }
+ else
+ {
+ /* VT_GETMODE failed, probably not syscons */
+ close(fd);
+ fd = -1;
+ }
+ }
+ return fd;
+}
+
+#endif /* SYSCONS_SUPPORT */
+
+
+#ifdef PCVT_SUPPORT
+
+static int
+xf86OpenPcvt()
+{
+ /* This looks much like syscons, since pcvt is API compatible */
+ int fd = -1;
+ vtmode_t vtmode;
+ char vtname[12], *vtprefix;
+ struct stat status;
+ struct pcvtid pcvt_version;
+
+#ifndef __OpenBSD__
+ vtprefix = "/dev/ttyv";
+#else
+ vtprefix = "/dev/ttyC";
+#endif
+
+ fd = open(PCVT_CONSOLE_DEV, PCVT_CONSOLE_MODE, 0);
+#ifdef WSCONS_PCVT_COMPAT_CONSOLE_DEV
+ if (fd < 0)
+ {
+ fd = open(WSCONS_PCVT_COMPAT_CONSOLE_DEV, PCVT_CONSOLE_MODE, 0);
+ vtprefix = "/dev/ttyE";
+ }
+#endif
+ if (fd >= 0)
+ {
+ if (ioctl(fd, VGAPCVTID, &pcvt_version) >= 0)
+ {
+ if(ioctl(fd, VT_GETMODE, &vtmode) < 0)
+ {
+ FatalError("%s: VT_GETMODE failed\n%s%s\n%s",
+ "xf86OpenPcvt",
+ "Found pcvt driver but X11 seems to be",
+ " not supported.", CHECK_DRIVER_MSG);
+ }
+
+ xf86Info.vtno = VTnum;
+
+ if (ioctl(fd, VT_GETACTIVE, &initialVT) < 0)
+ initialVT = -1;
+
+ if (xf86Info.vtno == -1)
+ {
+ if (ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0)
+ {
+ /* No free VTs */
+ xf86Info.vtno = -1;
+ }
+
+ if (xf86Info.vtno == -1)
+ {
+ /*
+ * All VTs are in use. If initialVT was found, use it.
+ * Otherwise, if stdin is a VT, use that one.
+ * XXX stdin is already closed, so this won't work.
+ */
+ if (initialVT != -1)
+ {
+ xf86Info.vtno = initialVT;
+ }
+ else if ((fstat(0, &status) >= 0)
+ && S_ISCHR(status.st_mode)
+ && (ioctl(0, VT_GETMODE, &vtmode) >= 0))
+ {
+ /* stdin is a VT */
+ xf86Info.vtno = minor(status.st_rdev) + 1;
+ }
+ else
+ {
+ FatalError("%s: Cannot find a free VT",
+ "xf86OpenPcvt");
+ }
+ }
+ }
+
+ close(fd);
+ sprintf(vtname, "%s%01x", vtprefix, xf86Info.vtno - 1);
+ if ((fd = open(vtname, PCVT_CONSOLE_MODE, 0)) < 0)
+ {
+ ErrorF("xf86OpenPcvt: Cannot open %s (%s)",
+ vtname, strerror(errno));
+ xf86Info.vtno = initialVT;
+ sprintf(vtname, "%s%01x", vtprefix, xf86Info.vtno - 1);
+ if ((fd = open(vtname, PCVT_CONSOLE_MODE, 0)) < 0) {
+ FatalError("xf86OpenPcvt: Cannot open %s (%s)",
+ vtname, strerror(errno));
+ }
+ }
+ if (ioctl(fd, VT_GETMODE, &vtmode) < 0)
+ {
+ FatalError("xf86OpenPcvt: VT_GETMODE failed");
+ }
+ xf86Info.consType = PCVT;
+#ifdef WSCONS_SUPPORT
+ xf86Msg(X_PROBED,
+ "Using wscons driver on %s in pcvt compatibility mode "
+ "(version %d.%d)\n", vtname,
+ pcvt_version.rmajor, pcvt_version.rminor);
+#else
+ xf86Msg(X_PROBED, "Using pcvt driver (version %d.%d)\n",
+ pcvt_version.rmajor, pcvt_version.rminor);
+#endif
+ }
+ else
+ {
+ /* Not pcvt */
+ close(fd);
+ fd = -1;
+ }
+ }
+ return fd;
+}
+
+#endif /* PCVT_SUPPORT */
+
+#ifdef WSCONS_SUPPORT
+
+static int
+xf86OpenWScons()
+{
+ int fd = -1;
+ int mode = WSDISPLAYIO_MODE_MAPPED;
+ int i;
+ char ttyname[16];
+
+ /* XXX Is this ok? */
+ for (i = 0; i < 8; i++) {
+#if defined(__NetBSD__)
+ sprintf(ttyname, "/dev/ttyE%d", i);
+#elif defined(__OpenBSD__)
+ sprintf(ttyname, "/dev/ttyC%x", i);
+#endif
+ if ((fd = open(ttyname, 2)) != -1)
+ break;
+ }
+ if (fd != -1) {
+ if (ioctl(fd, WSDISPLAYIO_SMODE, &mode) < 0) {
+ FatalError("%s: WSDISPLAYIO_MODE_MAPPED failed (%s)\n%s",
+ "xf86OpenConsole", strerror(errno),
+ CHECK_DRIVER_MSG);
+ }
+ xf86Info.consType = WSCONS;
+ xf86Msg(X_PROBED, "Using wscons driver\n");
+ }
+ return fd;
+}
+
+#endif /* WSCONS_SUPPORT */
+
+void
+xf86CloseConsole()
+{
+#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)
+ struct vt_mode VT;
+#endif
+
+ if (ShareVTs) return;
+
+ switch (xf86Info.consType)
+ {
+#ifdef PCCONS_SUPPORT
+ case PCCONS:
+ ioctl (xf86Info.consoleFd, CONSOLE_X_MODE_OFF, 0);
+ break;
+#endif /* PCCONS_SUPPORT */
+#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
+ case SYSCONS:
+ case PCVT:
+ ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT); /* Back to text mode */
+ if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1)
+ {
+ VT.mode = VT_AUTO;
+ ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* dflt vt handling */
+ }
+#if !defined(OpenBSD) && !defined(USE_DEV_IO) && !defined(USE_I386_IOPL)
+ if (ioctl(xf86Info.consoleFd, KDDISABIO, 0) < 0)
+ {
+ xf86FatalError("xf86CloseConsole: KDDISABIO failed (%s)",
+ strerror(errno));
+ }
+#endif
+ if (initialVT != -1)
+ ioctl(xf86Info.consoleFd, VT_ACTIVATE, initialVT);
+ break;
+#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
+#ifdef WSCONS_SUPPORT
+ case WSCONS:
+ {
+ int mode = WSDISPLAYIO_MODE_EMUL;
+ ioctl(xf86Info.screenFd, WSDISPLAYIO_SMODE, &mode);
+ break;
+ }
+#endif
+ }
+
+ if (xf86Info.screenFd != xf86Info.consoleFd)
+ {
+ close(xf86Info.screenFd);
+ close(xf86Info.consoleFd);
+ if ((xf86Info.consoleFd = open("/dev/console",O_RDONLY,0)) <0)
+ {
+ xf86FatalError("xf86CloseConsole: Cannot open /dev/console (%s)",
+ strerror(errno));
+ }
+ }
+ close(xf86Info.consoleFd);
+ if (devConsoleFd >= 0)
+ close(devConsoleFd);
+ return;
+}
+
+int
+xf86ProcessArgument(int argc, char *argv[], int i)
+{
+ /*
+ * Keep server from detaching from controlling tty. This is useful
+ * when debugging (so the server can receive keyboard signals.
+ */
+ if (!strcmp(argv[i], "-keeptty"))
+ {
+ KeepTty = TRUE;
+ return 1;
+ }
+#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
+ if (!strcmp(argv[i], "-sharevts"))
+ {
+ ShareVTs = TRUE;
+ return 1;
+ }
+ if ((argv[i][0] == 'v') && (argv[i][1] == 't'))
+ {
+ if (sscanf(argv[i], "vt%2d", &VTnum) == 0 ||
+ VTnum < 1 || VTnum > 12)
+ {
+ UseMsg();
+ VTnum = -1;
+ return 0;
+ }
+ return 1;
+ }
+#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
+ return 0;
+}
+
+void
+xf86UseMsg()
+{
+#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
+ ErrorF("vtXX use the specified VT number (1-12)\n");
+ ErrorF("-sharevts share VTs with another X server\n");
+#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
+ ErrorF("-keeptty ");
+ ErrorF("don't detach controlling tty (for debugging only)\n");
+ return;
+}
diff --git a/xorg-server/hw/xfree86/os-support/xf86_OSlib.h b/xorg-server/hw/xfree86/os-support/xf86_OSlib.h
index 3b646da70..147a201ee 100644
--- a/xorg-server/hw/xfree86/os-support/xf86_OSlib.h
+++ b/xorg-server/hw/xfree86/os-support/xf86_OSlib.h
@@ -264,14 +264,6 @@
# define CONSOLE_X_MODE_OFF PCCONIOCCOOK
# define CONSOLE_X_BELL PCCONIOCBEEP
# else /* __bsdi__ */
-# if defined(__OpenBSD__)
-# ifdef PCCONS_SUPPORT
-# include <machine/pccons.h>
-# undef CONSOLE_X_MODE_ON
-# undef CONSOLE_X_MODE_OFF
-# undef CONSOLE_X_BELL
-# endif
-# endif
# ifdef SYSCONS_SUPPORT
# define COMPAT_SYSCONS
# if defined(__NetBSD__) || defined(__OpenBSD__)
diff --git a/xorg-server/hw/xquartz/bundle/Info.plist.cpp b/xorg-server/hw/xquartz/bundle/Info.plist.cpp
index 2e568ffeb..0e98218be 100644
--- a/xorg-server/hw/xquartz/bundle/Info.plist.cpp
+++ b/xorg-server/hw/xquartz/bundle/Info.plist.cpp
@@ -34,6 +34,8 @@
<key>SUFeedURL</key>
<string>http://xquartz.macosforge.org/downloads/sparkle/release.xml</string>
#endif
+ <key>LSApplicationCategoryType</key>
+ <string>public.app-category.utilities</string>
<key>NSHumanReadableCopyright</key>
<string>© 2003-2011 Apple Inc.
© 2003 XFree86 Project, Inc.
diff --git a/xorg-server/hw/xquartz/bundle/Resources/French.lproj/locversion.plist b/xorg-server/hw/xquartz/bundle/Resources/French.lproj/locversion.plist
index 80a63fd48..1af1256c3 100644
--- a/xorg-server/hw/xquartz/bundle/Resources/French.lproj/locversion.plist
+++ b/xorg-server/hw/xquartz/bundle/Resources/French.lproj/locversion.plist
@@ -1,14 +1,14 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>LprojCompatibleVersion</key>
- <string>98</string>
- <key>LprojLocale</key>
- <string>fr</string>
- <key>LprojRevisionLevel</key>
- <string>1</string>
- <key>LprojVersion</key>
- <string>98</string>
-</dict>
-</plist>
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>LprojCompatibleVersion</key>
+ <string>101</string>
+ <key>LprojLocale</key>
+ <string>fr</string>
+ <key>LprojRevisionLevel</key>
+ <string>1</string>
+ <key>LprojVersion</key>
+ <string>101</string>
+</dict>
+</plist>
diff --git a/xorg-server/hw/xquartz/bundle/Resources/French.lproj/main.nib/designable.nib b/xorg-server/hw/xquartz/bundle/Resources/French.lproj/main.nib/designable.nib
index 7c35a1a60..cec363241 100644
--- a/xorg-server/hw/xquartz/bundle/Resources/French.lproj/main.nib/designable.nib
+++ b/xorg-server/hw/xquartz/bundle/Resources/French.lproj/main.nib/designable.nib
@@ -1,3616 +1,3767 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
- <data>
- <int key="IBDocument.SystemTarget">1040</int>
- <string key="IBDocument.SystemVersion">11A194b</string>
- <string key="IBDocument.InterfaceBuilderVersion">787</string>
- <string key="IBDocument.AppKitVersion">1079</string>
- <string key="IBDocument.HIToolboxVersion">502.00</string>
- <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
- <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="NS.object.0">787</string>
- </object>
- <array class="NSMutableArray" key="IBDocument.EditedObjectIDs"/>
- <array key="IBDocument.PluginDependencies">
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- </array>
- <dictionary class="NSMutableDictionary" key="IBDocument.Metadata"/>
- <array class="NSMutableArray" key="IBDocument.RootObjects" id="904585544">
- <object class="NSCustomObject" id="815810918">
- <object class="NSMutableString" key="NSClassName">
- <characters key="NS.bytes">NSApplication</characters>
- </object>
- </object>
- <object class="NSCustomObject" id="941939442">
- <string key="NSClassName">FirstResponder</string>
- </object>
- <object class="NSCustomObject" id="951368722">
- <string key="NSClassName">NSApplication</string>
- </object>
- <object class="NSMenu" id="524015605">
- <string key="NSTitle">MainMenu</string>
- <array class="NSMutableArray" key="NSMenuItems">
- <object class="NSMenuItem" id="365880285">
- <reference key="NSMenu" ref="524015605"/>
- <string key="NSTitle">X11</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <object class="NSCustomResource" key="NSOnImage" id="531645050">
- <string key="NSClassName">NSImage</string>
- <string key="NSResourceName">NSMenuCheckmark</string>
- </object>
- <object class="NSCustomResource" key="NSMixedImage" id="351811234">
- <string key="NSClassName">NSImage</string>
- <string key="NSResourceName">NSMenuMixedState</string>
- </object>
- <string key="NSAction">submenuAction:</string>
- <object class="NSMenu" key="NSSubmenu" id="576521955">
- <string key="NSTitle">X11</string>
- <array class="NSMutableArray" key="NSMenuItems">
- <object class="NSMenuItem" id="139290918">
- <reference key="NSMenu" ref="576521955"/>
- <string key="NSTitle">À propos d’X11</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="531645050"/>
- <reference key="NSMixedImage" ref="351811234"/>
- </object>
- <object class="NSMenuItem" id="386173216">
- <reference key="NSMenu" ref="576521955"/>
- <string key="NSTitle">Préférences…</string>
- <string key="NSKeyEquiv">,</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="531645050"/>
- <reference key="NSMixedImage" ref="351811234"/>
- </object>
- <object class="NSMenuItem" id="272876017">
- <reference key="NSMenu" ref="576521955"/>
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="531645050"/>
- <reference key="NSMixedImage" ref="351811234"/>
- </object>
- <object class="NSMenuItem" id="32285361">
- <reference key="NSMenu" ref="576521955"/>
- <string key="NSTitle">Services</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="531645050"/>
- <reference key="NSMixedImage" ref="351811234"/>
- <string key="NSAction">submenuAction:</string>
- <object class="NSMenu" key="NSSubmenu" id="821388474">
- <object class="NSMutableString" key="NSTitle">
- <characters key="NS.bytes">Services</characters>
- </object>
- <array class="NSMutableArray" key="NSMenuItems"/>
- <string key="NSName">_NSServicesMenu</string>
- </object>
- </object>
- <object class="NSMenuItem" id="431301145">
- <reference key="NSMenu" ref="576521955"/>
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="531645050"/>
- <reference key="NSMixedImage" ref="351811234"/>
- </object>
- <object class="NSMenuItem" id="6876565">
- <reference key="NSMenu" ref="576521955"/>
- <string key="NSTitle">Basculer en mode plein écran</string>
- <string key="NSKeyEquiv">a</string>
- <int key="NSKeyEquivModMask">1572864</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="531645050"/>
- <reference key="NSMixedImage" ref="351811234"/>
- </object>
- <object class="NSMenuItem" id="479677589">
- <reference key="NSMenu" ref="576521955"/>
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="531645050"/>
- <reference key="NSMixedImage" ref="351811234"/>
- </object>
- <object class="NSMenuItem" id="301008465">
- <reference key="NSMenu" ref="576521955"/>
- <string key="NSTitle">Masquer X11</string>
- <string key="NSKeyEquiv">h</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="531645050"/>
- <reference key="NSMixedImage" ref="351811234"/>
- <int key="NSTag">42</int>
- </object>
- <object class="NSMenuItem" id="206802571">
- <reference key="NSMenu" ref="576521955"/>
- <string key="NSTitle">Masquer les autres</string>
- <string key="NSKeyEquiv">h</string>
- <int key="NSKeyEquivModMask">1572864</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="531645050"/>
- <reference key="NSMixedImage" ref="351811234"/>
- </object>
- <object class="NSMenuItem" id="1023546148">
- <reference key="NSMenu" ref="576521955"/>
- <string key="NSTitle">Tout afficher</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="531645050"/>
- <reference key="NSMixedImage" ref="351811234"/>
- <int key="NSTag">42</int>
- </object>
- <object class="NSMenuItem" id="848095279">
- <reference key="NSMenu" ref="576521955"/>
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="531645050"/>
- <reference key="NSMixedImage" ref="351811234"/>
- </object>
- <object class="NSMenuItem" id="274138642">
- <reference key="NSMenu" ref="576521955"/>
- <string key="NSTitle">Quitter X11</string>
- <string key="NSKeyEquiv">q</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="531645050"/>
- <reference key="NSMixedImage" ref="351811234"/>
- </object>
- </array>
- <string key="NSName">_NSAppleMenu</string>
- </object>
- </object>
- <object class="NSMenuItem" id="868031522">
- <reference key="NSMenu" ref="524015605"/>
- <string key="NSTitle">Applications</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="531645050"/>
- <reference key="NSMixedImage" ref="351811234"/>
- <string key="NSAction">submenuAction:</string>
- <object class="NSMenu" key="NSSubmenu" id="981161348">
- <string key="NSTitle">Applications</string>
- <array class="NSMutableArray" key="NSMenuItems">
- <object class="NSMenuItem" id="390088328">
- <reference key="NSMenu" ref="981161348"/>
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="531645050"/>
- <reference key="NSMixedImage" ref="351811234"/>
- </object>
- <object class="NSMenuItem" id="1065386165">
- <reference key="NSMenu" ref="981161348"/>
- <string key="NSTitle">Personnaliser…</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="531645050"/>
- <reference key="NSMixedImage" ref="351811234"/>
- </object>
- </array>
- </object>
- </object>
- <object class="NSMenuItem" id="200491363">
- <reference key="NSMenu" ref="524015605"/>
- <string key="NSTitle">Édition</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="531645050"/>
- <reference key="NSMixedImage" ref="351811234"/>
- <string key="NSAction">submenuAction:</string>
- <object class="NSMenu" key="NSSubmenu" id="526778998">
- <string key="NSTitle">Édition</string>
- <array class="NSMutableArray" key="NSMenuItems">
- <object class="NSMenuItem" id="185296989">
- <reference key="NSMenu" ref="526778998"/>
- <string key="NSTitle">Copier</string>
- <string key="NSKeyEquiv">c</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="531645050"/>
- <reference key="NSMixedImage" ref="351811234"/>
- </object>
- </array>
- </object>
- </object>
- <object class="NSMenuItem" id="931553638">
- <reference key="NSMenu" ref="524015605"/>
- <string key="NSTitle">Fenêtre</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="531645050"/>
- <reference key="NSMixedImage" ref="351811234"/>
- <string key="NSAction">submenuAction:</string>
- <object class="NSMenu" key="NSSubmenu" id="96874957">
- <string key="NSTitle">Fenêtre</string>
- <array class="NSMutableArray" key="NSMenuItems">
- <object class="NSMenuItem" id="984461797">
- <reference key="NSMenu" ref="96874957"/>
- <string key="NSTitle">Fermer</string>
- <string key="NSKeyEquiv">w</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="531645050"/>
- <reference key="NSMixedImage" ref="351811234"/>
- </object>
- <object class="NSMenuItem" id="677652931">
- <reference key="NSMenu" ref="96874957"/>
- <string key="NSTitle">Placer dans le Dock</string>
- <string key="NSKeyEquiv">m</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="531645050"/>
- <reference key="NSMixedImage" ref="351811234"/>
- </object>
- <object class="NSMenuItem" id="1066447520">
- <reference key="NSMenu" ref="96874957"/>
- <string key="NSTitle">Réduire/agrandir</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="531645050"/>
- <reference key="NSMixedImage" ref="351811234"/>
- </object>
- <object class="NSMenuItem" id="280172320">
- <reference key="NSMenu" ref="96874957"/>
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="531645050"/>
- <reference key="NSMixedImage" ref="351811234"/>
- </object>
- <object class="NSMenuItem" id="1036389925">
- <reference key="NSMenu" ref="96874957"/>
- <string key="NSTitle">Faire défiler les fenêtres</string>
- <string key="NSKeyEquiv">`</string>
- <int key="NSKeyEquivModMask">1048840</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="531645050"/>
- <reference key="NSMixedImage" ref="351811234"/>
- </object>
- <object class="NSMenuItem" id="369641893">
- <reference key="NSMenu" ref="96874957"/>
- <string key="NSTitle">Faire défiler les fenêtres en sens inverse</string>
- <string key="NSKeyEquiv">`</string>
- <int key="NSKeyEquivModMask">1179648</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="531645050"/>
- <reference key="NSMixedImage" ref="351811234"/>
- </object>
- <object class="NSMenuItem" id="155085383">
- <reference key="NSMenu" ref="96874957"/>
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="531645050"/>
- <reference key="NSMixedImage" ref="351811234"/>
- </object>
- <object class="NSMenuItem" id="276216762">
- <reference key="NSMenu" ref="96874957"/>
- <string key="NSTitle">Tout ramener au premier plan</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="531645050"/>
- <reference key="NSMixedImage" ref="351811234"/>
- </object>
- </array>
- <string key="NSName">_NSWindowsMenu</string>
- </object>
- </object>
- <object class="NSMenuItem" id="551174276">
- <reference key="NSMenu" ref="524015605"/>
- <string key="NSTitle">Aide</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="531645050"/>
- <reference key="NSMixedImage" ref="351811234"/>
- <string key="NSAction">submenuAction:</string>
- <object class="NSMenu" key="NSSubmenu" id="511848303">
- <string key="NSTitle">Aide</string>
- <array class="NSMutableArray" key="NSMenuItems">
- <object class="NSMenuItem" id="504984881">
- <reference key="NSMenu" ref="511848303"/>
- <string key="NSTitle">Aide X11</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="531645050"/>
- <reference key="NSMixedImage" ref="351811234"/>
- </object>
- </array>
- </object>
- </object>
- </array>
- <string key="NSName">_NSMainMenu</string>
- </object>
- <object class="NSCustomObject" id="485884620">
- <string key="NSClassName">X11Controller</string>
- </object>
- <object class="NSWindowTemplate" id="124913468">
- <int key="NSWindowStyleMask">3</int>
- <int key="NSWindowBacking">2</int>
- <string key="NSWindowRect">{{414, 417}, {582, 329}}</string>
- <int key="NSWTFlags">1350041600</int>
- <string key="NSWindowTitle">Préférences d’X11</string>
- <string key="NSWindowClass">NSPanel</string>
- <object class="NSMutableString" key="NSViewClass">
- <characters key="NS.bytes">View</characters>
- </object>
- <nil key="NSUserInterfaceItemIdentifier"/>
- <string key="NSWindowContentMaxSize">{1.7976931348623157e+308, 1.7976931348623157e+308}</string>
- <string key="NSWindowContentMinSize">{320, 240}</string>
- <object class="NSView" key="NSWindowView" id="941366957">
- <nil key="NSNextResponder"/>
- <int key="NSvFlags">256</int>
- <array class="NSMutableArray" key="NSSubviews">
- <object class="NSTabView" id="448510093">
- <reference key="NSNextResponder" ref="941366957"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{13, 10}, {556, 313}}</string>
- <reference key="NSSuperview" ref="941366957"/>
- <array class="NSMutableArray" key="NSTabViewItems">
- <object class="NSTabViewItem" id="287591690">
- <object class="NSMutableString" key="NSIdentifier">
- <characters key="NS.bytes">1</characters>
- </object>
- <object class="NSView" key="NSView" id="596750588">
- <nil key="NSNextResponder"/>
- <int key="NSvFlags">256</int>
- <array class="NSMutableArray" key="NSSubviews">
- <object class="NSButton" id="119157981">
- <reference key="NSNextResponder" ref="596750588"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{67, 235}, {402, 18}}</string>
- <reference key="NSSuperview" ref="596750588"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="990762273">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">0</int>
- <string key="NSContents">Émuler une souris à trois boutons</string>
- <object class="NSFont" key="NSSupport" id="463863101">
- <string key="NSName">LucidaGrande</string>
- <double key="NSSize">13</double>
- <int key="NSfFlags">1044</int>
- </object>
- <reference key="NSControlView" ref="119157981"/>
- <int key="NSButtonFlags">1211912703</int>
- <int key="NSButtonFlags2">2</int>
- <object class="NSCustomResource" key="NSNormalImage" id="831743691">
- <string key="NSClassName">NSImage</string>
- <string key="NSResourceName">NSSwitch</string>
- </object>
- <object class="NSButtonImageSource" key="NSAlternateImage" id="391434389">
- <string key="NSImageName">NSSwitch</string>
- </object>
- <string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent"/>
- <int key="NSPeriodicDelay">200</int>
- <int key="NSPeriodicInterval">25</int>
- </object>
- </object>
- <object class="NSTextField" id="443008216">
- <reference key="NSNextResponder" ref="596750588"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{85, 64}, {385, 42}}</string>
- <reference key="NSSuperview" ref="596750588"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSTextFieldCell" key="NSCell" id="391919450">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">4194304</int>
- <string key="NSContents">Quand cette option est activée, les touches équivalentes de la barre des menus peuvent perturber les applications X11 qui utilisent le modificateur d’instructions virtuelles.</string>
- <object class="NSFont" key="NSSupport" id="26">
- <string key="NSName">LucidaGrande</string>
- <double key="NSSize">11</double>
- <int key="NSfFlags">3100</int>
- </object>
- <string key="NSPlaceholderString"/>
- <reference key="NSControlView" ref="443008216"/>
- <object class="NSColor" key="NSBackgroundColor" id="57160303">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">controlColor</string>
- <object class="NSColor" key="NSColor" id="590688762">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
- </object>
- </object>
- <object class="NSColor" key="NSTextColor" id="930815747">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">controlTextColor</string>
- <object class="NSColor" key="NSColor" id="214098874">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MAA</bytes>
- </object>
- </object>
- </object>
- </object>
- <object class="NSTextField" id="282885445">
- <reference key="NSNextResponder" ref="596750588"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{85, 195}, {385, 34}}</string>
- <reference key="NSSuperview" ref="596750588"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSTextFieldCell" key="NSCell" id="649334366">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">4194304</int>
- <string type="base64-UTF8" key="NSContents">TWFpbnRlbmV6IGxhIHRvdWNoZSBPcHRpb24gb3UgQ29tbWFuZGUgZW5mb25jw6llIHRvdXQgZW4gY2xp
-cXVhbnQgcG91ciBhY3RpdmVyIGxlIGJvdXRvbiBkcm9pdCBvdSBjZW50cmFsIGRlIGxhIHNvdXJpcy4K
-A</string>
- <reference key="NSSupport" ref="26"/>
- <string key="NSPlaceholderString"/>
- <reference key="NSControlView" ref="282885445"/>
- <reference key="NSBackgroundColor" ref="57160303"/>
- <reference key="NSTextColor" ref="930815747"/>
- </object>
- </object>
- <object class="NSButton" id="842100515">
- <reference key="NSNextResponder" ref="596750588"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{67, 112}, {402, 18}}</string>
- <reference key="NSSuperview" ref="596750588"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="940564599">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">0</int>
- <string key="NSContents">Activer les touches équivalentes sous X11</string>
- <reference key="NSSupport" ref="463863101"/>
- <reference key="NSControlView" ref="842100515"/>
- <int key="NSButtonFlags">1211912703</int>
- <int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="831743691"/>
- <reference key="NSAlternateImage" ref="391434389"/>
- <string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent"/>
- <int key="NSPeriodicDelay">200</int>
- <int key="NSPeriodicInterval">25</int>
- </object>
- </object>
- <object class="NSTextField" id="31160162">
- <reference key="NSNextResponder" ref="596750588"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{85, 136}, {385, 29}}</string>
- <reference key="NSSuperview" ref="596750588"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSTextFieldCell" key="NSCell" id="666057093">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">4194304</int>
- <string key="NSContents">Autorise les modifications du menu d’entrée pour remplacer la disposition des touches du clavier X11.</string>
- <reference key="NSSupport" ref="26"/>
- <string key="NSPlaceholderString"/>
- <reference key="NSControlView" ref="31160162"/>
- <reference key="NSBackgroundColor" ref="57160303"/>
- <reference key="NSTextColor" ref="930815747"/>
- </object>
- </object>
- <object class="NSButton" id="179949713">
- <reference key="NSNextResponder" ref="596750588"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{67, 171}, {402, 18}}</string>
- <reference key="NSSuperview" ref="596750588"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="967619578">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">0</int>
- <string key="NSContents">Utiliser la disposition des touches du clavier du système</string>
- <reference key="NSSupport" ref="463863101"/>
- <reference key="NSControlView" ref="179949713"/>
- <int key="NSButtonFlags">1211912703</int>
- <int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="831743691"/>
- <reference key="NSAlternateImage" ref="391434389"/>
- <string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent"/>
- <int key="NSPeriodicDelay">200</int>
- <int key="NSPeriodicInterval">25</int>
- </object>
- </object>
- <object class="NSTextField" id="278155937">
- <reference key="NSNextResponder" ref="596750588"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{85, 6}, {385, 28}}</string>
- <reference key="NSSuperview" ref="596750588"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSTextFieldCell" key="NSCell" id="617441821">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">4194304</int>
- <string key="NSContents">Une fois activées, les touches option envoient les symboles Alt_L et Alt_R au lieu de Mode_switch.</string>
- <reference key="NSSupport" ref="26"/>
- <reference key="NSControlView" ref="278155937"/>
- <reference key="NSBackgroundColor" ref="57160303"/>
- <reference key="NSTextColor" ref="930815747"/>
- </object>
- </object>
- <object class="NSButton" id="406291430">
- <reference key="NSNextResponder" ref="596750588"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{67, 40}, {402, 18}}</string>
- <reference key="NSSuperview" ref="596750588"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="67728988">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">0</int>
- <string key="NSContents">Les touches option envoient Alt_L et Alt_R</string>
- <reference key="NSSupport" ref="463863101"/>
- <reference key="NSControlView" ref="406291430"/>
- <int key="NSButtonFlags">1211912703</int>
- <int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="831743691"/>
- <reference key="NSAlternateImage" ref="391434389"/>
- <string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent"/>
- <int key="NSPeriodicDelay">200</int>
- <int key="NSPeriodicInterval">25</int>
- </object>
- </object>
- </array>
- <string key="NSFrame">{{10, 33}, {536, 267}}</string>
- </object>
- <string key="NSLabel">Entrée</string>
- <reference key="NSColor" ref="57160303"/>
- <reference key="NSTabView" ref="448510093"/>
- </object>
- <object class="NSTabViewItem" id="960678392">
- <object class="NSMutableString" key="NSIdentifier">
- <characters key="NS.bytes">2</characters>
- </object>
- <object class="NSView" key="NSView" id="515308735">
- <nil key="NSNextResponder"/>
- <int key="NSvFlags">256</int>
- <array class="NSMutableArray" key="NSSubviews">
- <object class="NSButton" id="418227126">
- <reference key="NSNextResponder" ref="515308735"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{34, 84}, {402, 18}}</string>
- <reference key="NSSuperview" ref="515308735"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="1016069354">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">0</int>
- <string key="NSContents">Utiliser l’effet d’avertissement du système</string>
- <reference key="NSSupport" ref="463863101"/>
- <reference key="NSControlView" ref="418227126"/>
- <int key="NSButtonFlags">1211912703</int>
- <int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="831743691"/>
- <reference key="NSAlternateImage" ref="391434389"/>
- <string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent"/>
- <int key="NSPeriodicDelay">200</int>
- <int key="NSPeriodicInterval">25</int>
- </object>
- </object>
- <object class="NSTextField" id="1039016593">
- <reference key="NSNextResponder" ref="515308735"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{52, 50}, {385, 28}}</string>
- <reference key="NSSuperview" ref="515308735"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSTextFieldCell" key="NSCell" id="624655599">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">4194304</int>
- <string key="NSContents">Les sons émis par X11 utiliseront l’avertissement standard du système, comme défini dans le panneau Effets sonores des Préférences Système.</string>
- <reference key="NSSupport" ref="26"/>
- <string key="NSPlaceholderString"/>
- <reference key="NSControlView" ref="1039016593"/>
- <reference key="NSBackgroundColor" ref="57160303"/>
- <reference key="NSTextColor" ref="930815747"/>
- </object>
- </object>
- <object class="NSPopUpButton" id="709074847">
- <reference key="NSNextResponder" ref="515308735"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{104, 223}, {128, 26}}</string>
- <reference key="NSSuperview" ref="515308735"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSPopUpButtonCell" key="NSCell" id="633115429">
- <int key="NSCellFlags">-2076049856</int>
- <int key="NSCellFlags2">1024</int>
- <reference key="NSSupport" ref="463863101"/>
- <reference key="NSControlView" ref="709074847"/>
- <int key="NSButtonFlags">109199615</int>
- <int key="NSButtonFlags2">1</int>
- <object class="NSFont" key="NSAlternateImage">
- <string key="NSName">LucidaGrande</string>
- <double key="NSSize">13</double>
- <int key="NSfFlags">16</int>
- </object>
- <string key="NSAlternateContents"/>
- <object class="NSMutableString" key="NSKeyEquivalent">
- <characters key="NS.bytes"/>
- </object>
- <int key="NSPeriodicDelay">400</int>
- <int key="NSPeriodicInterval">75</int>
- <object class="NSMenuItem" key="NSMenuItem" id="616492372">
- <reference key="NSMenu" ref="341113515"/>
- <string key="NSTitle">du moniteur</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <int key="NSState">1</int>
- <reference key="NSOnImage" ref="531645050"/>
- <reference key="NSMixedImage" ref="351811234"/>
- <string key="NSAction">_popUpItemAction:</string>
- <int key="NSTag">-1</int>
- <reference key="NSTarget" ref="633115429"/>
- </object>
- <bool key="NSMenuItemRespectAlignment">YES</bool>
- <object class="NSMenu" key="NSMenu" id="341113515">
- <object class="NSMutableString" key="NSTitle">
- <characters key="NS.bytes">OtherViews</characters>
- </object>
- <array class="NSMutableArray" key="NSMenuItems">
- <reference ref="616492372"/>
- <object class="NSMenuItem" id="759499526">
- <reference key="NSMenu" ref="341113515"/>
- <string key="NSTitle">256 couleurs</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="531645050"/>
- <reference key="NSMixedImage" ref="351811234"/>
- <string key="NSAction">_popUpItemAction:</string>
- <int key="NSTag">8</int>
- <reference key="NSTarget" ref="633115429"/>
- </object>
- <object class="NSMenuItem" id="543935434">
- <reference key="NSMenu" ref="341113515"/>
- <string key="NSTitle">milliers</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="531645050"/>
- <reference key="NSMixedImage" ref="351811234"/>
- <string key="NSAction">_popUpItemAction:</string>
- <int key="NSTag">15</int>
- <reference key="NSTarget" ref="633115429"/>
- </object>
- <object class="NSMenuItem" id="836673018">
- <reference key="NSMenu" ref="341113515"/>
- <string key="NSTitle">millions</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="531645050"/>
- <reference key="NSMixedImage" ref="351811234"/>
- <string key="NSAction">_popUpItemAction:</string>
- <int key="NSTag">24</int>
- <reference key="NSTarget" ref="633115429"/>
- </object>
- </array>
- </object>
- <int key="NSPreferredEdge">3</int>
- <bool key="NSUsesItemFromMenu">YES</bool>
- <bool key="NSAltersState">YES</bool>
- <int key="NSArrowPosition">1</int>
- </object>
- </object>
- <object class="NSTextField" id="201731424">
- <reference key="NSNextResponder" ref="515308735"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{33, 226}, {71, 20}}</string>
- <reference key="NSSuperview" ref="515308735"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSTextFieldCell" key="NSCell" id="930265681">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">4194304</int>
- <string key="NSContents">Couleurs :</string>
- <reference key="NSSupport" ref="463863101"/>
- <string key="NSPlaceholderString"/>
- <reference key="NSControlView" ref="201731424"/>
- <reference key="NSBackgroundColor" ref="57160303"/>
- <reference key="NSTextColor" ref="930815747"/>
- </object>
- </object>
- <object class="NSTextField" id="86150604">
- <reference key="NSNextResponder" ref="515308735"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{52, 204}, {392, 14}}</string>
- <reference key="NSSuperview" ref="515308735"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSTextFieldCell" key="NSCell" id="311969422">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">4194304</int>
- <string key="NSContents">Cette option prend effet au prochain lancement d’X11.</string>
- <reference key="NSSupport" ref="26"/>
- <string key="NSPlaceholderString"/>
- <reference key="NSControlView" ref="86150604"/>
- <reference key="NSBackgroundColor" ref="57160303"/>
- <reference key="NSTextColor" ref="930815747"/>
- </object>
- </object>
- <object class="NSButton" id="477203622">
- <reference key="NSNextResponder" ref="515308735"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{34, 170}, {409, 23}}</string>
- <reference key="NSSuperview" ref="515308735"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="631531164">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">0</int>
- <string key="NSContents">Mode plein écran</string>
- <reference key="NSSupport" ref="463863101"/>
- <reference key="NSControlView" ref="477203622"/>
- <int key="NSButtonFlags">1211912703</int>
- <int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="831743691"/>
- <reference key="NSAlternateImage" ref="391434389"/>
- <string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent"/>
- <int key="NSPeriodicDelay">200</int>
- <int key="NSPeriodicInterval">25</int>
- </object>
- </object>
- <object class="NSButton" id="57246850">
- <reference key="NSNextResponder" ref="515308735"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{53, 109}, {445, 18}}</string>
- <reference key="NSSuperview" ref="515308735"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="917248662">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">0</int>
- <string key="NSContents">Afficher automatiquement la barre des menus en mode plein écran</string>
- <reference key="NSSupport" ref="463863101"/>
- <reference key="NSControlView" ref="57246850"/>
- <int key="NSButtonFlags">1211912703</int>
- <int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="831743691"/>
- <reference key="NSAlternateImage" ref="391434389"/>
- <string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent"/>
- <int key="NSPeriodicDelay">200</int>
- <int key="NSPeriodicInterval">25</int>
- </object>
- </object>
- <object class="NSTextField" id="298603383">
- <reference key="NSNextResponder" ref="515308735"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{52, 133}, {385, 31}}</string>
- <reference key="NSSuperview" ref="515308735"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSTextFieldCell" key="NSCell" id="761107402">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">4194304</int>
- <string key="NSContents">Active la fenêtre root X11. Utilisez le raccourci clavier Commande + Option + A pour ouvrir et fermer le mode plein écran.</string>
- <reference key="NSSupport" ref="26"/>
- <string key="NSPlaceholderString"/>
- <reference key="NSControlView" ref="298603383"/>
- <reference key="NSBackgroundColor" ref="57160303"/>
- <reference key="NSTextColor" ref="930815747"/>
- </object>
- </object>
- </array>
- <string key="NSFrame">{{10, 33}, {536, 267}}</string>
- </object>
- <string key="NSLabel">Sortie</string>
- <reference key="NSColor" ref="57160303"/>
- <reference key="NSTabView" ref="448510093"/>
- </object>
- <object class="NSTabViewItem" id="723450037">
- <object class="NSMutableString" key="NSIdentifier">
- <characters key="NS.bytes">2</characters>
- </object>
- <object class="NSView" key="NSView" id="408298283">
- <nil key="NSNextResponder"/>
- <int key="NSvFlags">256</int>
- <array class="NSMutableArray" key="NSSubviews">
- <object class="NSButton" id="878106058">
- <reference key="NSNextResponder" ref="408298283"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{25, 235}, {409, 23}}</string>
- <reference key="NSSuperview" ref="408298283"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="718083688">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">0</int>
- <string key="NSContents">Activer la synchronisation</string>
- <reference key="NSSupport" ref="463863101"/>
- <reference key="NSControlView" ref="878106058"/>
- <int key="NSButtonFlags">1211912703</int>
- <int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="831743691"/>
- <reference key="NSAlternateImage" ref="391434389"/>
- <string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent"/>
- <int key="NSPeriodicDelay">200</int>
- <int key="NSPeriodicInterval">25</int>
- </object>
- </object>
- <object class="NSTextField" id="386152084">
- <reference key="NSNextResponder" ref="408298283"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{43, 187}, {378, 42}}</string>
- <reference key="NSSuperview" ref="408298283"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSTextFieldCell" key="NSCell" id="572508492">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">4194304</int>
- <string key="NSContents">Active la commande de menu « Copier » et permet la synchronisation entre le presse-papiers de OSX, celui de X11 (CLIPBOARD) et les mémoires tampons principales (PRIMARY).</string>
- <reference key="NSSupport" ref="26"/>
- <reference key="NSControlView" ref="386152084"/>
- <reference key="NSBackgroundColor" ref="57160303"/>
- <reference key="NSTextColor" ref="930815747"/>
- </object>
- </object>
- <object class="NSButton" id="477050998">
- <reference key="NSNextResponder" ref="408298283"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{41, 105}, {424, 18}}</string>
- <reference key="NSSuperview" ref="408298283"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="501304422">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">0</int>
- <string key="NSContents">Mettre à jour CLIPBOARD lorsque le presse-papiers est modifié</string>
- <reference key="NSSupport" ref="463863101"/>
- <reference key="NSControlView" ref="477050998"/>
- <int key="NSButtonFlags">1211912703</int>
- <int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="831743691"/>
- <reference key="NSAlternateImage" ref="391434389"/>
- <string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent"/>
- <int key="NSPeriodicDelay">200</int>
- <int key="NSPeriodicInterval">25</int>
- </object>
- </object>
- <object class="NSButton" id="765780304">
- <reference key="NSNextResponder" ref="408298283"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{41, 83}, {489, 18}}</string>
- <reference key="NSSuperview" ref="408298283"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="510771323">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">0</int>
- <string key="NSContents">Mettre à jour PRIMARY (clic central) lorsque le presse-papiers est modifié</string>
- <reference key="NSSupport" ref="463863101"/>
- <reference key="NSControlView" ref="765780304"/>
- <int key="NSButtonFlags">1211912703</int>
- <int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="831743691"/>
- <reference key="NSAlternateImage" ref="391434389"/>
- <string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent"/>
- <int key="NSPeriodicDelay">200</int>
- <int key="NSPeriodicInterval">25</int>
- </object>
- </object>
- <object class="NSButton" id="1002778833">
- <reference key="NSNextResponder" ref="408298283"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{41, 61}, {437, 18}}</string>
- <reference key="NSSuperview" ref="408298283"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="897099877">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">0</int>
- <string key="NSContents">Mettre à jour le presse-papiers dès la sélection de nouveau texte</string>
- <reference key="NSSupport" ref="463863101"/>
- <reference key="NSControlView" ref="1002778833"/>
- <int key="NSButtonFlags">1211912703</int>
- <int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="831743691"/>
- <reference key="NSAlternateImage" ref="391434389"/>
- <string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent"/>
- <int key="NSPeriodicDelay">200</int>
- <int key="NSPeriodicInterval">25</int>
- </object>
- </object>
- <object class="NSButton" id="487809555">
- <reference key="NSNextResponder" ref="408298283"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{41, 163}, {424, 18}}</string>
- <reference key="NSSuperview" ref="408298283"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="619977658">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">0</int>
- <string key="NSContents">Mettre à jour le presse-papiers lorsque CLIPBOARD est modifié</string>
- <reference key="NSSupport" ref="463863101"/>
- <reference key="NSControlView" ref="487809555"/>
- <int key="NSButtonFlags">1211912703</int>
- <int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="831743691"/>
- <reference key="NSAlternateImage" ref="391434389"/>
- <string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent"/>
- <int key="NSPeriodicDelay">200</int>
- <int key="NSPeriodicInterval">25</int>
- </object>
- </object>
- <object class="NSTextField" id="620944856">
- <reference key="NSNextResponder" ref="408298283"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{55, 129}, {385, 28}}</string>
- <reference key="NSSuperview" ref="408298283"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSTextFieldCell" key="NSCell" id="461823902">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">4194304</int>
- <string key="NSContents">Désactivez cette option si vous voulez utiliser xclipboard, klipper, ou tout autre gestionnaire de presse-papiers X11.</string>
- <reference key="NSSupport" ref="26"/>
- <reference key="NSControlView" ref="620944856"/>
- <reference key="NSBackgroundColor" ref="57160303"/>
- <reference key="NSTextColor" ref="930815747"/>
- </object>
- </object>
- <object class="NSTextField" id="522511724">
- <reference key="NSNextResponder" ref="408298283"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{55, 29}, {385, 28}}</string>
- <reference key="NSSuperview" ref="408298283"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSTextFieldCell" key="NSCell" id="994587858">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">4194304</int>
- <string key="NSContents">En raison de limitations du protocole X11, cette option ne fonctionnera pas toujours dans certaines applications.</string>
- <reference key="NSSupport" ref="26"/>
- <reference key="NSControlView" ref="522511724"/>
- <reference key="NSBackgroundColor" ref="57160303"/>
- <reference key="NSTextColor" ref="930815747"/>
- </object>
- </object>
- </array>
- <string key="NSFrame">{{10, 33}, {536, 267}}</string>
- </object>
- <string key="NSLabel">Presse-papiers</string>
- <reference key="NSColor" ref="57160303"/>
- <reference key="NSTabView" ref="448510093"/>
- </object>
- <object class="NSTabViewItem" id="10973343">
- <object class="NSMutableString" key="NSIdentifier">
- <characters key="NS.bytes">2</characters>
- </object>
- <object class="NSView" key="NSView" id="184765684">
- <reference key="NSNextResponder" ref="448510093"/>
- <int key="NSvFlags">256</int>
- <array class="NSMutableArray" key="NSSubviews">
- <object class="NSButton" id="657659108">
- <reference key="NSNextResponder" ref="184765684"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{67, 235}, {402, 18}}</string>
- <reference key="NSSuperview" ref="184765684"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="259618205">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">0</int>
- <string key="NSContents">Activation des fenêtres inactives en un clic</string>
- <reference key="NSSupport" ref="463863101"/>
- <reference key="NSControlView" ref="657659108"/>
- <int key="NSButtonFlags">1211912703</int>
- <int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="831743691"/>
- <reference key="NSAlternateImage" ref="391434389"/>
- <string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent"/>
- <int key="NSPeriodicDelay">200</int>
- <int key="NSPeriodicInterval">25</int>
- </object>
- </object>
- <object class="NSTextField" id="290578835">
- <reference key="NSNextResponder" ref="184765684"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{75, 198}, {385, 31}}</string>
- <reference key="NSSuperview" ref="184765684"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSTextFieldCell" key="NSCell" id="399127858">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">4194304</int>
- <string key="NSContents">En cas d’activation de cette option, si vous cliquez sur une fenêtre inactive, celle-ci deviendra active et le clic sera effectif.</string>
- <reference key="NSSupport" ref="26"/>
- <string key="NSPlaceholderString"/>
- <reference key="NSControlView" ref="290578835"/>
- <reference key="NSBackgroundColor" ref="57160303"/>
- <reference key="NSTextColor" ref="930815747"/>
- </object>
- </object>
- <object class="NSButton" id="992839333">
- <reference key="NSNextResponder" ref="184765684"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{67, 174}, {402, 18}}</string>
- <reference key="NSSuperview" ref="184765684"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="959555182">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">0</int>
- <string key="NSContents">Activation des fenêtres survolées par la souris</string>
- <reference key="NSSupport" ref="463863101"/>
- <reference key="NSControlView" ref="992839333"/>
- <int key="NSButtonFlags">1211912703</int>
- <int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="831743691"/>
- <reference key="NSAlternateImage" ref="391434389"/>
- <string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent"/>
- <int key="NSPeriodicDelay">200</int>
- <int key="NSPeriodicInterval">25</int>
- </object>
- </object>
- <object class="NSTextField" id="138261120">
- <reference key="NSNextResponder" ref="184765684"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{75, 140}, {381, 28}}</string>
- <reference key="NSSuperview" ref="184765684"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSTextFieldCell" key="NSCell" id="183409141">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">4194304</int>
- <string key="NSContents">L’activation des fenêtres X11 suit le curseur. Ceci comporte des effets adverses.</string>
- <reference key="NSSupport" ref="26"/>
- <string key="NSPlaceholderString"/>
- <reference key="NSControlView" ref="138261120"/>
- <reference key="NSBackgroundColor" ref="57160303"/>
- <reference key="NSTextColor" ref="930815747"/>
- </object>
- </object>
- <object class="NSButton" id="128352289">
- <reference key="NSNextResponder" ref="184765684"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{67, 116}, {402, 18}}</string>
- <reference key="NSSuperview" ref="184765684"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="556463187">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">0</int>
- <string key="NSContents">Activation des nouvelles fenêtres</string>
- <reference key="NSSupport" ref="463863101"/>
- <reference key="NSControlView" ref="128352289"/>
- <int key="NSButtonFlags">1211912703</int>
- <int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="831743691"/>
- <reference key="NSAlternateImage" ref="391434389"/>
- <string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent"/>
- <int key="NSPeriodicDelay">200</int>
- <int key="NSPeriodicInterval">25</int>
- </object>
- </object>
- <object class="NSTextField" id="57161931">
- <reference key="NSNextResponder" ref="184765684"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{75, 68}, {385, 42}}</string>
- <reference key="NSSuperview" ref="184765684"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSTextFieldCell" key="NSCell" id="989804990">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">4194304</int>
- <string key="NSContents">Lorsque cette option est activée, la création d’une nouvelle fenêtre X11 fait passer X11.app au premier plan (au lieu de Finder.app, Terminal.app, etc.)</string>
- <reference key="NSSupport" ref="26"/>
- <string key="NSPlaceholderString"/>
- <reference key="NSControlView" ref="57161931"/>
- <reference key="NSBackgroundColor" ref="57160303"/>
- <reference key="NSTextColor" ref="930815747"/>
- </object>
- </object>
- </array>
- <string key="NSFrame">{{10, 33}, {536, 267}}</string>
- <reference key="NSSuperview" ref="448510093"/>
- </object>
- <string key="NSLabel">Fenêtres</string>
- <reference key="NSColor" ref="57160303"/>
- <reference key="NSTabView" ref="448510093"/>
- </object>
- <object class="NSTabViewItem" id="348328898">
- <object class="NSView" key="NSView" id="300811574">
- <nil key="NSNextResponder"/>
- <int key="NSvFlags">256</int>
- <array class="NSMutableArray" key="NSSubviews">
- <object class="NSButton" id="989050925">
- <reference key="NSNextResponder" ref="300811574"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{67, 235}, {402, 18}}</string>
- <reference key="NSSuperview" ref="300811574"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="189594322">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">0</int>
- <string key="NSContents">Authentifier les connexions</string>
- <reference key="NSSupport" ref="463863101"/>
- <reference key="NSControlView" ref="989050925"/>
- <int key="NSButtonFlags">1211912703</int>
- <int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="831743691"/>
- <reference key="NSAlternateImage" ref="391434389"/>
- <string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent"/>
- <int key="NSPeriodicDelay">200</int>
- <int key="NSPeriodicInterval">25</int>
- </object>
- </object>
- <object class="NSButton" id="700826966">
- <reference key="NSNextResponder" ref="300811574"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{67, 158}, {402, 18}}</string>
- <reference key="NSSuperview" ref="300811574"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="489340979">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">0</int>
- <string key="NSContents">Autoriser les connexions de clients réseau</string>
- <reference key="NSSupport" ref="463863101"/>
- <reference key="NSControlView" ref="700826966"/>
- <int key="NSButtonFlags">1211912703</int>
- <int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="831743691"/>
- <reference key="NSAlternateImage" ref="391434389"/>
- <string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent"/>
- <int key="NSPeriodicDelay">200</int>
- <int key="NSPeriodicInterval">25</int>
- </object>
- </object>
- <object class="NSTextField" id="168436707">
- <reference key="NSNextResponder" ref="300811574"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{85, 187}, {385, 42}}</string>
- <reference key="NSSuperview" ref="300811574"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSTextFieldCell" key="NSCell" id="53243865">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">4194304</int>
- <string key="NSContents">Le lancement d’X11 créera des touches de contrôle d’accès Xauthority. Si l’adresse IP du système change, ces touches ne seront plus valides, ce qui risquera d’empêcher le lancement des applications X11.</string>
- <reference key="NSSupport" ref="26"/>
- <string key="NSPlaceholderString"/>
- <reference key="NSControlView" ref="168436707"/>
- <reference key="NSBackgroundColor" ref="57160303"/>
- <reference key="NSTextColor" ref="930815747"/>
- </object>
- </object>
- <object class="NSTextField" id="363817195">
- <reference key="NSNextResponder" ref="300811574"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{85, 96}, {385, 56}}</string>
- <reference key="NSSuperview" ref="300811574"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSTextFieldCell" key="NSCell" id="390084685">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">4194304</int>
- <string key="NSContents">En cas d’activation de cette option, « Authentifier les connexions » doit aussi être activée pour garantir la sécurité du système. En cas de désactivation, les connexions à partir d’applications distantes sont interdites.</string>
- <reference key="NSSupport" ref="26"/>
- <string key="NSPlaceholderString"/>
- <reference key="NSControlView" ref="363817195"/>
- <reference key="NSBackgroundColor" ref="57160303"/>
- <reference key="NSTextColor" ref="930815747"/>
- </object>
- </object>
- <object class="NSTextField" id="223835729">
- <reference key="NSNextResponder" ref="300811574"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{20, 5}, {404, 14}}</string>
- <reference key="NSSuperview" ref="300811574"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSTextFieldCell" key="NSCell" id="283628678">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">4194304</int>
- <string key="NSContents">Ces options prennent effet au prochain lancement d’X11.</string>
- <reference key="NSSupport" ref="26"/>
- <string key="NSPlaceholderString"/>
- <reference key="NSControlView" ref="223835729"/>
- <reference key="NSBackgroundColor" ref="57160303"/>
- <reference key="NSTextColor" ref="930815747"/>
- </object>
- </object>
- </array>
- <string key="NSFrame">{{10, 33}, {536, 267}}</string>
- </object>
- <string key="NSLabel">Sécurité</string>
- <reference key="NSColor" ref="57160303"/>
- <reference key="NSTabView" ref="448510093"/>
- </object>
- </array>
- <reference key="NSSelectedTabViewItem" ref="10973343"/>
- <reference key="NSFont" ref="463863101"/>
- <int key="NSTvFlags">0</int>
- <bool key="NSAllowTruncatedLabels">YES</bool>
- <bool key="NSDrawsBackground">YES</bool>
- <array class="NSMutableArray" key="NSSubviews">
- <reference ref="184765684"/>
- </array>
- </object>
- </array>
- <string key="NSFrameSize">{582, 329}</string>
- </object>
- <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
- <string key="NSMinSize">{320, 262}</string>
- <string key="NSMaxSize">{1.7976931348623157e+308, 1.7976931348623157e+308}</string>
- <string key="NSFrameAutosaveName">x11_prefs</string>
- </object>
- <object class="NSWindowTemplate" id="604417141">
- <int key="NSWindowStyleMask">11</int>
- <int key="NSWindowBacking">2</int>
- <string key="NSWindowRect">{{302, 440}, {548, 271}}</string>
- <int key="NSWTFlags">1350041600</int>
- <string key="NSWindowTitle">Menu de l’application X11</string>
- <string key="NSWindowClass">NSPanel</string>
- <object class="NSMutableString" key="NSViewClass">
- <characters key="NS.bytes">View</characters>
- </object>
- <nil key="NSUserInterfaceItemIdentifier"/>
- <string key="NSWindowContentMaxSize">{1.7976931348623157e+308, 1.7976931348623157e+308}</string>
- <string key="NSWindowContentMinSize">{320, 240}</string>
- <object class="NSView" key="NSWindowView" id="85544634">
- <nil key="NSNextResponder"/>
- <int key="NSvFlags">256</int>
- <array class="NSMutableArray" key="NSSubviews">
- <object class="NSButton" id="671954382">
- <reference key="NSNextResponder" ref="85544634"/>
- <int key="NSvFlags">265</int>
- <string key="NSFrame">{{372, 191}, {162, 32}}</string>
- <reference key="NSSuperview" ref="85544634"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="143554520">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">137887744</int>
- <string key="NSContents">Dupliquer</string>
- <reference key="NSSupport" ref="463863101"/>
- <reference key="NSControlView" ref="671954382"/>
- <int key="NSButtonFlags">-2038284033</int>
- <int key="NSButtonFlags2">1</int>
- <object class="NSFont" key="NSAlternateImage" id="549406736">
- <string key="NSName">Helvetica</string>
- <double key="NSSize">13</double>
- <int key="NSfFlags">16</int>
- </object>
- <string key="NSAlternateContents"/>
- <object class="NSMutableString" key="NSKeyEquivalent">
- <characters key="NS.bytes"/>
- </object>
- <int key="NSPeriodicDelay">200</int>
- <int key="NSPeriodicInterval">25</int>
- </object>
- </object>
- <object class="NSButton" id="492358940">
- <reference key="NSNextResponder" ref="85544634"/>
- <int key="NSvFlags">265</int>
- <string key="NSFrame">{{372, 159}, {162, 32}}</string>
- <reference key="NSSuperview" ref="85544634"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="8201128">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">137887744</int>
- <string key="NSContents">Supprimer</string>
- <reference key="NSSupport" ref="463863101"/>
- <reference key="NSControlView" ref="492358940"/>
- <int key="NSButtonFlags">-2038284033</int>
- <int key="NSButtonFlags2">1</int>
- <reference key="NSAlternateImage" ref="549406736"/>
- <string key="NSAlternateContents"/>
- <object class="NSMutableString" key="NSKeyEquivalent">
- <characters key="NS.bytes"/>
- </object>
- <int key="NSPeriodicDelay">200</int>
- <int key="NSPeriodicInterval">25</int>
- </object>
- </object>
- <object class="NSScrollView" id="1063387772">
- <reference key="NSNextResponder" ref="85544634"/>
- <int key="NSvFlags">274</int>
- <array class="NSMutableArray" key="NSSubviews">
- <object class="NSClipView" id="580565898">
- <reference key="NSNextResponder" ref="1063387772"/>
- <int key="NSvFlags">2304</int>
- <array class="NSMutableArray" key="NSSubviews">
- <object class="NSTableView" id="905092943">
- <reference key="NSNextResponder" ref="580565898"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrameSize">{333, 198}</string>
- <reference key="NSSuperview" ref="580565898"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSTableHeaderView" key="NSHeaderView" id="792419186">
- <reference key="NSNextResponder" ref="672307654"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrameSize">{333, 17}</string>
- <reference key="NSSuperview" ref="672307654"/>
- <reference key="NSTableView" ref="905092943"/>
- </object>
- <object class="_NSCornerView" key="NSCornerView" id="898633680">
- <reference key="NSNextResponder" ref="1063387772"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{334, 0}, {16, 17}}</string>
- <reference key="NSSuperview" ref="1063387772"/>
- </object>
- <array class="NSMutableArray" key="NSTableColumns">
- <object class="NSTableColumn" id="938444323">
- <double key="NSWidth">155</double>
- <double key="NSMinWidth">62.730998992919922</double>
- <double key="NSMaxWidth">1000</double>
- <object class="NSTableHeaderCell" key="NSHeaderCell">
- <int key="NSCellFlags">75628096</int>
- <int key="NSCellFlags2">2048</int>
- <string key="NSContents">Nom</string>
- <reference key="NSSupport" ref="26"/>
- <object class="NSColor" key="NSBackgroundColor" id="113872566">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC4zMzMzMzI5OQA</bytes>
- </object>
- <object class="NSColor" key="NSTextColor" id="249576247">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">headerTextColor</string>
- <reference key="NSColor" ref="214098874"/>
- </object>
- </object>
- <object class="NSTextFieldCell" key="NSDataCell" id="825378892">
- <int key="NSCellFlags">338820672</int>
- <int key="NSCellFlags2">1024</int>
- <string key="NSContents">Text Cell</string>
- <reference key="NSSupport" ref="463863101"/>
- <string key="NSPlaceholderString"/>
- <reference key="NSControlView" ref="905092943"/>
- <object class="NSColor" key="NSBackgroundColor" id="822946413">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MQA</bytes>
- </object>
- <reference key="NSTextColor" ref="930815747"/>
- </object>
- <int key="NSResizingMask">3</int>
- <bool key="NSIsResizeable">YES</bool>
- <bool key="NSIsEditable">YES</bool>
- <reference key="NSTableView" ref="905092943"/>
- <string key="NSHeaderToolTip"/>
- </object>
- <object class="NSTableColumn" id="84282687">
- <double key="NSWidth">100</double>
- <double key="NSMinWidth">40</double>
- <double key="NSMaxWidth">1000</double>
- <object class="NSTableHeaderCell" key="NSHeaderCell">
- <int key="NSCellFlags">75628096</int>
- <int key="NSCellFlags2">2048</int>
- <string key="NSContents">Commande</string>
- <reference key="NSSupport" ref="26"/>
- <reference key="NSBackgroundColor" ref="113872566"/>
- <reference key="NSTextColor" ref="249576247"/>
- </object>
- <object class="NSTextFieldCell" key="NSDataCell" id="432610585">
- <int key="NSCellFlags">338820672</int>
- <int key="NSCellFlags2">1024</int>
- <string key="NSContents">Text Cell</string>
- <reference key="NSSupport" ref="463863101"/>
- <string key="NSPlaceholderString"/>
- <reference key="NSControlView" ref="905092943"/>
- <reference key="NSBackgroundColor" ref="822946413"/>
- <reference key="NSTextColor" ref="930815747"/>
- </object>
- <int key="NSResizingMask">3</int>
- <bool key="NSIsResizeable">YES</bool>
- <bool key="NSIsEditable">YES</bool>
- <reference key="NSTableView" ref="905092943"/>
- <string key="NSHeaderToolTip"/>
- </object>
- <object class="NSTableColumn" id="242608782">
- <double key="NSWidth">69</double>
- <double key="NSMinWidth">10</double>
- <double key="NSMaxWidth">1000</double>
- <object class="NSTableHeaderCell" key="NSHeaderCell">
- <int key="NSCellFlags">75628096</int>
- <int key="NSCellFlags2">2048</int>
- <string key="NSContents">Raccourci</string>
- <reference key="NSSupport" ref="26"/>
- <object class="NSColor" key="NSBackgroundColor">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">headerColor</string>
- <reference key="NSColor" ref="822946413"/>
- </object>
- <reference key="NSTextColor" ref="249576247"/>
- </object>
- <object class="NSTextFieldCell" key="NSDataCell" id="34714764">
- <int key="NSCellFlags">338820672</int>
- <int key="NSCellFlags2">1024</int>
- <string key="NSContents">Text Cell</string>
- <object class="NSFont" key="NSSupport">
- <string key="NSName">LucidaGrande</string>
- <double key="NSSize">12</double>
- <int key="NSfFlags">16</int>
- </object>
- <string key="NSPlaceholderString"/>
- <reference key="NSControlView" ref="905092943"/>
- <bool key="NSDrawsBackground">YES</bool>
- <object class="NSColor" key="NSBackgroundColor" id="812484075">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">controlBackgroundColor</string>
- <reference key="NSColor" ref="590688762"/>
- </object>
- <reference key="NSTextColor" ref="930815747"/>
- </object>
- <int key="NSResizingMask">3</int>
- <bool key="NSIsResizeable">YES</bool>
- <bool key="NSIsEditable">YES</bool>
- <reference key="NSTableView" ref="905092943"/>
- <string key="NSHeaderToolTip"/>
- </object>
- </array>
- <double key="NSIntercellSpacingWidth">3</double>
- <double key="NSIntercellSpacingHeight">2</double>
- <reference key="NSBackgroundColor" ref="822946413"/>
- <object class="NSColor" key="NSGridColor">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">gridColor</string>
- <object class="NSColor" key="NSColor">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC41AA</bytes>
- </object>
- </object>
- <double key="NSRowHeight">17</double>
- <int key="NSTvFlags">1379958784</int>
- <reference key="NSDelegate"/>
- <reference key="NSDataSource"/>
- <int key="NSColumnAutoresizingStyle">1</int>
- <int key="NSDraggingSourceMaskForLocal">-1</int>
- <int key="NSDraggingSourceMaskForNonLocal">0</int>
- <bool key="NSAllowsTypeSelect">YES</bool>
- <int key="NSTableViewDraggingDestinationStyle">0</int>
- </object>
- </array>
- <string key="NSFrame">{{1, 17}, {333, 198}}</string>
- <reference key="NSSuperview" ref="1063387772"/>
- <reference key="NSNextKeyView" ref="905092943"/>
- <reference key="NSDocView" ref="905092943"/>
- <reference key="NSBGColor" ref="812484075"/>
- <int key="NScvFlags">4</int>
- </object>
- <object class="NSScroller" id="842897584">
- <reference key="NSNextResponder" ref="1063387772"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{334, 17}, {15, 198}}</string>
- <reference key="NSSuperview" ref="1063387772"/>
- <reference key="NSTarget" ref="1063387772"/>
- <string key="NSAction">_doScroller:</string>
- <double key="NSPercent">0.99492380000000002</double>
- </object>
- <object class="NSScroller" id="17278747">
- <reference key="NSNextResponder" ref="1063387772"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{1, 215}, {333, 15}}</string>
- <reference key="NSSuperview" ref="1063387772"/>
- <int key="NSsFlags">1</int>
- <reference key="NSTarget" ref="1063387772"/>
- <string key="NSAction">_doScroller:</string>
- <double key="NSPercent">0.97368421052631582</double>
- </object>
- <object class="NSClipView" id="672307654">
- <reference key="NSNextResponder" ref="1063387772"/>
- <int key="NSvFlags">2304</int>
- <array class="NSMutableArray" key="NSSubviews">
- <reference ref="792419186"/>
- </array>
- <string key="NSFrame">{{1, 0}, {333, 17}}</string>
- <reference key="NSSuperview" ref="1063387772"/>
- <reference key="NSNextKeyView" ref="792419186"/>
- <reference key="NSDocView" ref="792419186"/>
- <reference key="NSBGColor" ref="812484075"/>
- <int key="NScvFlags">4</int>
- </object>
- <reference ref="898633680"/>
- </array>
- <string key="NSFrame">{{20, 20}, {350, 231}}</string>
- <reference key="NSSuperview" ref="85544634"/>
- <reference key="NSNextKeyView" ref="580565898"/>
- <int key="NSsFlags">50</int>
- <reference key="NSVScroller" ref="842897584"/>
- <reference key="NSHScroller" ref="17278747"/>
- <reference key="NSContentView" ref="580565898"/>
- <reference key="NSHeaderClipView" ref="672307654"/>
- <bytes key="NSScrollAmts">QSAAAEEgAABBmAAAQZgAAA</bytes>
- </object>
- <object class="NSButton" id="758204686">
- <reference key="NSNextResponder" ref="85544634"/>
- <int key="NSvFlags">265</int>
- <string key="NSFrame">{{372, 223}, {162, 32}}</string>
- <reference key="NSSuperview" ref="85544634"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="1025474039">
- <int key="NSCellFlags">-2080244224</int>
- <int key="NSCellFlags2">137887744</int>
- <string key="NSContents">Ajouter un élément</string>
- <reference key="NSSupport" ref="463863101"/>
- <reference key="NSControlView" ref="758204686"/>
- <int key="NSButtonFlags">-2038284033</int>
- <int key="NSButtonFlags2">1</int>
- <reference key="NSAlternateImage" ref="549406736"/>
- <string key="NSAlternateContents"/>
- <object class="NSMutableString" key="NSKeyEquivalent">
- <characters key="NS.bytes"/>
- </object>
- <int key="NSPeriodicDelay">200</int>
- <int key="NSPeriodicInterval">25</int>
- </object>
- </object>
- </array>
- <string key="NSFrameSize">{548, 271}</string>
- </object>
- <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
- <string key="NSMinSize">{320, 262}</string>
- <string key="NSMaxSize">{1.7976931348623157e+308, 1.7976931348623157e+308}</string>
- <string key="NSFrameAutosaveName">x11_apps</string>
- </object>
- <object class="NSMenu" id="294137138">
- <string key="NSTitle">Menu</string>
- <array class="NSMutableArray" key="NSMenuItems">
- <object class="NSMenuItem" id="318286212">
- <reference key="NSMenu" ref="294137138"/>
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="531645050"/>
- <reference key="NSMixedImage" ref="351811234"/>
- </object>
- <object class="NSMenuItem" id="511651072">
- <reference key="NSMenu" ref="294137138"/>
- <string key="NSTitle">Applications</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="531645050"/>
- <reference key="NSMixedImage" ref="351811234"/>
- <string key="NSAction">submenuAction:</string>
- <object class="NSMenu" key="NSSubmenu" id="48278059">
- <string key="NSTitle">Applications</string>
- <array class="NSMutableArray" key="NSMenuItems">
- <object class="NSMenuItem" id="563798000">
- <reference key="NSMenu" ref="48278059"/>
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="531645050"/>
- <reference key="NSMixedImage" ref="351811234"/>
- </object>
- <object class="NSMenuItem" id="1032342329">
- <reference key="NSMenu" ref="48278059"/>
- <string key="NSTitle">Personnaliser…</string>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="531645050"/>
- <reference key="NSMixedImage" ref="351811234"/>
- </object>
- </array>
- </object>
- </object>
- </array>
- <string key="NSName"/>
- </object>
- </array>
- <object class="IBObjectContainer" key="IBDocument.Objects">
- <array class="NSMutableArray" key="connectionRecords">
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">copy:</string>
- <reference key="source" ref="941939442"/>
- <reference key="destination" ref="185296989"/>
- </object>
- <int key="connectionID">181</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">minimize_window:</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="677652931"/>
- </object>
- <int key="connectionID">202</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">close_window:</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="984461797"/>
- </object>
- <int key="connectionID">205</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">zoom_window:</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="1066447520"/>
- </object>
- <int key="connectionID">206</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">bring_to_front:</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="276216762"/>
- </object>
- <int key="connectionID">207</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">hideOtherApplications:</string>
- <reference key="source" ref="815810918"/>
- <reference key="destination" ref="206802571"/>
- </object>
- <int key="connectionID">263</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">apps_separator</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="390088328"/>
- </object>
- <int key="connectionID">273</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">apps_table</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="905092943"/>
- </object>
- <int key="connectionID">301</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">apps_table_delete:</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="492358940"/>
- </object>
- <int key="connectionID">303</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">apps_table_duplicate:</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="671954382"/>
- </object>
- <int key="connectionID">304</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">apps_table_show:</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="1065386165"/>
- </object>
- <int key="connectionID">308</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">apps_table_new:</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="758204686"/>
- </object>
- <int key="connectionID">311</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">prefs_show:</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="386173216"/>
- </object>
- <int key="connectionID">318</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">x11_about_item</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="139290918"/>
- </object>
- <int key="connectionID">321</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">enable_auth</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="989050925"/>
- </object>
- <int key="connectionID">387</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">enable_tcp</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="700826966"/>
- </object>
- <int key="connectionID">388</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">depth</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="709074847"/>
- </object>
- <int key="connectionID">389</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">use_sysbeep</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="418227126"/>
- </object>
- <int key="connectionID">390</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">fake_buttons</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="119157981"/>
- </object>
- <int key="connectionID">391</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">sync_keymap</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="179949713"/>
- </object>
- <int key="connectionID">392</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">enable_keyequivs</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="842100515"/>
- </object>
- <int key="connectionID">393</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">prefs_changed:</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="119157981"/>
- </object>
- <int key="connectionID">394</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">prefs_changed:</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="179949713"/>
- </object>
- <int key="connectionID">395</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">prefs_changed:</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="842100515"/>
- </object>
- <int key="connectionID">396</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">prefs_changed:</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="418227126"/>
- </object>
- <int key="connectionID">397</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">prefs_changed:</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="709074847"/>
- </object>
- <int key="connectionID">398</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">prefs_changed:</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="989050925"/>
- </object>
- <int key="connectionID">399</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">prefs_changed:</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="700826966"/>
- </object>
- <int key="connectionID">401</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">prefs_panel</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="124913468"/>
- </object>
- <int key="connectionID">402</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">x11_help:</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="504984881"/>
- </object>
- <int key="connectionID">422</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">dockMenu</string>
- <reference key="source" ref="815810918"/>
- <reference key="destination" ref="294137138"/>
- </object>
- <int key="connectionID">426</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">dock_menu</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="294137138"/>
- </object>
- <int key="connectionID">428</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">delegate</string>
- <reference key="source" ref="815810918"/>
- <reference key="destination" ref="485884620"/>
- </object>
- <int key="connectionID">429</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">hide:</string>
- <reference key="source" ref="815810918"/>
- <reference key="destination" ref="301008465"/>
- </object>
- <int key="connectionID">430</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">unhideAllApplications:</string>
- <reference key="source" ref="815810918"/>
- <reference key="destination" ref="1023546148"/>
- </object>
- <int key="connectionID">431</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">orderFrontStandardAboutPanel:</string>
- <reference key="source" ref="815810918"/>
- <reference key="destination" ref="139290918"/>
- </object>
- <int key="connectionID">433</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">dock_apps_menu</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="48278059"/>
- </object>
- <int key="connectionID">530</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">dock_window_separator</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="318286212"/>
- </object>
- <int key="connectionID">531</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">apps_table_show:</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="1032342329"/>
- </object>
- <int key="connectionID">534</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">next_window:</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="1036389925"/>
- </object>
- <int key="connectionID">539</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">previous_window:</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="369641893"/>
- </object>
- <int key="connectionID">540</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">enable_fullscreen</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="477203622"/>
- </object>
- <int key="connectionID">546</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">enable_fullscreen_changed:</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="477203622"/>
- </object>
- <int key="connectionID">547</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">toggle_fullscreen:</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="6876565"/>
- </object>
- <int key="connectionID">548</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">toggle_fullscreen_item</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="6876565"/>
- </object>
- <int key="connectionID">549</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">menu</string>
- <reference key="source" ref="815810918"/>
- <reference key="destination" ref="524015605"/>
- </object>
- <int key="connectionID">300334</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">terminate:</string>
- <reference key="source" ref="815810918"/>
- <reference key="destination" ref="274138642"/>
- </object>
- <int key="connectionID">300336</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">prefs_changed:</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="657659108"/>
- </object>
- <int key="connectionID">300389</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">prefs_changed:</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="992839333"/>
- </object>
- <int key="connectionID">300390</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">prefs_changed:</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="128352289"/>
- </object>
- <int key="connectionID">300391</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">click_through</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="657659108"/>
- </object>
- <int key="connectionID">300392</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">focus_follows_mouse</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="992839333"/>
- </object>
- <int key="connectionID">300393</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">focus_on_new_window</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="128352289"/>
- </object>
- <int key="connectionID">300394</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">copy_menu_item</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="185296989"/>
- </object>
- <int key="connectionID">300443</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">sync_pasteboard</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="878106058"/>
- </object>
- <int key="connectionID">300444</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">sync_clipboard_to_pasteboard</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="487809555"/>
- </object>
- <int key="connectionID">300461</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">sync_pasteboard_to_clipboard</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="477050998"/>
- </object>
- <int key="connectionID">300462</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">sync_pasteboard_to_primary</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="765780304"/>
- </object>
- <int key="connectionID">300463</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">sync_primary_immediately</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="1002778833"/>
- </object>
- <int key="connectionID">300464</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">prefs_changed:</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="878106058"/>
- </object>
- <int key="connectionID">300465</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">prefs_changed:</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="487809555"/>
- </object>
- <int key="connectionID">300466</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">prefs_changed:</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="477050998"/>
- </object>
- <int key="connectionID">300467</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">prefs_changed:</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="765780304"/>
- </object>
- <int key="connectionID">300468</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">prefs_changed:</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="1002778833"/>
- </object>
- <int key="connectionID">300469</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">sync_text1</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="620944856"/>
- </object>
- <int key="connectionID">300470</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">sync_text2</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="522511724"/>
- </object>
- <int key="connectionID">300471</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">enable_fullscreen_menu</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="57246850"/>
- </object>
- <int key="connectionID">300474</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">prefs_changed:</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="57246850"/>
- </object>
- <int key="connectionID">300475</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">prefs_changed:</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="406291430"/>
- </object>
- <int key="connectionID">300480</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">option_sends_alt</string>
- <reference key="source" ref="485884620"/>
- <reference key="destination" ref="406291430"/>
- </object>
- <int key="connectionID">300481</int>
- </object>
- </array>
- <object class="IBMutableOrderedSet" key="objectRecords">
- <array key="orderedObjects">
- <object class="IBObjectRecord">
- <int key="objectID">0</int>
- <array key="object" id="0"/>
- <reference key="children" ref="904585544"/>
- <nil key="parent"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-2</int>
- <reference key="object" ref="815810918"/>
- <reference key="parent" ref="0"/>
- <string key="objectName">File's Owner</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-1</int>
- <reference key="object" ref="941939442"/>
- <reference key="parent" ref="0"/>
- <string key="objectName">First Responder</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-3</int>
- <reference key="object" ref="951368722"/>
- <reference key="parent" ref="0"/>
- <string key="objectName">Application</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">29</int>
- <reference key="object" ref="524015605"/>
- <array class="NSMutableArray" key="children">
- <reference ref="931553638"/>
- <reference ref="365880285"/>
- <reference ref="200491363"/>
- <reference ref="868031522"/>
- <reference ref="551174276"/>
- </array>
- <reference key="parent" ref="0"/>
- <string key="objectName">MainMenu</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">19</int>
- <reference key="object" ref="931553638"/>
- <array class="NSMutableArray" key="children">
- <reference ref="96874957"/>
- </array>
- <reference key="parent" ref="524015605"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">24</int>
- <reference key="object" ref="96874957"/>
- <array class="NSMutableArray" key="children">
- <reference ref="677652931"/>
- <reference ref="276216762"/>
- <reference ref="1066447520"/>
- <reference ref="1036389925"/>
- <reference ref="369641893"/>
- <reference ref="155085383"/>
- <reference ref="984461797"/>
- <reference ref="280172320"/>
- </array>
- <reference key="parent" ref="931553638"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">5</int>
- <reference key="object" ref="276216762"/>
- <reference key="parent" ref="96874957"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">23</int>
- <reference key="object" ref="677652931"/>
- <reference key="parent" ref="96874957"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">92</int>
- <reference key="object" ref="280172320"/>
- <reference key="parent" ref="96874957"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">203</int>
- <reference key="object" ref="984461797"/>
- <reference key="parent" ref="96874957"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">204</int>
- <reference key="object" ref="1066447520"/>
- <reference key="parent" ref="96874957"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">536</int>
- <reference key="object" ref="155085383"/>
- <reference key="parent" ref="96874957"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">537</int>
- <reference key="object" ref="1036389925"/>
- <reference key="parent" ref="96874957"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">538</int>
- <reference key="object" ref="369641893"/>
- <reference key="parent" ref="96874957"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">56</int>
- <reference key="object" ref="365880285"/>
- <array class="NSMutableArray" key="children">
- <reference ref="576521955"/>
- </array>
- <reference key="parent" ref="524015605"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">57</int>
- <reference key="object" ref="576521955"/>
- <array class="NSMutableArray" key="children">
- <reference ref="139290918"/>
- <reference ref="386173216"/>
- <reference ref="32285361"/>
- <reference ref="301008465"/>
- <reference ref="274138642"/>
- <reference ref="272876017"/>
- <reference ref="431301145"/>
- <reference ref="206802571"/>
- <reference ref="848095279"/>
- <reference ref="1023546148"/>
- <reference ref="6876565"/>
- <reference ref="479677589"/>
- </array>
- <reference key="parent" ref="365880285"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">58</int>
- <reference key="object" ref="139290918"/>
- <reference key="parent" ref="576521955"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">129</int>
- <reference key="object" ref="386173216"/>
- <reference key="parent" ref="576521955"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">131</int>
- <reference key="object" ref="32285361"/>
- <array class="NSMutableArray" key="children">
- <reference ref="821388474"/>
- </array>
- <reference key="parent" ref="576521955"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">130</int>
- <reference key="object" ref="821388474"/>
- <reference key="parent" ref="32285361"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">134</int>
- <reference key="object" ref="301008465"/>
- <reference key="parent" ref="576521955"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">136</int>
- <reference key="object" ref="274138642"/>
- <reference key="parent" ref="576521955"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">143</int>
- <reference key="object" ref="272876017"/>
- <reference key="parent" ref="576521955"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">144</int>
- <reference key="object" ref="431301145"/>
- <reference key="parent" ref="576521955"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">145</int>
- <reference key="object" ref="206802571"/>
- <reference key="parent" ref="576521955"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">149</int>
- <reference key="object" ref="848095279"/>
- <reference key="parent" ref="576521955"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">150</int>
- <reference key="object" ref="1023546148"/>
- <reference key="parent" ref="576521955"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">544</int>
- <reference key="object" ref="6876565"/>
- <reference key="parent" ref="576521955"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">545</int>
- <reference key="object" ref="479677589"/>
- <reference key="parent" ref="576521955"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">163</int>
- <reference key="object" ref="200491363"/>
- <array class="NSMutableArray" key="children">
- <reference ref="526778998"/>
- </array>
- <reference key="parent" ref="524015605"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">169</int>
- <reference key="object" ref="526778998"/>
- <array class="NSMutableArray" key="children">
- <reference ref="185296989"/>
- </array>
- <reference key="parent" ref="200491363"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">157</int>
- <reference key="object" ref="185296989"/>
- <reference key="parent" ref="526778998"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">269</int>
- <reference key="object" ref="868031522"/>
- <array class="NSMutableArray" key="children">
- <reference ref="981161348"/>
- </array>
- <reference key="parent" ref="524015605"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">270</int>
- <reference key="object" ref="981161348"/>
- <array class="NSMutableArray" key="children">
- <reference ref="390088328"/>
- <reference ref="1065386165"/>
- </array>
- <reference key="parent" ref="868031522"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">272</int>
- <reference key="object" ref="390088328"/>
- <reference key="parent" ref="981161348"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">305</int>
- <reference key="object" ref="1065386165"/>
- <reference key="parent" ref="981161348"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">419</int>
- <reference key="object" ref="551174276"/>
- <array class="NSMutableArray" key="children">
- <reference ref="511848303"/>
- </array>
- <reference key="parent" ref="524015605"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">420</int>
- <reference key="object" ref="511848303"/>
- <array class="NSMutableArray" key="children">
- <reference ref="504984881"/>
- </array>
- <reference key="parent" ref="551174276"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">421</int>
- <reference key="object" ref="504984881"/>
- <reference key="parent" ref="511848303"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">196</int>
- <reference key="object" ref="485884620"/>
- <reference key="parent" ref="0"/>
- <string key="objectName">X11Controller</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">244</int>
- <reference key="object" ref="124913468"/>
- <array class="NSMutableArray" key="children">
- <reference ref="941366957"/>
- </array>
- <reference key="parent" ref="0"/>
- <string key="objectName">PrefsPanel</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">245</int>
- <reference key="object" ref="941366957"/>
- <array class="NSMutableArray" key="children">
- <reference ref="448510093"/>
- </array>
- <reference key="parent" ref="124913468"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">348</int>
- <reference key="object" ref="448510093"/>
- <array class="NSMutableArray" key="children">
- <reference ref="287591690"/>
- <reference ref="960678392"/>
- <reference ref="348328898"/>
- <reference ref="10973343"/>
- <reference ref="723450037"/>
- </array>
- <reference key="parent" ref="941366957"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">349</int>
- <reference key="object" ref="287591690"/>
- <array class="NSMutableArray" key="children">
- <reference ref="596750588"/>
- </array>
- <reference key="parent" ref="448510093"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">351</int>
- <reference key="object" ref="596750588"/>
- <array class="NSMutableArray" key="children">
- <reference ref="119157981"/>
- <reference ref="443008216"/>
- <reference ref="282885445"/>
- <reference ref="842100515"/>
- <reference ref="31160162"/>
- <reference ref="179949713"/>
- <reference ref="278155937"/>
- <reference ref="406291430"/>
- </array>
- <reference key="parent" ref="287591690"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">363</int>
- <reference key="object" ref="119157981"/>
- <array class="NSMutableArray" key="children">
- <reference ref="990762273"/>
- </array>
- <reference key="parent" ref="596750588"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">364</int>
- <reference key="object" ref="443008216"/>
- <array class="NSMutableArray" key="children">
- <reference ref="391919450"/>
- </array>
- <reference key="parent" ref="596750588"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">365</int>
- <reference key="object" ref="282885445"/>
- <array class="NSMutableArray" key="children">
- <reference ref="649334366"/>
- </array>
- <reference key="parent" ref="596750588"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">368</int>
- <reference key="object" ref="842100515"/>
- <array class="NSMutableArray" key="children">
- <reference ref="940564599"/>
- </array>
- <reference key="parent" ref="596750588"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">369</int>
- <reference key="object" ref="31160162"/>
- <array class="NSMutableArray" key="children">
- <reference ref="666057093"/>
- </array>
- <reference key="parent" ref="596750588"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">370</int>
- <reference key="object" ref="179949713"/>
- <array class="NSMutableArray" key="children">
- <reference ref="967619578"/>
- </array>
- <reference key="parent" ref="596750588"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">352</int>
- <reference key="object" ref="960678392"/>
- <array class="NSMutableArray" key="children">
- <reference ref="515308735"/>
- </array>
- <reference key="parent" ref="448510093"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">350</int>
- <reference key="object" ref="515308735"/>
- <array class="NSMutableArray" key="children">
- <reference ref="709074847"/>
- <reference ref="201731424"/>
- <reference ref="86150604"/>
- <reference ref="477203622"/>
- <reference ref="57246850"/>
- <reference ref="298603383"/>
- <reference ref="418227126"/>
- <reference ref="1039016593"/>
- </array>
- <reference key="parent" ref="960678392"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">371</int>
- <reference key="object" ref="418227126"/>
- <array class="NSMutableArray" key="children">
- <reference ref="1016069354"/>
- </array>
- <reference key="parent" ref="515308735"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">372</int>
- <reference key="object" ref="1039016593"/>
- <array class="NSMutableArray" key="children">
- <reference ref="624655599"/>
- </array>
- <reference key="parent" ref="515308735"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">382</int>
- <reference key="object" ref="709074847"/>
- <array class="NSMutableArray" key="children">
- <reference ref="633115429"/>
- </array>
- <reference key="parent" ref="515308735"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">385</int>
- <reference key="object" ref="201731424"/>
- <array class="NSMutableArray" key="children">
- <reference ref="930265681"/>
- </array>
- <reference key="parent" ref="515308735"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">386</int>
- <reference key="object" ref="86150604"/>
- <array class="NSMutableArray" key="children">
- <reference ref="311969422"/>
- </array>
- <reference key="parent" ref="515308735"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">541</int>
- <reference key="object" ref="477203622"/>
- <array class="NSMutableArray" key="children">
- <reference ref="631531164"/>
- </array>
- <reference key="parent" ref="515308735"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">543</int>
- <reference key="object" ref="298603383"/>
- <array class="NSMutableArray" key="children">
- <reference ref="761107402"/>
- </array>
- <reference key="parent" ref="515308735"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">353</int>
- <reference key="object" ref="348328898"/>
- <array class="NSMutableArray" key="children">
- <reference ref="300811574"/>
- </array>
- <reference key="parent" ref="448510093"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">354</int>
- <reference key="object" ref="300811574"/>
- <array class="NSMutableArray" key="children">
- <reference ref="989050925"/>
- <reference ref="700826966"/>
- <reference ref="168436707"/>
- <reference ref="363817195"/>
- <reference ref="223835729"/>
- </array>
- <reference key="parent" ref="348328898"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">374</int>
- <reference key="object" ref="989050925"/>
- <array class="NSMutableArray" key="children">
- <reference ref="189594322"/>
- </array>
- <reference key="parent" ref="300811574"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">375</int>
- <reference key="object" ref="700826966"/>
- <array class="NSMutableArray" key="children">
- <reference ref="489340979"/>
- </array>
- <reference key="parent" ref="300811574"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">376</int>
- <reference key="object" ref="168436707"/>
- <array class="NSMutableArray" key="children">
- <reference ref="53243865"/>
- </array>
- <reference key="parent" ref="300811574"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">377</int>
- <reference key="object" ref="363817195"/>
- <array class="NSMutableArray" key="children">
- <reference ref="390084685"/>
- </array>
- <reference key="parent" ref="300811574"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">379</int>
- <reference key="object" ref="223835729"/>
- <array class="NSMutableArray" key="children">
- <reference ref="283628678"/>
- </array>
- <reference key="parent" ref="300811574"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">285</int>
- <reference key="object" ref="604417141"/>
- <array class="NSMutableArray" key="children">
- <reference ref="85544634"/>
- </array>
- <reference key="parent" ref="0"/>
- <string key="objectName">EditPrograms</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">286</int>
- <reference key="object" ref="85544634"/>
- <array class="NSMutableArray" key="children">
- <reference ref="1063387772"/>
- <reference ref="758204686"/>
- <reference ref="671954382"/>
- <reference ref="492358940"/>
- </array>
- <reference key="parent" ref="604417141"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">423</int>
- <reference key="object" ref="294137138"/>
- <array class="NSMutableArray" key="children">
- <reference ref="318286212"/>
- <reference ref="511651072"/>
- </array>
- <reference key="parent" ref="0"/>
- <string key="objectName">DockMenu</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">524</int>
- <reference key="object" ref="318286212"/>
- <reference key="parent" ref="294137138"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">526</int>
- <reference key="object" ref="511651072"/>
- <array class="NSMutableArray" key="children">
- <reference ref="48278059"/>
- </array>
- <reference key="parent" ref="294137138"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">527</int>
- <reference key="object" ref="48278059"/>
- <array class="NSMutableArray" key="children">
- <reference ref="1032342329"/>
- <reference ref="563798000"/>
- </array>
- <reference key="parent" ref="511651072"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">532</int>
- <reference key="object" ref="1032342329"/>
- <reference key="parent" ref="48278059"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">533</int>
- <reference key="object" ref="563798000"/>
- <reference key="parent" ref="48278059"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">100363</int>
- <reference key="object" ref="990762273"/>
- <reference key="parent" ref="119157981"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">100364</int>
- <reference key="object" ref="391919450"/>
- <reference key="parent" ref="443008216"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">100365</int>
- <reference key="object" ref="649334366"/>
- <reference key="parent" ref="282885445"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">100368</int>
- <reference key="object" ref="940564599"/>
- <reference key="parent" ref="842100515"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">100369</int>
- <reference key="object" ref="666057093"/>
- <reference key="parent" ref="31160162"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">100370</int>
- <reference key="object" ref="967619578"/>
- <reference key="parent" ref="179949713"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">100371</int>
- <reference key="object" ref="1016069354"/>
- <reference key="parent" ref="418227126"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">100372</int>
- <reference key="object" ref="624655599"/>
- <reference key="parent" ref="1039016593"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">100382</int>
- <reference key="object" ref="633115429"/>
- <array class="NSMutableArray" key="children">
- <reference ref="341113515"/>
- </array>
- <reference key="parent" ref="709074847"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">100385</int>
- <reference key="object" ref="930265681"/>
- <reference key="parent" ref="201731424"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">100386</int>
- <reference key="object" ref="311969422"/>
- <reference key="parent" ref="86150604"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">100541</int>
- <reference key="object" ref="631531164"/>
- <reference key="parent" ref="477203622"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">100543</int>
- <reference key="object" ref="761107402"/>
- <reference key="parent" ref="298603383"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">100374</int>
- <reference key="object" ref="189594322"/>
- <reference key="parent" ref="989050925"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">100375</int>
- <reference key="object" ref="489340979"/>
- <reference key="parent" ref="700826966"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">100376</int>
- <reference key="object" ref="53243865"/>
- <reference key="parent" ref="168436707"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">100377</int>
- <reference key="object" ref="390084685"/>
- <reference key="parent" ref="363817195"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">100379</int>
- <reference key="object" ref="283628678"/>
- <reference key="parent" ref="223835729"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">380</int>
- <reference key="object" ref="341113515"/>
- <array class="NSMutableArray" key="children">
- <reference ref="759499526"/>
- <reference ref="616492372"/>
- <reference ref="543935434"/>
- <reference ref="836673018"/>
- </array>
- <reference key="parent" ref="633115429"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">435</int>
- <reference key="object" ref="759499526"/>
- <reference key="parent" ref="341113515"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">384</int>
- <reference key="object" ref="616492372"/>
- <reference key="parent" ref="341113515"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">383</int>
- <reference key="object" ref="543935434"/>
- <reference key="parent" ref="341113515"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">381</int>
- <reference key="object" ref="836673018"/>
- <reference key="parent" ref="341113515"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">295</int>
- <reference key="object" ref="1063387772"/>
- <array class="NSMutableArray" key="children">
- <reference ref="792419186"/>
- <reference ref="17278747"/>
- <reference ref="842897584"/>
- <reference ref="905092943"/>
- </array>
- <reference key="parent" ref="85544634"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300295</int>
- <reference key="object" ref="792419186"/>
- <reference key="parent" ref="1063387772"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">200295</int>
- <reference key="object" ref="17278747"/>
- <reference key="parent" ref="1063387772"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">100295</int>
- <reference key="object" ref="842897584"/>
- <reference key="parent" ref="1063387772"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">296</int>
- <reference key="object" ref="905092943"/>
- <array class="NSMutableArray" key="children">
- <reference ref="242608782"/>
- <reference ref="938444323"/>
- <reference ref="84282687"/>
- </array>
- <reference key="parent" ref="1063387772"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">535</int>
- <reference key="object" ref="242608782"/>
- <array class="NSMutableArray" key="children">
- <reference ref="34714764"/>
- </array>
- <reference key="parent" ref="905092943"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">575</int>
- <reference key="object" ref="34714764"/>
- <reference key="parent" ref="242608782"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">298</int>
- <reference key="object" ref="938444323"/>
- <array class="NSMutableArray" key="children">
- <reference ref="825378892"/>
- </array>
- <reference key="parent" ref="905092943"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">573</int>
- <reference key="object" ref="825378892"/>
- <reference key="parent" ref="938444323"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">297</int>
- <reference key="object" ref="84282687"/>
- <array class="NSMutableArray" key="children">
- <reference ref="432610585"/>
- </array>
- <reference key="parent" ref="905092943"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">574</int>
- <reference key="object" ref="432610585"/>
- <reference key="parent" ref="84282687"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">310</int>
- <reference key="object" ref="758204686"/>
- <array class="NSMutableArray" key="children">
- <reference ref="1025474039"/>
- </array>
- <reference key="parent" ref="85544634"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">100310</int>
- <reference key="object" ref="1025474039"/>
- <reference key="parent" ref="758204686"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">292</int>
- <reference key="object" ref="671954382"/>
- <array class="NSMutableArray" key="children">
- <reference ref="143554520"/>
- </array>
- <reference key="parent" ref="85544634"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">100292</int>
- <reference key="object" ref="143554520"/>
- <reference key="parent" ref="671954382"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">293</int>
- <reference key="object" ref="492358940"/>
- <array class="NSMutableArray" key="children">
- <reference ref="8201128"/>
- </array>
- <reference key="parent" ref="85544634"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">100293</int>
- <reference key="object" ref="8201128"/>
- <reference key="parent" ref="492358940"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300337</int>
- <reference key="object" ref="10973343"/>
- <array class="NSMutableArray" key="children">
- <reference ref="184765684"/>
- </array>
- <reference key="parent" ref="448510093"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300338</int>
- <reference key="object" ref="184765684"/>
- <array class="NSMutableArray" key="children">
- <reference ref="657659108"/>
- <reference ref="290578835"/>
- <reference ref="992839333"/>
- <reference ref="138261120"/>
- <reference ref="128352289"/>
- <reference ref="57161931"/>
- </array>
- <reference key="parent" ref="10973343"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300358</int>
- <reference key="object" ref="290578835"/>
- <array class="NSMutableArray" key="children">
- <reference ref="399127858"/>
- </array>
- <reference key="parent" ref="184765684"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300359</int>
- <reference key="object" ref="657659108"/>
- <array class="NSMutableArray" key="children">
- <reference ref="259618205"/>
- </array>
- <reference key="parent" ref="184765684"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300360</int>
- <reference key="object" ref="259618205"/>
- <reference key="parent" ref="657659108"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300361</int>
- <reference key="object" ref="399127858"/>
- <reference key="parent" ref="290578835"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300362</int>
- <reference key="object" ref="992839333"/>
- <array class="NSMutableArray" key="children">
- <reference ref="959555182"/>
- </array>
- <reference key="parent" ref="184765684"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300363</int>
- <reference key="object" ref="959555182"/>
- <reference key="parent" ref="992839333"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300364</int>
- <reference key="object" ref="138261120"/>
- <array class="NSMutableArray" key="children">
- <reference ref="183409141"/>
- </array>
- <reference key="parent" ref="184765684"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300365</int>
- <reference key="object" ref="183409141"/>
- <reference key="parent" ref="138261120"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300368</int>
- <reference key="object" ref="128352289"/>
- <array class="NSMutableArray" key="children">
- <reference ref="556463187"/>
- </array>
- <reference key="parent" ref="184765684"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300369</int>
- <reference key="object" ref="556463187"/>
- <reference key="parent" ref="128352289"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300370</int>
- <reference key="object" ref="57161931"/>
- <array class="NSMutableArray" key="children">
- <reference ref="989804990"/>
- </array>
- <reference key="parent" ref="184765684"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300371</int>
- <reference key="object" ref="989804990"/>
- <reference key="parent" ref="57161931"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300421</int>
- <reference key="object" ref="723450037"/>
- <array class="NSMutableArray" key="children">
- <reference ref="408298283"/>
- </array>
- <reference key="parent" ref="448510093"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300422</int>
- <reference key="object" ref="408298283"/>
- <array class="NSMutableArray" key="children">
- <reference ref="878106058"/>
- <reference ref="386152084"/>
- <reference ref="487809555"/>
- <reference ref="620944856"/>
- <reference ref="477050998"/>
- <reference ref="765780304"/>
- <reference ref="1002778833"/>
- <reference ref="522511724"/>
- </array>
- <reference key="parent" ref="723450037"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300423</int>
- <reference key="object" ref="386152084"/>
- <array class="NSMutableArray" key="children">
- <reference ref="572508492"/>
- </array>
- <reference key="parent" ref="408298283"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300424</int>
- <reference key="object" ref="878106058"/>
- <array class="NSMutableArray" key="children">
- <reference ref="718083688"/>
- </array>
- <reference key="parent" ref="408298283"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300440</int>
- <reference key="object" ref="718083688"/>
- <reference key="parent" ref="878106058"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300441</int>
- <reference key="object" ref="572508492"/>
- <reference key="parent" ref="386152084"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300447</int>
- <reference key="object" ref="477050998"/>
- <array class="NSMutableArray" key="children">
- <reference ref="501304422"/>
- </array>
- <reference key="parent" ref="408298283"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300450</int>
- <reference key="object" ref="501304422"/>
- <reference key="parent" ref="477050998"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300451</int>
- <reference key="object" ref="765780304"/>
- <array class="NSMutableArray" key="children">
- <reference ref="510771323"/>
- </array>
- <reference key="parent" ref="408298283"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300452</int>
- <reference key="object" ref="510771323"/>
- <reference key="parent" ref="765780304"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300453</int>
- <reference key="object" ref="487809555"/>
- <array class="NSMutableArray" key="children">
- <reference ref="619977658"/>
- </array>
- <reference key="parent" ref="408298283"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300454</int>
- <reference key="object" ref="619977658"/>
- <reference key="parent" ref="487809555"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300455</int>
- <reference key="object" ref="620944856"/>
- <array class="NSMutableArray" key="children">
- <reference ref="461823902"/>
- </array>
- <reference key="parent" ref="408298283"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300456</int>
- <reference key="object" ref="461823902"/>
- <reference key="parent" ref="620944856"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300457</int>
- <reference key="object" ref="1002778833"/>
- <array class="NSMutableArray" key="children">
- <reference ref="897099877"/>
- </array>
- <reference key="parent" ref="408298283"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300458</int>
- <reference key="object" ref="897099877"/>
- <reference key="parent" ref="1002778833"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300459</int>
- <reference key="object" ref="522511724"/>
- <array class="NSMutableArray" key="children">
- <reference ref="994587858"/>
- </array>
- <reference key="parent" ref="408298283"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300460</int>
- <reference key="object" ref="994587858"/>
- <reference key="parent" ref="522511724"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300472</int>
- <reference key="object" ref="57246850"/>
- <array class="NSMutableArray" key="children">
- <reference ref="917248662"/>
- </array>
- <reference key="parent" ref="515308735"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300473</int>
- <reference key="object" ref="917248662"/>
- <reference key="parent" ref="57246850"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300476</int>
- <reference key="object" ref="278155937"/>
- <array class="NSMutableArray" key="children">
- <reference ref="617441821"/>
- </array>
- <reference key="parent" ref="596750588"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300477</int>
- <reference key="object" ref="406291430"/>
- <array class="NSMutableArray" key="children">
- <reference ref="67728988"/>
- </array>
- <reference key="parent" ref="596750588"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300478</int>
- <reference key="object" ref="67728988"/>
- <reference key="parent" ref="406291430"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">300479</int>
- <reference key="object" ref="617441821"/>
- <reference key="parent" ref="278155937"/>
- </object>
- </array>
- </object>
- <dictionary class="NSMutableDictionary" key="flattenedProperties">
- <string key="-3.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="-3.ImportedFromIB2"/>
- <string key="100292.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="100293.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="100295.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="100295.IBShouldRemoveOnLegacySave"/>
- <string key="100310.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="100363.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="100364.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="100365.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="100368.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="100369.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="100370.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="100371.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="100372.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="100374.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="100375.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="100376.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="100377.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="100379.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="100382.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="100385.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="100385.object.labelIdentifier">IBBuiltInLabel-Red</string>
- <string key="100386.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="100541.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="100543.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="129.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="129.ImportedFromIB2"/>
- <string key="130.IBEditorWindowLastContentRect">{{318, 756}, {64, 6}}</string>
- <string key="130.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="130.ImportedFromIB2"/>
- <string key="131.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="131.ImportedFromIB2"/>
- <string key="134.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="134.ImportedFromIB2"/>
- <string key="136.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="136.ImportedFromIB2"/>
- <string key="143.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="143.ImportedFromIB2"/>
- <string key="144.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="144.ImportedFromIB2"/>
- <string key="145.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="145.ImportedFromIB2"/>
- <string key="149.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="149.ImportedFromIB2"/>
- <string key="150.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="150.ImportedFromIB2"/>
- <string key="157.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="157.ImportedFromIB2"/>
- <string key="163.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="163.ImportedFromIB2"/>
- <string key="169.IBEditorWindowLastContentRect">{{176, 789}, {120, 23}}</string>
- <string key="169.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="169.ImportedFromIB2"/>
- <string key="169.editorWindowContentRectSynchronizationRect">{{202, 626}, {154, 153}}</string>
- <string key="19.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="19.ImportedFromIB2"/>
- <integer value="1" key="196.ImportedFromIB2"/>
- <string key="200295.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="200295.IBShouldRemoveOnLegacySave"/>
- <string key="203.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="203.ImportedFromIB2"/>
- <string key="204.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="204.ImportedFromIB2"/>
- <string key="23.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="23.ImportedFromIB2"/>
- <string key="24.IBEditorWindowLastContentRect">{{242, 669}, {365, 143}}</string>
- <string key="24.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="24.ImportedFromIB2"/>
- <string key="24.editorWindowContentRectSynchronizationRect">{{271, 666}, {301, 153}}</string>
- <string key="244.IBEditorWindowLastContentRect">{{575, 463}, {582, 329}}</string>
- <string key="244.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="244.IBWindowTemplateEditedContentRect">{{575, 463}, {582, 329}}</string>
- <integer value="1" key="244.ImportedFromIB2"/>
- <string key="244.editorWindowContentRectSynchronizationRect">{{184, 290}, {481, 345}}</string>
- <integer value="0" key="244.windowTemplate.hasMaxSize"/>
- <integer value="1" key="244.windowTemplate.hasMinSize"/>
- <string key="244.windowTemplate.maxSize">{3.40282e+38, 3.40282e+38}</string>
- <string key="244.windowTemplate.minSize">{320, 240}</string>
- <string key="245.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="245.ImportedFromIB2"/>
- <string key="269.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="269.ImportedFromIB2"/>
- <string key="270.IBEditorWindowLastContentRect">{{74, 779}, {171, 33}}</string>
- <string key="270.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="270.ImportedFromIB2"/>
- <string key="270.editorWindowContentRectSynchronizationRect">{{100, 746}, {155, 33}}</string>
- <string key="272.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="272.ImportedFromIB2"/>
- <string key="285.IBEditorWindowLastContentRect">{{838, 503}, {548, 271}}</string>
- <string key="285.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="285.IBViewEditorWindowController.showingBoundsRectangles"/>
- <integer value="1" key="285.IBViewEditorWindowController.showingLayoutRectangles"/>
- <string key="285.IBWindowTemplateEditedContentRect">{{838, 503}, {548, 271}}</string>
- <integer value="1" key="285.ImportedFromIB2"/>
- <string key="285.editorWindowContentRectSynchronizationRect">{{433, 406}, {486, 327}}</string>
- <integer value="0" key="285.windowTemplate.hasMaxSize"/>
- <integer value="1" key="285.windowTemplate.hasMinSize"/>
- <string key="285.windowTemplate.maxSize">{3.40282e+38, 3.40282e+38}</string>
- <string key="285.windowTemplate.minSize">{320, 240}</string>
- <string key="286.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="286.ImportedFromIB2"/>
- <string key="29.IBEditorWindowLastContentRect">{{16, 812}, {356, 20}}</string>
- <string key="29.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="29.ImportedFromIB2"/>
- <string key="29.editorWindowContentRectSynchronizationRect">{{67, 819}, {336, 20}}</string>
- <string key="292.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="292.ImportedFromIB2"/>
- <string key="293.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="293.ImportedFromIB2"/>
- <string key="295.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="295.ImportedFromIB2"/>
- <string key="296.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="296.ImportedFromIB2"/>
- <string key="297.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="297.ImportedFromIB2"/>
- <string key="298.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="298.ImportedFromIB2"/>
- <string key="300295.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="300295.IBShouldRemoveOnLegacySave"/>
- <string key="300337.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="300337.ImportedFromIB2"/>
- <string key="300338.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="300338.ImportedFromIB2"/>
- <string key="300358.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="300358.ImportedFromIB2"/>
- <string key="300359.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="300359.ImportedFromIB2"/>
- <string key="300360.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="300361.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="300362.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="300362.ImportedFromIB2"/>
- <string key="300363.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="300364.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="300364.ImportedFromIB2"/>
- <string key="300365.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="300368.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="300368.ImportedFromIB2"/>
- <string key="300369.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="300370.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="300370.ImportedFromIB2"/>
- <string key="300371.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="300421.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="300421.ImportedFromIB2"/>
- <string key="300422.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="300422.ImportedFromIB2"/>
- <string key="300423.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="300423.ImportedFromIB2"/>
- <string key="300424.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="300424.ImportedFromIB2"/>
- <string key="300440.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="300441.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="300447.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="300447.ImportedFromIB2"/>
- <string key="300447.object.labelIdentifier">IBBuiltInLabel-Red</string>
- <string key="300450.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="300450.object.labelIdentifier">IBBuiltInLabel-Red</string>
- <string key="300451.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="300451.ImportedFromIB2"/>
- <string key="300451.object.labelIdentifier">IBBuiltInLabel-Red</string>
- <string key="300452.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="300452.object.labelIdentifier">IBBuiltInLabel-Red</string>
- <string key="300453.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="300453.ImportedFromIB2"/>
- <string key="300453.object.labelIdentifier">IBBuiltInLabel-Red</string>
- <string key="300454.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="300454.object.labelIdentifier">IBBuiltInLabel-Red</string>
- <string key="300455.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="300455.ImportedFromIB2"/>
- <string key="300456.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="300457.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="300457.ImportedFromIB2"/>
- <string key="300457.object.labelIdentifier">IBBuiltInLabel-Red</string>
- <string key="300458.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="300458.object.labelIdentifier">IBBuiltInLabel-Red</string>
- <string key="300459.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="300459.ImportedFromIB2"/>
- <string key="300460.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="300472.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="300472.ImportedFromIB2"/>
- <string key="300473.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="300476.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="300476.ImportedFromIB2"/>
- <string key="300476.object.labelIdentifier">IBBuiltInLabel-Red</string>
- <string key="300477.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="300477.ImportedFromIB2"/>
- <string key="300477.object.labelIdentifier">IBBuiltInLabel-Red</string>
- <string key="300478.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="300478.object.labelIdentifier">IBBuiltInLabel-Red</string>
- <string key="300479.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="300479.object.labelIdentifier">IBBuiltInLabel-Red</string>
- <string key="305.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="305.ImportedFromIB2"/>
- <string key="310.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="310.ImportedFromIB2"/>
- <string key="348.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="348.ImportedFromIB2"/>
- <string key="349.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="349.ImportedFromIB2"/>
- <string key="350.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="350.ImportedFromIB2"/>
- <string key="351.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="351.ImportedFromIB2"/>
- <string key="352.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="352.ImportedFromIB2"/>
- <string key="353.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="353.ImportedFromIB2"/>
- <string key="354.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="354.ImportedFromIB2"/>
- <string key="363.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="363.ImportedFromIB2"/>
- <string key="364.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="364.ImportedFromIB2"/>
- <string key="365.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="365.ImportedFromIB2"/>
- <string key="368.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="368.ImportedFromIB2"/>
- <string key="369.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="369.ImportedFromIB2"/>
- <string key="370.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="370.ImportedFromIB2"/>
- <string key="371.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="371.ImportedFromIB2"/>
- <string key="372.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="372.ImportedFromIB2"/>
- <string key="374.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="374.ImportedFromIB2"/>
- <string key="375.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="375.ImportedFromIB2"/>
- <string key="376.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="376.ImportedFromIB2"/>
- <string key="377.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="377.ImportedFromIB2"/>
- <string key="379.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="379.ImportedFromIB2"/>
- <string key="380.IBEditorWindowLastContentRect">{{274, 290}, {155, 83}}</string>
- <string key="380.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="380.ImportedFromIB2"/>
- <string key="381.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="381.ImportedFromIB2"/>
- <string key="382.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="382.ImportedFromIB2"/>
- <string key="383.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="383.ImportedFromIB2"/>
- <string key="384.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="384.ImportedFromIB2"/>
- <string key="385.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="385.ImportedFromIB2"/>
- <string key="386.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="386.ImportedFromIB2"/>
- <string key="419.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="419.ImportedFromIB2"/>
- <string key="420.IBEditorWindowLastContentRect">{{311, 789}, {128, 23}}</string>
- <string key="420.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="420.ImportedFromIB2"/>
- <string key="421.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="421.ImportedFromIB2"/>
- <string key="423.IBEditorWindowLastContentRect">{{567, 341}, {150, 33}}</string>
- <string key="423.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="423.ImportedFromIB2"/>
- <string key="435.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="435.ImportedFromIB2"/>
- <string key="5.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="5.ImportedFromIB2"/>
- <string key="524.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="524.ImportedFromIB2"/>
- <string key="526.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="526.ImportedFromIB2"/>
- <string key="527.IBEditorWindowLastContentRect">{{717, 331}, {171, 33}}</string>
- <string key="527.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="527.ImportedFromIB2"/>
- <string key="532.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="532.ImportedFromIB2"/>
- <string key="533.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="533.ImportedFromIB2"/>
- <string key="535.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="535.ImportedFromIB2"/>
- <string key="536.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="536.ImportedFromIB2"/>
- <string key="537.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="537.ImportedFromIB2"/>
- <string key="538.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="538.ImportedFromIB2"/>
- <string key="541.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="541.ImportedFromIB2"/>
- <string key="543.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="543.ImportedFromIB2"/>
- <string key="544.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="544.ImportedFromIB2"/>
- <string key="545.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="545.ImportedFromIB2"/>
- <string key="56.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="56.ImportedFromIB2"/>
- <string key="57.IBEditorWindowLastContentRect">{{28, 609}, {290, 203}}</string>
- <string key="57.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="57.ImportedFromIB2"/>
- <string key="57.editorWindowContentRectSynchronizationRect">{{79, 616}, {218, 203}}</string>
- <string key="573.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="573.ImportedFromIB2"/>
- <string key="574.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="574.ImportedFromIB2"/>
- <string key="575.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="575.ImportedFromIB2"/>
- <string key="58.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="58.ImportedFromIB2"/>
- <string key="92.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1" key="92.ImportedFromIB2"/>
- </dictionary>
- <dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
- <nil key="activeLocalization"/>
- <dictionary class="NSMutableDictionary" key="localizations"/>
- <nil key="sourceID"/>
- <int key="maxID">300481</int>
- </object>
- <object class="IBClassDescriber" key="IBDocument.Classes">
- <array class="NSMutableArray" key="referencedPartialClassDescriptions">
- <object class="IBPartialClassDescription">
- <string key="className">FirstResponder</string>
- <string key="superclassName">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBUserSource</string>
- <string key="minorKey"/>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSFormatter</string>
- <string key="superclassName">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBUserSource</string>
- <string key="minorKey"/>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">X11Controller</string>
- <string key="superclassName">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBUserSource</string>
- <string key="minorKey"/>
- </object>
- </object>
- </array>
- </object>
- <int key="IBDocument.localizationMode">0</int>
- <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
- <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
- <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
- <integer value="1040" key="NS.object.0"/>
- </object>
- <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
- <string key="IBDocument.LastKnownRelativeProjectPath">../X11.xcodeproj</string>
- <int key="IBDocument.defaultPropertyAccessControl">3</int>
- <dictionary class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
- <string key="NSMenuCheckmark">{9, 8}</string>
- <string key="NSMenuMixedState">{7, 2}</string>
- <string key="NSSwitch">{15, 15}</string>
- </dictionary>
- </data>
-</archive>
+<?xml version="1.0" encoding="UTF-8"?>
+<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
+ <data>
+ <int key="IBDocument.SystemTarget">1040</int>
+ <string key="IBDocument.SystemVersion">11A289</string>
+ <string key="IBDocument.InterfaceBuilderVersion">851</string>
+ <string key="IBDocument.AppKitVersion">1094.2</string>
+ <string key="IBDocument.HIToolboxVersion">521.00</string>
+ <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="NS.object.0">851</string>
+ </object>
+ <array class="NSMutableArray" key="IBDocument.EditedObjectIDs"/>
+ <array key="IBDocument.PluginDependencies">
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ </array>
+ <object class="NSMutableDictionary" key="IBDocument.Metadata">
+ <string key="NS.key.0">PluginDependencyRecalculationVersion</string>
+ <integer value="1" key="NS.object.0"/>
+ </object>
+ <array class="NSMutableArray" key="IBDocument.RootObjects" id="904585544">
+ <object class="NSCustomObject" id="815810918">
+ <object class="NSMutableString" key="NSClassName">
+ <characters key="NS.bytes">NSApplication</characters>
+ </object>
+ </object>
+ <object class="NSCustomObject" id="941939442">
+ <string key="NSClassName">FirstResponder</string>
+ </object>
+ <object class="NSCustomObject" id="951368722">
+ <string key="NSClassName">NSApplication</string>
+ </object>
+ <object class="NSMenu" id="524015605">
+ <string key="NSTitle">MainMenu</string>
+ <array class="NSMutableArray" key="NSMenuItems">
+ <object class="NSMenuItem" id="365880285">
+ <reference key="NSMenu" ref="524015605"/>
+ <string key="NSTitle">X11</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <object class="NSCustomResource" key="NSOnImage" id="531645050">
+ <string key="NSClassName">NSImage</string>
+ <string key="NSResourceName">NSMenuCheckmark</string>
+ </object>
+ <object class="NSCustomResource" key="NSMixedImage" id="351811234">
+ <string key="NSClassName">NSImage</string>
+ <string key="NSResourceName">NSMenuMixedState</string>
+ </object>
+ <string key="NSAction">submenuAction:</string>
+ <object class="NSMenu" key="NSSubmenu" id="576521955">
+ <string key="NSTitle">X11</string>
+ <array class="NSMutableArray" key="NSMenuItems">
+ <object class="NSMenuItem" id="139290918">
+ <reference key="NSMenu" ref="576521955"/>
+ <string key="NSTitle">À propos d’X11</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="386173216">
+ <reference key="NSMenu" ref="576521955"/>
+ <string key="NSTitle">Préférences…</string>
+ <string key="NSKeyEquiv">,</string>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="272876017">
+ <reference key="NSMenu" ref="576521955"/>
+ <bool key="NSIsDisabled">YES</bool>
+ <bool key="NSIsSeparator">YES</bool>
+ <string key="NSTitle"/>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="32285361">
+ <reference key="NSMenu" ref="576521955"/>
+ <string key="NSTitle">Services</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ <string key="NSAction">submenuAction:</string>
+ <object class="NSMenu" key="NSSubmenu" id="821388474">
+ <object class="NSMutableString" key="NSTitle">
+ <characters key="NS.bytes">Services</characters>
+ </object>
+ <array class="NSMutableArray" key="NSMenuItems"/>
+ <string key="NSName">_NSServicesMenu</string>
+ </object>
+ </object>
+ <object class="NSMenuItem" id="431301145">
+ <reference key="NSMenu" ref="576521955"/>
+ <bool key="NSIsDisabled">YES</bool>
+ <bool key="NSIsSeparator">YES</bool>
+ <string key="NSTitle"/>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="6876565">
+ <reference key="NSMenu" ref="576521955"/>
+ <string key="NSTitle">Basculer en mode plein écran</string>
+ <string key="NSKeyEquiv">a</string>
+ <int key="NSKeyEquivModMask">1572864</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="479677589">
+ <reference key="NSMenu" ref="576521955"/>
+ <bool key="NSIsDisabled">YES</bool>
+ <bool key="NSIsSeparator">YES</bool>
+ <string key="NSTitle"/>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="301008465">
+ <reference key="NSMenu" ref="576521955"/>
+ <string key="NSTitle">Masquer X11</string>
+ <string key="NSKeyEquiv">h</string>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ <int key="NSTag">42</int>
+ </object>
+ <object class="NSMenuItem" id="206802571">
+ <reference key="NSMenu" ref="576521955"/>
+ <string key="NSTitle">Masquer les autres</string>
+ <string key="NSKeyEquiv">h</string>
+ <int key="NSKeyEquivModMask">1572864</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="1023546148">
+ <reference key="NSMenu" ref="576521955"/>
+ <string key="NSTitle">Tout afficher</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ <int key="NSTag">42</int>
+ </object>
+ <object class="NSMenuItem" id="848095279">
+ <reference key="NSMenu" ref="576521955"/>
+ <bool key="NSIsDisabled">YES</bool>
+ <bool key="NSIsSeparator">YES</bool>
+ <string key="NSTitle"/>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="274138642">
+ <reference key="NSMenu" ref="576521955"/>
+ <string key="NSTitle">Quitter X11</string>
+ <string key="NSKeyEquiv">q</string>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ </array>
+ <string key="NSName">_NSAppleMenu</string>
+ </object>
+ </object>
+ <object class="NSMenuItem" id="868031522">
+ <reference key="NSMenu" ref="524015605"/>
+ <string key="NSTitle">Applications</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ <string key="NSAction">submenuAction:</string>
+ <object class="NSMenu" key="NSSubmenu" id="981161348">
+ <string key="NSTitle">Applications</string>
+ <array class="NSMutableArray" key="NSMenuItems">
+ <object class="NSMenuItem" id="390088328">
+ <reference key="NSMenu" ref="981161348"/>
+ <bool key="NSIsDisabled">YES</bool>
+ <bool key="NSIsSeparator">YES</bool>
+ <string key="NSTitle"/>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="1065386165">
+ <reference key="NSMenu" ref="981161348"/>
+ <string key="NSTitle">Personnaliser…</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ </array>
+ </object>
+ </object>
+ <object class="NSMenuItem" id="200491363">
+ <reference key="NSMenu" ref="524015605"/>
+ <string key="NSTitle">Édition</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ <string key="NSAction">submenuAction:</string>
+ <object class="NSMenu" key="NSSubmenu" id="526778998">
+ <string key="NSTitle">Édition</string>
+ <array class="NSMutableArray" key="NSMenuItems">
+ <object class="NSMenuItem" id="185296989">
+ <reference key="NSMenu" ref="526778998"/>
+ <string key="NSTitle">Copier</string>
+ <string key="NSKeyEquiv">c</string>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ </array>
+ </object>
+ </object>
+ <object class="NSMenuItem" id="931553638">
+ <reference key="NSMenu" ref="524015605"/>
+ <string key="NSTitle">Fenêtre</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ <string key="NSAction">submenuAction:</string>
+ <object class="NSMenu" key="NSSubmenu" id="96874957">
+ <string key="NSTitle">Fenêtre</string>
+ <array class="NSMutableArray" key="NSMenuItems">
+ <object class="NSMenuItem" id="984461797">
+ <reference key="NSMenu" ref="96874957"/>
+ <string key="NSTitle">Fermer</string>
+ <string key="NSKeyEquiv">w</string>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="677652931">
+ <reference key="NSMenu" ref="96874957"/>
+ <string key="NSTitle">Placer dans le Dock</string>
+ <string key="NSKeyEquiv">m</string>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="1066447520">
+ <reference key="NSMenu" ref="96874957"/>
+ <string key="NSTitle">Réduire/agrandir</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="280172320">
+ <reference key="NSMenu" ref="96874957"/>
+ <bool key="NSIsDisabled">YES</bool>
+ <bool key="NSIsSeparator">YES</bool>
+ <string key="NSTitle"/>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="1036389925">
+ <reference key="NSMenu" ref="96874957"/>
+ <string key="NSTitle">Faire défiler les fenêtres</string>
+ <string key="NSKeyEquiv">`</string>
+ <int key="NSKeyEquivModMask">1048840</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="369641893">
+ <reference key="NSMenu" ref="96874957"/>
+ <string key="NSTitle">Faire défiler les fenêtres en sens inverse</string>
+ <string key="NSKeyEquiv">`</string>
+ <int key="NSKeyEquivModMask">1179648</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="155085383">
+ <reference key="NSMenu" ref="96874957"/>
+ <bool key="NSIsDisabled">YES</bool>
+ <bool key="NSIsSeparator">YES</bool>
+ <string key="NSTitle"/>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="276216762">
+ <reference key="NSMenu" ref="96874957"/>
+ <string key="NSTitle">Tout ramener au premier plan</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ </array>
+ <string key="NSName">_NSWindowsMenu</string>
+ </object>
+ </object>
+ <object class="NSMenuItem" id="551174276">
+ <reference key="NSMenu" ref="524015605"/>
+ <string key="NSTitle">Aide</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ <string key="NSAction">submenuAction:</string>
+ <object class="NSMenu" key="NSSubmenu" id="511848303">
+ <string key="NSTitle">Aide</string>
+ <array class="NSMutableArray" key="NSMenuItems">
+ <object class="NSMenuItem" id="504984881">
+ <reference key="NSMenu" ref="511848303"/>
+ <string key="NSTitle">Aide X11</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ </array>
+ </object>
+ </object>
+ </array>
+ <string key="NSName">_NSMainMenu</string>
+ </object>
+ <object class="NSCustomObject" id="485884620">
+ <string key="NSClassName">X11Controller</string>
+ </object>
+ <object class="NSWindowTemplate" id="124913468">
+ <int key="NSWindowStyleMask">3</int>
+ <int key="NSWindowBacking">2</int>
+ <string key="NSWindowRect">{{414, 417}, {582, 329}}</string>
+ <int key="NSWTFlags">1350041600</int>
+ <string key="NSWindowTitle">Préférences d’X11</string>
+ <string key="NSWindowClass">NSPanel</string>
+ <object class="NSMutableString" key="NSViewClass">
+ <characters key="NS.bytes">View</characters>
+ </object>
+ <nil key="NSUserInterfaceItemIdentifier"/>
+ <string key="NSWindowContentMaxSize">{1.7976931348623157e+308, 1.7976931348623157e+308}</string>
+ <string key="NSWindowContentMinSize">{320, 240}</string>
+ <object class="NSView" key="NSWindowView" id="941366957">
+ <nil key="NSNextResponder"/>
+ <int key="NSvFlags">256</int>
+ <array class="NSMutableArray" key="NSSubviews">
+ <object class="NSTabView" id="448510093">
+ <reference key="NSNextResponder" ref="941366957"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{13, 10}, {556, 313}}</string>
+ <reference key="NSSuperview" ref="941366957"/>
+ <array class="NSMutableArray" key="NSTabViewItems">
+ <object class="NSTabViewItem" id="287591690">
+ <object class="NSMutableString" key="NSIdentifier">
+ <characters key="NS.bytes">1</characters>
+ </object>
+ <object class="NSView" key="NSView" id="596750588">
+ <nil key="NSNextResponder"/>
+ <int key="NSvFlags">256</int>
+ <array class="NSMutableArray" key="NSSubviews">
+ <object class="NSButton" id="119157981">
+ <reference key="NSNextResponder" ref="596750588"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{67, 235}, {402, 18}}</string>
+ <reference key="NSSuperview" ref="596750588"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="990762273">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Émuler une souris à trois boutons</string>
+ <object class="NSFont" key="NSSupport" id="463863101">
+ <string key="NSName">LucidaGrande</string>
+ <double key="NSSize">13</double>
+ <int key="NSfFlags">1044</int>
+ </object>
+ <reference key="NSControlView" ref="119157981"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">2</int>
+ <object class="NSCustomResource" key="NSNormalImage" id="243093215">
+ <string key="NSClassName">NSImage</string>
+ <string key="NSResourceName">NSSwitch</string>
+ </object>
+ <object class="NSButtonImageSource" key="NSAlternateImage" id="391434389">
+ <string key="NSImageName">NSSwitch</string>
+ </object>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSTextField" id="443008216">
+ <reference key="NSNextResponder" ref="596750588"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{85, 64}, {385, 42}}</string>
+ <reference key="NSSuperview" ref="596750588"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="391919450">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">4194304</int>
+ <string key="NSContents">Quand cette option est activée, les touches équivalentes de la barre des menus peuvent perturber les applications X11 qui utilisent le modificateur d’instructions virtuelles.</string>
+ <object class="NSFont" key="NSSupport" id="26">
+ <string key="NSName">LucidaGrande</string>
+ <double key="NSSize">11</double>
+ <int key="NSfFlags">3100</int>
+ </object>
+ <string key="NSPlaceholderString"/>
+ <reference key="NSControlView" ref="443008216"/>
+ <object class="NSColor" key="NSBackgroundColor" id="57160303">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">controlColor</string>
+ <object class="NSColor" key="NSColor" id="590688762">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
+ </object>
+ </object>
+ <object class="NSColor" key="NSTextColor" id="930815747">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">controlTextColor</string>
+ <object class="NSColor" key="NSColor" id="214098874">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MAA</bytes>
+ </object>
+ </object>
+ </object>
+ </object>
+ <object class="NSTextField" id="282885445">
+ <reference key="NSNextResponder" ref="596750588"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{85, 195}, {385, 34}}</string>
+ <reference key="NSSuperview" ref="596750588"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="649334366">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">4194304</int>
+ <string type="base64-UTF8" key="NSContents">TWFpbnRlbmV6IGxhIHRvdWNoZSBPcHRpb24gb3UgQ29tbWFuZGUgZW5mb25jw6llIHRvdXQgZW4gY2xp
+cXVhbnQgcG91ciBhY3RpdmVyIGxlIGJvdXRvbiBkcm9pdCBvdSBjZW50cmFsIGRlIGxhIHNvdXJpcy4K
+A</string>
+ <reference key="NSSupport" ref="26"/>
+ <string key="NSPlaceholderString"/>
+ <reference key="NSControlView" ref="282885445"/>
+ <reference key="NSBackgroundColor" ref="57160303"/>
+ <reference key="NSTextColor" ref="930815747"/>
+ </object>
+ </object>
+ <object class="NSButton" id="842100515">
+ <reference key="NSNextResponder" ref="596750588"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{67, 112}, {402, 18}}</string>
+ <reference key="NSSuperview" ref="596750588"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="940564599">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Activer les touches équivalentes sous X11</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="842100515"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">2</int>
+ <reference key="NSNormalImage" ref="243093215"/>
+ <reference key="NSAlternateImage" ref="391434389"/>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSTextField" id="31160162">
+ <reference key="NSNextResponder" ref="596750588"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{85, 136}, {385, 29}}</string>
+ <reference key="NSSuperview" ref="596750588"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="666057093">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">4194304</int>
+ <string key="NSContents">Autorise les modifications du menu d’entrée pour remplacer la disposition des touches du clavier X11.</string>
+ <reference key="NSSupport" ref="26"/>
+ <string key="NSPlaceholderString"/>
+ <reference key="NSControlView" ref="31160162"/>
+ <reference key="NSBackgroundColor" ref="57160303"/>
+ <reference key="NSTextColor" ref="930815747"/>
+ </object>
+ </object>
+ <object class="NSButton" id="179949713">
+ <reference key="NSNextResponder" ref="596750588"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{67, 171}, {402, 18}}</string>
+ <reference key="NSSuperview" ref="596750588"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="967619578">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Utiliser la disposition des touches du clavier du système</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="179949713"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">2</int>
+ <reference key="NSNormalImage" ref="243093215"/>
+ <reference key="NSAlternateImage" ref="391434389"/>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSTextField" id="278155937">
+ <reference key="NSNextResponder" ref="596750588"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{85, 6}, {385, 28}}</string>
+ <reference key="NSSuperview" ref="596750588"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="617441821">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">4194304</int>
+ <string key="NSContents">Une fois activées, les touches option envoient les symboles Alt_L et Alt_R au lieu de Mode_switch.</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="278155937"/>
+ <reference key="NSBackgroundColor" ref="57160303"/>
+ <reference key="NSTextColor" ref="930815747"/>
+ </object>
+ </object>
+ <object class="NSButton" id="406291430">
+ <reference key="NSNextResponder" ref="596750588"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{67, 40}, {402, 18}}</string>
+ <reference key="NSSuperview" ref="596750588"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="67728988">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Les touches option envoient Alt_L et Alt_R</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="406291430"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">2</int>
+ <reference key="NSNormalImage" ref="243093215"/>
+ <reference key="NSAlternateImage" ref="391434389"/>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ </array>
+ <string key="NSFrame">{{10, 33}, {536, 267}}</string>
+ </object>
+ <string key="NSLabel">Entrée</string>
+ <reference key="NSColor" ref="57160303"/>
+ <reference key="NSTabView" ref="448510093"/>
+ </object>
+ <object class="NSTabViewItem" id="960678392">
+ <object class="NSMutableString" key="NSIdentifier">
+ <characters key="NS.bytes">2</characters>
+ </object>
+ <object class="NSView" key="NSView" id="515308735">
+ <reference key="NSNextResponder" ref="448510093"/>
+ <int key="NSvFlags">256</int>
+ <array class="NSMutableArray" key="NSSubviews">
+ <object class="NSPopUpButton" id="709074847">
+ <reference key="NSNextResponder" ref="515308735"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{104, 223}, {128, 26}}</string>
+ <reference key="NSSuperview" ref="515308735"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSPopUpButtonCell" key="NSCell" id="633115429">
+ <int key="NSCellFlags">-2076049856</int>
+ <int key="NSCellFlags2">1024</int>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="709074847"/>
+ <int key="NSButtonFlags">109199615</int>
+ <int key="NSButtonFlags2">1</int>
+ <object class="NSFont" key="NSAlternateImage">
+ <string key="NSName">LucidaGrande</string>
+ <double key="NSSize">13</double>
+ <int key="NSfFlags">16</int>
+ </object>
+ <string key="NSAlternateContents"/>
+ <object class="NSMutableString" key="NSKeyEquivalent">
+ <characters key="NS.bytes"/>
+ </object>
+ <int key="NSPeriodicDelay">400</int>
+ <int key="NSPeriodicInterval">75</int>
+ <object class="NSMenuItem" key="NSMenuItem" id="616492372">
+ <reference key="NSMenu" ref="341113515"/>
+ <string key="NSTitle">du moniteur</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <int key="NSState">1</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ <string key="NSAction">_popUpItemAction:</string>
+ <int key="NSTag">-1</int>
+ <reference key="NSTarget" ref="633115429"/>
+ </object>
+ <bool key="NSMenuItemRespectAlignment">YES</bool>
+ <object class="NSMenu" key="NSMenu" id="341113515">
+ <object class="NSMutableString" key="NSTitle">
+ <characters key="NS.bytes">OtherViews</characters>
+ </object>
+ <array class="NSMutableArray" key="NSMenuItems">
+ <reference ref="616492372"/>
+ <object class="NSMenuItem" id="759499526">
+ <reference key="NSMenu" ref="341113515"/>
+ <string key="NSTitle">256 couleurs</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ <string key="NSAction">_popUpItemAction:</string>
+ <int key="NSTag">8</int>
+ <reference key="NSTarget" ref="633115429"/>
+ </object>
+ <object class="NSMenuItem" id="543935434">
+ <reference key="NSMenu" ref="341113515"/>
+ <string key="NSTitle">milliers</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ <string key="NSAction">_popUpItemAction:</string>
+ <int key="NSTag">15</int>
+ <reference key="NSTarget" ref="633115429"/>
+ </object>
+ <object class="NSMenuItem" id="836673018">
+ <reference key="NSMenu" ref="341113515"/>
+ <string key="NSTitle">millions</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ <string key="NSAction">_popUpItemAction:</string>
+ <int key="NSTag">24</int>
+ <reference key="NSTarget" ref="633115429"/>
+ </object>
+ </array>
+ </object>
+ <int key="NSPreferredEdge">3</int>
+ <bool key="NSUsesItemFromMenu">YES</bool>
+ <bool key="NSAltersState">YES</bool>
+ <int key="NSArrowPosition">1</int>
+ </object>
+ </object>
+ <object class="NSTextField" id="201731424">
+ <reference key="NSNextResponder" ref="515308735"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{33, 226}, {71, 20}}</string>
+ <reference key="NSSuperview" ref="515308735"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="930265681">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">4194304</int>
+ <string key="NSContents">Couleurs :</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <string key="NSPlaceholderString"/>
+ <reference key="NSControlView" ref="201731424"/>
+ <reference key="NSBackgroundColor" ref="57160303"/>
+ <reference key="NSTextColor" ref="930815747"/>
+ </object>
+ </object>
+ <object class="NSTextField" id="86150604">
+ <reference key="NSNextResponder" ref="515308735"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{52, 204}, {392, 14}}</string>
+ <reference key="NSSuperview" ref="515308735"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="311969422">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">4194304</int>
+ <string key="NSContents">Cette option prend effet au prochain lancement d’X11.</string>
+ <reference key="NSSupport" ref="26"/>
+ <string key="NSPlaceholderString"/>
+ <reference key="NSControlView" ref="86150604"/>
+ <reference key="NSBackgroundColor" ref="57160303"/>
+ <reference key="NSTextColor" ref="930815747"/>
+ </object>
+ </object>
+ <object class="NSButton" id="477203622">
+ <reference key="NSNextResponder" ref="515308735"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{34, 170}, {409, 23}}</string>
+ <reference key="NSSuperview" ref="515308735"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="631531164">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Mode plein écran</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="477203622"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">2</int>
+ <reference key="NSNormalImage" ref="243093215"/>
+ <reference key="NSAlternateImage" ref="391434389"/>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSButton" id="57246850">
+ <reference key="NSNextResponder" ref="515308735"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{53, 109}, {445, 18}}</string>
+ <reference key="NSSuperview" ref="515308735"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="917248662">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Afficher automatiquement la barre des menus en mode plein écran</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="57246850"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">2</int>
+ <reference key="NSNormalImage" ref="243093215"/>
+ <reference key="NSAlternateImage" ref="391434389"/>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSTextField" id="298603383">
+ <reference key="NSNextResponder" ref="515308735"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{52, 133}, {385, 31}}</string>
+ <reference key="NSSuperview" ref="515308735"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="761107402">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">4194304</int>
+ <string key="NSContents">Active la fenêtre root X11. Utilisez le raccourci clavier Commande + Option + A pour ouvrir et fermer le mode plein écran.</string>
+ <reference key="NSSupport" ref="26"/>
+ <string key="NSPlaceholderString"/>
+ <reference key="NSControlView" ref="298603383"/>
+ <reference key="NSBackgroundColor" ref="57160303"/>
+ <reference key="NSTextColor" ref="930815747"/>
+ </object>
+ </object>
+ </array>
+ <string key="NSFrame">{{10, 33}, {536, 267}}</string>
+ <reference key="NSSuperview" ref="448510093"/>
+ </object>
+ <string key="NSLabel">Sortie</string>
+ <reference key="NSColor" ref="57160303"/>
+ <reference key="NSTabView" ref="448510093"/>
+ </object>
+ <object class="NSTabViewItem" id="723450037">
+ <object class="NSMutableString" key="NSIdentifier">
+ <characters key="NS.bytes">2</characters>
+ </object>
+ <object class="NSView" key="NSView" id="408298283">
+ <nil key="NSNextResponder"/>
+ <int key="NSvFlags">256</int>
+ <array class="NSMutableArray" key="NSSubviews">
+ <object class="NSButton" id="878106058">
+ <reference key="NSNextResponder" ref="408298283"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{25, 235}, {409, 23}}</string>
+ <reference key="NSSuperview" ref="408298283"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="718083688">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Activer la synchronisation</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="878106058"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">2</int>
+ <reference key="NSNormalImage" ref="243093215"/>
+ <reference key="NSAlternateImage" ref="391434389"/>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSTextField" id="386152084">
+ <reference key="NSNextResponder" ref="408298283"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{43, 187}, {378, 42}}</string>
+ <reference key="NSSuperview" ref="408298283"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="572508492">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">4194304</int>
+ <string key="NSContents">Active la commande de menu « Copier » et permet la synchronisation entre le presse-papiers de OSX, celui de X11 (CLIPBOARD) et les mémoires tampons principales (PRIMARY).</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="386152084"/>
+ <reference key="NSBackgroundColor" ref="57160303"/>
+ <reference key="NSTextColor" ref="930815747"/>
+ </object>
+ </object>
+ <object class="NSButton" id="477050998">
+ <reference key="NSNextResponder" ref="408298283"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{41, 105}, {424, 18}}</string>
+ <reference key="NSSuperview" ref="408298283"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="501304422">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Mettre à jour CLIPBOARD lorsque le presse-papiers est modifié</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="477050998"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">2</int>
+ <reference key="NSNormalImage" ref="243093215"/>
+ <reference key="NSAlternateImage" ref="391434389"/>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSButton" id="765780304">
+ <reference key="NSNextResponder" ref="408298283"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{41, 83}, {489, 18}}</string>
+ <reference key="NSSuperview" ref="408298283"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="510771323">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Mettre à jour PRIMARY (clic central) lorsque le presse-papiers est modifié</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="765780304"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">2</int>
+ <reference key="NSNormalImage" ref="243093215"/>
+ <reference key="NSAlternateImage" ref="391434389"/>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSButton" id="1002778833">
+ <reference key="NSNextResponder" ref="408298283"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{41, 61}, {437, 18}}</string>
+ <reference key="NSSuperview" ref="408298283"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="897099877">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Mettre à jour le presse-papiers dès la sélection de nouveau texte</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="1002778833"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">2</int>
+ <reference key="NSNormalImage" ref="243093215"/>
+ <reference key="NSAlternateImage" ref="391434389"/>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSButton" id="487809555">
+ <reference key="NSNextResponder" ref="408298283"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{41, 163}, {424, 18}}</string>
+ <reference key="NSSuperview" ref="408298283"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="619977658">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Mettre à jour le presse-papiers lorsque CLIPBOARD est modifié</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="487809555"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">2</int>
+ <reference key="NSNormalImage" ref="243093215"/>
+ <reference key="NSAlternateImage" ref="391434389"/>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSTextField" id="620944856">
+ <reference key="NSNextResponder" ref="408298283"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{55, 129}, {385, 28}}</string>
+ <reference key="NSSuperview" ref="408298283"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="461823902">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">4194304</int>
+ <string key="NSContents">Désactivez cette option si vous voulez utiliser xclipboard, klipper, ou tout autre gestionnaire de presse-papiers X11.</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="620944856"/>
+ <reference key="NSBackgroundColor" ref="57160303"/>
+ <reference key="NSTextColor" ref="930815747"/>
+ </object>
+ </object>
+ <object class="NSTextField" id="522511724">
+ <reference key="NSNextResponder" ref="408298283"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{55, 29}, {385, 28}}</string>
+ <reference key="NSSuperview" ref="408298283"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="994587858">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">4194304</int>
+ <string key="NSContents">En raison de limitations du protocole X11, cette option ne fonctionnera pas toujours dans certaines applications.</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="522511724"/>
+ <reference key="NSBackgroundColor" ref="57160303"/>
+ <reference key="NSTextColor" ref="930815747"/>
+ </object>
+ </object>
+ </array>
+ <string key="NSFrame">{{10, 33}, {536, 267}}</string>
+ </object>
+ <string key="NSLabel">Presse-papiers</string>
+ <reference key="NSColor" ref="57160303"/>
+ <reference key="NSTabView" ref="448510093"/>
+ </object>
+ <object class="NSTabViewItem" id="10973343">
+ <object class="NSMutableString" key="NSIdentifier">
+ <characters key="NS.bytes">2</characters>
+ </object>
+ <object class="NSView" key="NSView" id="184765684">
+ <nil key="NSNextResponder"/>
+ <int key="NSvFlags">256</int>
+ <array class="NSMutableArray" key="NSSubviews">
+ <object class="NSButton" id="657659108">
+ <reference key="NSNextResponder" ref="184765684"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{67, 235}, {402, 18}}</string>
+ <reference key="NSSuperview" ref="184765684"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="259618205">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Activation des fenêtres inactives en un clic</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="657659108"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">2</int>
+ <reference key="NSNormalImage" ref="243093215"/>
+ <reference key="NSAlternateImage" ref="391434389"/>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSTextField" id="290578835">
+ <reference key="NSNextResponder" ref="184765684"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{75, 198}, {385, 31}}</string>
+ <reference key="NSSuperview" ref="184765684"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="399127858">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">4194304</int>
+ <string key="NSContents">En cas d’activation de cette option, si vous cliquez sur une fenêtre inactive, celle-ci deviendra active et le clic sera effectif.</string>
+ <reference key="NSSupport" ref="26"/>
+ <string key="NSPlaceholderString"/>
+ <reference key="NSControlView" ref="290578835"/>
+ <reference key="NSBackgroundColor" ref="57160303"/>
+ <reference key="NSTextColor" ref="930815747"/>
+ </object>
+ </object>
+ <object class="NSButton" id="992839333">
+ <reference key="NSNextResponder" ref="184765684"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{67, 174}, {402, 18}}</string>
+ <reference key="NSSuperview" ref="184765684"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="959555182">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Activation des fenêtres survolées par la souris</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="992839333"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">2</int>
+ <reference key="NSNormalImage" ref="243093215"/>
+ <reference key="NSAlternateImage" ref="391434389"/>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSTextField" id="138261120">
+ <reference key="NSNextResponder" ref="184765684"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{75, 140}, {381, 28}}</string>
+ <reference key="NSSuperview" ref="184765684"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="183409141">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">4194304</int>
+ <string key="NSContents">L’activation des fenêtres X11 suit le curseur. Ceci comporte des effets adverses.</string>
+ <reference key="NSSupport" ref="26"/>
+ <string key="NSPlaceholderString"/>
+ <reference key="NSControlView" ref="138261120"/>
+ <reference key="NSBackgroundColor" ref="57160303"/>
+ <reference key="NSTextColor" ref="930815747"/>
+ </object>
+ </object>
+ <object class="NSButton" id="128352289">
+ <reference key="NSNextResponder" ref="184765684"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{67, 116}, {402, 18}}</string>
+ <reference key="NSSuperview" ref="184765684"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="556463187">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Activation des nouvelles fenêtres</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="128352289"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">2</int>
+ <reference key="NSNormalImage" ref="243093215"/>
+ <reference key="NSAlternateImage" ref="391434389"/>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSTextField" id="57161931">
+ <reference key="NSNextResponder" ref="184765684"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{75, 68}, {385, 42}}</string>
+ <reference key="NSSuperview" ref="184765684"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="989804990">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">4194304</int>
+ <string key="NSContents">Lorsque cette option est activée, la création d’une nouvelle fenêtre X11 fait passer X11.app au premier plan (au lieu de Finder.app, Terminal.app, etc.)</string>
+ <reference key="NSSupport" ref="26"/>
+ <string key="NSPlaceholderString"/>
+ <reference key="NSControlView" ref="57161931"/>
+ <reference key="NSBackgroundColor" ref="57160303"/>
+ <reference key="NSTextColor" ref="930815747"/>
+ </object>
+ </object>
+ </array>
+ <string key="NSFrame">{{10, 33}, {536, 267}}</string>
+ </object>
+ <string key="NSLabel">Fenêtres</string>
+ <reference key="NSColor" ref="57160303"/>
+ <reference key="NSTabView" ref="448510093"/>
+ </object>
+ <object class="NSTabViewItem" id="348328898">
+ <object class="NSView" key="NSView" id="300811574">
+ <nil key="NSNextResponder"/>
+ <int key="NSvFlags">256</int>
+ <array class="NSMutableArray" key="NSSubviews">
+ <object class="NSButton" id="989050925">
+ <reference key="NSNextResponder" ref="300811574"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{67, 235}, {402, 18}}</string>
+ <reference key="NSSuperview" ref="300811574"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="189594322">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Authentifier les connexions</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="989050925"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">2</int>
+ <reference key="NSNormalImage" ref="243093215"/>
+ <reference key="NSAlternateImage" ref="391434389"/>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSButton" id="700826966">
+ <reference key="NSNextResponder" ref="300811574"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{67, 158}, {402, 18}}</string>
+ <reference key="NSSuperview" ref="300811574"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="489340979">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Autoriser les connexions de clients réseau</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="700826966"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">2</int>
+ <reference key="NSNormalImage" ref="243093215"/>
+ <reference key="NSAlternateImage" ref="391434389"/>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSTextField" id="168436707">
+ <reference key="NSNextResponder" ref="300811574"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{85, 187}, {385, 42}}</string>
+ <reference key="NSSuperview" ref="300811574"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="53243865">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">4194304</int>
+ <string key="NSContents">Le lancement d’X11 créera des touches de contrôle d’accès Xauthority. Si l’adresse IP du système change, ces touches ne seront plus valides, ce qui risquera d’empêcher le lancement des applications X11.</string>
+ <reference key="NSSupport" ref="26"/>
+ <string key="NSPlaceholderString"/>
+ <reference key="NSControlView" ref="168436707"/>
+ <reference key="NSBackgroundColor" ref="57160303"/>
+ <reference key="NSTextColor" ref="930815747"/>
+ </object>
+ </object>
+ <object class="NSTextField" id="363817195">
+ <reference key="NSNextResponder" ref="300811574"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{85, 96}, {385, 56}}</string>
+ <reference key="NSSuperview" ref="300811574"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="390084685">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">4194304</int>
+ <string key="NSContents">En cas d’activation de cette option, « Authentifier les connexions » doit aussi être activée pour garantir la sécurité du système. En cas de désactivation, les connexions à partir d’applications distantes sont interdites.</string>
+ <reference key="NSSupport" ref="26"/>
+ <string key="NSPlaceholderString"/>
+ <reference key="NSControlView" ref="363817195"/>
+ <reference key="NSBackgroundColor" ref="57160303"/>
+ <reference key="NSTextColor" ref="930815747"/>
+ </object>
+ </object>
+ <object class="NSTextField" id="223835729">
+ <reference key="NSNextResponder" ref="300811574"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{20, 5}, {404, 14}}</string>
+ <reference key="NSSuperview" ref="300811574"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="283628678">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">4194304</int>
+ <string key="NSContents">Ces options prennent effet au prochain lancement d’X11.</string>
+ <reference key="NSSupport" ref="26"/>
+ <string key="NSPlaceholderString"/>
+ <reference key="NSControlView" ref="223835729"/>
+ <reference key="NSBackgroundColor" ref="57160303"/>
+ <reference key="NSTextColor" ref="930815747"/>
+ </object>
+ </object>
+ </array>
+ <string key="NSFrame">{{10, 33}, {536, 267}}</string>
+ </object>
+ <string key="NSLabel">Sécurité</string>
+ <reference key="NSColor" ref="57160303"/>
+ <reference key="NSTabView" ref="448510093"/>
+ </object>
+ </array>
+ <reference key="NSSelectedTabViewItem" ref="960678392"/>
+ <reference key="NSFont" ref="463863101"/>
+ <int key="NSTvFlags">0</int>
+ <bool key="NSAllowTruncatedLabels">YES</bool>
+ <bool key="NSDrawsBackground">YES</bool>
+ <array class="NSMutableArray" key="NSSubviews">
+ <reference ref="515308735"/>
+ </array>
+ </object>
+ </array>
+ <string key="NSFrameSize">{582, 329}</string>
+ </object>
+ <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
+ <string key="NSMinSize">{320, 262}</string>
+ <string key="NSMaxSize">{1.7976931348623157e+308, 1.7976931348623157e+308}</string>
+ <string key="NSFrameAutosaveName">x11_prefs</string>
+ </object>
+ <object class="NSWindowTemplate" id="604417141">
+ <int key="NSWindowStyleMask">11</int>
+ <int key="NSWindowBacking">2</int>
+ <string key="NSWindowRect">{{302, 440}, {548, 271}}</string>
+ <int key="NSWTFlags">1350041600</int>
+ <string key="NSWindowTitle">Menu de l’application X11</string>
+ <string key="NSWindowClass">NSPanel</string>
+ <object class="NSMutableString" key="NSViewClass">
+ <characters key="NS.bytes">View</characters>
+ </object>
+ <nil key="NSUserInterfaceItemIdentifier"/>
+ <string key="NSWindowContentMaxSize">{1.7976931348623157e+308, 1.7976931348623157e+308}</string>
+ <string key="NSWindowContentMinSize">{320, 240}</string>
+ <object class="NSView" key="NSWindowView" id="85544634">
+ <nil key="NSNextResponder"/>
+ <int key="NSvFlags">256</int>
+ <array class="NSMutableArray" key="NSSubviews">
+ <object class="NSButton" id="671954382">
+ <reference key="NSNextResponder" ref="85544634"/>
+ <int key="NSvFlags">265</int>
+ <string key="NSFrame">{{372, 191}, {162, 32}}</string>
+ <reference key="NSSuperview" ref="85544634"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="143554520">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">137887744</int>
+ <string key="NSContents">Dupliquer</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="671954382"/>
+ <int key="NSButtonFlags">-2038284033</int>
+ <int key="NSButtonFlags2">1</int>
+ <object class="NSFont" key="NSAlternateImage" id="549406736">
+ <string key="NSName">Helvetica</string>
+ <double key="NSSize">13</double>
+ <int key="NSfFlags">16</int>
+ </object>
+ <string key="NSAlternateContents"/>
+ <object class="NSMutableString" key="NSKeyEquivalent">
+ <characters key="NS.bytes"/>
+ </object>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSButton" id="492358940">
+ <reference key="NSNextResponder" ref="85544634"/>
+ <int key="NSvFlags">265</int>
+ <string key="NSFrame">{{372, 159}, {162, 32}}</string>
+ <reference key="NSSuperview" ref="85544634"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="8201128">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">137887744</int>
+ <string key="NSContents">Supprimer</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="492358940"/>
+ <int key="NSButtonFlags">-2038284033</int>
+ <int key="NSButtonFlags2">1</int>
+ <reference key="NSAlternateImage" ref="549406736"/>
+ <string key="NSAlternateContents"/>
+ <object class="NSMutableString" key="NSKeyEquivalent">
+ <characters key="NS.bytes"/>
+ </object>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSScrollView" id="1063387772">
+ <reference key="NSNextResponder" ref="85544634"/>
+ <int key="NSvFlags">274</int>
+ <array class="NSMutableArray" key="NSSubviews">
+ <object class="NSClipView" id="580565898">
+ <reference key="NSNextResponder" ref="1063387772"/>
+ <int key="NSvFlags">2304</int>
+ <array class="NSMutableArray" key="NSSubviews">
+ <object class="NSTableView" id="905092943">
+ <reference key="NSNextResponder" ref="580565898"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrameSize">{333, 198}</string>
+ <reference key="NSSuperview" ref="580565898"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTableHeaderView" key="NSHeaderView" id="792419186">
+ <reference key="NSNextResponder" ref="672307654"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrameSize">{333, 17}</string>
+ <reference key="NSSuperview" ref="672307654"/>
+ <reference key="NSTableView" ref="905092943"/>
+ </object>
+ <object class="_NSCornerView" key="NSCornerView" id="898633680">
+ <reference key="NSNextResponder" ref="1063387772"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{334, 0}, {16, 17}}</string>
+ <reference key="NSSuperview" ref="1063387772"/>
+ </object>
+ <array class="NSMutableArray" key="NSTableColumns">
+ <object class="NSTableColumn" id="938444323">
+ <double key="NSWidth">155</double>
+ <double key="NSMinWidth">62.730998992919922</double>
+ <double key="NSMaxWidth">1000</double>
+ <object class="NSTableHeaderCell" key="NSHeaderCell">
+ <int key="NSCellFlags">75628096</int>
+ <int key="NSCellFlags2">2048</int>
+ <string key="NSContents">Nom</string>
+ <reference key="NSSupport" ref="26"/>
+ <object class="NSColor" key="NSBackgroundColor" id="113872566">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MC4zMzMzMzI5OQA</bytes>
+ </object>
+ <object class="NSColor" key="NSTextColor" id="249576247">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">headerTextColor</string>
+ <reference key="NSColor" ref="214098874"/>
+ </object>
+ </object>
+ <object class="NSTextFieldCell" key="NSDataCell" id="825378892">
+ <int key="NSCellFlags">338820672</int>
+ <int key="NSCellFlags2">1024</int>
+ <string key="NSContents">Text Cell</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <string key="NSPlaceholderString"/>
+ <reference key="NSControlView" ref="905092943"/>
+ <object class="NSColor" key="NSBackgroundColor" id="822946413">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MQA</bytes>
+ </object>
+ <reference key="NSTextColor" ref="930815747"/>
+ </object>
+ <int key="NSResizingMask">3</int>
+ <bool key="NSIsResizeable">YES</bool>
+ <bool key="NSIsEditable">YES</bool>
+ <reference key="NSTableView" ref="905092943"/>
+ <string key="NSHeaderToolTip"/>
+ </object>
+ <object class="NSTableColumn" id="84282687">
+ <double key="NSWidth">100</double>
+ <double key="NSMinWidth">40</double>
+ <double key="NSMaxWidth">1000</double>
+ <object class="NSTableHeaderCell" key="NSHeaderCell">
+ <int key="NSCellFlags">75628096</int>
+ <int key="NSCellFlags2">2048</int>
+ <string key="NSContents">Commande</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSBackgroundColor" ref="113872566"/>
+ <reference key="NSTextColor" ref="249576247"/>
+ </object>
+ <object class="NSTextFieldCell" key="NSDataCell" id="432610585">
+ <int key="NSCellFlags">338820672</int>
+ <int key="NSCellFlags2">1024</int>
+ <string key="NSContents">Text Cell</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <string key="NSPlaceholderString"/>
+ <reference key="NSControlView" ref="905092943"/>
+ <reference key="NSBackgroundColor" ref="822946413"/>
+ <reference key="NSTextColor" ref="930815747"/>
+ </object>
+ <int key="NSResizingMask">3</int>
+ <bool key="NSIsResizeable">YES</bool>
+ <bool key="NSIsEditable">YES</bool>
+ <reference key="NSTableView" ref="905092943"/>
+ <string key="NSHeaderToolTip"/>
+ </object>
+ <object class="NSTableColumn" id="242608782">
+ <double key="NSWidth">69</double>
+ <double key="NSMinWidth">10</double>
+ <double key="NSMaxWidth">1000</double>
+ <object class="NSTableHeaderCell" key="NSHeaderCell">
+ <int key="NSCellFlags">75628096</int>
+ <int key="NSCellFlags2">2048</int>
+ <string key="NSContents">Raccourci</string>
+ <reference key="NSSupport" ref="26"/>
+ <object class="NSColor" key="NSBackgroundColor">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">headerColor</string>
+ <reference key="NSColor" ref="822946413"/>
+ </object>
+ <reference key="NSTextColor" ref="249576247"/>
+ </object>
+ <object class="NSTextFieldCell" key="NSDataCell" id="34714764">
+ <int key="NSCellFlags">338820672</int>
+ <int key="NSCellFlags2">1024</int>
+ <string key="NSContents">Text Cell</string>
+ <object class="NSFont" key="NSSupport">
+ <string key="NSName">LucidaGrande</string>
+ <double key="NSSize">12</double>
+ <int key="NSfFlags">16</int>
+ </object>
+ <string key="NSPlaceholderString"/>
+ <reference key="NSControlView" ref="905092943"/>
+ <bool key="NSDrawsBackground">YES</bool>
+ <object class="NSColor" key="NSBackgroundColor" id="812484075">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">controlBackgroundColor</string>
+ <reference key="NSColor" ref="590688762"/>
+ </object>
+ <reference key="NSTextColor" ref="930815747"/>
+ </object>
+ <int key="NSResizingMask">3</int>
+ <bool key="NSIsResizeable">YES</bool>
+ <bool key="NSIsEditable">YES</bool>
+ <reference key="NSTableView" ref="905092943"/>
+ <string key="NSHeaderToolTip"/>
+ </object>
+ </array>
+ <double key="NSIntercellSpacingWidth">3</double>
+ <double key="NSIntercellSpacingHeight">2</double>
+ <reference key="NSBackgroundColor" ref="822946413"/>
+ <object class="NSColor" key="NSGridColor">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">gridColor</string>
+ <object class="NSColor" key="NSColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MC41AA</bytes>
+ </object>
+ </object>
+ <double key="NSRowHeight">17</double>
+ <int key="NSTvFlags">1379958784</int>
+ <reference key="NSDelegate"/>
+ <reference key="NSDataSource"/>
+ <int key="NSColumnAutoresizingStyle">1</int>
+ <int key="NSDraggingSourceMaskForLocal">-1</int>
+ <int key="NSDraggingSourceMaskForNonLocal">0</int>
+ <bool key="NSAllowsTypeSelect">YES</bool>
+ <int key="NSTableViewDraggingDestinationStyle">0</int>
+ <int key="NSTableViewGroupRowStyle">1</int>
+ </object>
+ </array>
+ <string key="NSFrame">{{1, 17}, {333, 198}}</string>
+ <reference key="NSSuperview" ref="1063387772"/>
+ <reference key="NSNextKeyView" ref="905092943"/>
+ <reference key="NSDocView" ref="905092943"/>
+ <reference key="NSBGColor" ref="812484075"/>
+ <int key="NScvFlags">4</int>
+ </object>
+ <object class="NSScroller" id="842897584">
+ <reference key="NSNextResponder" ref="1063387772"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{334, 17}, {15, 198}}</string>
+ <reference key="NSSuperview" ref="1063387772"/>
+ <reference key="NSTarget" ref="1063387772"/>
+ <string key="NSAction">_doScroller:</string>
+ <double key="NSPercent">0.99492380000000002</double>
+ </object>
+ <object class="NSScroller" id="17278747">
+ <reference key="NSNextResponder" ref="1063387772"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{1, 215}, {333, 15}}</string>
+ <reference key="NSSuperview" ref="1063387772"/>
+ <int key="NSsFlags">1</int>
+ <reference key="NSTarget" ref="1063387772"/>
+ <string key="NSAction">_doScroller:</string>
+ <double key="NSPercent">0.68852460000000004</double>
+ </object>
+ <object class="NSClipView" id="672307654">
+ <reference key="NSNextResponder" ref="1063387772"/>
+ <int key="NSvFlags">2304</int>
+ <array class="NSMutableArray" key="NSSubviews">
+ <reference ref="792419186"/>
+ </array>
+ <string key="NSFrame">{{1, 0}, {333, 17}}</string>
+ <reference key="NSSuperview" ref="1063387772"/>
+ <reference key="NSNextKeyView" ref="792419186"/>
+ <reference key="NSDocView" ref="792419186"/>
+ <reference key="NSBGColor" ref="812484075"/>
+ <int key="NScvFlags">4</int>
+ </object>
+ <reference ref="898633680"/>
+ </array>
+ <string key="NSFrame">{{20, 20}, {350, 231}}</string>
+ <reference key="NSSuperview" ref="85544634"/>
+ <reference key="NSNextKeyView" ref="580565898"/>
+ <int key="NSsFlags">133170</int>
+ <reference key="NSVScroller" ref="842897584"/>
+ <reference key="NSHScroller" ref="17278747"/>
+ <reference key="NSContentView" ref="580565898"/>
+ <reference key="NSHeaderClipView" ref="672307654"/>
+ <reference key="NSCornerView" ref="898633680"/>
+ <bytes key="NSScrollAmts">QSAAAEEgAABBmAAAQZgAAA</bytes>
+ </object>
+ <object class="NSButton" id="758204686">
+ <reference key="NSNextResponder" ref="85544634"/>
+ <int key="NSvFlags">265</int>
+ <string key="NSFrame">{{372, 223}, {162, 32}}</string>
+ <reference key="NSSuperview" ref="85544634"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="1025474039">
+ <int key="NSCellFlags">-2080244224</int>
+ <int key="NSCellFlags2">137887744</int>
+ <string key="NSContents">Ajouter un élément</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="758204686"/>
+ <int key="NSButtonFlags">-2038284033</int>
+ <int key="NSButtonFlags2">1</int>
+ <reference key="NSAlternateImage" ref="549406736"/>
+ <string key="NSAlternateContents"/>
+ <object class="NSMutableString" key="NSKeyEquivalent">
+ <characters key="NS.bytes"/>
+ </object>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ </array>
+ <string key="NSFrameSize">{548, 271}</string>
+ </object>
+ <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
+ <string key="NSMinSize">{320, 262}</string>
+ <string key="NSMaxSize">{1.7976931348623157e+308, 1.7976931348623157e+308}</string>
+ <string key="NSFrameAutosaveName">x11_apps</string>
+ </object>
+ <object class="NSMenu" id="294137138">
+ <string key="NSTitle">Menu</string>
+ <array class="NSMutableArray" key="NSMenuItems">
+ <object class="NSMenuItem" id="318286212">
+ <reference key="NSMenu" ref="294137138"/>
+ <bool key="NSIsDisabled">YES</bool>
+ <bool key="NSIsSeparator">YES</bool>
+ <string key="NSTitle"/>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="511651072">
+ <reference key="NSMenu" ref="294137138"/>
+ <string key="NSTitle">Applications</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ <string key="NSAction">submenuAction:</string>
+ <object class="NSMenu" key="NSSubmenu" id="48278059">
+ <string key="NSTitle">Applications</string>
+ <array class="NSMutableArray" key="NSMenuItems">
+ <object class="NSMenuItem" id="563798000">
+ <reference key="NSMenu" ref="48278059"/>
+ <bool key="NSIsDisabled">YES</bool>
+ <bool key="NSIsSeparator">YES</bool>
+ <string key="NSTitle"/>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="1032342329">
+ <reference key="NSMenu" ref="48278059"/>
+ <string key="NSTitle">Personnaliser…</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ </array>
+ </object>
+ </object>
+ </array>
+ <string key="NSName"/>
+ </object>
+ </array>
+ <object class="IBObjectContainer" key="IBDocument.Objects">
+ <array class="NSMutableArray" key="connectionRecords">
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">copy:</string>
+ <reference key="source" ref="941939442"/>
+ <reference key="destination" ref="185296989"/>
+ </object>
+ <int key="connectionID">181</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">minimize_window:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="677652931"/>
+ </object>
+ <int key="connectionID">202</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">close_window:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="984461797"/>
+ </object>
+ <int key="connectionID">205</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">zoom_window:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="1066447520"/>
+ </object>
+ <int key="connectionID">206</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">bring_to_front:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="276216762"/>
+ </object>
+ <int key="connectionID">207</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">hideOtherApplications:</string>
+ <reference key="source" ref="815810918"/>
+ <reference key="destination" ref="206802571"/>
+ </object>
+ <int key="connectionID">263</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">apps_separator</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="390088328"/>
+ </object>
+ <int key="connectionID">273</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">apps_table</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="905092943"/>
+ </object>
+ <int key="connectionID">301</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">apps_table_delete:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="492358940"/>
+ </object>
+ <int key="connectionID">303</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">apps_table_duplicate:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="671954382"/>
+ </object>
+ <int key="connectionID">304</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">apps_table_show:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="1065386165"/>
+ </object>
+ <int key="connectionID">308</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">apps_table_new:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="758204686"/>
+ </object>
+ <int key="connectionID">311</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">prefs_show:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="386173216"/>
+ </object>
+ <int key="connectionID">318</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">x11_about_item</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="139290918"/>
+ </object>
+ <int key="connectionID">321</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">enable_auth</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="989050925"/>
+ </object>
+ <int key="connectionID">387</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">enable_tcp</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="700826966"/>
+ </object>
+ <int key="connectionID">388</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">depth</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="709074847"/>
+ </object>
+ <int key="connectionID">389</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">fake_buttons</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="119157981"/>
+ </object>
+ <int key="connectionID">391</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">sync_keymap</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="179949713"/>
+ </object>
+ <int key="connectionID">392</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">enable_keyequivs</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="842100515"/>
+ </object>
+ <int key="connectionID">393</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">prefs_changed:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="119157981"/>
+ </object>
+ <int key="connectionID">394</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">prefs_changed:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="179949713"/>
+ </object>
+ <int key="connectionID">395</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">prefs_changed:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="842100515"/>
+ </object>
+ <int key="connectionID">396</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">prefs_changed:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="709074847"/>
+ </object>
+ <int key="connectionID">398</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">prefs_changed:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="989050925"/>
+ </object>
+ <int key="connectionID">399</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">prefs_changed:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="700826966"/>
+ </object>
+ <int key="connectionID">401</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">prefs_panel</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="124913468"/>
+ </object>
+ <int key="connectionID">402</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">x11_help:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="504984881"/>
+ </object>
+ <int key="connectionID">422</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">dockMenu</string>
+ <reference key="source" ref="815810918"/>
+ <reference key="destination" ref="294137138"/>
+ </object>
+ <int key="connectionID">426</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">dock_menu</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="294137138"/>
+ </object>
+ <int key="connectionID">428</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">delegate</string>
+ <reference key="source" ref="815810918"/>
+ <reference key="destination" ref="485884620"/>
+ </object>
+ <int key="connectionID">429</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">hide:</string>
+ <reference key="source" ref="815810918"/>
+ <reference key="destination" ref="301008465"/>
+ </object>
+ <int key="connectionID">430</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">unhideAllApplications:</string>
+ <reference key="source" ref="815810918"/>
+ <reference key="destination" ref="1023546148"/>
+ </object>
+ <int key="connectionID">431</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">orderFrontStandardAboutPanel:</string>
+ <reference key="source" ref="815810918"/>
+ <reference key="destination" ref="139290918"/>
+ </object>
+ <int key="connectionID">433</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">dock_apps_menu</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="48278059"/>
+ </object>
+ <int key="connectionID">530</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">dock_window_separator</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="318286212"/>
+ </object>
+ <int key="connectionID">531</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">apps_table_show:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="1032342329"/>
+ </object>
+ <int key="connectionID">534</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">next_window:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="1036389925"/>
+ </object>
+ <int key="connectionID">539</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">previous_window:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="369641893"/>
+ </object>
+ <int key="connectionID">540</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">enable_fullscreen</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="477203622"/>
+ </object>
+ <int key="connectionID">546</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">enable_fullscreen_changed:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="477203622"/>
+ </object>
+ <int key="connectionID">547</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">toggle_fullscreen:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="6876565"/>
+ </object>
+ <int key="connectionID">548</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">toggle_fullscreen_item</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="6876565"/>
+ </object>
+ <int key="connectionID">549</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">menu</string>
+ <reference key="source" ref="815810918"/>
+ <reference key="destination" ref="524015605"/>
+ </object>
+ <int key="connectionID">300334</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">terminate:</string>
+ <reference key="source" ref="815810918"/>
+ <reference key="destination" ref="274138642"/>
+ </object>
+ <int key="connectionID">300336</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">prefs_changed:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="657659108"/>
+ </object>
+ <int key="connectionID">300389</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">prefs_changed:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="992839333"/>
+ </object>
+ <int key="connectionID">300390</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">prefs_changed:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="128352289"/>
+ </object>
+ <int key="connectionID">300391</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">click_through</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="657659108"/>
+ </object>
+ <int key="connectionID">300392</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">focus_follows_mouse</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="992839333"/>
+ </object>
+ <int key="connectionID">300393</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">focus_on_new_window</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="128352289"/>
+ </object>
+ <int key="connectionID">300394</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">copy_menu_item</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="185296989"/>
+ </object>
+ <int key="connectionID">300443</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">sync_pasteboard</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="878106058"/>
+ </object>
+ <int key="connectionID">300444</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">sync_clipboard_to_pasteboard</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="487809555"/>
+ </object>
+ <int key="connectionID">300461</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">sync_pasteboard_to_clipboard</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="477050998"/>
+ </object>
+ <int key="connectionID">300462</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">sync_pasteboard_to_primary</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="765780304"/>
+ </object>
+ <int key="connectionID">300463</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">sync_primary_immediately</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="1002778833"/>
+ </object>
+ <int key="connectionID">300464</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">prefs_changed:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="878106058"/>
+ </object>
+ <int key="connectionID">300465</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">prefs_changed:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="487809555"/>
+ </object>
+ <int key="connectionID">300466</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">prefs_changed:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="477050998"/>
+ </object>
+ <int key="connectionID">300467</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">prefs_changed:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="765780304"/>
+ </object>
+ <int key="connectionID">300468</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">prefs_changed:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="1002778833"/>
+ </object>
+ <int key="connectionID">300469</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">sync_text1</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="620944856"/>
+ </object>
+ <int key="connectionID">300470</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">sync_text2</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="522511724"/>
+ </object>
+ <int key="connectionID">300471</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">enable_fullscreen_menu</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="57246850"/>
+ </object>
+ <int key="connectionID">300474</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">prefs_changed:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="57246850"/>
+ </object>
+ <int key="connectionID">300475</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">prefs_changed:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="406291430"/>
+ </object>
+ <int key="connectionID">300480</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">option_sends_alt</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="406291430"/>
+ </object>
+ <int key="connectionID">300481</int>
+ </object>
+ </array>
+ <object class="IBMutableOrderedSet" key="objectRecords">
+ <array key="orderedObjects">
+ <object class="IBObjectRecord">
+ <int key="objectID">0</int>
+ <array key="object" id="0"/>
+ <reference key="children" ref="904585544"/>
+ <nil key="parent"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-2</int>
+ <reference key="object" ref="815810918"/>
+ <reference key="parent" ref="0"/>
+ <string key="objectName">File's Owner</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-1</int>
+ <reference key="object" ref="941939442"/>
+ <reference key="parent" ref="0"/>
+ <string key="objectName">First Responder</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-3</int>
+ <reference key="object" ref="951368722"/>
+ <reference key="parent" ref="0"/>
+ <string key="objectName">Application</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">29</int>
+ <reference key="object" ref="524015605"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="931553638"/>
+ <reference ref="365880285"/>
+ <reference ref="200491363"/>
+ <reference ref="868031522"/>
+ <reference ref="551174276"/>
+ </array>
+ <reference key="parent" ref="0"/>
+ <string key="objectName">MainMenu</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">19</int>
+ <reference key="object" ref="931553638"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="96874957"/>
+ </array>
+ <reference key="parent" ref="524015605"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">24</int>
+ <reference key="object" ref="96874957"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="677652931"/>
+ <reference ref="276216762"/>
+ <reference ref="1066447520"/>
+ <reference ref="1036389925"/>
+ <reference ref="369641893"/>
+ <reference ref="155085383"/>
+ <reference ref="984461797"/>
+ <reference ref="280172320"/>
+ </array>
+ <reference key="parent" ref="931553638"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">5</int>
+ <reference key="object" ref="276216762"/>
+ <reference key="parent" ref="96874957"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">23</int>
+ <reference key="object" ref="677652931"/>
+ <reference key="parent" ref="96874957"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">92</int>
+ <reference key="object" ref="280172320"/>
+ <reference key="parent" ref="96874957"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">203</int>
+ <reference key="object" ref="984461797"/>
+ <reference key="parent" ref="96874957"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">204</int>
+ <reference key="object" ref="1066447520"/>
+ <reference key="parent" ref="96874957"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">536</int>
+ <reference key="object" ref="155085383"/>
+ <reference key="parent" ref="96874957"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">537</int>
+ <reference key="object" ref="1036389925"/>
+ <reference key="parent" ref="96874957"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">538</int>
+ <reference key="object" ref="369641893"/>
+ <reference key="parent" ref="96874957"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">56</int>
+ <reference key="object" ref="365880285"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="576521955"/>
+ </array>
+ <reference key="parent" ref="524015605"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">57</int>
+ <reference key="object" ref="576521955"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="139290918"/>
+ <reference ref="386173216"/>
+ <reference ref="32285361"/>
+ <reference ref="301008465"/>
+ <reference ref="274138642"/>
+ <reference ref="272876017"/>
+ <reference ref="431301145"/>
+ <reference ref="206802571"/>
+ <reference ref="848095279"/>
+ <reference ref="1023546148"/>
+ <reference ref="6876565"/>
+ <reference ref="479677589"/>
+ </array>
+ <reference key="parent" ref="365880285"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">58</int>
+ <reference key="object" ref="139290918"/>
+ <reference key="parent" ref="576521955"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">129</int>
+ <reference key="object" ref="386173216"/>
+ <reference key="parent" ref="576521955"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">131</int>
+ <reference key="object" ref="32285361"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="821388474"/>
+ </array>
+ <reference key="parent" ref="576521955"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">130</int>
+ <reference key="object" ref="821388474"/>
+ <reference key="parent" ref="32285361"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">134</int>
+ <reference key="object" ref="301008465"/>
+ <reference key="parent" ref="576521955"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">136</int>
+ <reference key="object" ref="274138642"/>
+ <reference key="parent" ref="576521955"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">143</int>
+ <reference key="object" ref="272876017"/>
+ <reference key="parent" ref="576521955"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">144</int>
+ <reference key="object" ref="431301145"/>
+ <reference key="parent" ref="576521955"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">145</int>
+ <reference key="object" ref="206802571"/>
+ <reference key="parent" ref="576521955"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">149</int>
+ <reference key="object" ref="848095279"/>
+ <reference key="parent" ref="576521955"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">150</int>
+ <reference key="object" ref="1023546148"/>
+ <reference key="parent" ref="576521955"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">544</int>
+ <reference key="object" ref="6876565"/>
+ <reference key="parent" ref="576521955"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">545</int>
+ <reference key="object" ref="479677589"/>
+ <reference key="parent" ref="576521955"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">163</int>
+ <reference key="object" ref="200491363"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="526778998"/>
+ </array>
+ <reference key="parent" ref="524015605"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">169</int>
+ <reference key="object" ref="526778998"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="185296989"/>
+ </array>
+ <reference key="parent" ref="200491363"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">157</int>
+ <reference key="object" ref="185296989"/>
+ <reference key="parent" ref="526778998"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">269</int>
+ <reference key="object" ref="868031522"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="981161348"/>
+ </array>
+ <reference key="parent" ref="524015605"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">270</int>
+ <reference key="object" ref="981161348"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="390088328"/>
+ <reference ref="1065386165"/>
+ </array>
+ <reference key="parent" ref="868031522"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">272</int>
+ <reference key="object" ref="390088328"/>
+ <reference key="parent" ref="981161348"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">305</int>
+ <reference key="object" ref="1065386165"/>
+ <reference key="parent" ref="981161348"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">419</int>
+ <reference key="object" ref="551174276"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="511848303"/>
+ </array>
+ <reference key="parent" ref="524015605"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">420</int>
+ <reference key="object" ref="511848303"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="504984881"/>
+ </array>
+ <reference key="parent" ref="551174276"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">421</int>
+ <reference key="object" ref="504984881"/>
+ <reference key="parent" ref="511848303"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">196</int>
+ <reference key="object" ref="485884620"/>
+ <reference key="parent" ref="0"/>
+ <string key="objectName">X11Controller</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">244</int>
+ <reference key="object" ref="124913468"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="941366957"/>
+ </array>
+ <reference key="parent" ref="0"/>
+ <string key="objectName">PrefsPanel</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">245</int>
+ <reference key="object" ref="941366957"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="448510093"/>
+ </array>
+ <reference key="parent" ref="124913468"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">348</int>
+ <reference key="object" ref="448510093"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="287591690"/>
+ <reference ref="960678392"/>
+ <reference ref="348328898"/>
+ <reference ref="10973343"/>
+ <reference ref="723450037"/>
+ </array>
+ <reference key="parent" ref="941366957"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">349</int>
+ <reference key="object" ref="287591690"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="596750588"/>
+ </array>
+ <reference key="parent" ref="448510093"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">351</int>
+ <reference key="object" ref="596750588"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="119157981"/>
+ <reference ref="443008216"/>
+ <reference ref="282885445"/>
+ <reference ref="842100515"/>
+ <reference ref="31160162"/>
+ <reference ref="179949713"/>
+ <reference ref="278155937"/>
+ <reference ref="406291430"/>
+ </array>
+ <reference key="parent" ref="287591690"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">363</int>
+ <reference key="object" ref="119157981"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="990762273"/>
+ </array>
+ <reference key="parent" ref="596750588"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">364</int>
+ <reference key="object" ref="443008216"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="391919450"/>
+ </array>
+ <reference key="parent" ref="596750588"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">365</int>
+ <reference key="object" ref="282885445"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="649334366"/>
+ </array>
+ <reference key="parent" ref="596750588"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">368</int>
+ <reference key="object" ref="842100515"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="940564599"/>
+ </array>
+ <reference key="parent" ref="596750588"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">369</int>
+ <reference key="object" ref="31160162"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="666057093"/>
+ </array>
+ <reference key="parent" ref="596750588"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">370</int>
+ <reference key="object" ref="179949713"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="967619578"/>
+ </array>
+ <reference key="parent" ref="596750588"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">352</int>
+ <reference key="object" ref="960678392"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="515308735"/>
+ </array>
+ <reference key="parent" ref="448510093"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">350</int>
+ <reference key="object" ref="515308735"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="709074847"/>
+ <reference ref="201731424"/>
+ <reference ref="86150604"/>
+ <reference ref="477203622"/>
+ <reference ref="57246850"/>
+ <reference ref="298603383"/>
+ </array>
+ <reference key="parent" ref="960678392"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">382</int>
+ <reference key="object" ref="709074847"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="633115429"/>
+ </array>
+ <reference key="parent" ref="515308735"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">385</int>
+ <reference key="object" ref="201731424"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="930265681"/>
+ </array>
+ <reference key="parent" ref="515308735"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">386</int>
+ <reference key="object" ref="86150604"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="311969422"/>
+ </array>
+ <reference key="parent" ref="515308735"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">541</int>
+ <reference key="object" ref="477203622"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="631531164"/>
+ </array>
+ <reference key="parent" ref="515308735"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">543</int>
+ <reference key="object" ref="298603383"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="761107402"/>
+ </array>
+ <reference key="parent" ref="515308735"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">353</int>
+ <reference key="object" ref="348328898"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="300811574"/>
+ </array>
+ <reference key="parent" ref="448510093"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">354</int>
+ <reference key="object" ref="300811574"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="989050925"/>
+ <reference ref="700826966"/>
+ <reference ref="168436707"/>
+ <reference ref="363817195"/>
+ <reference ref="223835729"/>
+ </array>
+ <reference key="parent" ref="348328898"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">374</int>
+ <reference key="object" ref="989050925"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="189594322"/>
+ </array>
+ <reference key="parent" ref="300811574"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">375</int>
+ <reference key="object" ref="700826966"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="489340979"/>
+ </array>
+ <reference key="parent" ref="300811574"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">376</int>
+ <reference key="object" ref="168436707"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="53243865"/>
+ </array>
+ <reference key="parent" ref="300811574"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">377</int>
+ <reference key="object" ref="363817195"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="390084685"/>
+ </array>
+ <reference key="parent" ref="300811574"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">379</int>
+ <reference key="object" ref="223835729"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="283628678"/>
+ </array>
+ <reference key="parent" ref="300811574"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">285</int>
+ <reference key="object" ref="604417141"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="85544634"/>
+ </array>
+ <reference key="parent" ref="0"/>
+ <string key="objectName">EditPrograms</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">286</int>
+ <reference key="object" ref="85544634"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="1063387772"/>
+ <reference ref="758204686"/>
+ <reference ref="671954382"/>
+ <reference ref="492358940"/>
+ </array>
+ <reference key="parent" ref="604417141"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">423</int>
+ <reference key="object" ref="294137138"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="318286212"/>
+ <reference ref="511651072"/>
+ </array>
+ <reference key="parent" ref="0"/>
+ <string key="objectName">DockMenu</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">524</int>
+ <reference key="object" ref="318286212"/>
+ <reference key="parent" ref="294137138"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">526</int>
+ <reference key="object" ref="511651072"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="48278059"/>
+ </array>
+ <reference key="parent" ref="294137138"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">527</int>
+ <reference key="object" ref="48278059"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="1032342329"/>
+ <reference ref="563798000"/>
+ </array>
+ <reference key="parent" ref="511651072"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">532</int>
+ <reference key="object" ref="1032342329"/>
+ <reference key="parent" ref="48278059"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">533</int>
+ <reference key="object" ref="563798000"/>
+ <reference key="parent" ref="48278059"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100363</int>
+ <reference key="object" ref="990762273"/>
+ <reference key="parent" ref="119157981"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100364</int>
+ <reference key="object" ref="391919450"/>
+ <reference key="parent" ref="443008216"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100365</int>
+ <reference key="object" ref="649334366"/>
+ <reference key="parent" ref="282885445"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100368</int>
+ <reference key="object" ref="940564599"/>
+ <reference key="parent" ref="842100515"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100369</int>
+ <reference key="object" ref="666057093"/>
+ <reference key="parent" ref="31160162"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100370</int>
+ <reference key="object" ref="967619578"/>
+ <reference key="parent" ref="179949713"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100382</int>
+ <reference key="object" ref="633115429"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="341113515"/>
+ </array>
+ <reference key="parent" ref="709074847"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100385</int>
+ <reference key="object" ref="930265681"/>
+ <reference key="parent" ref="201731424"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100386</int>
+ <reference key="object" ref="311969422"/>
+ <reference key="parent" ref="86150604"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100541</int>
+ <reference key="object" ref="631531164"/>
+ <reference key="parent" ref="477203622"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100543</int>
+ <reference key="object" ref="761107402"/>
+ <reference key="parent" ref="298603383"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100374</int>
+ <reference key="object" ref="189594322"/>
+ <reference key="parent" ref="989050925"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100375</int>
+ <reference key="object" ref="489340979"/>
+ <reference key="parent" ref="700826966"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100376</int>
+ <reference key="object" ref="53243865"/>
+ <reference key="parent" ref="168436707"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100377</int>
+ <reference key="object" ref="390084685"/>
+ <reference key="parent" ref="363817195"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100379</int>
+ <reference key="object" ref="283628678"/>
+ <reference key="parent" ref="223835729"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">380</int>
+ <reference key="object" ref="341113515"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="759499526"/>
+ <reference ref="616492372"/>
+ <reference ref="543935434"/>
+ <reference ref="836673018"/>
+ </array>
+ <reference key="parent" ref="633115429"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">435</int>
+ <reference key="object" ref="759499526"/>
+ <reference key="parent" ref="341113515"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">384</int>
+ <reference key="object" ref="616492372"/>
+ <reference key="parent" ref="341113515"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">383</int>
+ <reference key="object" ref="543935434"/>
+ <reference key="parent" ref="341113515"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">381</int>
+ <reference key="object" ref="836673018"/>
+ <reference key="parent" ref="341113515"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">295</int>
+ <reference key="object" ref="1063387772"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="792419186"/>
+ <reference ref="17278747"/>
+ <reference ref="842897584"/>
+ <reference ref="905092943"/>
+ </array>
+ <reference key="parent" ref="85544634"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300295</int>
+ <reference key="object" ref="792419186"/>
+ <reference key="parent" ref="1063387772"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">200295</int>
+ <reference key="object" ref="17278747"/>
+ <reference key="parent" ref="1063387772"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100295</int>
+ <reference key="object" ref="842897584"/>
+ <reference key="parent" ref="1063387772"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">296</int>
+ <reference key="object" ref="905092943"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="242608782"/>
+ <reference ref="938444323"/>
+ <reference ref="84282687"/>
+ </array>
+ <reference key="parent" ref="1063387772"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">535</int>
+ <reference key="object" ref="242608782"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="34714764"/>
+ </array>
+ <reference key="parent" ref="905092943"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">575</int>
+ <reference key="object" ref="34714764"/>
+ <reference key="parent" ref="242608782"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">298</int>
+ <reference key="object" ref="938444323"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="825378892"/>
+ </array>
+ <reference key="parent" ref="905092943"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">573</int>
+ <reference key="object" ref="825378892"/>
+ <reference key="parent" ref="938444323"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">297</int>
+ <reference key="object" ref="84282687"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="432610585"/>
+ </array>
+ <reference key="parent" ref="905092943"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">574</int>
+ <reference key="object" ref="432610585"/>
+ <reference key="parent" ref="84282687"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">310</int>
+ <reference key="object" ref="758204686"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="1025474039"/>
+ </array>
+ <reference key="parent" ref="85544634"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100310</int>
+ <reference key="object" ref="1025474039"/>
+ <reference key="parent" ref="758204686"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">292</int>
+ <reference key="object" ref="671954382"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="143554520"/>
+ </array>
+ <reference key="parent" ref="85544634"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100292</int>
+ <reference key="object" ref="143554520"/>
+ <reference key="parent" ref="671954382"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">293</int>
+ <reference key="object" ref="492358940"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="8201128"/>
+ </array>
+ <reference key="parent" ref="85544634"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100293</int>
+ <reference key="object" ref="8201128"/>
+ <reference key="parent" ref="492358940"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300337</int>
+ <reference key="object" ref="10973343"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="184765684"/>
+ </array>
+ <reference key="parent" ref="448510093"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300338</int>
+ <reference key="object" ref="184765684"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="657659108"/>
+ <reference ref="290578835"/>
+ <reference ref="992839333"/>
+ <reference ref="138261120"/>
+ <reference ref="128352289"/>
+ <reference ref="57161931"/>
+ </array>
+ <reference key="parent" ref="10973343"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300358</int>
+ <reference key="object" ref="290578835"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="399127858"/>
+ </array>
+ <reference key="parent" ref="184765684"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300359</int>
+ <reference key="object" ref="657659108"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="259618205"/>
+ </array>
+ <reference key="parent" ref="184765684"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300360</int>
+ <reference key="object" ref="259618205"/>
+ <reference key="parent" ref="657659108"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300361</int>
+ <reference key="object" ref="399127858"/>
+ <reference key="parent" ref="290578835"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300362</int>
+ <reference key="object" ref="992839333"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="959555182"/>
+ </array>
+ <reference key="parent" ref="184765684"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300363</int>
+ <reference key="object" ref="959555182"/>
+ <reference key="parent" ref="992839333"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300364</int>
+ <reference key="object" ref="138261120"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="183409141"/>
+ </array>
+ <reference key="parent" ref="184765684"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300365</int>
+ <reference key="object" ref="183409141"/>
+ <reference key="parent" ref="138261120"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300368</int>
+ <reference key="object" ref="128352289"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="556463187"/>
+ </array>
+ <reference key="parent" ref="184765684"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300369</int>
+ <reference key="object" ref="556463187"/>
+ <reference key="parent" ref="128352289"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300370</int>
+ <reference key="object" ref="57161931"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="989804990"/>
+ </array>
+ <reference key="parent" ref="184765684"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300371</int>
+ <reference key="object" ref="989804990"/>
+ <reference key="parent" ref="57161931"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300421</int>
+ <reference key="object" ref="723450037"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="408298283"/>
+ </array>
+ <reference key="parent" ref="448510093"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300422</int>
+ <reference key="object" ref="408298283"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="878106058"/>
+ <reference ref="386152084"/>
+ <reference ref="487809555"/>
+ <reference ref="620944856"/>
+ <reference ref="477050998"/>
+ <reference ref="765780304"/>
+ <reference ref="1002778833"/>
+ <reference ref="522511724"/>
+ </array>
+ <reference key="parent" ref="723450037"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300423</int>
+ <reference key="object" ref="386152084"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="572508492"/>
+ </array>
+ <reference key="parent" ref="408298283"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300424</int>
+ <reference key="object" ref="878106058"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="718083688"/>
+ </array>
+ <reference key="parent" ref="408298283"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300440</int>
+ <reference key="object" ref="718083688"/>
+ <reference key="parent" ref="878106058"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300441</int>
+ <reference key="object" ref="572508492"/>
+ <reference key="parent" ref="386152084"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300447</int>
+ <reference key="object" ref="477050998"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="501304422"/>
+ </array>
+ <reference key="parent" ref="408298283"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300450</int>
+ <reference key="object" ref="501304422"/>
+ <reference key="parent" ref="477050998"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300451</int>
+ <reference key="object" ref="765780304"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="510771323"/>
+ </array>
+ <reference key="parent" ref="408298283"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300452</int>
+ <reference key="object" ref="510771323"/>
+ <reference key="parent" ref="765780304"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300453</int>
+ <reference key="object" ref="487809555"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="619977658"/>
+ </array>
+ <reference key="parent" ref="408298283"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300454</int>
+ <reference key="object" ref="619977658"/>
+ <reference key="parent" ref="487809555"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300455</int>
+ <reference key="object" ref="620944856"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="461823902"/>
+ </array>
+ <reference key="parent" ref="408298283"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300456</int>
+ <reference key="object" ref="461823902"/>
+ <reference key="parent" ref="620944856"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300457</int>
+ <reference key="object" ref="1002778833"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="897099877"/>
+ </array>
+ <reference key="parent" ref="408298283"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300458</int>
+ <reference key="object" ref="897099877"/>
+ <reference key="parent" ref="1002778833"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300459</int>
+ <reference key="object" ref="522511724"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="994587858"/>
+ </array>
+ <reference key="parent" ref="408298283"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300460</int>
+ <reference key="object" ref="994587858"/>
+ <reference key="parent" ref="522511724"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300472</int>
+ <reference key="object" ref="57246850"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="917248662"/>
+ </array>
+ <reference key="parent" ref="515308735"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300473</int>
+ <reference key="object" ref="917248662"/>
+ <reference key="parent" ref="57246850"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300476</int>
+ <reference key="object" ref="278155937"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="617441821"/>
+ </array>
+ <reference key="parent" ref="596750588"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300477</int>
+ <reference key="object" ref="406291430"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="67728988"/>
+ </array>
+ <reference key="parent" ref="596750588"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300478</int>
+ <reference key="object" ref="67728988"/>
+ <reference key="parent" ref="406291430"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300479</int>
+ <reference key="object" ref="617441821"/>
+ <reference key="parent" ref="278155937"/>
+ </object>
+ </array>
+ </object>
+ <dictionary class="NSMutableDictionary" key="flattenedProperties">
+ <string key="-3.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="-3.ImportedFromIB2"/>
+ <string key="100292.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="100293.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="100295.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="100295.IBShouldRemoveOnLegacySave"/>
+ <string key="100310.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="100363.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="100364.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="100365.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="100368.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="100369.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="100370.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="100374.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="100375.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="100376.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="100377.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="100379.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="100382.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="100385.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="100386.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="100541.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="100543.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="129.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="129.ImportedFromIB2"/>
+ <string key="130.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="130.ImportedFromIB2"/>
+ <string key="131.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="131.ImportedFromIB2"/>
+ <string key="134.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="134.ImportedFromIB2"/>
+ <string key="136.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="136.ImportedFromIB2"/>
+ <string key="143.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="143.ImportedFromIB2"/>
+ <string key="144.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="144.ImportedFromIB2"/>
+ <string key="145.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="145.ImportedFromIB2"/>
+ <string key="149.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="149.ImportedFromIB2"/>
+ <string key="150.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="150.ImportedFromIB2"/>
+ <string key="157.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="157.ImportedFromIB2"/>
+ <string key="163.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="163.ImportedFromIB2"/>
+ <string key="169.IBEditorWindowLastContentRect">{{168, 821}, {113, 23}}</string>
+ <string key="169.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="169.ImportedFromIB2"/>
+ <string key="169.editorWindowContentRectSynchronizationRect">{{202, 626}, {154, 153}}</string>
+ <string key="19.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="19.ImportedFromIB2"/>
+ <integer value="1" key="196.ImportedFromIB2"/>
+ <string key="200295.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="200295.IBShouldRemoveOnLegacySave"/>
+ <string key="203.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="203.ImportedFromIB2"/>
+ <string key="204.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="204.ImportedFromIB2"/>
+ <string key="23.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="23.ImportedFromIB2"/>
+ <string key="24.IBEditorWindowLastContentRect">{{349, 868}, {315, 143}}</string>
+ <string key="24.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="24.ImportedFromIB2"/>
+ <string key="24.editorWindowContentRectSynchronizationRect">{{271, 666}, {301, 153}}</string>
+ <string key="244.IBEditorWindowLastContentRect">{{507, 565}, {484, 308}}</string>
+ <string key="244.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="244.IBWindowTemplateEditedContentRect">{{507, 565}, {484, 308}}</string>
+ <integer value="1" key="244.ImportedFromIB2"/>
+ <string key="244.editorWindowContentRectSynchronizationRect">{{184, 290}, {481, 345}}</string>
+ <integer value="0" key="244.windowTemplate.hasMaxSize"/>
+ <integer value="1" key="244.windowTemplate.hasMinSize"/>
+ <string key="244.windowTemplate.maxSize">{3.40282e+38, 3.40282e+38}</string>
+ <string key="244.windowTemplate.minSize">{320, 240}</string>
+ <string key="245.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="245.ImportedFromIB2"/>
+ <string key="269.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="269.ImportedFromIB2"/>
+ <string key="270.IBEditorWindowLastContentRect">{{58, 803}, {155, 33}}</string>
+ <string key="270.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="270.ImportedFromIB2"/>
+ <string key="270.editorWindowContentRectSynchronizationRect">{{100, 746}, {155, 33}}</string>
+ <string key="272.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="272.ImportedFromIB2"/>
+ <string key="285.IBEditorWindowLastContentRect">{{68, 585}, {454, 271}}</string>
+ <string key="285.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="285.IBViewEditorWindowController.showingBoundsRectangles"/>
+ <integer value="1" key="285.IBViewEditorWindowController.showingLayoutRectangles"/>
+ <string key="285.IBWindowTemplateEditedContentRect">{{68, 585}, {454, 271}}</string>
+ <integer value="1" key="285.ImportedFromIB2"/>
+ <string key="285.editorWindowContentRectSynchronizationRect">{{433, 406}, {486, 327}}</string>
+ <integer value="0" key="285.windowTemplate.hasMaxSize"/>
+ <integer value="1" key="285.windowTemplate.hasMinSize"/>
+ <string key="285.windowTemplate.maxSize">{3.40282e+38, 3.40282e+38}</string>
+ <string key="285.windowTemplate.minSize">{320, 240}</string>
+ <string key="286.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="286.ImportedFromIB2"/>
+ <string key="29.IBEditorWindowLastContentRect">{{145, 1011}, {336, 20}}</string>
+ <string key="29.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="29.ImportedFromIB2"/>
+ <string key="29.editorWindowContentRectSynchronizationRect">{{67, 819}, {336, 20}}</string>
+ <string key="292.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="292.ImportedFromIB2"/>
+ <string key="293.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="293.ImportedFromIB2"/>
+ <string key="295.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="295.ImportedFromIB2"/>
+ <string key="296.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="296.ImportedFromIB2"/>
+ <string key="297.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="297.ImportedFromIB2"/>
+ <string key="298.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="298.ImportedFromIB2"/>
+ <string key="300295.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="300295.IBShouldRemoveOnLegacySave"/>
+ <string key="300337.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="300337.ImportedFromIB2"/>
+ <string key="300338.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="300338.ImportedFromIB2"/>
+ <string key="300358.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="300358.ImportedFromIB2"/>
+ <string key="300359.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="300359.ImportedFromIB2"/>
+ <string key="300360.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="300361.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="300362.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="300362.ImportedFromIB2"/>
+ <string key="300363.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="300364.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="300364.ImportedFromIB2"/>
+ <string key="300365.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="300368.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="300368.ImportedFromIB2"/>
+ <string key="300369.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="300370.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="300370.ImportedFromIB2"/>
+ <string key="300371.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="300421.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="300421.ImportedFromIB2"/>
+ <string key="300422.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="300422.ImportedFromIB2"/>
+ <string key="300423.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="300423.ImportedFromIB2"/>
+ <string key="300424.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="300424.ImportedFromIB2"/>
+ <string key="300440.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="300441.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="300447.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="300447.ImportedFromIB2"/>
+ <string key="300450.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="300451.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="300451.ImportedFromIB2"/>
+ <string key="300452.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="300453.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="300453.ImportedFromIB2"/>
+ <string key="300454.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="300455.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="300455.ImportedFromIB2"/>
+ <string key="300456.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="300457.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="300457.ImportedFromIB2"/>
+ <string key="300458.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="300459.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="300459.ImportedFromIB2"/>
+ <string key="300460.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="300472.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="300472.ImportedFromIB2"/>
+ <string key="300473.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="300476.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="300476.ImportedFromIB2"/>
+ <string key="300477.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="300477.ImportedFromIB2"/>
+ <string key="300478.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="300479.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="305.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="305.ImportedFromIB2"/>
+ <string key="310.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="310.ImportedFromIB2"/>
+ <string key="348.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="348.ImportedFromIB2"/>
+ <string key="349.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="349.ImportedFromIB2"/>
+ <string key="350.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="350.ImportedFromIB2"/>
+ <string key="351.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="351.ImportedFromIB2"/>
+ <string key="352.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="352.ImportedFromIB2"/>
+ <string key="353.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="353.ImportedFromIB2"/>
+ <string key="354.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="354.ImportedFromIB2"/>
+ <string key="363.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="363.ImportedFromIB2"/>
+ <string key="364.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="364.ImportedFromIB2"/>
+ <string key="365.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="365.ImportedFromIB2"/>
+ <string key="368.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="368.ImportedFromIB2"/>
+ <string key="369.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="369.ImportedFromIB2"/>
+ <string key="370.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="370.ImportedFromIB2"/>
+ <string key="374.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="374.ImportedFromIB2"/>
+ <string key="375.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="375.ImportedFromIB2"/>
+ <string key="376.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="376.ImportedFromIB2"/>
+ <string key="377.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="377.ImportedFromIB2"/>
+ <string key="379.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="379.ImportedFromIB2"/>
+ <string key="380.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="380.ImportedFromIB2"/>
+ <string key="381.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="381.ImportedFromIB2"/>
+ <string key="382.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="382.ImportedFromIB2"/>
+ <string key="383.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="383.ImportedFromIB2"/>
+ <string key="384.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="384.ImportedFromIB2"/>
+ <string key="385.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="385.ImportedFromIB2"/>
+ <string key="386.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="386.ImportedFromIB2"/>
+ <string key="419.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="419.ImportedFromIB2"/>
+ <string key="420.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="420.ImportedFromIB2"/>
+ <string key="421.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="421.ImportedFromIB2"/>
+ <string key="423.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="423.ImportedFromIB2"/>
+ <string key="435.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="435.ImportedFromIB2"/>
+ <string key="5.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="5.ImportedFromIB2"/>
+ <string key="524.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="524.ImportedFromIB2"/>
+ <string key="526.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="526.ImportedFromIB2"/>
+ <string key="527.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="527.ImportedFromIB2"/>
+ <string key="532.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="532.ImportedFromIB2"/>
+ <string key="533.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="533.ImportedFromIB2"/>
+ <string key="535.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="535.ImportedFromIB2"/>
+ <string key="536.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="536.ImportedFromIB2"/>
+ <string key="537.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="537.ImportedFromIB2"/>
+ <string key="538.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="538.ImportedFromIB2"/>
+ <string key="541.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="541.ImportedFromIB2"/>
+ <string key="543.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="543.ImportedFromIB2"/>
+ <string key="544.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="544.ImportedFromIB2"/>
+ <string key="545.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="545.ImportedFromIB2"/>
+ <string key="56.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="56.ImportedFromIB2"/>
+ <string key="57.IBEditorWindowLastContentRect">{{20, 641}, {218, 203}}</string>
+ <string key="57.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="57.ImportedFromIB2"/>
+ <string key="57.editorWindowContentRectSynchronizationRect">{{79, 616}, {218, 203}}</string>
+ <string key="573.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="573.ImportedFromIB2"/>
+ <string key="574.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="574.ImportedFromIB2"/>
+ <string key="575.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="575.ImportedFromIB2"/>
+ <string key="58.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="58.ImportedFromIB2"/>
+ <string key="92.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" key="92.ImportedFromIB2"/>
+ </dictionary>
+ <dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
+ <nil key="activeLocalization"/>
+ <dictionary class="NSMutableDictionary" key="localizations"/>
+ <nil key="sourceID"/>
+ <int key="maxID">300481</int>
+ </object>
+ <object class="IBClassDescriber" key="IBDocument.Classes">
+ <array class="NSMutableArray" key="referencedPartialClassDescriptions">
+ <object class="IBPartialClassDescription">
+ <string key="className">FirstResponder</string>
+ <string key="superclassName">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBUserSource</string>
+ <string key="minorKey"/>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSFormatter</string>
+ <string key="superclassName">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBUserSource</string>
+ <string key="minorKey"/>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">X11Controller</string>
+ <string key="superclassName">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBUserSource</string>
+ <string key="minorKey"/>
+ </object>
+ </object>
+ </array>
+ <array class="NSMutableArray" key="referencedPartialClassDescriptionsV3.1+">
+ <object class="IBPartialClassDescription">
+ <string key="className">X11Controller</string>
+ <string key="superclassName">NSObject</string>
+ <dictionary class="NSMutableDictionary" key="actions">
+ <string key="apps_table_delete:">id</string>
+ <string key="apps_table_done:">id</string>
+ <string key="apps_table_duplicate:">id</string>
+ <string key="apps_table_new:">id</string>
+ <string key="apps_table_show:">id</string>
+ <string key="bring_to_front:">id</string>
+ <string key="close_window:">id</string>
+ <string key="enable_fullscreen_changed:">id</string>
+ <string key="minimize_window:">id</string>
+ <string key="next_window:">id</string>
+ <string key="prefs_changed:">id</string>
+ <string key="prefs_show:">id</string>
+ <string key="previous_window:">id</string>
+ <string key="quit:">id</string>
+ <string key="toggle_fullscreen:">id</string>
+ <string key="x11_help:">id</string>
+ <string key="zoom_window:">id</string>
+ </dictionary>
+ <dictionary class="NSMutableDictionary" key="actionInfosByName">
+ <object class="IBActionInfo" key="apps_table_delete:">
+ <string key="name">apps_table_delete:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="apps_table_done:">
+ <string key="name">apps_table_done:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="apps_table_duplicate:">
+ <string key="name">apps_table_duplicate:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="apps_table_new:">
+ <string key="name">apps_table_new:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="apps_table_show:">
+ <string key="name">apps_table_show:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="bring_to_front:">
+ <string key="name">bring_to_front:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="close_window:">
+ <string key="name">close_window:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="enable_fullscreen_changed:">
+ <string key="name">enable_fullscreen_changed:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="minimize_window:">
+ <string key="name">minimize_window:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="next_window:">
+ <string key="name">next_window:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="prefs_changed:">
+ <string key="name">prefs_changed:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="prefs_show:">
+ <string key="name">prefs_show:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="previous_window:">
+ <string key="name">previous_window:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="quit:">
+ <string key="name">quit:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="toggle_fullscreen:">
+ <string key="name">toggle_fullscreen:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="x11_help:">
+ <string key="name">x11_help:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="zoom_window:">
+ <string key="name">zoom_window:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ </dictionary>
+ <dictionary class="NSMutableDictionary" key="outlets">
+ <string key="apps_separator">NSMenuItem</string>
+ <string key="apps_table">NSTableView</string>
+ <string key="click_through">NSButton</string>
+ <string key="copy_menu_item">NSMenuItem</string>
+ <string key="depth">NSPopUpButton</string>
+ <string key="dock_apps_menu">NSMenu</string>
+ <string key="dock_menu">NSMenu</string>
+ <string key="dock_window_separator">NSMenuItem</string>
+ <string key="enable_auth">NSButton</string>
+ <string key="enable_fullscreen">NSButton</string>
+ <string key="enable_fullscreen_menu">NSButton</string>
+ <string key="enable_keyequivs">NSButton</string>
+ <string key="enable_tcp">NSButton</string>
+ <string key="fake_buttons">NSButton</string>
+ <string key="focus_follows_mouse">NSButton</string>
+ <string key="focus_on_new_window">NSButton</string>
+ <string key="option_sends_alt">NSButton</string>
+ <string key="prefs_panel">NSPanel</string>
+ <string key="sync_clipboard_to_pasteboard">NSButton</string>
+ <string key="sync_keymap">NSButton</string>
+ <string key="sync_pasteboard">NSButton</string>
+ <string key="sync_pasteboard_to_clipboard">NSButton</string>
+ <string key="sync_pasteboard_to_primary">NSButton</string>
+ <string key="sync_primary_immediately">NSButton</string>
+ <string key="sync_text1">NSTextField</string>
+ <string key="sync_text2">NSTextField</string>
+ <string key="toggle_fullscreen_item">NSMenuItem</string>
+ <string key="use_sysbeep">NSButton</string>
+ <string key="window_separator">NSMenuItem</string>
+ <string key="x11_about_item">NSMenuItem</string>
+ </dictionary>
+ <dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
+ <object class="IBToOneOutletInfo" key="apps_separator">
+ <string key="name">apps_separator</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="apps_table">
+ <string key="name">apps_table</string>
+ <string key="candidateClassName">NSTableView</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="click_through">
+ <string key="name">click_through</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="copy_menu_item">
+ <string key="name">copy_menu_item</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="depth">
+ <string key="name">depth</string>
+ <string key="candidateClassName">NSPopUpButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="dock_apps_menu">
+ <string key="name">dock_apps_menu</string>
+ <string key="candidateClassName">NSMenu</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="dock_menu">
+ <string key="name">dock_menu</string>
+ <string key="candidateClassName">NSMenu</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="dock_window_separator">
+ <string key="name">dock_window_separator</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="enable_auth">
+ <string key="name">enable_auth</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="enable_fullscreen">
+ <string key="name">enable_fullscreen</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="enable_fullscreen_menu">
+ <string key="name">enable_fullscreen_menu</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="enable_keyequivs">
+ <string key="name">enable_keyequivs</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="enable_tcp">
+ <string key="name">enable_tcp</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="fake_buttons">
+ <string key="name">fake_buttons</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="focus_follows_mouse">
+ <string key="name">focus_follows_mouse</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="focus_on_new_window">
+ <string key="name">focus_on_new_window</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="option_sends_alt">
+ <string key="name">option_sends_alt</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="prefs_panel">
+ <string key="name">prefs_panel</string>
+ <string key="candidateClassName">NSPanel</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="sync_clipboard_to_pasteboard">
+ <string key="name">sync_clipboard_to_pasteboard</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="sync_keymap">
+ <string key="name">sync_keymap</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="sync_pasteboard">
+ <string key="name">sync_pasteboard</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="sync_pasteboard_to_clipboard">
+ <string key="name">sync_pasteboard_to_clipboard</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="sync_pasteboard_to_primary">
+ <string key="name">sync_pasteboard_to_primary</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="sync_primary_immediately">
+ <string key="name">sync_primary_immediately</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="sync_text1">
+ <string key="name">sync_text1</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="sync_text2">
+ <string key="name">sync_text2</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="toggle_fullscreen_item">
+ <string key="name">toggle_fullscreen_item</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="use_sysbeep">
+ <string key="name">use_sysbeep</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="window_separator">
+ <string key="name">window_separator</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="x11_about_item">
+ <string key="name">x11_about_item</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ </dictionary>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBDocumentRelativeSource</string>
+ <string key="minorKey">../../../X11Controller.h</string>
+ </object>
+ </object>
+ </array>
+ </object>
+ <int key="IBDocument.localizationMode">0</int>
+ <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
+ <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
+ <integer value="1040" key="NS.object.0"/>
+ </object>
+ <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
+ <string key="IBDocument.LastKnownRelativeProjectPath">../X11.xcodeproj</string>
+ <int key="IBDocument.defaultPropertyAccessControl">3</int>
+ <dictionary class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
+ <string key="NSMenuCheckmark">{9, 8}</string>
+ <string key="NSMenuMixedState">{7, 2}</string>
+ <string key="NSSwitch">{15, 15}</string>
+ </dictionary>
+ </data>
+</archive>
diff --git a/xorg-server/hw/xquartz/bundle/Resources/French.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/Resources/French.lproj/main.nib/keyedobjects.nib
index 981332331..3443780f1 100644
--- a/xorg-server/hw/xquartz/bundle/Resources/French.lproj/main.nib/keyedobjects.nib
+++ b/xorg-server/hw/xquartz/bundle/Resources/French.lproj/main.nib/keyedobjects.nib
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/Resources/German.lproj/locversion.plist b/xorg-server/hw/xquartz/bundle/Resources/German.lproj/locversion.plist
index 313b57752..caf0364c7 100644
--- a/xorg-server/hw/xquartz/bundle/Resources/German.lproj/locversion.plist
+++ b/xorg-server/hw/xquartz/bundle/Resources/German.lproj/locversion.plist
@@ -3,12 +3,12 @@
<plist version="1.0">
<dict>
<key>LprojCompatibleVersion</key>
- <string>101</string>
+ <string>102</string>
<key>LprojLocale</key>
<string>de</string>
<key>LprojRevisionLevel</key>
<string>1</string>
<key>LprojVersion</key>
- <string>101</string>
+ <string>102</string>
</dict>
</plist>
diff --git a/xorg-server/hw/xquartz/bundle/Resources/German.lproj/main.nib/designable.nib b/xorg-server/hw/xquartz/bundle/Resources/German.lproj/main.nib/designable.nib
index d34ff7266..dea837bce 100644
--- a/xorg-server/hw/xquartz/bundle/Resources/German.lproj/main.nib/designable.nib
+++ b/xorg-server/hw/xquartz/bundle/Resources/German.lproj/main.nib/designable.nib
@@ -2,13 +2,13 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1040</int>
- <string key="IBDocument.SystemVersion">11A194b</string>
- <string key="IBDocument.InterfaceBuilderVersion">787</string>
- <string key="IBDocument.AppKitVersion">1079</string>
- <string key="IBDocument.HIToolboxVersion">502.00</string>
+ <string key="IBDocument.SystemVersion">11A289</string>
+ <string key="IBDocument.InterfaceBuilderVersion">844</string>
+ <string key="IBDocument.AppKitVersion">1094.2</string>
+ <string key="IBDocument.HIToolboxVersion">521.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="NS.object.0">787</string>
+ <string key="NS.object.0">844</string>
</object>
<array class="NSMutableArray" key="IBDocument.EditedObjectIDs"/>
<array key="IBDocument.PluginDependencies">
@@ -370,7 +370,7 @@
<characters key="NS.bytes">View</characters>
</object>
<nil key="NSUserInterfaceItemIdentifier"/>
- <string key="NSWindowContentMaxSize">{3.4028235e+38, 3.4028235e+38}</string>
+ <string key="NSWindowContentMaxSize">{1.7976931348623157e+308, 1.7976931348623157e+308}</string>
<string key="NSWindowContentMinSize">{320, 240}</string>
<object class="NSView" key="NSWindowView" id="941366957">
<nil key="NSNextResponder"/>
@@ -387,7 +387,7 @@
<characters key="NS.bytes">1</characters>
</object>
<object class="NSView" key="NSView" id="596750588">
- <reference key="NSNextResponder" ref="448510093"/>
+ <nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<array class="NSMutableArray" key="NSSubviews">
<object class="NSButton" id="119157981">
@@ -408,7 +408,7 @@
<reference key="NSControlView" ref="119157981"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
- <object class="NSCustomResource" key="NSNormalImage" id="718371158">
+ <object class="NSCustomResource" key="NSNormalImage" id="65187362">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">NSSwitch</string>
</object>
@@ -444,7 +444,7 @@
<string key="NSColorName">controlColor</string>
<object class="NSColor" key="NSColor" id="590688762">
<int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC42NjY2NjY2ODY1AA</bytes>
+ <bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
</object>
</object>
<object class="NSColor" key="NSTextColor" id="930815747">
@@ -491,7 +491,7 @@ dmllcmVuLgo</string>
<reference key="NSControlView" ref="842100515"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="718371158"/>
+ <reference key="NSNormalImage" ref="65187362"/>
<reference key="NSAlternateImage" ref="391434389"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@@ -530,7 +530,7 @@ dmllcmVuLgo</string>
<reference key="NSControlView" ref="179949713"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="718371158"/>
+ <reference key="NSNormalImage" ref="65187362"/>
<reference key="NSAlternateImage" ref="391434389"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@@ -568,7 +568,7 @@ dmllcmVuLgo</string>
<reference key="NSControlView" ref="406291430"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="718371158"/>
+ <reference key="NSNormalImage" ref="65187362"/>
<reference key="NSAlternateImage" ref="391434389"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@@ -578,7 +578,6 @@ dmllcmVuLgo</string>
</object>
</array>
<string key="NSFrame">{{10, 33}, {559, 240}}</string>
- <reference key="NSSuperview" ref="448510093"/>
</object>
<string key="NSLabel">Eingabe</string>
<reference key="NSColor" ref="57160303"/>
@@ -589,7 +588,7 @@ dmllcmVuLgo</string>
<characters key="NS.bytes">2</characters>
</object>
<object class="NSView" key="NSView" id="515308735">
- <nil key="NSNextResponder"/>
+ <reference key="NSNextResponder" ref="448510093"/>
<int key="NSvFlags">256</int>
<array class="NSMutableArray" key="NSSubviews">
<object class="NSPopUpButton" id="709074847">
@@ -616,16 +615,17 @@ dmllcmVuLgo</string>
</object>
<int key="NSPeriodicDelay">400</int>
<int key="NSPeriodicInterval">75</int>
- <object class="NSMenuItem" key="NSMenuItem" id="836673018">
+ <object class="NSMenuItem" key="NSMenuItem" id="616492372">
<reference key="NSMenu" ref="341113515"/>
- <string key="NSTitle">16,7 Millionen Farben</string>
+ <string key="NSTitle">Vom Monitor</string>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
+ <int key="NSState">1</int>
<reference key="NSOnImage" ref="531645050"/>
<reference key="NSMixedImage" ref="351811234"/>
<string key="NSAction">_popUpItemAction:</string>
- <int key="NSTag">24</int>
+ <int key="NSTag">-1</int>
<reference key="NSTarget" ref="633115429"/>
</object>
<bool key="NSMenuItemRespectAlignment">YES</bool>
@@ -634,47 +634,45 @@ dmllcmVuLgo</string>
<characters key="NS.bytes">OtherViews</characters>
</object>
<array class="NSMutableArray" key="NSMenuItems">
- <object class="NSMenuItem" id="616492372">
+ <reference ref="616492372"/>
+ <object class="NSMenuItem" id="759499526">
<reference key="NSMenu" ref="341113515"/>
- <string key="NSTitle">Vom Monitor</string>
+ <string key="NSTitle">256 Farben</string>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
- <int key="NSState">1</int>
<reference key="NSOnImage" ref="531645050"/>
<reference key="NSMixedImage" ref="351811234"/>
<string key="NSAction">_popUpItemAction:</string>
- <int key="NSTag">-1</int>
+ <int key="NSTag">8</int>
<reference key="NSTarget" ref="633115429"/>
</object>
- <object class="NSMenuItem" id="759499526">
+ <object class="NSMenuItem" id="543935434">
<reference key="NSMenu" ref="341113515"/>
- <string key="NSTitle">256 Farben</string>
+ <string key="NSTitle">32768 Farben</string>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="531645050"/>
<reference key="NSMixedImage" ref="351811234"/>
<string key="NSAction">_popUpItemAction:</string>
- <int key="NSTag">8</int>
+ <int key="NSTag">15</int>
<reference key="NSTarget" ref="633115429"/>
</object>
- <object class="NSMenuItem" id="543935434">
+ <object class="NSMenuItem" id="836673018">
<reference key="NSMenu" ref="341113515"/>
- <string key="NSTitle">32768 Farben</string>
+ <string key="NSTitle">16,7 Millionen Farben</string>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="531645050"/>
<reference key="NSMixedImage" ref="351811234"/>
<string key="NSAction">_popUpItemAction:</string>
- <int key="NSTag">15</int>
+ <int key="NSTag">24</int>
<reference key="NSTarget" ref="633115429"/>
</object>
- <reference ref="836673018"/>
</array>
</object>
- <int key="NSSelectedIndex">3</int>
<int key="NSPreferredEdge">3</int>
<bool key="NSUsesItemFromMenu">YES</bool>
<bool key="NSAltersState">YES</bool>
@@ -729,7 +727,7 @@ dmllcmVuLgo</string>
<reference key="NSControlView" ref="477203622"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="718371158"/>
+ <reference key="NSNormalImage" ref="65187362"/>
<reference key="NSAlternateImage" ref="391434389"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@@ -751,7 +749,7 @@ dmllcmVuLgo</string>
<reference key="NSControlView" ref="57246850"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="718371158"/>
+ <reference key="NSNormalImage" ref="65187362"/>
<reference key="NSAlternateImage" ref="391434389"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@@ -778,6 +776,7 @@ dmllcmVuLgo</string>
</object>
</array>
<string key="NSFrame">{{10, 33}, {559, 240}}</string>
+ <reference key="NSSuperview" ref="448510093"/>
</object>
<string key="NSLabel">Ausgabe</string>
<reference key="NSColor" ref="57160303"/>
@@ -805,7 +804,7 @@ dmllcmVuLgo</string>
<reference key="NSControlView" ref="878106058"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="718371158"/>
+ <reference key="NSNormalImage" ref="65187362"/>
<reference key="NSAlternateImage" ref="391434389"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@@ -843,7 +842,7 @@ dmllcmVuLgo</string>
<reference key="NSControlView" ref="477050998"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="718371158"/>
+ <reference key="NSNormalImage" ref="65187362"/>
<reference key="NSAlternateImage" ref="391434389"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@@ -865,7 +864,7 @@ dmllcmVuLgo</string>
<reference key="NSControlView" ref="765780304"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="718371158"/>
+ <reference key="NSNormalImage" ref="65187362"/>
<reference key="NSAlternateImage" ref="391434389"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@@ -887,7 +886,7 @@ dmllcmVuLgo</string>
<reference key="NSControlView" ref="1002778833"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="718371158"/>
+ <reference key="NSNormalImage" ref="65187362"/>
<reference key="NSAlternateImage" ref="391434389"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@@ -909,7 +908,7 @@ dmllcmVuLgo</string>
<reference key="NSControlView" ref="487809555"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="718371158"/>
+ <reference key="NSNormalImage" ref="65187362"/>
<reference key="NSAlternateImage" ref="391434389"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@@ -978,7 +977,7 @@ dmllcmVuLgo</string>
<reference key="NSControlView" ref="657659108"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="718371158"/>
+ <reference key="NSNormalImage" ref="65187362"/>
<reference key="NSAlternateImage" ref="391434389"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@@ -1016,7 +1015,7 @@ dmllcmVuLgo</string>
<reference key="NSControlView" ref="992839333"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="718371158"/>
+ <reference key="NSNormalImage" ref="65187362"/>
<reference key="NSAlternateImage" ref="391434389"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@@ -1054,7 +1053,7 @@ dmllcmVuLgo</string>
<reference key="NSControlView" ref="128352289"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="718371158"/>
+ <reference key="NSNormalImage" ref="65187362"/>
<reference key="NSAlternateImage" ref="391434389"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@@ -1104,7 +1103,7 @@ dmllcmVuLgo</string>
<reference key="NSControlView" ref="989050925"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="718371158"/>
+ <reference key="NSNormalImage" ref="65187362"/>
<reference key="NSAlternateImage" ref="391434389"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@@ -1126,7 +1125,7 @@ dmllcmVuLgo</string>
<reference key="NSControlView" ref="700826966"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="718371158"/>
+ <reference key="NSNormalImage" ref="65187362"/>
<reference key="NSAlternateImage" ref="391434389"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@@ -1193,13 +1192,13 @@ dmllcmVuLgo</string>
<reference key="NSTabView" ref="448510093"/>
</object>
</array>
- <reference key="NSSelectedTabViewItem" ref="287591690"/>
+ <reference key="NSSelectedTabViewItem" ref="960678392"/>
<reference key="NSFont" ref="463863101"/>
<int key="NSTvFlags">0</int>
<bool key="NSAllowTruncatedLabels">YES</bool>
<bool key="NSDrawsBackground">YES</bool>
<array class="NSMutableArray" key="NSSubviews">
- <reference ref="596750588"/>
+ <reference ref="515308735"/>
</array>
</object>
</array>
@@ -1207,7 +1206,7 @@ dmllcmVuLgo</string>
</object>
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
<string key="NSMinSize">{320, 262}</string>
- <string key="NSMaxSize">{3.4028235e+38, 3.4028235e+38}</string>
+ <string key="NSMaxSize">{1.7976931348623157e+308, 1.7976931348623157e+308}</string>
<string key="NSFrameAutosaveName">x11_prefs</string>
</object>
<object class="NSWindowTemplate" id="604417141">
@@ -1221,7 +1220,7 @@ dmllcmVuLgo</string>
<characters key="NS.bytes">View</characters>
</object>
<nil key="NSUserInterfaceItemIdentifier"/>
- <string key="NSWindowContentMaxSize">{3.4028235e+38, 3.4028235e+38}</string>
+ <string key="NSWindowContentMaxSize">{1.7976931348623157e+308, 1.7976931348623157e+308}</string>
<string key="NSWindowContentMinSize">{512, 240}</string>
<object class="NSView" key="NSWindowView" id="85544634">
<nil key="NSNextResponder"/>
@@ -1316,7 +1315,7 @@ dmllcmVuLgo</string>
<reference key="NSSupport" ref="26"/>
<object class="NSColor" key="NSBackgroundColor" id="113872566">
<int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC4zMzMzMzI5ODU2AA</bytes>
+ <bytes key="NSWhite">MC4zMzMzMzI5OQA</bytes>
</object>
<object class="NSColor" key="NSTextColor" id="249576247">
<int key="NSColorSpace">6</int>
@@ -1434,6 +1433,7 @@ dmllcmVuLgo</string>
<int key="NSDraggingSourceMaskForNonLocal">0</int>
<bool key="NSAllowsTypeSelect">YES</bool>
<int key="NSTableViewDraggingDestinationStyle">0</int>
+ <int key="NSTableViewGroupRowStyle">1</int>
</object>
</array>
<string key="NSFrame">{{1, 17}, {301, 198}}</string>
@@ -1450,7 +1450,7 @@ dmllcmVuLgo</string>
<reference key="NSSuperview" ref="1063387772"/>
<reference key="NSTarget" ref="1063387772"/>
<string key="NSAction">_doScroller:</string>
- <double key="NSPercent">0.99492377042770386</double>
+ <double key="NSPercent">0.99492380000000002</double>
</object>
<object class="NSScroller" id="17278747">
<reference key="NSNextResponder" ref="1063387772"/>
@@ -1460,7 +1460,7 @@ dmllcmVuLgo</string>
<int key="NSsFlags">1</int>
<reference key="NSTarget" ref="1063387772"/>
<string key="NSAction">_doScroller:</string>
- <double key="NSPercent">0.68852460384368896</double>
+ <double key="NSPercent">0.68852460000000004</double>
</object>
<object class="NSClipView" id="672307654">
<reference key="NSNextResponder" ref="1063387772"/>
@@ -1480,11 +1480,12 @@ dmllcmVuLgo</string>
<string key="NSFrame">{{20, 20}, {318, 231}}</string>
<reference key="NSSuperview" ref="85544634"/>
<reference key="NSNextKeyView" ref="580565898"/>
- <int key="NSsFlags">50</int>
+ <int key="NSsFlags">133170</int>
<reference key="NSVScroller" ref="842897584"/>
<reference key="NSHScroller" ref="17278747"/>
<reference key="NSContentView" ref="580565898"/>
<reference key="NSHeaderClipView" ref="672307654"/>
+ <reference key="NSCornerView" ref="898633680"/>
<bytes key="NSScrollAmts">QSAAAEEgAABBmAAAQZgAAA</bytes>
</object>
<object class="NSButton" id="758204686">
@@ -1515,7 +1516,7 @@ dmllcmVuLgo</string>
</object>
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
<string key="NSMinSize">{512, 262}</string>
- <string key="NSMaxSize">{3.4028235e+38, 3.4028235e+38}</string>
+ <string key="NSMaxSize">{1.7976931348623157e+308, 1.7976931348623157e+308}</string>
<string key="NSFrameAutosaveName">x11_apps</string>
</object>
<object class="NSMenu" id="294137138">
@@ -3235,10 +3236,9 @@ dmllcmVuLgo</string>
<string key="24.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1" key="24.ImportedFromIB2"/>
<string key="24.editorWindowContentRectSynchronizationRect">{{271, 666}, {301, 153}}</string>
- <string key="244.IBEditorWindowLastContentRect">{{390, 203}, {613, 302}}</string>
+ <string key="244.IBEditorWindowLastContentRect">{{507, 565}, {484, 308}}</string>
<string key="244.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <boolean value="YES" key="244.IBViewEditorWindowController.showingLayoutRectangles"/>
- <string key="244.IBWindowTemplateEditedContentRect">{{390, 203}, {613, 302}}</string>
+ <string key="244.IBWindowTemplateEditedContentRect">{{507, 565}, {484, 308}}</string>
<integer value="1" key="244.ImportedFromIB2"/>
<string key="244.editorWindowContentRectSynchronizationRect">{{184, 290}, {481, 345}}</string>
<integer value="0" key="244.windowTemplate.hasMaxSize"/>
@@ -3385,7 +3385,6 @@ dmllcmVuLgo</string>
<integer value="1" key="377.ImportedFromIB2"/>
<string key="379.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1" key="379.ImportedFromIB2"/>
- <string key="380.IBEditorWindowLastContentRect">{{476, 379}, {215, 83}}</string>
<string key="380.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1" key="380.ImportedFromIB2"/>
<string key="381.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -3488,6 +3487,259 @@ dmllcmVuLgo</string>
</object>
</object>
</array>
+ <array class="NSMutableArray" key="referencedPartialClassDescriptionsV3.1+">
+ <object class="IBPartialClassDescription">
+ <string key="className">X11Controller</string>
+ <string key="superclassName">NSObject</string>
+ <dictionary class="NSMutableDictionary" key="actions">
+ <string key="apps_table_delete:">id</string>
+ <string key="apps_table_done:">id</string>
+ <string key="apps_table_duplicate:">id</string>
+ <string key="apps_table_new:">id</string>
+ <string key="apps_table_show:">id</string>
+ <string key="bring_to_front:">id</string>
+ <string key="close_window:">id</string>
+ <string key="enable_fullscreen_changed:">id</string>
+ <string key="minimize_window:">id</string>
+ <string key="next_window:">id</string>
+ <string key="prefs_changed:">id</string>
+ <string key="prefs_show:">id</string>
+ <string key="previous_window:">id</string>
+ <string key="quit:">id</string>
+ <string key="toggle_fullscreen:">id</string>
+ <string key="x11_help:">id</string>
+ <string key="zoom_window:">id</string>
+ </dictionary>
+ <dictionary class="NSMutableDictionary" key="actionInfosByName">
+ <object class="IBActionInfo" key="apps_table_delete:">
+ <string key="name">apps_table_delete:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="apps_table_done:">
+ <string key="name">apps_table_done:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="apps_table_duplicate:">
+ <string key="name">apps_table_duplicate:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="apps_table_new:">
+ <string key="name">apps_table_new:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="apps_table_show:">
+ <string key="name">apps_table_show:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="bring_to_front:">
+ <string key="name">bring_to_front:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="close_window:">
+ <string key="name">close_window:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="enable_fullscreen_changed:">
+ <string key="name">enable_fullscreen_changed:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="minimize_window:">
+ <string key="name">minimize_window:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="next_window:">
+ <string key="name">next_window:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="prefs_changed:">
+ <string key="name">prefs_changed:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="prefs_show:">
+ <string key="name">prefs_show:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="previous_window:">
+ <string key="name">previous_window:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="quit:">
+ <string key="name">quit:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="toggle_fullscreen:">
+ <string key="name">toggle_fullscreen:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="x11_help:">
+ <string key="name">x11_help:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="zoom_window:">
+ <string key="name">zoom_window:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ </dictionary>
+ <dictionary class="NSMutableDictionary" key="outlets">
+ <string key="apps_separator">NSMenuItem</string>
+ <string key="apps_table">NSTableView</string>
+ <string key="click_through">NSButton</string>
+ <string key="copy_menu_item">NSMenuItem</string>
+ <string key="depth">NSPopUpButton</string>
+ <string key="dock_apps_menu">NSMenu</string>
+ <string key="dock_menu">NSMenu</string>
+ <string key="dock_window_separator">NSMenuItem</string>
+ <string key="enable_auth">NSButton</string>
+ <string key="enable_fullscreen">NSButton</string>
+ <string key="enable_fullscreen_menu">NSButton</string>
+ <string key="enable_keyequivs">NSButton</string>
+ <string key="enable_tcp">NSButton</string>
+ <string key="fake_buttons">NSButton</string>
+ <string key="focus_follows_mouse">NSButton</string>
+ <string key="focus_on_new_window">NSButton</string>
+ <string key="option_sends_alt">NSButton</string>
+ <string key="prefs_panel">NSPanel</string>
+ <string key="sync_clipboard_to_pasteboard">NSButton</string>
+ <string key="sync_keymap">NSButton</string>
+ <string key="sync_pasteboard">NSButton</string>
+ <string key="sync_pasteboard_to_clipboard">NSButton</string>
+ <string key="sync_pasteboard_to_primary">NSButton</string>
+ <string key="sync_primary_immediately">NSButton</string>
+ <string key="sync_text1">NSTextField</string>
+ <string key="sync_text2">NSTextField</string>
+ <string key="toggle_fullscreen_item">NSMenuItem</string>
+ <string key="use_sysbeep">NSButton</string>
+ <string key="window_separator">NSMenuItem</string>
+ <string key="x11_about_item">NSMenuItem</string>
+ </dictionary>
+ <dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
+ <object class="IBToOneOutletInfo" key="apps_separator">
+ <string key="name">apps_separator</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="apps_table">
+ <string key="name">apps_table</string>
+ <string key="candidateClassName">NSTableView</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="click_through">
+ <string key="name">click_through</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="copy_menu_item">
+ <string key="name">copy_menu_item</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="depth">
+ <string key="name">depth</string>
+ <string key="candidateClassName">NSPopUpButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="dock_apps_menu">
+ <string key="name">dock_apps_menu</string>
+ <string key="candidateClassName">NSMenu</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="dock_menu">
+ <string key="name">dock_menu</string>
+ <string key="candidateClassName">NSMenu</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="dock_window_separator">
+ <string key="name">dock_window_separator</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="enable_auth">
+ <string key="name">enable_auth</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="enable_fullscreen">
+ <string key="name">enable_fullscreen</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="enable_fullscreen_menu">
+ <string key="name">enable_fullscreen_menu</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="enable_keyequivs">
+ <string key="name">enable_keyequivs</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="enable_tcp">
+ <string key="name">enable_tcp</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="fake_buttons">
+ <string key="name">fake_buttons</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="focus_follows_mouse">
+ <string key="name">focus_follows_mouse</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="focus_on_new_window">
+ <string key="name">focus_on_new_window</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="option_sends_alt">
+ <string key="name">option_sends_alt</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="prefs_panel">
+ <string key="name">prefs_panel</string>
+ <string key="candidateClassName">NSPanel</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="sync_clipboard_to_pasteboard">
+ <string key="name">sync_clipboard_to_pasteboard</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="sync_keymap">
+ <string key="name">sync_keymap</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="sync_pasteboard">
+ <string key="name">sync_pasteboard</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="sync_pasteboard_to_clipboard">
+ <string key="name">sync_pasteboard_to_clipboard</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="sync_pasteboard_to_primary">
+ <string key="name">sync_pasteboard_to_primary</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="sync_primary_immediately">
+ <string key="name">sync_primary_immediately</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="sync_text1">
+ <string key="name">sync_text1</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="sync_text2">
+ <string key="name">sync_text2</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="toggle_fullscreen_item">
+ <string key="name">toggle_fullscreen_item</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="use_sysbeep">
+ <string key="name">use_sysbeep</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="window_separator">
+ <string key="name">window_separator</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="x11_about_item">
+ <string key="name">x11_about_item</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ </dictionary>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBDocumentRelativeSource</string>
+ <string key="minorKey">../../../X11Controller.h</string>
+ </object>
+ </object>
+ </array>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
diff --git a/xorg-server/hw/xquartz/bundle/Resources/German.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/Resources/German.lproj/main.nib/keyedobjects.nib
index f5df325d4..55b75a38a 100644
--- a/xorg-server/hw/xquartz/bundle/Resources/German.lproj/main.nib/keyedobjects.nib
+++ b/xorg-server/hw/xquartz/bundle/Resources/German.lproj/main.nib/keyedobjects.nib
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/Resources/Japanese.lproj/locversion.plist b/xorg-server/hw/xquartz/bundle/Resources/Japanese.lproj/locversion.plist
index 0c81bd02a..6c8948397 100644
--- a/xorg-server/hw/xquartz/bundle/Resources/Japanese.lproj/locversion.plist
+++ b/xorg-server/hw/xquartz/bundle/Resources/Japanese.lproj/locversion.plist
@@ -3,12 +3,12 @@
<plist version="1.0">
<dict>
<key>LprojCompatibleVersion</key>
- <string>101</string>
+ <string>102</string>
<key>LprojLocale</key>
<string>ja</string>
<key>LprojRevisionLevel</key>
<string>1</string>
<key>LprojVersion</key>
- <string>101</string>
+ <string>102</string>
</dict>
</plist>
diff --git a/xorg-server/hw/xquartz/bundle/Resources/Japanese.lproj/main.nib/designable.nib b/xorg-server/hw/xquartz/bundle/Resources/Japanese.lproj/main.nib/designable.nib
index 2803baa8d..a800d3c9d 100644
--- a/xorg-server/hw/xquartz/bundle/Resources/Japanese.lproj/main.nib/designable.nib
+++ b/xorg-server/hw/xquartz/bundle/Resources/Japanese.lproj/main.nib/designable.nib
@@ -2,13 +2,13 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1040</int>
- <string key="IBDocument.SystemVersion">11A194b</string>
- <string key="IBDocument.InterfaceBuilderVersion">787</string>
- <string key="IBDocument.AppKitVersion">1079</string>
- <string key="IBDocument.HIToolboxVersion">502.00</string>
+ <string key="IBDocument.SystemVersion">11A289</string>
+ <string key="IBDocument.InterfaceBuilderVersion">844</string>
+ <string key="IBDocument.AppKitVersion">1094.2</string>
+ <string key="IBDocument.HIToolboxVersion">521.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="NS.object.0">787</string>
+ <string key="NS.object.0">844</string>
</object>
<array class="NSMutableArray" key="IBDocument.EditedObjectIDs"/>
<array key="IBDocument.PluginDependencies">
@@ -373,7 +373,7 @@
<string key="NSWindowContentMaxSize">{1.7976931348623157e+308, 1.7976931348623157e+308}</string>
<string key="NSWindowContentMinSize">{320, 240}</string>
<object class="NSView" key="NSWindowView" id="941366957">
- <reference key="NSNextResponder"/>
+ <nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<array class="NSMutableArray" key="NSSubviews">
<object class="NSTabView" id="448510093">
@@ -381,7 +381,6 @@
<int key="NSvFlags">256</int>
<string key="NSFrame">{{13, 10}, {558, 292}}</string>
<reference key="NSSuperview" ref="941366957"/>
- <reference key="NSWindow"/>
<array class="NSMutableArray" key="NSTabViewItems">
<object class="NSTabViewItem" id="287591690">
<object class="NSMutableString" key="NSIdentifier">
@@ -409,7 +408,7 @@
<reference key="NSControlView" ref="119157981"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
- <object class="NSCustomResource" key="NSNormalImage" id="6132373">
+ <object class="NSCustomResource" key="NSNormalImage" id="891575339">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">NSSwitch</string>
</object>
@@ -469,9 +468,9 @@
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags2">4194304</int>
<string type="base64-UTF8" key="NSContents">T3B0aW9uIOOCreODvOOCkuaKvOOBl+OBn+OBvuOBvuOCr+ODquODg+OCr+OBmeOCi+OBqOODnuOCpuOC
-ueOBruS4reODnOOCv+ODs+aTjeS9nOOBq+OBquOCiuOAgeOCs+ODnuODs+ODieOCreODvOOCkuaKvOOB
-l+OBn+OBvuOBvuOCr+ODquODg+OCr+OBmeOCi+OBqOODnuOCpuOCueOBruWPs+ODnOOCv+ODs+aTjeS9
-nOOBq+OBquOCiuOBvuOBmeOAggo</string>
+ueOBruS4reODnOOCv+ODs+aTjeS9nOOBq+OBquOCiuOAgUNvbW1hbmQg44Kt44O844KS5oq844GX44Gf
+44G+44G+44Kv44Oq44OD44Kv44GZ44KL44Go44Oe44Km44K544Gu5Y+z44Oc44K/44Oz5pON5L2c44Gr
+44Gq44KK44G+44GZ44CCCg</string>
<reference key="NSSupport" ref="26"/>
<string key="NSPlaceholderString"/>
<reference key="NSControlView" ref="282885445"/>
@@ -493,7 +492,7 @@ nOOBq+OBquOCiuOBvuOBmeOAggo</string>
<reference key="NSControlView" ref="842100515"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="6132373"/>
+ <reference key="NSNormalImage" ref="891575339"/>
<reference key="NSAlternateImage" ref="391434389"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@@ -532,7 +531,7 @@ nOOBq+OBquOCiuOBvuOBmeOAggo</string>
<reference key="NSControlView" ref="179949713"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="6132373"/>
+ <reference key="NSNormalImage" ref="891575339"/>
<reference key="NSAlternateImage" ref="391434389"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@@ -570,7 +569,7 @@ nOOBq+OBquOCiuOBvuOBmeOAggo</string>
<reference key="NSControlView" ref="406291430"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="6132373"/>
+ <reference key="NSNormalImage" ref="891575339"/>
<reference key="NSAlternateImage" ref="391434389"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@@ -598,7 +597,6 @@ nOOBq+OBquOCiuOBvuOBmeOAggo</string>
<int key="NSvFlags">256</int>
<string key="NSFrame">{{75, 201}, {163, 26}}</string>
<reference key="NSSuperview" ref="515308735"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSPopUpButtonCell" key="NSCell" id="633115429">
<int key="NSCellFlags">-2076049856</int>
@@ -687,7 +685,6 @@ nOOBq+OBquOCiuOBvuOBmeOAggo</string>
<int key="NSvFlags">256</int>
<string key="NSFrame">{{17, 205}, {56, 19}}</string>
<reference key="NSSuperview" ref="515308735"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="930265681">
<int key="NSCellFlags">67239424</int>
@@ -705,7 +702,6 @@ nOOBq+OBquOCiuOBvuOBmeOAggo</string>
<int key="NSvFlags">256</int>
<string key="NSFrame">{{36, 183}, {392, 14}}</string>
<reference key="NSSuperview" ref="515308735"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="311969422">
<int key="NSCellFlags">67239424</int>
@@ -723,7 +719,6 @@ nOOBq+OBquOCiuOBvuOBmeOAggo</string>
<int key="NSvFlags">256</int>
<string key="NSFrame">{{18, 149}, {409, 23}}</string>
<reference key="NSSuperview" ref="515308735"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="631531164">
<int key="NSCellFlags">67239424</int>
@@ -733,7 +728,7 @@ nOOBq+OBquOCiuOBvuOBmeOAggo</string>
<reference key="NSControlView" ref="477203622"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="6132373"/>
+ <reference key="NSNormalImage" ref="891575339"/>
<reference key="NSAlternateImage" ref="391434389"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@@ -746,7 +741,6 @@ nOOBq+OBquOCiuOBvuOBmeOAggo</string>
<int key="NSvFlags">256</int>
<string key="NSFrame">{{37, 83}, {409, 23}}</string>
<reference key="NSSuperview" ref="515308735"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="917248662">
<int key="NSCellFlags">67239424</int>
@@ -756,7 +750,7 @@ nOOBq+OBquOCiuOBvuOBmeOAggo</string>
<reference key="NSControlView" ref="57246850"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="6132373"/>
+ <reference key="NSNormalImage" ref="891575339"/>
<reference key="NSAlternateImage" ref="391434389"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@@ -769,7 +763,6 @@ nOOBq+OBquOCiuOBvuOBmeOAggo</string>
<int key="NSvFlags">256</int>
<string key="NSFrame">{{36, 113}, {468, 30}}</string>
<reference key="NSSuperview" ref="515308735"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="761107402">
<int key="NSCellFlags">67239424</int>
@@ -785,7 +778,6 @@ nOOBq+OBquOCiuOBvuOBmeOAggo</string>
</array>
<string key="NSFrame">{{10, 33}, {538, 246}}</string>
<reference key="NSSuperview" ref="448510093"/>
- <reference key="NSWindow"/>
</object>
<string key="NSLabel">出力</string>
<reference key="NSColor" ref="57160303"/>
@@ -813,7 +805,7 @@ nOOBq+OBquOCiuOBvuOBmeOAggo</string>
<reference key="NSControlView" ref="878106058"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="6132373"/>
+ <reference key="NSNormalImage" ref="891575339"/>
<reference key="NSAlternateImage" ref="391434389"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@@ -851,7 +843,7 @@ nOOBq+OBquOCiuOBvuOBmeOAggo</string>
<reference key="NSControlView" ref="477050998"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="6132373"/>
+ <reference key="NSNormalImage" ref="891575339"/>
<reference key="NSAlternateImage" ref="391434389"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@@ -873,7 +865,7 @@ nOOBq+OBquOCiuOBvuOBmeOAggo</string>
<reference key="NSControlView" ref="765780304"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="6132373"/>
+ <reference key="NSNormalImage" ref="891575339"/>
<reference key="NSAlternateImage" ref="391434389"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@@ -895,7 +887,7 @@ nOOBq+OBquOCiuOBvuOBmeOAggo</string>
<reference key="NSControlView" ref="1002778833"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="6132373"/>
+ <reference key="NSNormalImage" ref="891575339"/>
<reference key="NSAlternateImage" ref="391434389"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@@ -917,7 +909,7 @@ nOOBq+OBquOCiuOBvuOBmeOAggo</string>
<reference key="NSControlView" ref="487809555"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="6132373"/>
+ <reference key="NSNormalImage" ref="891575339"/>
<reference key="NSAlternateImage" ref="391434389"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@@ -986,7 +978,7 @@ nOOBq+OBquOCiuOBvuOBmeOAggo</string>
<reference key="NSControlView" ref="657659108"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="6132373"/>
+ <reference key="NSNormalImage" ref="891575339"/>
<reference key="NSAlternateImage" ref="391434389"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@@ -1025,7 +1017,7 @@ nOOBq+OBquOCiuOBvuOBmeOAggo</string>
<reference key="NSControlView" ref="992839333"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="6132373"/>
+ <reference key="NSNormalImage" ref="891575339"/>
<reference key="NSAlternateImage" ref="391434389"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@@ -1064,7 +1056,7 @@ nOOBq+OBquOCiuOBvuOBmeOAggo</string>
<reference key="NSControlView" ref="128352289"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="6132373"/>
+ <reference key="NSNormalImage" ref="891575339"/>
<reference key="NSAlternateImage" ref="391434389"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@@ -1115,7 +1107,7 @@ nOOBq+OBquOCiuOBvuOBmeOAggo</string>
<reference key="NSControlView" ref="989050925"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="6132373"/>
+ <reference key="NSNormalImage" ref="891575339"/>
<reference key="NSAlternateImage" ref="391434389"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@@ -1137,7 +1129,7 @@ nOOBq+OBquOCiuOBvuOBmeOAggo</string>
<reference key="NSControlView" ref="700826966"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="6132373"/>
+ <reference key="NSNormalImage" ref="891575339"/>
<reference key="NSAlternateImage" ref="391434389"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@@ -1215,8 +1207,6 @@ nOOBq+OBquOCiuOBvuOBmeOAggo</string>
</object>
</array>
<string key="NSFrameSize">{584, 308}</string>
- <reference key="NSSuperview"/>
- <reference key="NSWindow"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
<string key="NSMinSize">{320, 262}</string>
@@ -1450,6 +1440,7 @@ nOOBq+OBquOCiuOBvuOBmeOAggo</string>
<int key="NSDraggingSourceMaskForNonLocal">0</int>
<bool key="NSAllowsTypeSelect">YES</bool>
<int key="NSTableViewDraggingDestinationStyle">0</int>
+ <int key="NSTableViewGroupRowStyle">1</int>
</object>
</array>
<string key="NSFrame">{{1, 17}, {301, 198}}</string>
@@ -1496,7 +1487,7 @@ nOOBq+OBquOCiuOBvuOBmeOAggo</string>
<string key="NSFrame">{{20, 20}, {318, 231}}</string>
<reference key="NSSuperview" ref="85544634"/>
<reference key="NSNextKeyView" ref="580565898"/>
- <int key="NSsFlags">50</int>
+ <int key="NSsFlags">133170</int>
<reference key="NSVScroller" ref="842897584"/>
<reference key="NSHScroller" ref="17278747"/>
<reference key="NSContentView" ref="580565898"/>
@@ -3251,10 +3242,9 @@ nOOBq+OBquOCiuOBvuOBmeOAggo</string>
<string key="24.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1" key="24.ImportedFromIB2"/>
<string key="24.editorWindowContentRectSynchronizationRect">{{271, 666}, {301, 153}}</string>
- <string key="244.IBEditorWindowLastContentRect">{{539, 548}, {584, 308}}</string>
+ <string key="244.IBEditorWindowLastContentRect">{{507, 565}, {484, 308}}</string>
<string key="244.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <boolean value="YES" key="244.IBViewEditorWindowController.showingLayoutRectangles"/>
- <string key="244.IBWindowTemplateEditedContentRect">{{539, 548}, {584, 308}}</string>
+ <string key="244.IBWindowTemplateEditedContentRect">{{507, 565}, {484, 308}}</string>
<integer value="1" key="244.ImportedFromIB2"/>
<string key="244.editorWindowContentRectSynchronizationRect">{{184, 290}, {481, 345}}</string>
<integer value="0" key="244.windowTemplate.hasMaxSize"/>
@@ -3284,7 +3274,7 @@ nOOBq+OBquOCiuOBvuOBmeOAggo</string>
<string key="285.windowTemplate.minSize">{454, 271}</string>
<string key="286.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1" key="286.ImportedFromIB2"/>
- <string key="29.IBEditorWindowLastContentRect">{{145, 836}, {394, 20}}</string>
+ <string key="29.IBEditorWindowLastContentRect">{{145, 1011}, {336, 20}}</string>
<string key="29.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1" key="29.ImportedFromIB2"/>
<string key="29.editorWindowContentRectSynchronizationRect">{{67, 819}, {336, 20}}</string>
@@ -3503,6 +3493,259 @@ nOOBq+OBquOCiuOBvuOBmeOAggo</string>
</object>
</object>
</array>
+ <array class="NSMutableArray" key="referencedPartialClassDescriptionsV3.1+">
+ <object class="IBPartialClassDescription">
+ <string key="className">X11Controller</string>
+ <string key="superclassName">NSObject</string>
+ <dictionary class="NSMutableDictionary" key="actions">
+ <string key="apps_table_delete:">id</string>
+ <string key="apps_table_done:">id</string>
+ <string key="apps_table_duplicate:">id</string>
+ <string key="apps_table_new:">id</string>
+ <string key="apps_table_show:">id</string>
+ <string key="bring_to_front:">id</string>
+ <string key="close_window:">id</string>
+ <string key="enable_fullscreen_changed:">id</string>
+ <string key="minimize_window:">id</string>
+ <string key="next_window:">id</string>
+ <string key="prefs_changed:">id</string>
+ <string key="prefs_show:">id</string>
+ <string key="previous_window:">id</string>
+ <string key="quit:">id</string>
+ <string key="toggle_fullscreen:">id</string>
+ <string key="x11_help:">id</string>
+ <string key="zoom_window:">id</string>
+ </dictionary>
+ <dictionary class="NSMutableDictionary" key="actionInfosByName">
+ <object class="IBActionInfo" key="apps_table_delete:">
+ <string key="name">apps_table_delete:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="apps_table_done:">
+ <string key="name">apps_table_done:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="apps_table_duplicate:">
+ <string key="name">apps_table_duplicate:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="apps_table_new:">
+ <string key="name">apps_table_new:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="apps_table_show:">
+ <string key="name">apps_table_show:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="bring_to_front:">
+ <string key="name">bring_to_front:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="close_window:">
+ <string key="name">close_window:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="enable_fullscreen_changed:">
+ <string key="name">enable_fullscreen_changed:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="minimize_window:">
+ <string key="name">minimize_window:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="next_window:">
+ <string key="name">next_window:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="prefs_changed:">
+ <string key="name">prefs_changed:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="prefs_show:">
+ <string key="name">prefs_show:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="previous_window:">
+ <string key="name">previous_window:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="quit:">
+ <string key="name">quit:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="toggle_fullscreen:">
+ <string key="name">toggle_fullscreen:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="x11_help:">
+ <string key="name">x11_help:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="zoom_window:">
+ <string key="name">zoom_window:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ </dictionary>
+ <dictionary class="NSMutableDictionary" key="outlets">
+ <string key="apps_separator">NSMenuItem</string>
+ <string key="apps_table">NSTableView</string>
+ <string key="click_through">NSButton</string>
+ <string key="copy_menu_item">NSMenuItem</string>
+ <string key="depth">NSPopUpButton</string>
+ <string key="dock_apps_menu">NSMenu</string>
+ <string key="dock_menu">NSMenu</string>
+ <string key="dock_window_separator">NSMenuItem</string>
+ <string key="enable_auth">NSButton</string>
+ <string key="enable_fullscreen">NSButton</string>
+ <string key="enable_fullscreen_menu">NSButton</string>
+ <string key="enable_keyequivs">NSButton</string>
+ <string key="enable_tcp">NSButton</string>
+ <string key="fake_buttons">NSButton</string>
+ <string key="focus_follows_mouse">NSButton</string>
+ <string key="focus_on_new_window">NSButton</string>
+ <string key="option_sends_alt">NSButton</string>
+ <string key="prefs_panel">NSPanel</string>
+ <string key="sync_clipboard_to_pasteboard">NSButton</string>
+ <string key="sync_keymap">NSButton</string>
+ <string key="sync_pasteboard">NSButton</string>
+ <string key="sync_pasteboard_to_clipboard">NSButton</string>
+ <string key="sync_pasteboard_to_primary">NSButton</string>
+ <string key="sync_primary_immediately">NSButton</string>
+ <string key="sync_text1">NSTextField</string>
+ <string key="sync_text2">NSTextField</string>
+ <string key="toggle_fullscreen_item">NSMenuItem</string>
+ <string key="use_sysbeep">NSButton</string>
+ <string key="window_separator">NSMenuItem</string>
+ <string key="x11_about_item">NSMenuItem</string>
+ </dictionary>
+ <dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
+ <object class="IBToOneOutletInfo" key="apps_separator">
+ <string key="name">apps_separator</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="apps_table">
+ <string key="name">apps_table</string>
+ <string key="candidateClassName">NSTableView</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="click_through">
+ <string key="name">click_through</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="copy_menu_item">
+ <string key="name">copy_menu_item</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="depth">
+ <string key="name">depth</string>
+ <string key="candidateClassName">NSPopUpButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="dock_apps_menu">
+ <string key="name">dock_apps_menu</string>
+ <string key="candidateClassName">NSMenu</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="dock_menu">
+ <string key="name">dock_menu</string>
+ <string key="candidateClassName">NSMenu</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="dock_window_separator">
+ <string key="name">dock_window_separator</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="enable_auth">
+ <string key="name">enable_auth</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="enable_fullscreen">
+ <string key="name">enable_fullscreen</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="enable_fullscreen_menu">
+ <string key="name">enable_fullscreen_menu</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="enable_keyequivs">
+ <string key="name">enable_keyequivs</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="enable_tcp">
+ <string key="name">enable_tcp</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="fake_buttons">
+ <string key="name">fake_buttons</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="focus_follows_mouse">
+ <string key="name">focus_follows_mouse</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="focus_on_new_window">
+ <string key="name">focus_on_new_window</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="option_sends_alt">
+ <string key="name">option_sends_alt</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="prefs_panel">
+ <string key="name">prefs_panel</string>
+ <string key="candidateClassName">NSPanel</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="sync_clipboard_to_pasteboard">
+ <string key="name">sync_clipboard_to_pasteboard</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="sync_keymap">
+ <string key="name">sync_keymap</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="sync_pasteboard">
+ <string key="name">sync_pasteboard</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="sync_pasteboard_to_clipboard">
+ <string key="name">sync_pasteboard_to_clipboard</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="sync_pasteboard_to_primary">
+ <string key="name">sync_pasteboard_to_primary</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="sync_primary_immediately">
+ <string key="name">sync_primary_immediately</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="sync_text1">
+ <string key="name">sync_text1</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="sync_text2">
+ <string key="name">sync_text2</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="toggle_fullscreen_item">
+ <string key="name">toggle_fullscreen_item</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="use_sysbeep">
+ <string key="name">use_sysbeep</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="window_separator">
+ <string key="name">window_separator</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="x11_about_item">
+ <string key="name">x11_about_item</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ </dictionary>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBDocumentRelativeSource</string>
+ <string key="minorKey">../../../X11Controller.h</string>
+ </object>
+ </object>
+ </array>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
diff --git a/xorg-server/hw/xquartz/bundle/Resources/Japanese.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/Resources/Japanese.lproj/main.nib/keyedobjects.nib
index 46d376334..6700f64a6 100644
--- a/xorg-server/hw/xquartz/bundle/Resources/Japanese.lproj/main.nib/keyedobjects.nib
+++ b/xorg-server/hw/xquartz/bundle/Resources/Japanese.lproj/main.nib/keyedobjects.nib
Binary files differ
diff --git a/xorg-server/include/colormapst.h b/xorg-server/include/colormapst.h
index 385c7969c..b597e2c60 100644
--- a/xorg-server/include/colormapst.h
+++ b/xorg-server/include/colormapst.h
@@ -1,132 +1,132 @@
-/*
-
-Copyright 1987, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-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
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-*/
-
-#ifndef CMAPSTRUCT_H
-#define CMAPSTRUCT_H 1
-
-#include <X11/Xarch.h>
-
-#include "colormap.h"
-#include "screenint.h"
-#include "privates.h"
-
-/* Shared color -- the color is used by AllocColorPlanes */
-typedef struct
-{
- unsigned short color;
- short refcnt;
-} SHAREDCOLOR;
-
-/* LOCO -- a local color for a PseudoColor cell. DirectColor maps always
- * use the first value (called red) in the structure. What channel they
- * are really talking about depends on which map they are in. */
-typedef struct
-{
- unsigned short red, green, blue;
-} LOCO;
-
-/* SHCO -- a shared color for a PseudoColor cell. Used with AllocColorPlanes.
- * DirectColor maps always use the first value (called red) in the structure.
- * What channel they are really talking about depends on which map they
- * are in. */
-typedef struct
-{
- SHAREDCOLOR *red, *green, *blue;
-} SHCO;
-
-
-/* color map entry */
-typedef struct _CMEntry
-{
- union
- {
- LOCO local;
- SHCO shco;
- } co;
- short refcnt;
- Bool fShared;
-} Entry;
-
-/*
- * COLORMAPs can be used for either Direct or Pseudo color. PseudoColor
- * only needs one cell table, we arbitrarily pick red. We keep track
- * of that table with freeRed, numPixelsRed, and clientPixelsRed
- *
- * The padN variables are unfortunate ABI BC. See fdo bug #6924.
- */
-
-typedef struct _ColormapRec
-{
- VisualPtr pVisual;
- short class; /* PseudoColor or DirectColor */
-#if defined(_XSERVER64)
- short pad0;
- XID pad1;
-#endif
- XID mid; /* client's name for colormap */
-#if defined(_XSERVER64) && (X_BYTE_ORDER == X_LITTLE_ENDIAN)
- XID pad2;
-#endif
- ScreenPtr pScreen; /* screen map is associated with */
- short flags; /* 1 = IsDefault
- * 2 = AllAllocated */
- int freeRed;
- int freeGreen;
- int freeBlue;
- int *numPixelsRed;
- int *numPixelsGreen;
- int *numPixelsBlue;
- Pixel **clientPixelsRed;
- Pixel **clientPixelsGreen;
- Pixel **clientPixelsBlue;
- Entry *red;
- Entry *green;
- Entry *blue;
- PrivateRec *devPrivates;
-} ColormapRec;
-
-#endif /* COLORMAP_H */
+/*
+
+Copyright 1987, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+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
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+
+#ifndef CMAPSTRUCT_H
+#define CMAPSTRUCT_H 1
+
+#include <X11/Xarch.h>
+
+#include "colormap.h"
+#include "screenint.h"
+#include "privates.h"
+
+/* Shared color -- the color is used by AllocColorPlanes */
+typedef struct
+{
+ unsigned short color;
+ short refcnt;
+} SHAREDCOLOR;
+
+/* LOCO -- a local color for a PseudoColor cell. DirectColor maps always
+ * use the first value (called red) in the structure. What channel they
+ * are really talking about depends on which map they are in. */
+typedef struct
+{
+ unsigned short red, green, blue;
+} LOCO;
+
+/* SHCO -- a shared color for a PseudoColor cell. Used with AllocColorPlanes.
+ * DirectColor maps always use the first value (called red) in the structure.
+ * What channel they are really talking about depends on which map they
+ * are in. */
+typedef struct
+{
+ SHAREDCOLOR *red, *green, *blue;
+} SHCO;
+
+
+/* color map entry */
+typedef struct _CMEntry
+{
+ union
+ {
+ LOCO local;
+ SHCO shco;
+ } co;
+ short refcnt;
+ Bool fShared;
+} Entry;
+
+/*
+ * COLORMAPs can be used for either Direct or Pseudo color. PseudoColor
+ * only needs one cell table, we arbitrarily pick red. We keep track
+ * of that table with freeRed, numPixelsRed, and clientPixelsRed
+ *
+ * The padN variables are unfortunate ABI BC. See fdo bug #6924.
+ */
+
+typedef struct _ColormapRec
+{
+ VisualPtr pVisual;
+ short class; /* PseudoColor or DirectColor */
+#if defined(_LP64)
+ short pad0;
+ XID pad1;
+#endif
+ XID mid; /* client's name for colormap */
+#if defined(_LP64) && (X_BYTE_ORDER == X_LITTLE_ENDIAN)
+ XID pad2;
+#endif
+ ScreenPtr pScreen; /* screen map is associated with */
+ short flags; /* 1 = IsDefault
+ * 2 = AllAllocated */
+ int freeRed;
+ int freeGreen;
+ int freeBlue;
+ int *numPixelsRed;
+ int *numPixelsGreen;
+ int *numPixelsBlue;
+ Pixel **clientPixelsRed;
+ Pixel **clientPixelsGreen;
+ Pixel **clientPixelsBlue;
+ Entry *red;
+ Entry *green;
+ Entry *blue;
+ PrivateRec *devPrivates;
+} ColormapRec;
+
+#endif /* COLORMAP_H */
diff --git a/xorg-server/include/protocol-versions.h b/xorg-server/include/protocol-versions.h
index 441d76788..1d33bddcf 100644
--- a/xorg-server/include/protocol-versions.h
+++ b/xorg-server/include/protocol-versions.h
@@ -1,148 +1,148 @@
-/*
- * Copyright © 2009 Red Hat, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * 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.
- *
- */
-
-/**
- * This file specifies the server-supported protocol versions.
- */
-#ifndef _PROTOCOL_VERSIONS_
-#define _PROTOCOL_VERSIONS_
-
-/* Apple DRI */
-#define SERVER_APPLEDRI_MAJOR_VERSION 1
-#define SERVER_APPLEDRI_MINOR_VERSION 0
-#define SERVER_APPLEDRI_PATCH_VERSION 0
-
-/* AppleWM */
-#define SERVER_APPLEWM_MAJOR_VERSION 1
-#define SERVER_APPLEWM_MINOR_VERSION 3
-#define SERVER_APPLEWM_PATCH_VERSION 0
-
-/* Composite */
-#define SERVER_COMPOSITE_MAJOR_VERSION 0
-#define SERVER_COMPOSITE_MINOR_VERSION 4
-
-/* Damage */
-#define SERVER_DAMAGE_MAJOR_VERSION 1
-#define SERVER_DAMAGE_MINOR_VERSION 1
-
-/* DMX */
-#define SERVER_DMX_MAJOR_VERSION 2
-#define SERVER_DMX_MINOR_VERSION 2
-#define SERVER_DMX_PATCH_VERSION 20040604
-
-/* Generic event extension */
-#define SERVER_GE_MAJOR_VERSION 1
-#define SERVER_GE_MINOR_VERSION 0
-
-/* GLX */
-#define SERVER_GLX_MAJOR_VERSION 1
-#define SERVER_GLX_MINOR_VERSION 4
-
-/* Xinerama */
-#define SERVER_PANORAMIX_MAJOR_VERSION 1
-#define SERVER_PANORAMIX_MINOR_VERSION 1
-
-/* RandR */
-#define SERVER_RANDR_MAJOR_VERSION 1
-#define SERVER_RANDR_MINOR_VERSION 4
-
-/* Record */
-#define SERVER_RECORD_MAJOR_VERSION 1
-#define SERVER_RECORD_MINOR_VERSION 13
-
-/* Render */
-#define SERVER_RENDER_MAJOR_VERSION 0
-#define SERVER_RENDER_MINOR_VERSION 11
-
-/* RandR Xinerama */
-#define SERVER_RRXINERAMA_MAJOR_VERSION 1
-#define SERVER_RRXINERAMA_MINOR_VERSION 1
-
-/* Screensaver */
-#define SERVER_SAVER_MAJOR_VERSION 1
-#define SERVER_SAVER_MINOR_VERSION 1
-
-/* Security */
-#define SERVER_SECURITY_MAJOR_VERSION 1
-#define SERVER_SECURITY_MINOR_VERSION 0
-
-/* Shape */
-#define SERVER_SHAPE_MAJOR_VERSION 1
-#define SERVER_SHAPE_MINOR_VERSION 1
-
-/* SHM */
-#define SERVER_SHM_MAJOR_VERSION 1
-#define SERVER_SHM_MINOR_VERSION 1
-
-/* Sync */
-#define SERVER_SYNC_MAJOR_VERSION 3
-#define SERVER_SYNC_MINOR_VERSION 1
-
-/* Windows WM */
-#define SERVER_WINDOWSWM_MAJOR_VERSION 1
-#define SERVER_WINDOWSWM_MINOR_VERSION 0
-#define SERVER_WINDOWSWM_PATCH_VERSION 0
-
-/* Xcalibrate */
-#define SERVER_XCALIBRATE_MAJOR_VERSION 0
-#define SERVER_XCALIBRATE_MINOR_VERSION 1
-
-/* DGA */
-#define SERVER_XDGA_MAJOR_VERSION 2
-#define SERVER_XDGA_MINOR_VERSION 0
-
-/* Big Font */
-#define SERVER_XF86BIGFONT_MAJOR_VERSION 1
-#define SERVER_XF86BIGFONT_MINOR_VERSION 1
-
-/* DRI */
-#define SERVER_XF86DRI_MAJOR_VERSION 4
-#define SERVER_XF86DRI_MINOR_VERSION 1
-#define SERVER_XF86DRI_PATCH_VERSION 20040604
-
-/* Vidmode */
-#define SERVER_XF86VIDMODE_MAJOR_VERSION 2
-#define SERVER_XF86VIDMODE_MINOR_VERSION 2
-
-/* Fixes */
-#define SERVER_XFIXES_MAJOR_VERSION 4
-#define SERVER_XFIXES_MINOR_VERSION 0
-
-/* X Input */
-#define SERVER_XI_MAJOR_VERSION 2
-#define SERVER_XI_MINOR_VERSION 0
-
-/* XKB */
-#define SERVER_XKB_MAJOR_VERSION 1
-#define SERVER_XKB_MINOR_VERSION 0
-
-/* Resource */
-#define SERVER_XRES_MAJOR_VERSION 1
-#define SERVER_XRES_MINOR_VERSION 0
-
-/* XvMC */
-#define SERVER_XVMC_MAJOR_VERSION 1
-#define SERVER_XVMC_MINOR_VERSION 1
-
-#endif
+/*
+ * Copyright © 2009 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * 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.
+ *
+ */
+
+/**
+ * This file specifies the server-supported protocol versions.
+ */
+#ifndef _PROTOCOL_VERSIONS_
+#define _PROTOCOL_VERSIONS_
+
+/* Apple DRI */
+#define SERVER_APPLEDRI_MAJOR_VERSION 1
+#define SERVER_APPLEDRI_MINOR_VERSION 0
+#define SERVER_APPLEDRI_PATCH_VERSION 0
+
+/* AppleWM */
+#define SERVER_APPLEWM_MAJOR_VERSION 1
+#define SERVER_APPLEWM_MINOR_VERSION 3
+#define SERVER_APPLEWM_PATCH_VERSION 0
+
+/* Composite */
+#define SERVER_COMPOSITE_MAJOR_VERSION 0
+#define SERVER_COMPOSITE_MINOR_VERSION 4
+
+/* Damage */
+#define SERVER_DAMAGE_MAJOR_VERSION 1
+#define SERVER_DAMAGE_MINOR_VERSION 1
+
+/* DMX */
+#define SERVER_DMX_MAJOR_VERSION 2
+#define SERVER_DMX_MINOR_VERSION 2
+#define SERVER_DMX_PATCH_VERSION 20040604
+
+/* Generic event extension */
+#define SERVER_GE_MAJOR_VERSION 1
+#define SERVER_GE_MINOR_VERSION 0
+
+/* GLX */
+#define SERVER_GLX_MAJOR_VERSION 1
+#define SERVER_GLX_MINOR_VERSION 4
+
+/* Xinerama */
+#define SERVER_PANORAMIX_MAJOR_VERSION 1
+#define SERVER_PANORAMIX_MINOR_VERSION 1
+
+/* RandR */
+#define SERVER_RANDR_MAJOR_VERSION 1
+#define SERVER_RANDR_MINOR_VERSION 3
+
+/* Record */
+#define SERVER_RECORD_MAJOR_VERSION 1
+#define SERVER_RECORD_MINOR_VERSION 13
+
+/* Render */
+#define SERVER_RENDER_MAJOR_VERSION 0
+#define SERVER_RENDER_MINOR_VERSION 11
+
+/* RandR Xinerama */
+#define SERVER_RRXINERAMA_MAJOR_VERSION 1
+#define SERVER_RRXINERAMA_MINOR_VERSION 1
+
+/* Screensaver */
+#define SERVER_SAVER_MAJOR_VERSION 1
+#define SERVER_SAVER_MINOR_VERSION 1
+
+/* Security */
+#define SERVER_SECURITY_MAJOR_VERSION 1
+#define SERVER_SECURITY_MINOR_VERSION 0
+
+/* Shape */
+#define SERVER_SHAPE_MAJOR_VERSION 1
+#define SERVER_SHAPE_MINOR_VERSION 1
+
+/* SHM */
+#define SERVER_SHM_MAJOR_VERSION 1
+#define SERVER_SHM_MINOR_VERSION 1
+
+/* Sync */
+#define SERVER_SYNC_MAJOR_VERSION 3
+#define SERVER_SYNC_MINOR_VERSION 1
+
+/* Windows WM */
+#define SERVER_WINDOWSWM_MAJOR_VERSION 1
+#define SERVER_WINDOWSWM_MINOR_VERSION 0
+#define SERVER_WINDOWSWM_PATCH_VERSION 0
+
+/* Xcalibrate */
+#define SERVER_XCALIBRATE_MAJOR_VERSION 0
+#define SERVER_XCALIBRATE_MINOR_VERSION 1
+
+/* DGA */
+#define SERVER_XDGA_MAJOR_VERSION 2
+#define SERVER_XDGA_MINOR_VERSION 0
+
+/* Big Font */
+#define SERVER_XF86BIGFONT_MAJOR_VERSION 1
+#define SERVER_XF86BIGFONT_MINOR_VERSION 1
+
+/* DRI */
+#define SERVER_XF86DRI_MAJOR_VERSION 4
+#define SERVER_XF86DRI_MINOR_VERSION 1
+#define SERVER_XF86DRI_PATCH_VERSION 20040604
+
+/* Vidmode */
+#define SERVER_XF86VIDMODE_MAJOR_VERSION 2
+#define SERVER_XF86VIDMODE_MINOR_VERSION 2
+
+/* Fixes */
+#define SERVER_XFIXES_MAJOR_VERSION 4
+#define SERVER_XFIXES_MINOR_VERSION 0
+
+/* X Input */
+#define SERVER_XI_MAJOR_VERSION 2
+#define SERVER_XI_MINOR_VERSION 0
+
+/* XKB */
+#define SERVER_XKB_MAJOR_VERSION 1
+#define SERVER_XKB_MINOR_VERSION 0
+
+/* Resource */
+#define SERVER_XRES_MAJOR_VERSION 1
+#define SERVER_XRES_MINOR_VERSION 0
+
+/* XvMC */
+#define SERVER_XVMC_MAJOR_VERSION 1
+#define SERVER_XVMC_MINOR_VERSION 1
+
+#endif
diff --git a/xorg-server/include/scrnintstr.h b/xorg-server/include/scrnintstr.h
index 9f4fbf3df..a9357e8a5 100644
--- a/xorg-server/include/scrnintstr.h
+++ b/xorg-server/include/scrnintstr.h
@@ -404,7 +404,7 @@ typedef void (* DeviceCursorCleanupProcPtr)(
ScreenPtr /* pScreen */);
typedef void (*ConstrainCursorHarderProcPtr)(
- DeviceIntPtr, ScreenPtr, int *, int *);
+ DeviceIntPtr, ScreenPtr, int, int *, int *);
typedef struct _Screen {
int myNum; /* index of this instance in Screens[] */
diff --git a/xorg-server/include/xorg-server.h.in b/xorg-server/include/xorg-server.h.in
index 76cab16b6..b10b9949e 100644
--- a/xorg-server/include/xorg-server.h.in
+++ b/xorg-server/include/xorg-server.h.in
@@ -157,9 +157,6 @@
/* Name of X server */
#undef __XSERVERNAME__
-/* Define to 1 if unsigned long is 64 bits. */
-#undef _XSERVER64
-
/* Building vgahw module */
#undef WITH_VGAHW
@@ -187,4 +184,8 @@
/* X Access Control Extension */
#undef XACE
+#ifdef _LP64
+#define _XSERVER64 1
+#endif
+
#endif /* _XORG_SERVER_H_ */
diff --git a/xorg-server/randr/Makefile.am b/xorg-server/randr/Makefile.am
index 2b0b3a984..de338b972 100644
--- a/xorg-server/randr/Makefile.am
+++ b/xorg-server/randr/Makefile.am
@@ -1,33 +1,29 @@
-noinst_LTLIBRARIES = librandr.la
-
-AM_CFLAGS = $(DIX_CFLAGS)
-
-XINERAMA_SRCS = rrxinerama.c
-
-if XORG
-sdk_HEADERS = randrstr.h rrtransform.h
-endif
-
-librandr_la_SOURCES = \
- randr.c \
- randrstr.h \
- rrcrtc.c \
- rrdispatch.c \
- rrinfo.c \
- rrmode.c \
- rroutput.c \
- rrpixmap.c \
- rrpointer.c \
- rrproperty.c \
- rrscreen.c \
- rrsdispatch.c \
- rrsprite.c \
- rrtransform.h \
- rrtransform.c \
- mirrcrtc.c
-
-
-if XINERAMA
-librandr_la_SOURCES += ${XINERAMA_SRCS}
-endif
-
+noinst_LTLIBRARIES = librandr.la
+
+AM_CFLAGS = $(DIX_CFLAGS)
+
+XINERAMA_SRCS = rrxinerama.c
+
+if XORG
+sdk_HEADERS = randrstr.h rrtransform.h
+endif
+
+librandr_la_SOURCES = \
+ randr.c \
+ randrstr.h \
+ rrcrtc.c \
+ rrdispatch.c \
+ rrinfo.c \
+ rrmode.c \
+ rroutput.c \
+ rrpointer.c \
+ rrproperty.c \
+ rrscreen.c \
+ rrsdispatch.c \
+ rrtransform.h \
+ rrtransform.c
+
+if XINERAMA
+librandr_la_SOURCES += ${XINERAMA_SRCS}
+endif
+
diff --git a/xorg-server/randr/randr.c b/xorg-server/randr/randr.c
index 1346d1e9c..607770520 100644
--- a/xorg-server/randr/randr.c
+++ b/xorg-server/randr/randr.c
@@ -1,517 +1,502 @@
-/*
- * Copyright © 2000 Compaq Computer Corporation
- * Copyright © 2002 Hewlett-Packard Company
- * Copyright © 2006 Intel Corporation
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting documentation, and
- * that the name of the copyright holders not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. The copyright holders make no representations
- * about the suitability of this software for any purpose. It is provided "as
- * is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
- * OF THIS SOFTWARE.
- *
- * Author: Jim Gettys, Hewlett-Packard Company, Inc.
- * Keith Packard, Intel Corporation
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "randrstr.h"
-
-/* From render.h */
-#ifndef SubPixelUnknown
-#define SubPixelUnknown 0
-#endif
-
-#define RR_VALIDATE
-static int RRNScreens;
-
-#define wrap(priv,real,mem,func) {\
- priv->mem = real->mem; \
- real->mem = func; \
-}
-
-#define unwrap(priv,real,mem) {\
- real->mem = priv->mem; \
-}
-
-static int ProcRRDispatch (ClientPtr pClient);
-static int SProcRRDispatch (ClientPtr pClient);
-
-int RREventBase;
-int RRErrorBase;
-RESTYPE RRClientType, RREventType; /* resource types for event masks */
-DevPrivateKeyRec RRClientPrivateKeyRec;
-
-DevPrivateKeyRec rrPrivKeyRec;
-
-static void
-RRClientCallback (CallbackListPtr *list,
- pointer closure,
- pointer data)
-{
- NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
- ClientPtr pClient = clientinfo->client;
- rrClientPriv(pClient);
- RRTimesPtr pTimes = (RRTimesPtr) (pRRClient + 1);
- int i;
-
- pRRClient->major_version = 0;
- pRRClient->minor_version = 0;
- for (i = 0; i < screenInfo.numScreens; i++)
- {
- ScreenPtr pScreen = screenInfo.screens[i];
- rrScrPriv(pScreen);
-
- if (pScrPriv)
- {
- pTimes[i].setTime = pScrPriv->lastSetTime;
- pTimes[i].configTime = pScrPriv->lastConfigTime;
- }
- }
-}
-
-static Bool
-RRCloseScreen (int i, ScreenPtr pScreen)
-{
- rrScrPriv(pScreen);
- int j;
-
- unwrap (pScrPriv, pScreen, CloseScreen);
- for (j = pScrPriv->numCrtcs - 1; j >= 0; j--)
- RRCrtcDestroy (pScrPriv->crtcs[j]);
- for (j = pScrPriv->numOutputs - 1; j >= 0; j--)
- RROutputDestroy (pScrPriv->outputs[j]);
-
- free(pScrPriv->crtcs);
- free(pScrPriv->outputs);
- free(pScrPriv->scanout_info);
- free(pScrPriv);
- RRNScreens -= 1; /* ok, one fewer screen with RandR running */
- return (*pScreen->CloseScreen) (i, pScreen);
-}
-
-static void
-SRRScreenChangeNotifyEvent(xRRScreenChangeNotifyEvent *from,
- xRRScreenChangeNotifyEvent *to)
-{
- to->type = from->type;
- to->rotation = from->rotation;
- cpswaps(from->sequenceNumber, to->sequenceNumber);
- cpswapl(from->timestamp, to->timestamp);
- cpswapl(from->configTimestamp, to->configTimestamp);
- cpswapl(from->root, to->root);
- cpswapl(from->window, to->window);
- cpswaps(from->sizeID, to->sizeID);
- cpswaps(from->subpixelOrder, to->subpixelOrder);
- cpswaps(from->widthInPixels, to->widthInPixels);
- cpswaps(from->heightInPixels, to->heightInPixels);
- cpswaps(from->widthInMillimeters, to->widthInMillimeters);
- cpswaps(from->heightInMillimeters, to->heightInMillimeters);
-}
-
-static void
-SRRCrtcChangeNotifyEvent(xRRCrtcChangeNotifyEvent *from,
- xRRCrtcChangeNotifyEvent *to)
-{
- to->type = from->type;
- to->subCode = from->subCode;
- cpswaps(from->sequenceNumber, to->sequenceNumber);
- cpswapl(from->timestamp, to->timestamp);
- cpswapl(from->window, to->window);
- cpswapl(from->crtc, to->crtc);
- cpswapl(from->mode, to->mode);
- cpswaps(from->rotation, to->rotation);
- /* pad1 */
- cpswaps(from->x, to->x);
- cpswaps(from->y, to->y);
- cpswaps(from->width, to->width);
- cpswaps(from->height, to->height);
-}
-
-static void
-SRROutputChangeNotifyEvent(xRROutputChangeNotifyEvent *from,
- xRROutputChangeNotifyEvent *to)
-{
- to->type = from->type;
- to->subCode = from->subCode;
- cpswaps(from->sequenceNumber, to->sequenceNumber);
- cpswapl(from->timestamp, to->timestamp);
- cpswapl(from->configTimestamp, to->configTimestamp);
- cpswapl(from->window, to->window);
- cpswapl(from->output, to->output);
- cpswapl(from->crtc, to->crtc);
- cpswapl(from->mode, to->mode);
- cpswaps(from->rotation, to->rotation);
- to->connection = from->connection;
- to->subpixelOrder = from->subpixelOrder;
-}
-
-static void
-SRROutputPropertyNotifyEvent(xRROutputPropertyNotifyEvent *from,
- xRROutputPropertyNotifyEvent *to)
-{
- to->type = from->type;
- to->subCode = from->subCode;
- cpswaps(from->sequenceNumber, to->sequenceNumber);
- cpswapl(from->window, to->window);
- cpswapl(from->output, to->output);
- cpswapl(from->atom, to->atom);
- cpswapl(from->timestamp, to->timestamp);
- to->state = from->state;
- /* pad1 */
- /* pad2 */
- /* pad3 */
- /* pad4 */
-}
-
-static void
-SRRNotifyEvent (xEvent *from,
- xEvent *to)
-{
- switch (from->u.u.detail) {
- case RRNotify_CrtcChange:
- SRRCrtcChangeNotifyEvent ((xRRCrtcChangeNotifyEvent *) from,
- (xRRCrtcChangeNotifyEvent *) to);
- break;
- case RRNotify_OutputChange:
- SRROutputChangeNotifyEvent ((xRROutputChangeNotifyEvent *) from,
- (xRROutputChangeNotifyEvent *) to);
- break;
- case RRNotify_OutputProperty:
- SRROutputPropertyNotifyEvent ((xRROutputPropertyNotifyEvent *) from,
- (xRROutputPropertyNotifyEvent *) to);
- break;
- default:
- break;
- }
-}
-
-static int RRGeneration;
-
-Bool RRInit (void)
-{
- if (RRGeneration != serverGeneration)
- {
- if (!RRModeInit ())
- return FALSE;
- if (!RRCrtcInit ())
- return FALSE;
- if (!RROutputInit ())
- return FALSE;
- RRGeneration = serverGeneration;
- }
- if (!dixRegisterPrivateKey(&rrPrivKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
-
- return TRUE;
-}
-
-Bool RRScreenInit(ScreenPtr pScreen)
-{
- rrScrPrivPtr pScrPriv;
-
- if (!RRInit ())
- return FALSE;
-
- pScrPriv = (rrScrPrivPtr) calloc(1, sizeof (rrScrPrivRec));
- if (!pScrPriv)
- return FALSE;
-
- SetRRScreen(pScreen, pScrPriv);
-
- /*
- * Calling function best set these function vectors
- */
- pScrPriv->rrGetInfo = 0;
- pScrPriv->maxWidth = pScrPriv->minWidth = pScreen->width;
- pScrPriv->maxHeight = pScrPriv->minHeight = pScreen->height;
-
- pScrPriv->width = pScreen->width;
- pScrPriv->height = pScreen->height;
- pScrPriv->mmWidth = pScreen->mmWidth;
- pScrPriv->mmHeight = pScreen->mmHeight;
-#if RANDR_12_INTERFACE
- pScrPriv->rrScreenSetSize = NULL;
- pScrPriv->rrCrtcSet = NULL;
- pScrPriv->rrCrtcSetGamma = NULL;
-#endif
- pScrPriv->scanout_info = NULL;
- pScrPriv->n_scanout_info = 0;
-#if RANDR_10_INTERFACE
- pScrPriv->rrSetConfig = 0;
- pScrPriv->rotations = RR_Rotate_0;
- pScrPriv->reqWidth = pScreen->width;
- pScrPriv->reqHeight = pScreen->height;
- pScrPriv->nSizes = 0;
- pScrPriv->pSizes = NULL;
- pScrPriv->rotation = RR_Rotate_0;
- pScrPriv->rate = 0;
- pScrPriv->size = 0;
-#endif
-
- /*
- * This value doesn't really matter -- any client must call
- * GetScreenInfo before reading it which will automatically update
- * the time
- */
- pScrPriv->lastSetTime = currentTime;
- pScrPriv->lastConfigTime = currentTime;
-
- wrap (pScrPriv, pScreen, CloseScreen, RRCloseScreen);
-
- pScrPriv->numOutputs = 0;
- pScrPriv->outputs = NULL;
- pScrPriv->numCrtcs = 0;
- pScrPriv->crtcs = NULL;
-
- RRNScreens += 1; /* keep count of screens that implement randr */
- return TRUE;
-}
-
-/*ARGSUSED*/
-static int
-RRFreeClient (pointer data, XID id)
-{
- RREventPtr pRREvent;
- WindowPtr pWin;
- RREventPtr *pHead, pCur, pPrev;
-
- pRREvent = (RREventPtr) data;
- pWin = pRREvent->window;
- dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id,
- RREventType, serverClient, DixDestroyAccess);
- if (pHead) {
- pPrev = 0;
- for (pCur = *pHead; pCur && pCur != pRREvent; pCur=pCur->next)
- pPrev = pCur;
- if (pCur)
- {
- if (pPrev)
- pPrev->next = pRREvent->next;
- else
- *pHead = pRREvent->next;
- }
- }
- free((pointer) pRREvent);
- return 1;
-}
-
-/*ARGSUSED*/
-static int
-RRFreeEvents (pointer data, XID id)
-{
- RREventPtr *pHead, pCur, pNext;
-
- pHead = (RREventPtr *) data;
- for (pCur = *pHead; pCur; pCur = pNext) {
- pNext = pCur->next;
- FreeResource (pCur->clientResource, RRClientType);
- free((pointer) pCur);
- }
- free((pointer) pHead);
- return 1;
-}
-
-void
-RRExtensionInit (void)
-{
- ExtensionEntry *extEntry;
-
- if (RRNScreens == 0) return;
-
- if (!dixRegisterPrivateKey(&RRClientPrivateKeyRec, PRIVATE_CLIENT,
- sizeof (RRClientRec) +
- screenInfo.numScreens * sizeof (RRTimesRec)))
- return;
- if (!AddCallback (&ClientStateCallback, RRClientCallback, 0))
- return;
-
- RRClientType = CreateNewResourceType(RRFreeClient, "RandRClient");
- if (!RRClientType)
- return;
- RREventType = CreateNewResourceType(RRFreeEvents, "RandREvent");
- if (!RREventType)
- return;
- extEntry = AddExtension (RANDR_NAME, RRNumberEvents, RRNumberErrors,
- ProcRRDispatch, SProcRRDispatch,
- NULL, StandardMinorOpcode);
- if (!extEntry)
- return;
- RRErrorBase = extEntry->errorBase;
- RREventBase = extEntry->eventBase;
- EventSwapVector[RREventBase + RRScreenChangeNotify] = (EventSwapPtr)
- SRRScreenChangeNotifyEvent;
- EventSwapVector[RREventBase + RRNotify] = (EventSwapPtr)
- SRRNotifyEvent;
-
- RRModeInitErrorValue();
- RRCrtcInitErrorValue();
- RROutputInitErrorValue();
-
-#ifdef PANORAMIX
- RRXineramaExtensionInit();
-#endif
-}
-
-static int
-TellChanged (WindowPtr pWin, pointer value)
-{
- RREventPtr *pHead, pRREvent;
- ClientPtr client;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- rrScrPriv(pScreen);
- int i;
-
- dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id,
- RREventType, serverClient, DixReadAccess);
- if (!pHead)
- return WT_WALKCHILDREN;
-
- for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next)
- {
- client = pRREvent->client;
- if (client == serverClient || client->clientGone)
- continue;
-
- if (pRREvent->mask & RRScreenChangeNotifyMask)
- RRDeliverScreenEvent (client, pWin, pScreen);
-
- if (pRREvent->mask & RRCrtcChangeNotifyMask)
- {
- for (i = 0; i < pScrPriv->numCrtcs; i++)
- {
- RRCrtcPtr crtc = pScrPriv->crtcs[i];
- if (crtc->changed)
- RRDeliverCrtcEvent (client, pWin, crtc);
- }
- }
-
- if (pRREvent->mask & RROutputChangeNotifyMask)
- {
- for (i = 0; i < pScrPriv->numOutputs; i++)
- {
- RROutputPtr output = pScrPriv->outputs[i];
- if (output->changed)
- RRDeliverOutputEvent (client, pWin, output);
- }
- }
- }
- return WT_WALKCHILDREN;
-}
-
-/*
- * Something changed; send events and adjust pointer position
- */
-void
-RRTellChanged (ScreenPtr pScreen)
-{
- rrScrPriv (pScreen);
- int i;
-
- if (pScrPriv->changed)
- {
- UpdateCurrentTime ();
- if (pScrPriv->configChanged)
- {
- pScrPriv->lastConfigTime = currentTime;
- pScrPriv->configChanged = FALSE;
- }
- pScrPriv->changed = FALSE;
- WalkTree (pScreen, TellChanged, (pointer) pScreen);
- for (i = 0; i < pScrPriv->numOutputs; i++)
- pScrPriv->outputs[i]->changed = FALSE;
- for (i = 0; i < pScrPriv->numCrtcs; i++)
- pScrPriv->crtcs[i]->changed = FALSE;
- if (pScrPriv->layoutChanged)
- {
- pScrPriv->layoutChanged = FALSE;
- RRPointerScreenConfigured (pScreen);
- RRSendConfigNotify (pScreen);
- }
- }
-}
-
-/*
- * Return the first output which is connected to an active CRTC
- * Used in emulating 1.0 behaviour
- */
-RROutputPtr
-RRFirstOutput (ScreenPtr pScreen)
-{
- rrScrPriv(pScreen);
- RROutputPtr output;
- int i, j;
-
- if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc)
- return pScrPriv->primaryOutput;
-
- for (i = 0; i < pScrPriv->numCrtcs; i++)
- {
- RRCrtcPtr crtc = pScrPriv->crtcs[i];
- for (j = 0; j < pScrPriv->numOutputs; j++)
- {
- output = pScrPriv->outputs[j];
- if (output->crtc == crtc)
- return output;
- }
- }
- return NULL;
-}
-
-CARD16
-RRVerticalRefresh (xRRModeInfo *mode)
-{
- CARD32 refresh;
- CARD32 dots = mode->hTotal * mode->vTotal;
- if (!dots)
- return 0;
- refresh = (mode->dotClock + dots/2) / dots;
- if (refresh > 0xffff)
- refresh = 0xffff;
- return (CARD16) refresh;
-}
-
-RRScanoutPixmapInfo *
-RRQueryScanoutPixmapInfo(ScreenPtr screen, int *n_info)
-{
- rrScrPriv(screen);
-
- if (!pScrPriv->scanout_info && pScrPriv->rrQueryScanoutPixmaps)
- pScrPriv->scanout_info = pScrPriv->rrQueryScanoutPixmaps(screen,
- &pScrPriv->n_scanout_info);
- *n_info = pScrPriv->n_scanout_info;
- return pScrPriv->scanout_info;
-}
-
-static int
-ProcRRDispatch (ClientPtr client)
-{
- REQUEST(xReq);
- if (stuff->data >= RRNumberRequests || !ProcRandrVector[stuff->data])
- return BadRequest;
- return (*ProcRandrVector[stuff->data]) (client);
-}
-
-static int
-SProcRRDispatch (ClientPtr client)
-{
- REQUEST(xReq);
- if (stuff->data >= RRNumberRequests || !ProcRandrVector[stuff->data])
- return BadRequest;
- return (*SProcRandrVector[stuff->data]) (client);
-}
-
+/*
+ * Copyright © 2000 Compaq Computer Corporation
+ * Copyright © 2002 Hewlett-Packard Company
+ * Copyright © 2006 Intel Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ *
+ * Author: Jim Gettys, Hewlett-Packard Company, Inc.
+ * Keith Packard, Intel Corporation
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "randrstr.h"
+
+/* From render.h */
+#ifndef SubPixelUnknown
+#define SubPixelUnknown 0
+#endif
+
+#define RR_VALIDATE
+static int RRNScreens;
+
+#define wrap(priv,real,mem,func) {\
+ priv->mem = real->mem; \
+ real->mem = func; \
+}
+
+#define unwrap(priv,real,mem) {\
+ real->mem = priv->mem; \
+}
+
+static int ProcRRDispatch (ClientPtr pClient);
+static int SProcRRDispatch (ClientPtr pClient);
+
+int RREventBase;
+int RRErrorBase;
+RESTYPE RRClientType, RREventType; /* resource types for event masks */
+DevPrivateKeyRec RRClientPrivateKeyRec;
+
+DevPrivateKeyRec rrPrivKeyRec;
+
+static void
+RRClientCallback (CallbackListPtr *list,
+ pointer closure,
+ pointer data)
+{
+ NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
+ ClientPtr pClient = clientinfo->client;
+ rrClientPriv(pClient);
+ RRTimesPtr pTimes = (RRTimesPtr) (pRRClient + 1);
+ int i;
+
+ pRRClient->major_version = 0;
+ pRRClient->minor_version = 0;
+ for (i = 0; i < screenInfo.numScreens; i++)
+ {
+ ScreenPtr pScreen = screenInfo.screens[i];
+ rrScrPriv(pScreen);
+
+ if (pScrPriv)
+ {
+ pTimes[i].setTime = pScrPriv->lastSetTime;
+ pTimes[i].configTime = pScrPriv->lastConfigTime;
+ }
+ }
+}
+
+static Bool
+RRCloseScreen (int i, ScreenPtr pScreen)
+{
+ rrScrPriv(pScreen);
+ int j;
+
+ unwrap (pScrPriv, pScreen, CloseScreen);
+ for (j = pScrPriv->numCrtcs - 1; j >= 0; j--)
+ RRCrtcDestroy (pScrPriv->crtcs[j]);
+ for (j = pScrPriv->numOutputs - 1; j >= 0; j--)
+ RROutputDestroy (pScrPriv->outputs[j]);
+
+ free(pScrPriv->crtcs);
+ free(pScrPriv->outputs);
+ free(pScrPriv);
+ RRNScreens -= 1; /* ok, one fewer screen with RandR running */
+ return (*pScreen->CloseScreen) (i, pScreen);
+}
+
+static void
+SRRScreenChangeNotifyEvent(xRRScreenChangeNotifyEvent *from,
+ xRRScreenChangeNotifyEvent *to)
+{
+ to->type = from->type;
+ to->rotation = from->rotation;
+ cpswaps(from->sequenceNumber, to->sequenceNumber);
+ cpswapl(from->timestamp, to->timestamp);
+ cpswapl(from->configTimestamp, to->configTimestamp);
+ cpswapl(from->root, to->root);
+ cpswapl(from->window, to->window);
+ cpswaps(from->sizeID, to->sizeID);
+ cpswaps(from->subpixelOrder, to->subpixelOrder);
+ cpswaps(from->widthInPixels, to->widthInPixels);
+ cpswaps(from->heightInPixels, to->heightInPixels);
+ cpswaps(from->widthInMillimeters, to->widthInMillimeters);
+ cpswaps(from->heightInMillimeters, to->heightInMillimeters);
+}
+
+static void
+SRRCrtcChangeNotifyEvent(xRRCrtcChangeNotifyEvent *from,
+ xRRCrtcChangeNotifyEvent *to)
+{
+ to->type = from->type;
+ to->subCode = from->subCode;
+ cpswaps(from->sequenceNumber, to->sequenceNumber);
+ cpswapl(from->timestamp, to->timestamp);
+ cpswapl(from->window, to->window);
+ cpswapl(from->crtc, to->crtc);
+ cpswapl(from->mode, to->mode);
+ cpswaps(from->rotation, to->rotation);
+ /* pad1 */
+ cpswaps(from->x, to->x);
+ cpswaps(from->y, to->y);
+ cpswaps(from->width, to->width);
+ cpswaps(from->height, to->height);
+}
+
+static void
+SRROutputChangeNotifyEvent(xRROutputChangeNotifyEvent *from,
+ xRROutputChangeNotifyEvent *to)
+{
+ to->type = from->type;
+ to->subCode = from->subCode;
+ cpswaps(from->sequenceNumber, to->sequenceNumber);
+ cpswapl(from->timestamp, to->timestamp);
+ cpswapl(from->configTimestamp, to->configTimestamp);
+ cpswapl(from->window, to->window);
+ cpswapl(from->output, to->output);
+ cpswapl(from->crtc, to->crtc);
+ cpswapl(from->mode, to->mode);
+ cpswaps(from->rotation, to->rotation);
+ to->connection = from->connection;
+ to->subpixelOrder = from->subpixelOrder;
+}
+
+static void
+SRROutputPropertyNotifyEvent(xRROutputPropertyNotifyEvent *from,
+ xRROutputPropertyNotifyEvent *to)
+{
+ to->type = from->type;
+ to->subCode = from->subCode;
+ cpswaps(from->sequenceNumber, to->sequenceNumber);
+ cpswapl(from->window, to->window);
+ cpswapl(from->output, to->output);
+ cpswapl(from->atom, to->atom);
+ cpswapl(from->timestamp, to->timestamp);
+ to->state = from->state;
+ /* pad1 */
+ /* pad2 */
+ /* pad3 */
+ /* pad4 */
+}
+
+static void
+SRRNotifyEvent (xEvent *from,
+ xEvent *to)
+{
+ switch (from->u.u.detail) {
+ case RRNotify_CrtcChange:
+ SRRCrtcChangeNotifyEvent ((xRRCrtcChangeNotifyEvent *) from,
+ (xRRCrtcChangeNotifyEvent *) to);
+ break;
+ case RRNotify_OutputChange:
+ SRROutputChangeNotifyEvent ((xRROutputChangeNotifyEvent *) from,
+ (xRROutputChangeNotifyEvent *) to);
+ break;
+ case RRNotify_OutputProperty:
+ SRROutputPropertyNotifyEvent ((xRROutputPropertyNotifyEvent *) from,
+ (xRROutputPropertyNotifyEvent *) to);
+ break;
+ default:
+ break;
+ }
+}
+
+static int RRGeneration;
+
+Bool RRInit (void)
+{
+ if (RRGeneration != serverGeneration)
+ {
+ if (!RRModeInit ())
+ return FALSE;
+ if (!RRCrtcInit ())
+ return FALSE;
+ if (!RROutputInit ())
+ return FALSE;
+ RRGeneration = serverGeneration;
+ }
+ if (!dixRegisterPrivateKey(&rrPrivKeyRec, PRIVATE_SCREEN, 0))
+ return FALSE;
+
+ return TRUE;
+}
+
+Bool RRScreenInit(ScreenPtr pScreen)
+{
+ rrScrPrivPtr pScrPriv;
+
+ if (!RRInit ())
+ return FALSE;
+
+ pScrPriv = (rrScrPrivPtr) calloc(1, sizeof (rrScrPrivRec));
+ if (!pScrPriv)
+ return FALSE;
+
+ SetRRScreen(pScreen, pScrPriv);
+
+ /*
+ * Calling function best set these function vectors
+ */
+ pScrPriv->rrGetInfo = 0;
+ pScrPriv->maxWidth = pScrPriv->minWidth = pScreen->width;
+ pScrPriv->maxHeight = pScrPriv->minHeight = pScreen->height;
+
+ pScrPriv->width = pScreen->width;
+ pScrPriv->height = pScreen->height;
+ pScrPriv->mmWidth = pScreen->mmWidth;
+ pScrPriv->mmHeight = pScreen->mmHeight;
+#if RANDR_12_INTERFACE
+ pScrPriv->rrScreenSetSize = NULL;
+ pScrPriv->rrCrtcSet = NULL;
+ pScrPriv->rrCrtcSetGamma = NULL;
+#endif
+#if RANDR_10_INTERFACE
+ pScrPriv->rrSetConfig = 0;
+ pScrPriv->rotations = RR_Rotate_0;
+ pScrPriv->reqWidth = pScreen->width;
+ pScrPriv->reqHeight = pScreen->height;
+ pScrPriv->nSizes = 0;
+ pScrPriv->pSizes = NULL;
+ pScrPriv->rotation = RR_Rotate_0;
+ pScrPriv->rate = 0;
+ pScrPriv->size = 0;
+#endif
+
+ /*
+ * This value doesn't really matter -- any client must call
+ * GetScreenInfo before reading it which will automatically update
+ * the time
+ */
+ pScrPriv->lastSetTime = currentTime;
+ pScrPriv->lastConfigTime = currentTime;
+
+ wrap (pScrPriv, pScreen, CloseScreen, RRCloseScreen);
+
+ pScrPriv->numOutputs = 0;
+ pScrPriv->outputs = NULL;
+ pScrPriv->numCrtcs = 0;
+ pScrPriv->crtcs = NULL;
+
+ RRNScreens += 1; /* keep count of screens that implement randr */
+ return TRUE;
+}
+
+/*ARGSUSED*/
+static int
+RRFreeClient (pointer data, XID id)
+{
+ RREventPtr pRREvent;
+ WindowPtr pWin;
+ RREventPtr *pHead, pCur, pPrev;
+
+ pRREvent = (RREventPtr) data;
+ pWin = pRREvent->window;
+ dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id,
+ RREventType, serverClient, DixDestroyAccess);
+ if (pHead) {
+ pPrev = 0;
+ for (pCur = *pHead; pCur && pCur != pRREvent; pCur=pCur->next)
+ pPrev = pCur;
+ if (pCur)
+ {
+ if (pPrev)
+ pPrev->next = pRREvent->next;
+ else
+ *pHead = pRREvent->next;
+ }
+ }
+ free((pointer) pRREvent);
+ return 1;
+}
+
+/*ARGSUSED*/
+static int
+RRFreeEvents (pointer data, XID id)
+{
+ RREventPtr *pHead, pCur, pNext;
+
+ pHead = (RREventPtr *) data;
+ for (pCur = *pHead; pCur; pCur = pNext) {
+ pNext = pCur->next;
+ FreeResource (pCur->clientResource, RRClientType);
+ free((pointer) pCur);
+ }
+ free((pointer) pHead);
+ return 1;
+}
+
+void
+RRExtensionInit (void)
+{
+ ExtensionEntry *extEntry;
+
+ if (RRNScreens == 0) return;
+
+ if (!dixRegisterPrivateKey(&RRClientPrivateKeyRec, PRIVATE_CLIENT,
+ sizeof (RRClientRec) +
+ screenInfo.numScreens * sizeof (RRTimesRec)))
+ return;
+ if (!AddCallback (&ClientStateCallback, RRClientCallback, 0))
+ return;
+
+ RRClientType = CreateNewResourceType(RRFreeClient, "RandRClient");
+ if (!RRClientType)
+ return;
+ RREventType = CreateNewResourceType(RRFreeEvents, "RandREvent");
+ if (!RREventType)
+ return;
+ extEntry = AddExtension (RANDR_NAME, RRNumberEvents, RRNumberErrors,
+ ProcRRDispatch, SProcRRDispatch,
+ NULL, StandardMinorOpcode);
+ if (!extEntry)
+ return;
+ RRErrorBase = extEntry->errorBase;
+ RREventBase = extEntry->eventBase;
+ EventSwapVector[RREventBase + RRScreenChangeNotify] = (EventSwapPtr)
+ SRRScreenChangeNotifyEvent;
+ EventSwapVector[RREventBase + RRNotify] = (EventSwapPtr)
+ SRRNotifyEvent;
+
+ RRModeInitErrorValue();
+ RRCrtcInitErrorValue();
+ RROutputInitErrorValue();
+
+#ifdef PANORAMIX
+ RRXineramaExtensionInit();
+#endif
+}
+
+static int
+TellChanged (WindowPtr pWin, pointer value)
+{
+ RREventPtr *pHead, pRREvent;
+ ClientPtr client;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ rrScrPriv(pScreen);
+ int i;
+
+ dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id,
+ RREventType, serverClient, DixReadAccess);
+ if (!pHead)
+ return WT_WALKCHILDREN;
+
+ for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next)
+ {
+ client = pRREvent->client;
+ if (client == serverClient || client->clientGone)
+ continue;
+
+ if (pRREvent->mask & RRScreenChangeNotifyMask)
+ RRDeliverScreenEvent (client, pWin, pScreen);
+
+ if (pRREvent->mask & RRCrtcChangeNotifyMask)
+ {
+ for (i = 0; i < pScrPriv->numCrtcs; i++)
+ {
+ RRCrtcPtr crtc = pScrPriv->crtcs[i];
+ if (crtc->changed)
+ RRDeliverCrtcEvent (client, pWin, crtc);
+ }
+ }
+
+ if (pRREvent->mask & RROutputChangeNotifyMask)
+ {
+ for (i = 0; i < pScrPriv->numOutputs; i++)
+ {
+ RROutputPtr output = pScrPriv->outputs[i];
+ if (output->changed)
+ RRDeliverOutputEvent (client, pWin, output);
+ }
+ }
+ }
+ return WT_WALKCHILDREN;
+}
+
+/*
+ * Something changed; send events and adjust pointer position
+ */
+void
+RRTellChanged (ScreenPtr pScreen)
+{
+ rrScrPriv (pScreen);
+ int i;
+
+ if (pScrPriv->changed)
+ {
+ UpdateCurrentTime ();
+ if (pScrPriv->configChanged)
+ {
+ pScrPriv->lastConfigTime = currentTime;
+ pScrPriv->configChanged = FALSE;
+ }
+ pScrPriv->changed = FALSE;
+ WalkTree (pScreen, TellChanged, (pointer) pScreen);
+ for (i = 0; i < pScrPriv->numOutputs; i++)
+ pScrPriv->outputs[i]->changed = FALSE;
+ for (i = 0; i < pScrPriv->numCrtcs; i++)
+ pScrPriv->crtcs[i]->changed = FALSE;
+ if (pScrPriv->layoutChanged)
+ {
+ pScrPriv->layoutChanged = FALSE;
+ RRPointerScreenConfigured (pScreen);
+ RRSendConfigNotify (pScreen);
+ }
+ }
+}
+
+/*
+ * Return the first output which is connected to an active CRTC
+ * Used in emulating 1.0 behaviour
+ */
+RROutputPtr
+RRFirstOutput (ScreenPtr pScreen)
+{
+ rrScrPriv(pScreen);
+ RROutputPtr output;
+ int i, j;
+
+ if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc)
+ return pScrPriv->primaryOutput;
+
+ for (i = 0; i < pScrPriv->numCrtcs; i++)
+ {
+ RRCrtcPtr crtc = pScrPriv->crtcs[i];
+ for (j = 0; j < pScrPriv->numOutputs; j++)
+ {
+ output = pScrPriv->outputs[j];
+ if (output->crtc == crtc)
+ return output;
+ }
+ }
+ return NULL;
+}
+
+CARD16
+RRVerticalRefresh (xRRModeInfo *mode)
+{
+ CARD32 refresh;
+ CARD32 dots = mode->hTotal * mode->vTotal;
+ if (!dots)
+ return 0;
+ refresh = (mode->dotClock + dots/2) / dots;
+ if (refresh > 0xffff)
+ refresh = 0xffff;
+ return (CARD16) refresh;
+}
+
+static int
+ProcRRDispatch (ClientPtr client)
+{
+ REQUEST(xReq);
+ if (stuff->data >= RRNumberRequests || !ProcRandrVector[stuff->data])
+ return BadRequest;
+ return (*ProcRandrVector[stuff->data]) (client);
+}
+
+static int
+SProcRRDispatch (ClientPtr client)
+{
+ REQUEST(xReq);
+ if (stuff->data >= RRNumberRequests || !ProcRandrVector[stuff->data])
+ return BadRequest;
+ return (*SProcRandrVector[stuff->data]) (client);
+}
+
diff --git a/xorg-server/randr/randrstr.h b/xorg-server/randr/randrstr.h
index ee208f569..7ea608003 100644
--- a/xorg-server/randr/randrstr.h
+++ b/xorg-server/randr/randrstr.h
@@ -1,1129 +1,970 @@
-/*
- * Copyright © 2000 Compaq Computer Corporation
- * Copyright © 2002 Hewlett-Packard Company
- * Copyright © 2006 Intel Corporation
- * Copyright © 2008 Red Hat, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting documentation, and
- * that the name of the copyright holders not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. The copyright holders make no representations
- * about the suitability of this software for any purpose. It is provided "as
- * is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
- * OF THIS SOFTWARE.
- *
- * Author: Jim Gettys, Hewlett-Packard Company, Inc.
- * Keith Packard, Intel Corporation
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef _RANDRSTR_H_
-#define _RANDRSTR_H_
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "misc.h"
-#include "os.h"
-#include "dixstruct.h"
-#include "resource.h"
-#include "scrnintstr.h"
-#include "windowstr.h"
-#include "pixmapstr.h"
-#include "extnsionst.h"
-#include "servermd.h"
-#include "rrtransform.h"
-#include <X11/extensions/randr.h>
-#include <X11/extensions/randrproto.h>
-#include <X11/extensions/render.h> /* we share subpixel order information */
-#include "picturestr.h"
-#include <X11/Xfuncproto.h>
-
-/* required for ABI compatibility for now */
-#define RANDR_10_INTERFACE 1
-#define RANDR_12_INTERFACE 1
-#define RANDR_13_INTERFACE 1 /* requires RANDR_12_INTERFACE */
-#define RANDR_14_INTERFACE 1 /* requires RANDR_13_INTERFACE */
-#define RANDR_GET_CRTC_INTERFACE 1
-
-#define RANDR_INTERFACE_VERSION 0x0104
-
-typedef XID RRMode;
-typedef XID RROutput;
-typedef XID RRCrtc;
-
-extern _X_EXPORT int RREventBase, RRErrorBase;
-
-extern _X_EXPORT int (*ProcRandrVector[RRNumberRequests])(ClientPtr);
-extern _X_EXPORT int (*SProcRandrVector[RRNumberRequests])(ClientPtr);
-
-/*
- * Modeline for a monitor. Name follows directly after this struct
- */
-
-#define RRModeName(pMode) ((char *) (pMode + 1))
-typedef struct _rrMode RRModeRec, *RRModePtr;
-typedef struct _rrPropertyValue RRPropertyValueRec, *RRPropertyValuePtr;
-typedef struct _rrProperty RRPropertyRec, *RRPropertyPtr;
-typedef struct _rrCrtc RRCrtcRec, *RRCrtcPtr;
-typedef struct _rrScreenConfig RRScreenConfigRec, *RRScreenConfigPtr;
-typedef struct _rrCrtcConfig RRCrtcConfigRec, *RRCrtcConfigPtr;
-typedef struct _rrOutput RROutputRec, *RROutputPtr;
-
-struct _rrMode {
- int refcnt;
- xRRModeInfo mode;
- char *name;
- ScreenPtr userScreen;
-};
-
-struct _rrPropertyValue {
- Atom type; /* ignored by server */
- short format; /* format of data for swapping - 8,16,32 */
- long size; /* size of data in (format/8) bytes */
- pointer data; /* private to client */
-};
-
-struct _rrProperty {
- RRPropertyPtr next;
- ATOM propertyName;
- Bool is_pending;
- Bool range;
- Bool immutable;
- int num_valid;
- INT32 *valid_values;
- RRPropertyValueRec current, pending;
-};
-
-struct _rrCrtc {
- RRCrtc id;
- ScreenPtr pScreen;
- RRModePtr mode;
- int x, y;
- Rotation rotation;
- Rotation rotations;
- Bool changed;
- int numOutputs;
- RROutputPtr *outputs;
- int gammaSize;
- CARD16 *gammaRed;
- CARD16 *gammaBlue;
- CARD16 *gammaGreen;
- void *devPrivate;
- Bool transforms;
- PixmapPtr scanoutPixmap;
- RRTransformRec client_pending_transform;
- RRTransformRec client_current_transform;
- PictTransform client_sprite_position_transform;
- PictTransform client_sprite_image_transform;
- struct pict_f_transform client_sprite_f_position_transform;
- struct pict_f_transform client_sprite_f_image_transform;
-
- PictTransform transform;
- struct pict_f_transform f_transform;
- struct pict_f_transform f_inverse;
- struct pict_f_transform f_sprite_position; /* crtc from screen */
- struct pict_f_transform f_sprite_image_inverse; /* image from crtc */
-};
-
-struct _rrScreenConfig {
- CARD16 screen_pixmap_width;
- CARD16 screen_pixmap_height;
- CARD16 screen_width;
- CARD16 screen_height;
- CARD32 mm_width;
- CARD32 mm_height;
-};
-
-struct _rrCrtcConfig {
- RRCrtcPtr crtc;
- int x, y;
- RRModePtr mode;
- Rotation rotation;
- int numOutputs;
- RROutputPtr *outputs;
- PictTransform sprite_position_transform;
- PictTransform sprite_image_transform;
- struct pict_f_transform sprite_position_f_transform;
- struct pict_f_transform sprite_image_f_transform;
- PixmapPtr pixmap;
- int pixmap_x, pixmap_y;
-};
-
-struct _rrOutput {
- RROutput id;
- ScreenPtr pScreen;
- char *name;
- int nameLength;
- CARD8 connection;
- CARD8 subpixelOrder;
- int mmWidth;
- int mmHeight;
- RRCrtcPtr crtc;
- int numCrtcs;
- RRCrtcPtr *crtcs;
- int numClones;
- RROutputPtr *clones;
- int numModes;
- int numPreferred;
- RRModePtr *modes;
- int numUserModes;
- RRModePtr *userModes;
- Bool changed;
- RRPropertyPtr properties;
- Bool pendingProperties;
- void *devPrivate;
-};
-
-#if RANDR_12_INTERFACE
-typedef Bool (*RRScreenSetSizeProcPtr) (ScreenPtr pScreen,
- CARD16 width,
- CARD16 height,
- CARD16 pixWidth,
- CARD16 pixHeight,
- CARD32 mmWidth,
- CARD32 mmHeight);
-
-typedef Bool (*RRCrtcSetProcPtr) (ScreenPtr pScreen,
- RRCrtcPtr crtc,
- RRModePtr mode,
- int x,
- int y,
- Rotation rotation,
- int numOutputs,
- RROutputPtr *outputs,
- PixmapPtr scanout_pixmap);
-
-typedef Bool (*RRCrtcSetGammaProcPtr) (ScreenPtr pScreen,
- RRCrtcPtr crtc);
-
-typedef Bool (*RRCrtcGetGammaProcPtr) (ScreenPtr pScreen,
- RRCrtcPtr crtc);
-
-typedef Bool (*RROutputSetPropertyProcPtr) (ScreenPtr pScreen,
- RROutputPtr output,
- Atom property,
- RRPropertyValuePtr value);
-
-typedef Bool (*RROutputValidateModeProcPtr) (ScreenPtr pScreen,
- RROutputPtr output,
- RRModePtr mode);
-
-typedef void (*RRModeDestroyProcPtr) (ScreenPtr pScreen,
- RRModePtr mode);
-
-#endif
-
-#if RANDR_13_INTERFACE
-typedef Bool (*RROutputGetPropertyProcPtr) (ScreenPtr pScreen,
- RROutputPtr output,
- Atom property);
-typedef Bool (*RRGetPanningProcPtr) (ScreenPtr pScrn,
- RRCrtcPtr crtc,
- BoxPtr totalArea,
- BoxPtr trackingArea,
- INT16 *border);
-typedef Bool (*RRSetPanningProcPtr) (ScreenPtr pScrn,
- RRCrtcPtr crtc,
- BoxPtr totalArea,
- BoxPtr trackingArea,
- INT16 *border);
-
-#endif /* RANDR_13_INTERFACE */
-
-typedef Bool (*RRGetInfoProcPtr) (ScreenPtr pScreen, Rotation *rotations);
-typedef Bool (*RRCloseScreenProcPtr) ( int i, ScreenPtr pscreen);
-
-/* These are for 1.0 compatibility */
-
-typedef struct _rrRefresh {
- CARD16 rate;
- RRModePtr mode;
-} RRScreenRate, *RRScreenRatePtr;
-
-typedef struct _rrScreenSize {
- int id;
- short width, height;
- short mmWidth, mmHeight;
- int nRates;
- RRScreenRatePtr pRates;
-} RRScreenSize, *RRScreenSizePtr;
-
-#ifdef RANDR_10_INTERFACE
-
-typedef Bool (*RRSetConfigProcPtr) (ScreenPtr pScreen,
- Rotation rotation,
- int rate,
- RRScreenSizePtr pSize);
-
-#endif
-
-typedef struct {
- PictFormatPtr format;
- int maxWidth, maxHeight;
- int depth;
- Rotation rotations;
-} RRScanoutPixmapInfo;
-
-typedef RRScanoutPixmapInfo *(*RRQueryScanoutPixmapsPtr) (ScreenPtr pScreen,
- int *num_info);
-
-typedef PixmapPtr (*RRCreateScanoutPixmapPtr) (ScreenPtr pScreen,
- int width, int height, int depth,
- Rotation rotations,
- PictFormatPtr format);
-
-typedef void (*RRSetCrtcSpriteTransformPtr) (ScreenPtr pScreen,
- RRCrtcPtr randr_crtc,
- struct pict_f_transform *position_transform,
- struct pict_f_transform *image_transform);
-
-typedef void (*RRGetCrtcSpriteTransformPtr) (ScreenPtr pScreen,
- RRCrtcPtr randr_crtc,
- struct pict_f_transform *position_transform,
- struct pict_f_transform *image_transform);
-
-typedef Bool (*RRSetCrtcConfigsPtr) (ScreenPtr screen,
- RRScreenConfigPtr screen_config,
- RRCrtcConfigPtr crtc_configs,
- int num_configs);
-
-typedef struct _rrScrPriv {
- /*
- * 'public' part of the structure; DDXen fill this in
- * as they initialize
- */
-#if RANDR_10_INTERFACE
- RRSetConfigProcPtr rrSetConfig;
-#endif
- RRGetInfoProcPtr rrGetInfo;
-#if RANDR_12_INTERFACE
- RRScreenSetSizeProcPtr rrScreenSetSize;
- RRCrtcSetProcPtr rrCrtcSet;
- RRCrtcSetGammaProcPtr rrCrtcSetGamma;
- RRCrtcGetGammaProcPtr rrCrtcGetGamma;
- RROutputSetPropertyProcPtr rrOutputSetProperty;
- RROutputValidateModeProcPtr rrOutputValidateMode;
- RRModeDestroyProcPtr rrModeDestroy;
-#endif
-#if RANDR_13_INTERFACE
- RROutputGetPropertyProcPtr rrOutputGetProperty;
- RRGetPanningProcPtr rrGetPanning;
- RRSetPanningProcPtr rrSetPanning;
-#endif
- RRQueryScanoutPixmapsPtr rrQueryScanoutPixmaps;
- RRCreateScanoutPixmapPtr rrCreateScanoutPixmap;
- RRSetCrtcSpriteTransformPtr rrSetCrtcSpriteTransform;
- RRGetCrtcSpriteTransformPtr rrGetCrtcSpriteTransform;
- RRSetCrtcConfigsPtr rrSetCrtcConfigs;
-
- /*
- * Private part of the structure; not considered part of the ABI
- */
- TimeStamp lastSetTime; /* last changed by client */
- TimeStamp lastConfigTime; /* possible configs changed */
- RRCloseScreenProcPtr CloseScreen;
-
- Bool changed; /* some config changed */
- Bool configChanged; /* configuration changed */
- Bool layoutChanged; /* screen layout changed */
-
- CARD16 minWidth, minHeight;
- CARD16 maxWidth, maxHeight;
- CARD16 width, height; /* last known screen size */
- CARD16 mmWidth, mmHeight; /* last known screen size */
-
- int numOutputs;
- RROutputPtr *outputs;
- RROutputPtr primaryOutput;
-
- int numCrtcs;
- RRCrtcPtr *crtcs;
-
- /* Last known pointer position */
- RRCrtcPtr pointerCrtc;
-
- RRScanoutPixmapInfo *scanout_info;
- int n_scanout_info;
-#ifdef RANDR_10_INTERFACE
- /*
- * Configuration information
- */
- Rotation rotations;
- CARD16 reqWidth, reqHeight;
-
- int nSizes;
- RRScreenSizePtr pSizes;
-
- Rotation rotation;
- int rate;
- int size;
-#endif
-
-} rrScrPrivRec, *rrScrPrivPtr;
-
-extern _X_EXPORT DevPrivateKeyRec rrPrivKeyRec;
-#define rrPrivKey (&rrPrivKeyRec)
-
-#define rrGetScrPriv(pScr) ((rrScrPrivPtr)dixLookupPrivate(&(pScr)->devPrivates, rrPrivKey))
-#define rrScrPriv(pScr) rrScrPrivPtr pScrPriv = rrGetScrPriv(pScr)
-#define SetRRScreen(s,p) dixSetPrivate(&(s)->devPrivates, rrPrivKey, p)
-
-/*
- * each window has a list of clients requesting
- * RRNotify events. Each client has a resource
- * for each window it selects RRNotify input for,
- * this resource is used to delete the RRNotifyRec
- * entry from the per-window queue.
- */
-
-typedef struct _RREvent *RREventPtr;
-
-typedef struct _RREvent {
- RREventPtr next;
- ClientPtr client;
- WindowPtr window;
- XID clientResource;
- int mask;
-} RREventRec;
-
-typedef struct _RRTimes {
- TimeStamp setTime;
- TimeStamp configTime;
-} RRTimesRec, *RRTimesPtr;
-
-typedef struct _RRClient {
- int major_version;
- int minor_version;
-/* RRTimesRec times[0]; */
-} RRClientRec, *RRClientPtr;
-
-extern _X_EXPORT RESTYPE RRClientType, RREventType; /* resource types for event masks */
-extern _X_EXPORT DevPrivateKeyRec RRClientPrivateKeyRec;
-#define RRClientPrivateKey (&RRClientPrivateKeyRec)
-extern _X_EXPORT RESTYPE RRCrtcType, RRModeType, RROutputType;
-
-#define VERIFY_RR_OUTPUT(id, ptr, a)\
- {\
- int rc = dixLookupResourceByType((pointer *)&(ptr), id,\
- RROutputType, client, a);\
- if (rc != Success) {\
- client->errorValue = id;\
- return rc;\
- }\
- }
-
-#define VERIFY_RR_CRTC(id, ptr, a)\
- {\
- int rc = dixLookupResourceByType((pointer *)&(ptr), id,\
- RRCrtcType, client, a);\
- if (rc != Success) {\
- client->errorValue = id;\
- return rc;\
- }\
- }
-
-#define VERIFY_RR_MODE(id, ptr, a)\
- {\
- int rc = dixLookupResourceByType((pointer *)&(ptr), id,\
- RRModeType, client, a);\
- if (rc != Success) {\
- client->errorValue = id;\
- return rc;\
- }\
- }
-
-#define GetRRClient(pClient) ((RRClientPtr)dixLookupPrivate(&(pClient)->devPrivates, RRClientPrivateKey))
-#define rrClientPriv(pClient) RRClientPtr pRRClient = GetRRClient(pClient)
-
-/* Initialize the extension */
-extern _X_EXPORT void
-RRExtensionInit (void);
-
-#ifdef RANDR_12_INTERFACE
-/*
- * Set the range of sizes for the screen
- */
-extern _X_EXPORT void
-RRScreenSetSizeRange (ScreenPtr pScreen,
- CARD16 minWidth,
- CARD16 minHeight,
- CARD16 maxWidth,
- CARD16 maxHeight);
-#endif
-
-/* rrscreen.c */
-/*
- * Notify the extension that the screen size has been changed.
- * The driver is responsible for calling this whenever it has changed
- * the size of the screen
- */
-extern _X_EXPORT void
-RRScreenSizeNotify (ScreenPtr pScreen);
-
-/*
- * Request that the screen be resized
- */
-extern _X_EXPORT Bool
-RRScreenSizeSet (ScreenPtr pScreen,
- CARD16 width,
- CARD16 height,
- CARD16 pixWidth,
- CARD16 pixHeight,
- CARD32 mmWidth,
- CARD32 mmHeight);
-
-extern _X_EXPORT void
-RRScreenCurrentConfig(ScreenPtr screen,
- RRScreenConfigPtr screen_config);
-
-/*
- * Send ConfigureNotify event to root window when 'something' happens
- */
-extern _X_EXPORT void
-RRSendConfigNotify (ScreenPtr pScreen);
-
-/*
- * screen dispatch
- */
-extern _X_EXPORT int
-ProcRRGetScreenSizeRange (ClientPtr client);
-
-extern _X_EXPORT int
-ProcRRSetScreenSize (ClientPtr client);
-
-extern _X_EXPORT int
-ProcRRGetScreenResources (ClientPtr client);
-
-extern _X_EXPORT int
-ProcRRGetScreenResourcesCurrent (ClientPtr client);
-
-extern _X_EXPORT int
-ProcRRSetScreenConfig (ClientPtr client);
-
-extern _X_EXPORT int
-ProcRRGetScreenInfo (ClientPtr client);
-
-/*
- * Deliver a ScreenNotify event
- */
-extern _X_EXPORT void
-RRDeliverScreenEvent (ClientPtr client, WindowPtr pWin, ScreenPtr pScreen);
-
-/* randr.c */
-/*
- * Send all pending events
- */
-extern _X_EXPORT void
-RRTellChanged (ScreenPtr pScreen);
-
-/*
- * Poll the driver for changed information
- */
-extern _X_EXPORT Bool
-RRGetInfo (ScreenPtr pScreen, Bool force_query);
-
-extern _X_EXPORT Bool RRInit (void);
-
-extern _X_EXPORT Bool RRScreenInit(ScreenPtr pScreen);
-
-extern _X_EXPORT RROutputPtr
-RRFirstOutput (ScreenPtr pScreen);
-
-extern _X_EXPORT Rotation
-RRGetRotation (ScreenPtr pScreen);
-
-extern _X_EXPORT CARD16
-RRVerticalRefresh (xRRModeInfo *mode);
-
-extern _X_EXPORT RRScanoutPixmapInfo *
-RRQueryScanoutPixmapInfo(ScreenPtr screen, int *n_info);
-
-#ifdef RANDR_10_INTERFACE
-/*
- * This is the old interface, deprecated but left
- * around for compatibility
- */
-
-/*
- * Then, register the specific size with the screen
- */
-
-extern _X_EXPORT RRScreenSizePtr
-RRRegisterSize (ScreenPtr pScreen,
- short width,
- short height,
- short mmWidth,
- short mmHeight);
-
-extern _X_EXPORT Bool
-RRRegisterRate (ScreenPtr pScreen,
- RRScreenSizePtr pSize,
- int rate);
-
-/*
- * Finally, set the current configuration of the screen
- */
-
-extern _X_EXPORT void
-RRSetCurrentConfig (ScreenPtr pScreen,
- Rotation rotation,
- int rate,
- RRScreenSizePtr pSize);
-
-extern _X_EXPORT Bool RRScreenInit (ScreenPtr pScreen);
-
-extern _X_EXPORT Rotation
-RRGetRotation (ScreenPtr pScreen);
-
-#endif
-
-/* rrcrtc.c */
-
-/*
- * Notify the CRTC of some change; layoutChanged indicates that
- * some position or size element changed
- */
-extern _X_EXPORT void
-RRCrtcChanged (RRCrtcPtr crtc, Bool layoutChanged);
-
-/*
- * Create a CRTC
- */
-extern _X_EXPORT RRCrtcPtr
-RRCrtcCreate (ScreenPtr pScreen, void *devPrivate);
-
-/*
- * Set the allowed rotations on a CRTC
- */
-extern _X_EXPORT void
-RRCrtcSetRotations (RRCrtcPtr crtc, Rotation rotations);
-
-/*
- * Set whether transforms are allowed on a CRTC
- */
-extern _X_EXPORT void
-RRCrtcSetTransformSupport (RRCrtcPtr crtc, Bool transforms);
-
-/*
- * Notify the extension that the Crtc has been reconfigured,
- * the driver calls this whenever it has updated the mode
- */
-extern _X_EXPORT Bool
-RRCrtcNotify (RRCrtcPtr crtc,
- RRModePtr mode,
- int x,
- int y,
- Rotation rotation,
- RRTransformPtr transform,
- int numOutputs,
- RROutputPtr *outputs,
- PixmapPtr scanoutPixmap);
-
-extern _X_EXPORT void
-RRDeliverCrtcEvent (ClientPtr client, WindowPtr pWin, RRCrtcPtr crtc);
-
-/*
- * Request that the Crtc be reconfigured
- */
-extern _X_EXPORT Bool
-RRCrtcSet (RRCrtcPtr crtc,
- RRModePtr mode,
- int x,
- int y,
- Rotation rotation,
- int numOutput,
- RROutputPtr *outputs,
- PixmapPtr scanout_pixmap);
-
-/*
- * Request that the Crtc gamma be changed
- */
-
-extern _X_EXPORT Bool
-RRCrtcGammaSet (RRCrtcPtr crtc,
- CARD16 *red,
- CARD16 *green,
- CARD16 *blue);
-
-/*
- * Request current gamma back from the DDX (if possible).
- * This includes gamma size.
- */
-
-extern _X_EXPORT Bool
-RRCrtcGammaGet(RRCrtcPtr crtc);
-
-/*
- * Notify the extension that the Crtc gamma has been changed
- * The driver calls this whenever it has changed the gamma values
- * in the RRCrtcRec
- */
-
-extern _X_EXPORT Bool
-RRCrtcGammaNotify (RRCrtcPtr crtc);
-
-void
-RRModeGetScanoutSize (RRModePtr mode, struct pixman_f_transform *transform,
- int *width, int *height);
-
-/*
- * Set the size of the gamma table at server startup time
- */
-
-extern _X_EXPORT Bool
-RRCrtcGammaSetSize (RRCrtcPtr crtc,
- int size);
-
-/*
- * Return the area of the frame buffer scanned out by the crtc,
- * taking into account the current mode and rotation
- */
-
-extern _X_EXPORT void
-RRCrtcGetScanoutSize(RRCrtcPtr crtc, int *width, int *height);
-
-/*
- * Return crtc transform
- */
-extern _X_EXPORT RRTransformPtr
-RRCrtcGetTransform (RRCrtcPtr crtc);
-
-/*
- * Check whether the pending and current transforms are the same
- */
-extern _X_EXPORT Bool
-RRCrtcPendingTransform (RRCrtcPtr crtc);
-
-/*
- * Destroy a Crtc at shutdown
- */
-extern _X_EXPORT void
-RRCrtcDestroy (RRCrtcPtr crtc);
-
-
-/*
- * Set the pending CRTC transformation
- */
-
-extern _X_EXPORT int
-RRCrtcTransformSet (RRCrtcPtr crtc,
- PictTransformPtr transform,
- struct pict_f_transform *f_transform,
- struct pict_f_transform *f_inverse,
- char *filter,
- int filter_len,
- xFixed *params,
- int nparams);
-
-/*
- * Initialize crtc type
- */
-extern _X_EXPORT Bool
-RRCrtcInit (void);
-
-/*
- * Initialize crtc type error value
- */
-extern _X_EXPORT void
-RRCrtcInitErrorValue (void);
-
-/*
- * Free a set of crtc configs and their attached output arrays
- */
-void
-RRFreeCrtcConfigs(RRCrtcConfigPtr configs, int num_configs);
-
-/*
- * Convert the current crtc configuration into an RRCrtcConfig
- */
-extern _X_EXPORT Bool
-RRCrtcCurrentConfig(RRCrtcPtr crtc,
- RRCrtcConfigPtr crtc_config);
-
-/*
- * Figure out whether the specific crtc_config can fit
- * within the screen_config
- */
-Bool
-RRScreenCoversCrtc(RRScreenConfigPtr screen_config,
- RRCrtcConfigPtr crtc_config,
- RRTransformPtr client_transform,
- XID *errorValue);
-
-/*
- * Set a screen and set of crtc configurations in one operation
- */
-Bool
-RRSetCrtcConfigs(ScreenPtr screen,
- RRScreenConfigPtr screen_config,
- RRCrtcConfigPtr crtc_configs,
- int num_configs);
-
-/*
- * Crtc dispatch
- */
-
-extern _X_EXPORT int
-ProcRRGetCrtcInfo (ClientPtr client);
-
-extern _X_EXPORT int
-ProcRRSetCrtcConfig (ClientPtr client);
-
-extern _X_EXPORT int
-ProcRRGetCrtcGammaSize (ClientPtr client);
-
-extern _X_EXPORT int
-ProcRRGetCrtcGamma (ClientPtr client);
-
-extern _X_EXPORT int
-ProcRRSetCrtcGamma (ClientPtr client);
-
-extern _X_EXPORT int
-ProcRRSetCrtcTransform (ClientPtr client);
-
-extern _X_EXPORT int
-ProcRRGetCrtcTransform (ClientPtr client);
-
-extern _X_EXPORT int
-ProcRRSetCrtcConfigs (ClientPtr client);
-
-int
-ProcRRGetPanning (ClientPtr client);
-
-int
-ProcRRSetPanning (ClientPtr client);
-
-void
-RRCrtcSpriteTransformSet(RRCrtcPtr crtc,
- PictTransform *position_transform,
- PictTransform *image_transform,
- struct pict_f_transform *f_position_transform,
- struct pict_f_transform *f_image_transform);
-
-int
-ProcRRQueryScanoutPixmaps (ClientPtr client);
-
-int
-ProcRRCreateScanoutPixmap (ClientPtr client);
-
-int
-ProcRRSetCrtcPixmapConfig (ClientPtr client);
-
-int
-ProcRRSetCrtcSpriteTransform (ClientPtr client);
-
-int
-ProcRRGetCrtcSpriteTransform (ClientPtr client);
-
-int
-ProcRRSetCrtcConfigs (ClientPtr client);
-
-/* rrdispatch.c */
-extern _X_EXPORT Bool
-RRClientKnowsRates (ClientPtr pClient);
-
-/* rrmode.c */
-/*
- * Find, and if necessary, create a mode
- */
-
-extern _X_EXPORT RRModePtr
-RRModeGet (xRRModeInfo *modeInfo,
- const char *name);
-
-/*
- * Destroy a mode.
- */
-
-extern _X_EXPORT void
-RRModeDestroy (RRModePtr mode);
-
-/*
- * Return a list of modes that are valid for some output in pScreen
- */
-extern _X_EXPORT RRModePtr *
-RRModesForScreen (ScreenPtr pScreen, int *num_ret);
-
-/*
- * Initialize mode type
- */
-extern _X_EXPORT Bool
-RRModeInit (void);
-
-/*
- * Initialize mode type error value
- */
-extern _X_EXPORT void
-RRModeInitErrorValue (void);
-
-extern _X_EXPORT int
-ProcRRCreateMode (ClientPtr client);
-
-extern _X_EXPORT int
-ProcRRDestroyMode (ClientPtr client);
-
-extern _X_EXPORT int
-ProcRRAddOutputMode (ClientPtr client);
-
-extern _X_EXPORT int
-ProcRRDeleteOutputMode (ClientPtr client);
-
-/* rroutput.c */
-
-/*
- * Notify the output of some change. configChanged indicates whether
- * any external configuration (mode list, clones, connected status)
- * has changed, or whether the change was strictly internal
- * (which crtc is in use)
- */
-extern _X_EXPORT void
-RROutputChanged (RROutputPtr output, Bool configChanged);
-
-/*
- * Create an output
- */
-
-extern _X_EXPORT RROutputPtr
-RROutputCreate (ScreenPtr pScreen,
- const char *name,
- int nameLength,
- void *devPrivate);
-
-/*
- * Notify extension that output parameters have been changed
- */
-extern _X_EXPORT Bool
-RROutputSetClones (RROutputPtr output,
- RROutputPtr *clones,
- int numClones);
-
-extern _X_EXPORT Bool
-RROutputSetModes (RROutputPtr output,
- RRModePtr *modes,
- int numModes,
- int numPreferred);
-
-extern _X_EXPORT int
-RROutputAddUserMode (RROutputPtr output,
- RRModePtr mode);
-
-extern _X_EXPORT int
-RROutputDeleteUserMode (RROutputPtr output,
- RRModePtr mode);
-
-extern _X_EXPORT Bool
-RROutputSetCrtcs (RROutputPtr output,
- RRCrtcPtr *crtcs,
- int numCrtcs);
-
-extern _X_EXPORT Bool
-RROutputSetConnection (RROutputPtr output,
- CARD8 connection);
-
-extern _X_EXPORT Bool
-RROutputSetSubpixelOrder (RROutputPtr output,
- int subpixelOrder);
-
-extern _X_EXPORT Bool
-RROutputSetPhysicalSize (RROutputPtr output,
- int mmWidth,
- int mmHeight);
-
-extern _X_EXPORT void
-RRDeliverOutputEvent(ClientPtr client, WindowPtr pWin, RROutputPtr output);
-
-extern _X_EXPORT void
-RROutputDestroy (RROutputPtr output);
-
-extern _X_EXPORT int
-ProcRRGetOutputInfo (ClientPtr client);
-
-extern _X_EXPORT int
-ProcRRSetOutputPrimary (ClientPtr client);
-
-extern _X_EXPORT int
-ProcRRGetOutputPrimary (ClientPtr client);
-
-/*
- * Initialize output type
- */
-extern _X_EXPORT Bool
-RROutputInit (void);
-
-/*
- * Initialize output type error value
- */
-extern _X_EXPORT void
-RROutputInitErrorValue (void);
-
-/* rrpointer.c */
-extern _X_EXPORT void
-RRPointerMoved (ScreenPtr pScreen, int x, int y);
-
-extern _X_EXPORT void
-RRPointerScreenConfigured (ScreenPtr pScreen);
-
-/* rrproperty.c */
-
-extern _X_EXPORT void
-RRDeleteAllOutputProperties (RROutputPtr output);
-
-extern _X_EXPORT RRPropertyValuePtr
-RRGetOutputProperty (RROutputPtr output, Atom property, Bool pending);
-
-extern _X_EXPORT RRPropertyPtr
-RRQueryOutputProperty (RROutputPtr output, Atom property);
-
-extern _X_EXPORT void
-RRDeleteOutputProperty (RROutputPtr output, Atom property);
-
-extern _X_EXPORT Bool
-RRPostPendingProperties (RROutputPtr output);
-
-extern _X_EXPORT int
-RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type,
- int format, int mode, unsigned long len,
- pointer value, Bool sendevent, Bool pending);
-
-extern _X_EXPORT int
-RRConfigureOutputProperty (RROutputPtr output, Atom property,
- Bool pending, Bool range, Bool immutable,
- int num_values, INT32 *values);
-extern _X_EXPORT int
-ProcRRChangeOutputProperty (ClientPtr client);
-
-extern _X_EXPORT int
-ProcRRGetOutputProperty (ClientPtr client);
-
-extern _X_EXPORT int
-ProcRRListOutputProperties (ClientPtr client);
-
-extern _X_EXPORT int
-ProcRRQueryOutputProperty (ClientPtr client);
-
-extern _X_EXPORT int
-ProcRRConfigureOutputProperty (ClientPtr client);
-
-extern _X_EXPORT int
-ProcRRDeleteOutputProperty (ClientPtr client);
-
-/* rrsprite.c */
-extern _X_EXPORT int
-ProcRRSetCrtcSpriteTransform (ClientPtr client);
-
-extern _X_EXPORT int
-ProcRRGetCrtcSpriteTransform (ClientPtr client);
-
-/* rrxinerama.c */
-#ifdef XINERAMA
-extern _X_EXPORT void
-RRXineramaExtensionInit(void);
-#endif
-
-/* mirrcrtc.c */
-Bool
-miRRSetScreenConfig(ScreenPtr screen,
- RRScreenConfigPtr screen_config);
-
-Bool
-miRRSetCrtcConfig(RRCrtcConfigPtr crtc_config);
-
-Bool
-miRRDisableCrtc(RRCrtcPtr crtc);
-
-Bool
-miRRCheckDisableCrtc(RRScreenConfigPtr new_screen_config,
- RRCrtcConfigPtr old_crtc_config);
-
-Bool
-miRRSetCrtcConfigs(ScreenPtr screen,
- RRScreenConfigPtr screen_config,
- RRCrtcConfigPtr crtc_configs,
- int num_configs);
-
-#endif /* _RANDRSTR_H_ */
-
-/*
-
-randr extension implementation structure
-
-Query state:
- ProcRRGetScreenInfo/ProcRRGetScreenResources
- RRGetInfo
-
- • Request configuration from driver, either 1.0 or 1.2 style
- • These functions only record state changes, all
- other actions are pended until RRTellChanged is called
-
- ->rrGetInfo
- 1.0:
- RRRegisterSize
- RRRegisterRate
- RRSetCurrentConfig
- 1.2:
- RRScreenSetSizeRange
- RROutputSetCrtcs
- RRModeGet
- RROutputSetModes
- RROutputSetConnection
- RROutputSetSubpixelOrder
- RROutputSetClones
- RRCrtcNotify
-
- • Must delay scanning configuration until after ->rrGetInfo returns
- because some drivers will call SetCurrentConfig in the middle
- of the ->rrGetInfo operation.
-
- 1.0:
-
- • Scan old configuration, mirror to new structures
-
- RRScanOldConfig
- RRCrtcCreate
- RROutputCreate
- RROutputSetCrtcs
- RROutputSetConnection
- RROutputSetSubpixelOrder
- RROldModeAdd • This adds modes one-at-a-time
- RRModeGet
- RRCrtcNotify
-
- • send events, reset pointer if necessary
-
- RRTellChanged
- WalkTree (sending events)
-
- • when layout has changed:
- RRPointerScreenConfigured
- RRSendConfigNotify
-
-Asynchronous state setting (1.2 only)
- When setting state asynchronously, the driver invokes the
- ->rrGetInfo function and then calls RRTellChanged to flush
- the changes to the clients and reset pointer if necessary
-
-Set state
-
- ProcRRSetScreenConfig
- RRCrtcSet
- 1.2:
- ->rrCrtcSet
- RRCrtcNotify
- 1.0:
- ->rrSetConfig
- RRCrtcNotify
- RRTellChanged
- */
+/*
+ * Copyright © 2000 Compaq Computer Corporation
+ * Copyright © 2002 Hewlett-Packard Company
+ * Copyright © 2006 Intel Corporation
+ * Copyright © 2008 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ *
+ * Author: Jim Gettys, Hewlett-Packard Company, Inc.
+ * Keith Packard, Intel Corporation
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef _RANDRSTR_H_
+#define _RANDRSTR_H_
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "misc.h"
+#include "os.h"
+#include "dixstruct.h"
+#include "resource.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "extnsionst.h"
+#include "servermd.h"
+#include "rrtransform.h"
+#include <X11/extensions/randr.h>
+#include <X11/extensions/randrproto.h>
+#include <X11/extensions/render.h> /* we share subpixel order information */
+#include "picturestr.h"
+#include <X11/Xfuncproto.h>
+
+/* required for ABI compatibility for now */
+#define RANDR_10_INTERFACE 1
+#define RANDR_12_INTERFACE 1
+#define RANDR_13_INTERFACE 1 /* requires RANDR_12_INTERFACE */
+#define RANDR_GET_CRTC_INTERFACE 1
+
+#define RANDR_INTERFACE_VERSION 0x0103
+
+typedef XID RRMode;
+typedef XID RROutput;
+typedef XID RRCrtc;
+
+extern _X_EXPORT int RREventBase, RRErrorBase;
+
+extern _X_EXPORT int (*ProcRandrVector[RRNumberRequests])(ClientPtr);
+extern _X_EXPORT int (*SProcRandrVector[RRNumberRequests])(ClientPtr);
+
+/*
+ * Modeline for a monitor. Name follows directly after this struct
+ */
+
+#define RRModeName(pMode) ((char *) (pMode + 1))
+typedef struct _rrMode RRModeRec, *RRModePtr;
+typedef struct _rrPropertyValue RRPropertyValueRec, *RRPropertyValuePtr;
+typedef struct _rrProperty RRPropertyRec, *RRPropertyPtr;
+typedef struct _rrCrtc RRCrtcRec, *RRCrtcPtr;
+typedef struct _rrOutput RROutputRec, *RROutputPtr;
+
+struct _rrMode {
+ int refcnt;
+ xRRModeInfo mode;
+ char *name;
+ ScreenPtr userScreen;
+};
+
+struct _rrPropertyValue {
+ Atom type; /* ignored by server */
+ short format; /* format of data for swapping - 8,16,32 */
+ long size; /* size of data in (format/8) bytes */
+ pointer data; /* private to client */
+};
+
+struct _rrProperty {
+ RRPropertyPtr next;
+ ATOM propertyName;
+ Bool is_pending;
+ Bool range;
+ Bool immutable;
+ int num_valid;
+ INT32 *valid_values;
+ RRPropertyValueRec current, pending;
+};
+
+struct _rrCrtc {
+ RRCrtc id;
+ ScreenPtr pScreen;
+ RRModePtr mode;
+ int x, y;
+ Rotation rotation;
+ Rotation rotations;
+ Bool changed;
+ int numOutputs;
+ RROutputPtr *outputs;
+ int gammaSize;
+ CARD16 *gammaRed;
+ CARD16 *gammaBlue;
+ CARD16 *gammaGreen;
+ void *devPrivate;
+ Bool transforms;
+ RRTransformRec client_pending_transform;
+ RRTransformRec client_current_transform;
+ PictTransform transform;
+ struct pict_f_transform f_transform;
+ struct pict_f_transform f_inverse;
+};
+
+struct _rrOutput {
+ RROutput id;
+ ScreenPtr pScreen;
+ char *name;
+ int nameLength;
+ CARD8 connection;
+ CARD8 subpixelOrder;
+ int mmWidth;
+ int mmHeight;
+ RRCrtcPtr crtc;
+ int numCrtcs;
+ RRCrtcPtr *crtcs;
+ int numClones;
+ RROutputPtr *clones;
+ int numModes;
+ int numPreferred;
+ RRModePtr *modes;
+ int numUserModes;
+ RRModePtr *userModes;
+ Bool changed;
+ RRPropertyPtr properties;
+ Bool pendingProperties;
+ void *devPrivate;
+};
+
+#if RANDR_12_INTERFACE
+typedef Bool (*RRScreenSetSizeProcPtr) (ScreenPtr pScreen,
+ CARD16 width,
+ CARD16 height,
+ CARD32 mmWidth,
+ CARD32 mmHeight);
+
+typedef Bool (*RRCrtcSetProcPtr) (ScreenPtr pScreen,
+ RRCrtcPtr crtc,
+ RRModePtr mode,
+ int x,
+ int y,
+ Rotation rotation,
+ int numOutputs,
+ RROutputPtr *outputs);
+
+typedef Bool (*RRCrtcSetGammaProcPtr) (ScreenPtr pScreen,
+ RRCrtcPtr crtc);
+
+typedef Bool (*RRCrtcGetGammaProcPtr) (ScreenPtr pScreen,
+ RRCrtcPtr crtc);
+
+typedef Bool (*RROutputSetPropertyProcPtr) (ScreenPtr pScreen,
+ RROutputPtr output,
+ Atom property,
+ RRPropertyValuePtr value);
+
+typedef Bool (*RROutputValidateModeProcPtr) (ScreenPtr pScreen,
+ RROutputPtr output,
+ RRModePtr mode);
+
+typedef void (*RRModeDestroyProcPtr) (ScreenPtr pScreen,
+ RRModePtr mode);
+
+#endif
+
+#if RANDR_13_INTERFACE
+typedef Bool (*RROutputGetPropertyProcPtr) (ScreenPtr pScreen,
+ RROutputPtr output,
+ Atom property);
+typedef Bool (*RRGetPanningProcPtr) (ScreenPtr pScrn,
+ RRCrtcPtr crtc,
+ BoxPtr totalArea,
+ BoxPtr trackingArea,
+ INT16 *border);
+typedef Bool (*RRSetPanningProcPtr) (ScreenPtr pScrn,
+ RRCrtcPtr crtc,
+ BoxPtr totalArea,
+ BoxPtr trackingArea,
+ INT16 *border);
+
+#endif /* RANDR_13_INTERFACE */
+
+typedef Bool (*RRGetInfoProcPtr) (ScreenPtr pScreen, Rotation *rotations);
+typedef Bool (*RRCloseScreenProcPtr) ( int i, ScreenPtr pscreen);
+
+/* These are for 1.0 compatibility */
+
+typedef struct _rrRefresh {
+ CARD16 rate;
+ RRModePtr mode;
+} RRScreenRate, *RRScreenRatePtr;
+
+typedef struct _rrScreenSize {
+ int id;
+ short width, height;
+ short mmWidth, mmHeight;
+ int nRates;
+ RRScreenRatePtr pRates;
+} RRScreenSize, *RRScreenSizePtr;
+
+#ifdef RANDR_10_INTERFACE
+
+typedef Bool (*RRSetConfigProcPtr) (ScreenPtr pScreen,
+ Rotation rotation,
+ int rate,
+ RRScreenSizePtr pSize);
+
+#endif
+
+
+typedef struct _rrScrPriv {
+ /*
+ * 'public' part of the structure; DDXen fill this in
+ * as they initialize
+ */
+#if RANDR_10_INTERFACE
+ RRSetConfigProcPtr rrSetConfig;
+#endif
+ RRGetInfoProcPtr rrGetInfo;
+#if RANDR_12_INTERFACE
+ RRScreenSetSizeProcPtr rrScreenSetSize;
+ RRCrtcSetProcPtr rrCrtcSet;
+ RRCrtcSetGammaProcPtr rrCrtcSetGamma;
+ RRCrtcGetGammaProcPtr rrCrtcGetGamma;
+ RROutputSetPropertyProcPtr rrOutputSetProperty;
+ RROutputValidateModeProcPtr rrOutputValidateMode;
+ RRModeDestroyProcPtr rrModeDestroy;
+#endif
+#if RANDR_13_INTERFACE
+ RROutputGetPropertyProcPtr rrOutputGetProperty;
+ RRGetPanningProcPtr rrGetPanning;
+ RRSetPanningProcPtr rrSetPanning;
+#endif
+
+ /*
+ * Private part of the structure; not considered part of the ABI
+ */
+ TimeStamp lastSetTime; /* last changed by client */
+ TimeStamp lastConfigTime; /* possible configs changed */
+ RRCloseScreenProcPtr CloseScreen;
+
+ Bool changed; /* some config changed */
+ Bool configChanged; /* configuration changed */
+ Bool layoutChanged; /* screen layout changed */
+
+ CARD16 minWidth, minHeight;
+ CARD16 maxWidth, maxHeight;
+ CARD16 width, height; /* last known screen size */
+ CARD16 mmWidth, mmHeight; /* last known screen size */
+
+ int numOutputs;
+ RROutputPtr *outputs;
+ RROutputPtr primaryOutput;
+
+ int numCrtcs;
+ RRCrtcPtr *crtcs;
+
+ /* Last known pointer position */
+ RRCrtcPtr pointerCrtc;
+
+#ifdef RANDR_10_INTERFACE
+ /*
+ * Configuration information
+ */
+ Rotation rotations;
+ CARD16 reqWidth, reqHeight;
+
+ int nSizes;
+ RRScreenSizePtr pSizes;
+
+ Rotation rotation;
+ int rate;
+ int size;
+#endif
+} rrScrPrivRec, *rrScrPrivPtr;
+
+extern _X_EXPORT DevPrivateKeyRec rrPrivKeyRec;
+#define rrPrivKey (&rrPrivKeyRec)
+
+#define rrGetScrPriv(pScr) ((rrScrPrivPtr)dixLookupPrivate(&(pScr)->devPrivates, rrPrivKey))
+#define rrScrPriv(pScr) rrScrPrivPtr pScrPriv = rrGetScrPriv(pScr)
+#define SetRRScreen(s,p) dixSetPrivate(&(s)->devPrivates, rrPrivKey, p)
+
+/*
+ * each window has a list of clients requesting
+ * RRNotify events. Each client has a resource
+ * for each window it selects RRNotify input for,
+ * this resource is used to delete the RRNotifyRec
+ * entry from the per-window queue.
+ */
+
+typedef struct _RREvent *RREventPtr;
+
+typedef struct _RREvent {
+ RREventPtr next;
+ ClientPtr client;
+ WindowPtr window;
+ XID clientResource;
+ int mask;
+} RREventRec;
+
+typedef struct _RRTimes {
+ TimeStamp setTime;
+ TimeStamp configTime;
+} RRTimesRec, *RRTimesPtr;
+
+typedef struct _RRClient {
+ int major_version;
+ int minor_version;
+/* RRTimesRec times[0]; */
+} RRClientRec, *RRClientPtr;
+
+extern _X_EXPORT RESTYPE RRClientType, RREventType; /* resource types for event masks */
+extern _X_EXPORT DevPrivateKeyRec RRClientPrivateKeyRec;
+#define RRClientPrivateKey (&RRClientPrivateKeyRec)
+extern _X_EXPORT RESTYPE RRCrtcType, RRModeType, RROutputType;
+
+#define VERIFY_RR_OUTPUT(id, ptr, a)\
+ {\
+ int rc = dixLookupResourceByType((pointer *)&(ptr), id,\
+ RROutputType, client, a);\
+ if (rc != Success) {\
+ client->errorValue = id;\
+ return rc;\
+ }\
+ }
+
+#define VERIFY_RR_CRTC(id, ptr, a)\
+ {\
+ int rc = dixLookupResourceByType((pointer *)&(ptr), id,\
+ RRCrtcType, client, a);\
+ if (rc != Success) {\
+ client->errorValue = id;\
+ return rc;\
+ }\
+ }
+
+#define VERIFY_RR_MODE(id, ptr, a)\
+ {\
+ int rc = dixLookupResourceByType((pointer *)&(ptr), id,\
+ RRModeType, client, a);\
+ if (rc != Success) {\
+ client->errorValue = id;\
+ return rc;\
+ }\
+ }
+
+#define GetRRClient(pClient) ((RRClientPtr)dixLookupPrivate(&(pClient)->devPrivates, RRClientPrivateKey))
+#define rrClientPriv(pClient) RRClientPtr pRRClient = GetRRClient(pClient)
+
+/* Initialize the extension */
+extern _X_EXPORT void
+RRExtensionInit (void);
+
+#ifdef RANDR_12_INTERFACE
+/*
+ * Set the range of sizes for the screen
+ */
+extern _X_EXPORT void
+RRScreenSetSizeRange (ScreenPtr pScreen,
+ CARD16 minWidth,
+ CARD16 minHeight,
+ CARD16 maxWidth,
+ CARD16 maxHeight);
+#endif
+
+/* rrscreen.c */
+/*
+ * Notify the extension that the screen size has been changed.
+ * The driver is responsible for calling this whenever it has changed
+ * the size of the screen
+ */
+extern _X_EXPORT void
+RRScreenSizeNotify (ScreenPtr pScreen);
+
+/*
+ * Request that the screen be resized
+ */
+extern _X_EXPORT Bool
+RRScreenSizeSet (ScreenPtr pScreen,
+ CARD16 width,
+ CARD16 height,
+ CARD32 mmWidth,
+ CARD32 mmHeight);
+
+/*
+ * Send ConfigureNotify event to root window when 'something' happens
+ */
+extern _X_EXPORT void
+RRSendConfigNotify (ScreenPtr pScreen);
+
+/*
+ * screen dispatch
+ */
+extern _X_EXPORT int
+ProcRRGetScreenSizeRange (ClientPtr client);
+
+extern _X_EXPORT int
+ProcRRSetScreenSize (ClientPtr client);
+
+extern _X_EXPORT int
+ProcRRGetScreenResources (ClientPtr client);
+
+extern _X_EXPORT int
+ProcRRGetScreenResourcesCurrent (ClientPtr client);
+
+extern _X_EXPORT int
+ProcRRSetScreenConfig (ClientPtr client);
+
+extern _X_EXPORT int
+ProcRRGetScreenInfo (ClientPtr client);
+
+/*
+ * Deliver a ScreenNotify event
+ */
+extern _X_EXPORT void
+RRDeliverScreenEvent (ClientPtr client, WindowPtr pWin, ScreenPtr pScreen);
+
+/* randr.c */
+/*
+ * Send all pending events
+ */
+extern _X_EXPORT void
+RRTellChanged (ScreenPtr pScreen);
+
+/*
+ * Poll the driver for changed information
+ */
+extern _X_EXPORT Bool
+RRGetInfo (ScreenPtr pScreen, Bool force_query);
+
+extern _X_EXPORT Bool RRInit (void);
+
+extern _X_EXPORT Bool RRScreenInit(ScreenPtr pScreen);
+
+extern _X_EXPORT RROutputPtr
+RRFirstOutput (ScreenPtr pScreen);
+
+extern _X_EXPORT Rotation
+RRGetRotation (ScreenPtr pScreen);
+
+extern _X_EXPORT CARD16
+RRVerticalRefresh (xRRModeInfo *mode);
+
+#ifdef RANDR_10_INTERFACE
+/*
+ * This is the old interface, deprecated but left
+ * around for compatibility
+ */
+
+/*
+ * Then, register the specific size with the screen
+ */
+
+extern _X_EXPORT RRScreenSizePtr
+RRRegisterSize (ScreenPtr pScreen,
+ short width,
+ short height,
+ short mmWidth,
+ short mmHeight);
+
+extern _X_EXPORT Bool
+RRRegisterRate (ScreenPtr pScreen,
+ RRScreenSizePtr pSize,
+ int rate);
+
+/*
+ * Finally, set the current configuration of the screen
+ */
+
+extern _X_EXPORT void
+RRSetCurrentConfig (ScreenPtr pScreen,
+ Rotation rotation,
+ int rate,
+ RRScreenSizePtr pSize);
+
+extern _X_EXPORT Bool RRScreenInit (ScreenPtr pScreen);
+
+extern _X_EXPORT Rotation
+RRGetRotation (ScreenPtr pScreen);
+
+#endif
+
+/* rrcrtc.c */
+
+/*
+ * Notify the CRTC of some change; layoutChanged indicates that
+ * some position or size element changed
+ */
+extern _X_EXPORT void
+RRCrtcChanged (RRCrtcPtr crtc, Bool layoutChanged);
+
+/*
+ * Create a CRTC
+ */
+extern _X_EXPORT RRCrtcPtr
+RRCrtcCreate (ScreenPtr pScreen, void *devPrivate);
+
+/*
+ * Set the allowed rotations on a CRTC
+ */
+extern _X_EXPORT void
+RRCrtcSetRotations (RRCrtcPtr crtc, Rotation rotations);
+
+/*
+ * Set whether transforms are allowed on a CRTC
+ */
+extern _X_EXPORT void
+RRCrtcSetTransformSupport (RRCrtcPtr crtc, Bool transforms);
+
+/*
+ * Notify the extension that the Crtc has been reconfigured,
+ * the driver calls this whenever it has updated the mode
+ */
+extern _X_EXPORT Bool
+RRCrtcNotify (RRCrtcPtr crtc,
+ RRModePtr mode,
+ int x,
+ int y,
+ Rotation rotation,
+ RRTransformPtr transform,
+ int numOutputs,
+ RROutputPtr *outputs);
+
+extern _X_EXPORT void
+RRDeliverCrtcEvent (ClientPtr client, WindowPtr pWin, RRCrtcPtr crtc);
+
+/*
+ * Request that the Crtc be reconfigured
+ */
+extern _X_EXPORT Bool
+RRCrtcSet (RRCrtcPtr crtc,
+ RRModePtr mode,
+ int x,
+ int y,
+ Rotation rotation,
+ int numOutput,
+ RROutputPtr *outputs);
+
+/*
+ * Request that the Crtc gamma be changed
+ */
+
+extern _X_EXPORT Bool
+RRCrtcGammaSet (RRCrtcPtr crtc,
+ CARD16 *red,
+ CARD16 *green,
+ CARD16 *blue);
+
+/*
+ * Request current gamma back from the DDX (if possible).
+ * This includes gamma size.
+ */
+
+extern _X_EXPORT Bool
+RRCrtcGammaGet(RRCrtcPtr crtc);
+
+/*
+ * Notify the extension that the Crtc gamma has been changed
+ * The driver calls this whenever it has changed the gamma values
+ * in the RRCrtcRec
+ */
+
+extern _X_EXPORT Bool
+RRCrtcGammaNotify (RRCrtcPtr crtc);
+
+/*
+ * Set the size of the gamma table at server startup time
+ */
+
+extern _X_EXPORT Bool
+RRCrtcGammaSetSize (RRCrtcPtr crtc,
+ int size);
+
+/*
+ * Return the area of the frame buffer scanned out by the crtc,
+ * taking into account the current mode and rotation
+ */
+
+extern _X_EXPORT void
+RRCrtcGetScanoutSize(RRCrtcPtr crtc, int *width, int *height);
+
+/*
+ * Compute the complete transformation matrix including
+ * client-specified transform, rotation/reflection values and the crtc
+ * offset.
+ *
+ * Return TRUE if the resulting transform is not a simple translation.
+ */
+extern _X_EXPORT Bool
+RRTransformCompute (int x,
+ int y,
+ int width,
+ int height,
+ Rotation rotation,
+ RRTransformPtr rr_transform,
+
+ PictTransformPtr transform,
+ struct pict_f_transform *f_transform,
+ struct pict_f_transform *f_inverse);
+
+/*
+ * Return crtc transform
+ */
+extern _X_EXPORT RRTransformPtr
+RRCrtcGetTransform (RRCrtcPtr crtc);
+
+/*
+ * Check whether the pending and current transforms are the same
+ */
+extern _X_EXPORT Bool
+RRCrtcPendingTransform (RRCrtcPtr crtc);
+
+/*
+ * Destroy a Crtc at shutdown
+ */
+extern _X_EXPORT void
+RRCrtcDestroy (RRCrtcPtr crtc);
+
+
+/*
+ * Set the pending CRTC transformation
+ */
+
+extern _X_EXPORT int
+RRCrtcTransformSet (RRCrtcPtr crtc,
+ PictTransformPtr transform,
+ struct pict_f_transform *f_transform,
+ struct pict_f_transform *f_inverse,
+ char *filter,
+ int filter_len,
+ xFixed *params,
+ int nparams);
+
+/*
+ * Initialize crtc type
+ */
+extern _X_EXPORT Bool
+RRCrtcInit (void);
+
+/*
+ * Initialize crtc type error value
+ */
+extern _X_EXPORT void
+RRCrtcInitErrorValue (void);
+
+/*
+ * Crtc dispatch
+ */
+
+extern _X_EXPORT int
+ProcRRGetCrtcInfo (ClientPtr client);
+
+extern _X_EXPORT int
+ProcRRSetCrtcConfig (ClientPtr client);
+
+extern _X_EXPORT int
+ProcRRGetCrtcGammaSize (ClientPtr client);
+
+extern _X_EXPORT int
+ProcRRGetCrtcGamma (ClientPtr client);
+
+extern _X_EXPORT int
+ProcRRSetCrtcGamma (ClientPtr client);
+
+extern _X_EXPORT int
+ProcRRSetCrtcTransform (ClientPtr client);
+
+extern _X_EXPORT int
+ProcRRGetCrtcTransform (ClientPtr client);
+
+int
+ProcRRGetPanning (ClientPtr client);
+
+int
+ProcRRSetPanning (ClientPtr client);
+
+/* rrdispatch.c */
+extern _X_EXPORT Bool
+RRClientKnowsRates (ClientPtr pClient);
+
+/* rrmode.c */
+/*
+ * Find, and if necessary, create a mode
+ */
+
+extern _X_EXPORT RRModePtr
+RRModeGet (xRRModeInfo *modeInfo,
+ const char *name);
+
+/*
+ * Destroy a mode.
+ */
+
+extern _X_EXPORT void
+RRModeDestroy (RRModePtr mode);
+
+/*
+ * Return a list of modes that are valid for some output in pScreen
+ */
+extern _X_EXPORT RRModePtr *
+RRModesForScreen (ScreenPtr pScreen, int *num_ret);
+
+/*
+ * Initialize mode type
+ */
+extern _X_EXPORT Bool
+RRModeInit (void);
+
+/*
+ * Initialize mode type error value
+ */
+extern _X_EXPORT void
+RRModeInitErrorValue (void);
+
+extern _X_EXPORT int
+ProcRRCreateMode (ClientPtr client);
+
+extern _X_EXPORT int
+ProcRRDestroyMode (ClientPtr client);
+
+extern _X_EXPORT int
+ProcRRAddOutputMode (ClientPtr client);
+
+extern _X_EXPORT int
+ProcRRDeleteOutputMode (ClientPtr client);
+
+/* rroutput.c */
+
+/*
+ * Notify the output of some change. configChanged indicates whether
+ * any external configuration (mode list, clones, connected status)
+ * has changed, or whether the change was strictly internal
+ * (which crtc is in use)
+ */
+extern _X_EXPORT void
+RROutputChanged (RROutputPtr output, Bool configChanged);
+
+/*
+ * Create an output
+ */
+
+extern _X_EXPORT RROutputPtr
+RROutputCreate (ScreenPtr pScreen,
+ const char *name,
+ int nameLength,
+ void *devPrivate);
+
+/*
+ * Notify extension that output parameters have been changed
+ */
+extern _X_EXPORT Bool
+RROutputSetClones (RROutputPtr output,
+ RROutputPtr *clones,
+ int numClones);
+
+extern _X_EXPORT Bool
+RROutputSetModes (RROutputPtr output,
+ RRModePtr *modes,
+ int numModes,
+ int numPreferred);
+
+extern _X_EXPORT int
+RROutputAddUserMode (RROutputPtr output,
+ RRModePtr mode);
+
+extern _X_EXPORT int
+RROutputDeleteUserMode (RROutputPtr output,
+ RRModePtr mode);
+
+extern _X_EXPORT Bool
+RROutputSetCrtcs (RROutputPtr output,
+ RRCrtcPtr *crtcs,
+ int numCrtcs);
+
+extern _X_EXPORT Bool
+RROutputSetConnection (RROutputPtr output,
+ CARD8 connection);
+
+extern _X_EXPORT Bool
+RROutputSetSubpixelOrder (RROutputPtr output,
+ int subpixelOrder);
+
+extern _X_EXPORT Bool
+RROutputSetPhysicalSize (RROutputPtr output,
+ int mmWidth,
+ int mmHeight);
+
+extern _X_EXPORT void
+RRDeliverOutputEvent(ClientPtr client, WindowPtr pWin, RROutputPtr output);
+
+extern _X_EXPORT void
+RROutputDestroy (RROutputPtr output);
+
+extern _X_EXPORT int
+ProcRRGetOutputInfo (ClientPtr client);
+
+extern _X_EXPORT int
+ProcRRSetOutputPrimary (ClientPtr client);
+
+extern _X_EXPORT int
+ProcRRGetOutputPrimary (ClientPtr client);
+
+/*
+ * Initialize output type
+ */
+extern _X_EXPORT Bool
+RROutputInit (void);
+
+/*
+ * Initialize output type error value
+ */
+extern _X_EXPORT void
+RROutputInitErrorValue (void);
+
+/* rrpointer.c */
+extern _X_EXPORT void
+RRPointerMoved (ScreenPtr pScreen, int x, int y);
+
+extern _X_EXPORT void
+RRPointerScreenConfigured (ScreenPtr pScreen);
+
+/* rrproperty.c */
+
+extern _X_EXPORT void
+RRDeleteAllOutputProperties (RROutputPtr output);
+
+extern _X_EXPORT RRPropertyValuePtr
+RRGetOutputProperty (RROutputPtr output, Atom property, Bool pending);
+
+extern _X_EXPORT RRPropertyPtr
+RRQueryOutputProperty (RROutputPtr output, Atom property);
+
+extern _X_EXPORT void
+RRDeleteOutputProperty (RROutputPtr output, Atom property);
+
+extern _X_EXPORT Bool
+RRPostPendingProperties (RROutputPtr output);
+
+extern _X_EXPORT int
+RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type,
+ int format, int mode, unsigned long len,
+ pointer value, Bool sendevent, Bool pending);
+
+extern _X_EXPORT int
+RRConfigureOutputProperty (RROutputPtr output, Atom property,
+ Bool pending, Bool range, Bool immutable,
+ int num_values, INT32 *values);
+extern _X_EXPORT int
+ProcRRChangeOutputProperty (ClientPtr client);
+
+extern _X_EXPORT int
+ProcRRGetOutputProperty (ClientPtr client);
+
+extern _X_EXPORT int
+ProcRRListOutputProperties (ClientPtr client);
+
+extern _X_EXPORT int
+ProcRRQueryOutputProperty (ClientPtr client);
+
+extern _X_EXPORT int
+ProcRRConfigureOutputProperty (ClientPtr client);
+
+extern _X_EXPORT int
+ProcRRDeleteOutputProperty (ClientPtr client);
+
+/* rrxinerama.c */
+#ifdef XINERAMA
+extern _X_EXPORT void
+RRXineramaExtensionInit(void);
+#endif
+
+#endif /* _RANDRSTR_H_ */
+
+/*
+
+randr extension implementation structure
+
+Query state:
+ ProcRRGetScreenInfo/ProcRRGetScreenResources
+ RRGetInfo
+
+ • Request configuration from driver, either 1.0 or 1.2 style
+ • These functions only record state changes, all
+ other actions are pended until RRTellChanged is called
+
+ ->rrGetInfo
+ 1.0:
+ RRRegisterSize
+ RRRegisterRate
+ RRSetCurrentConfig
+ 1.2:
+ RRScreenSetSizeRange
+ RROutputSetCrtcs
+ RRModeGet
+ RROutputSetModes
+ RROutputSetConnection
+ RROutputSetSubpixelOrder
+ RROutputSetClones
+ RRCrtcNotify
+
+ • Must delay scanning configuration until after ->rrGetInfo returns
+ because some drivers will call SetCurrentConfig in the middle
+ of the ->rrGetInfo operation.
+
+ 1.0:
+
+ • Scan old configuration, mirror to new structures
+
+ RRScanOldConfig
+ RRCrtcCreate
+ RROutputCreate
+ RROutputSetCrtcs
+ RROutputSetConnection
+ RROutputSetSubpixelOrder
+ RROldModeAdd • This adds modes one-at-a-time
+ RRModeGet
+ RRCrtcNotify
+
+ • send events, reset pointer if necessary
+
+ RRTellChanged
+ WalkTree (sending events)
+
+ • when layout has changed:
+ RRPointerScreenConfigured
+ RRSendConfigNotify
+
+Asynchronous state setting (1.2 only)
+ When setting state asynchronously, the driver invokes the
+ ->rrGetInfo function and then calls RRTellChanged to flush
+ the changes to the clients and reset pointer if necessary
+
+Set state
+
+ ProcRRSetScreenConfig
+ RRCrtcSet
+ 1.2:
+ ->rrCrtcSet
+ RRCrtcNotify
+ 1.0:
+ ->rrSetConfig
+ RRCrtcNotify
+ RRTellChanged
+ */
diff --git a/xorg-server/randr/rrcrtc.c b/xorg-server/randr/rrcrtc.c
index 524fcd266..98206a2b9 100644
--- a/xorg-server/randr/rrcrtc.c
+++ b/xorg-server/randr/rrcrtc.c
@@ -1,1799 +1,1351 @@
-/*
- * Copyright © 2006 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting documentation, and
- * that the name of the copyright holders not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. The copyright holders make no representations
- * about the suitability of this software for any purpose. It is provided "as
- * is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
- * OF THIS SOFTWARE.
- */
-
-#include "randrstr.h"
-#include "swaprep.h"
-
-RESTYPE RRCrtcType;
-
-/*
- * Notify the CRTC of some change
- */
-void
-RRCrtcChanged (RRCrtcPtr crtc, Bool layoutChanged)
-{
- ScreenPtr pScreen = crtc->pScreen;
-
- crtc->changed = TRUE;
- if (pScreen)
- {
- rrScrPriv(pScreen);
-
- pScrPriv->changed = TRUE;
- /*
- * Send ConfigureNotify on any layout change
- */
- if (layoutChanged)
- pScrPriv->layoutChanged = TRUE;
- }
-}
-
-/*
- * Create a CRTC
- */
-RRCrtcPtr
-RRCrtcCreate (ScreenPtr pScreen, void *devPrivate)
-{
- RRCrtcPtr crtc;
- RRCrtcPtr *crtcs;
- rrScrPrivPtr pScrPriv;
-
- if (!RRInit())
- return NULL;
-
- pScrPriv = rrGetScrPriv(pScreen);
-
- /* make space for the crtc pointer */
- if (pScrPriv->numCrtcs)
- crtcs = realloc(pScrPriv->crtcs,
- (pScrPriv->numCrtcs + 1) * sizeof (RRCrtcPtr));
- else
- crtcs = malloc(sizeof (RRCrtcPtr));
- if (!crtcs)
- return FALSE;
- pScrPriv->crtcs = crtcs;
-
- crtc = calloc(1, sizeof (RRCrtcRec));
- if (!crtc)
- return NULL;
- crtc->id = FakeClientID (0);
- crtc->pScreen = pScreen;
- crtc->mode = NULL;
- crtc->x = 0;
- crtc->y = 0;
- crtc->rotation = RR_Rotate_0;
- crtc->rotations = RR_Rotate_0;
- crtc->outputs = NULL;
- crtc->numOutputs = 0;
- crtc->gammaSize = 0;
- crtc->gammaRed = crtc->gammaBlue = crtc->gammaGreen = NULL;
- crtc->changed = FALSE;
- crtc->devPrivate = devPrivate;
- RRTransformInit (&crtc->client_pending_transform);
- RRTransformInit (&crtc->client_current_transform);
- pixman_transform_init_identity (&crtc->client_sprite_position_transform);
- pixman_transform_init_identity (&crtc->client_sprite_image_transform);
- pixman_transform_init_identity (&crtc->transform);
- pixman_f_transform_init_identity (&crtc->f_transform);
- pixman_f_transform_init_identity (&crtc->f_inverse);
- pixman_f_transform_init_identity (&crtc->f_sprite_position);
- pixman_f_transform_init_identity (&crtc->f_sprite_image_inverse);
-
- if (!AddResource (crtc->id, RRCrtcType, (pointer) crtc))
- return NULL;
-
- /* attach the screen and crtc together */
- crtc->pScreen = pScreen;
- pScrPriv->crtcs[pScrPriv->numCrtcs++] = crtc;
-
- return crtc;
-}
-
-/*
- * Set the allowed rotations on a CRTC
- */
-void
-RRCrtcSetRotations (RRCrtcPtr crtc, Rotation rotations)
-{
- crtc->rotations = rotations;
-}
-
-/*
- * Set whether transforms are allowed on a CRTC
- */
-void
-RRCrtcSetTransformSupport (RRCrtcPtr crtc, Bool transforms)
-{
- crtc->transforms = transforms;
-}
-
-/*
- * Notify the extension that the Crtc has been reconfigured,
- * the driver calls this whenever it has updated the mode
- */
-Bool
-RRCrtcNotify (RRCrtcPtr crtc,
- RRModePtr mode,
- int x,
- int y,
- Rotation rotation,
- RRTransformPtr transform,
- int numOutputs,
- RROutputPtr *outputs,
- PixmapPtr scanoutPixmap)
-{
- int i, j;
-
- /*
- * Check to see if any of the new outputs were
- * not in the old list and mark them as changed
- */
- for (i = 0; i < numOutputs; i++)
- {
- for (j = 0; j < crtc->numOutputs; j++)
- if (outputs[i] == crtc->outputs[j])
- break;
- if (j == crtc->numOutputs)
- {
- outputs[i]->crtc = crtc;
- RROutputChanged (outputs[i], FALSE);
- RRCrtcChanged (crtc, FALSE);
- }
- }
- /*
- * Check to see if any of the old outputs are
- * not in the new list and mark them as changed
- */
- for (j = 0; j < crtc->numOutputs; j++)
- {
- for (i = 0; i < numOutputs; i++)
- if (outputs[i] == crtc->outputs[j])
- break;
- if (i == numOutputs)
- {
- if (crtc->outputs[j]->crtc == crtc)
- crtc->outputs[j]->crtc = NULL;
- RROutputChanged (crtc->outputs[j], FALSE);
- RRCrtcChanged (crtc, FALSE);
- }
- }
- /*
- * Reallocate the crtc output array if necessary
- */
- if (numOutputs != crtc->numOutputs)
- {
- RROutputPtr *newoutputs;
-
- if (numOutputs)
- {
- if (crtc->numOutputs)
- newoutputs = realloc(crtc->outputs,
- numOutputs * sizeof (RROutputPtr));
- else
- newoutputs = malloc(numOutputs * sizeof (RROutputPtr));
- if (!newoutputs)
- return FALSE;
- }
- else
- {
- free(crtc->outputs);
- newoutputs = NULL;
- }
- crtc->outputs = newoutputs;
- crtc->numOutputs = numOutputs;
- }
- /*
- * Copy the new list of outputs into the crtc
- */
- memcpy (crtc->outputs, outputs, numOutputs * sizeof (RROutputPtr));
- /*
- * Update remaining crtc fields
- */
- if (mode != crtc->mode)
- {
- if (crtc->mode)
- RRModeDestroy (crtc->mode);
- crtc->mode = mode;
- if (mode != NULL)
- mode->refcnt++;
- RRCrtcChanged (crtc, TRUE);
- }
- if (x != crtc->x)
- {
- crtc->x = x;
- RRCrtcChanged (crtc, TRUE);
- }
- if (y != crtc->y)
- {
- crtc->y = y;
- RRCrtcChanged (crtc, TRUE);
- }
- if (rotation != crtc->rotation)
- {
- crtc->rotation = rotation;
- RRCrtcChanged (crtc, TRUE);
- }
- if (!RRTransformEqual (transform, &crtc->client_current_transform)) {
- RRTransformCopy (&crtc->client_current_transform, transform);
- RRCrtcChanged (crtc, TRUE);
- }
-
- if (scanoutPixmap != crtc->scanoutPixmap)
- {
- if (scanoutPixmap)
- ++scanoutPixmap->refcnt;
- if (crtc->scanoutPixmap)
- (*crtc->scanoutPixmap->drawable.pScreen->DestroyPixmap) (crtc->scanoutPixmap);
- crtc->scanoutPixmap = scanoutPixmap;
- }
-
- if (crtc->changed && mode)
- {
- RRTransformCompute (x, y,
- mode->mode.width, mode->mode.height,
- rotation,
- &crtc->client_current_transform,
- &crtc->client_sprite_f_position_transform,
- &crtc->client_sprite_f_image_transform,
- &crtc->transform, &crtc->f_transform,
- &crtc->f_inverse, &crtc->f_sprite_position,
- &crtc->f_sprite_image_inverse,
- NULL);
- }
-
- return TRUE;
-}
-
-void
-RRDeliverCrtcEvent (ClientPtr client, WindowPtr pWin, RRCrtcPtr crtc)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- rrScrPriv (pScreen);
- xRRCrtcChangeNotifyEvent ce;
- RRModePtr mode = crtc->mode;
-
- ce.type = RRNotify + RREventBase;
- ce.subCode = RRNotify_CrtcChange;
- ce.timestamp = pScrPriv->lastSetTime.milliseconds;
- ce.window = pWin->drawable.id;
- ce.crtc = crtc->id;
- ce.rotation = crtc->rotation;
- if (mode)
- {
- ce.mode = mode->mode.id;
- ce.x = crtc->x;
- ce.y = crtc->y;
- ce.width = mode->mode.width;
- ce.height = mode->mode.height;
- }
- else
- {
- ce.mode = None;
- ce.x = 0;
- ce.y = 0;
- ce.width = 0;
- ce.height = 0;
- }
- WriteEventsToClient (client, 1, (xEvent *) &ce);
-}
-
-static Bool
-RRCrtcPendingProperties (RRCrtcPtr crtc)
-{
- ScreenPtr pScreen = crtc->pScreen;
- rrScrPriv(pScreen);
- int o;
-
- for (o = 0; o < pScrPriv->numOutputs; o++)
- {
- RROutputPtr output = pScrPriv->outputs[o];
- if (output->crtc == crtc && output->pendingProperties)
- return TRUE;
- }
- return FALSE;
-}
-
-/*
- * Request that the Crtc be reconfigured
- */
-Bool
-RRCrtcSet (RRCrtcPtr crtc,
- RRModePtr mode,
- int x,
- int y,
- Rotation rotation,
- int numOutputs,
- RROutputPtr *outputs,
- PixmapPtr scanout_pixmap)
-{
- ScreenPtr pScreen = crtc->pScreen;
- Bool ret = FALSE;
- rrScrPriv(pScreen);
-
- /* See if nothing changed */
- if (crtc->mode == mode &&
- crtc->x == x &&
- crtc->y == y &&
- crtc->rotation == rotation &&
- crtc->numOutputs == numOutputs &&
- !memcmp (crtc->outputs, outputs, numOutputs * sizeof (RROutputPtr)) &&
- !RRCrtcPendingProperties (crtc) &&
- !RRCrtcPendingTransform (crtc) &&
- crtc->scanoutPixmap == scanout_pixmap)
- {
- ret = TRUE;
- }
- else
- {
-#if RANDR_12_INTERFACE
- if (pScrPriv->rrCrtcSet)
- {
- ret = (*pScrPriv->rrCrtcSet) (pScreen, crtc, mode, x, y,
- rotation, numOutputs, outputs, scanout_pixmap);
- }
- else
-#endif
- {
-#if RANDR_10_INTERFACE
- if (pScrPriv->rrSetConfig)
- {
- RRScreenSize size;
- RRScreenRate rate;
-
- if (!mode)
- {
- RRCrtcNotify (crtc, NULL, x, y, rotation, NULL, 0, NULL, scanout_pixmap);
- ret = TRUE;
- }
- else
- {
- size.width = mode->mode.width;
- size.height = mode->mode.height;
- if (outputs[0]->mmWidth && outputs[0]->mmHeight)
- {
- size.mmWidth = outputs[0]->mmWidth;
- size.mmHeight = outputs[0]->mmHeight;
- }
- else
- {
- size.mmWidth = pScreen->mmWidth;
- size.mmHeight = pScreen->mmHeight;
- }
- size.nRates = 1;
- rate.rate = RRVerticalRefresh (&mode->mode);
- size.pRates = &rate;
- ret = (*pScrPriv->rrSetConfig) (pScreen, rotation, rate.rate, &size);
- /*
- * Old 1.0 interface tied screen size to mode size
- */
- if (ret)
- {
- RRCrtcNotify (crtc, mode, x, y, rotation, NULL, 1, outputs, scanout_pixmap);
- RRScreenSizeNotify (pScreen);
- }
- }
- }
-#endif
- }
- if (ret)
- {
- int o;
- RRTellChanged (pScreen);
-
- for (o = 0; o < numOutputs; o++)
- RRPostPendingProperties (outputs[o]);
- }
- }
- return ret;
-}
-
-void
-RRFreeCrtcConfigs(RRCrtcConfigPtr configs, int num_configs)
-{
- int i;
-
- for (i = 0; i < num_configs; i++)
- free(configs[i].outputs);
- free(configs);
-}
-
-Bool
-RRCrtcCurrentConfig(RRCrtcPtr crtc,
- RRCrtcConfigPtr crtc_config)
-{
- crtc_config->crtc = crtc;
- crtc_config->x = crtc->x;
- crtc_config->y = crtc->y;
- crtc_config->mode = crtc->mode;
- crtc_config->rotation = crtc->rotation;
- crtc_config->numOutputs = crtc->numOutputs;
- crtc_config->outputs = calloc(crtc->numOutputs, sizeof (RROutputPtr));
- if (!crtc_config->outputs)
- return FALSE;
- memcpy(crtc_config->outputs, crtc->outputs, crtc->numOutputs * sizeof (RROutputPtr));
- crtc_config->sprite_position_transform = crtc->client_sprite_position_transform;
- crtc_config->sprite_image_transform = crtc->client_sprite_image_transform;
- crtc_config->sprite_position_f_transform = crtc->client_sprite_f_position_transform;
- crtc_config->sprite_image_f_transform = crtc->client_sprite_f_image_transform;
-
- crtc_config->pixmap = crtc->scanoutPixmap;
- crtc_config->pixmap_x = crtc->x;
- crtc_config->pixmap_y = crtc->y;
- return TRUE;
-}
-
-
-/*
- * Request that a set of crtcs be configured at the same
- * time on a single screen
- */
-
-Bool
-RRSetCrtcConfigs(ScreenPtr screen,
- RRScreenConfigPtr screen_config,
- RRCrtcConfigPtr crtc_configs,
- int num_configs)
-{
- rrScrPrivPtr scr_priv = rrGetScrPriv(screen);
-
- if (!scr_priv)
- return FALSE;
- return (*scr_priv->rrSetCrtcConfigs)(screen, screen_config, crtc_configs, num_configs);
-}
-
-/*
- * Return crtc transform
- */
-RRTransformPtr
-RRCrtcGetTransform (RRCrtcPtr crtc)
-{
- RRTransformPtr transform = &crtc->client_pending_transform;
-
- if (pixman_transform_is_identity (&transform->transform))
- return NULL;
- return transform;
-}
-
-/*
- * Check whether the pending and current transforms are the same
- */
-Bool
-RRCrtcPendingTransform (RRCrtcPtr crtc)
-{
- return memcmp (&crtc->client_current_transform.transform,
- &crtc->client_pending_transform.transform,
- sizeof (PictTransform)) != 0;
-}
-
-/*
- * Destroy a Crtc at shutdown
- */
-void
-RRCrtcDestroy (RRCrtcPtr crtc)
-{
- FreeResource (crtc->id, 0);
-}
-
-static int
-RRCrtcDestroyResource (pointer value, XID pid)
-{
- RRCrtcPtr crtc = (RRCrtcPtr) value;
- ScreenPtr pScreen = crtc->pScreen;
-
- if (pScreen)
- {
- rrScrPriv(pScreen);
- int i;
-
- for (i = 0; i < pScrPriv->numCrtcs; i++)
- {
- if (pScrPriv->crtcs[i] == crtc)
- {
- memmove (pScrPriv->crtcs + i, pScrPriv->crtcs + i + 1,
- (pScrPriv->numCrtcs - (i + 1)) * sizeof (RRCrtcPtr));
- --pScrPriv->numCrtcs;
- break;
- }
- }
- }
- free(crtc->gammaRed);
- if (crtc->mode)
- RRModeDestroy (crtc->mode);
- free(crtc);
- return 1;
-}
-
-/*
- * Request that the Crtc gamma be changed
- */
-
-Bool
-RRCrtcGammaSet (RRCrtcPtr crtc,
- CARD16 *red,
- CARD16 *green,
- CARD16 *blue)
-{
- Bool ret = TRUE;
-#if RANDR_12_INTERFACE
- ScreenPtr pScreen = crtc->pScreen;
-#endif
-
- memcpy (crtc->gammaRed, red, crtc->gammaSize * sizeof (CARD16));
- memcpy (crtc->gammaGreen, green, crtc->gammaSize * sizeof (CARD16));
- memcpy (crtc->gammaBlue, blue, crtc->gammaSize * sizeof (CARD16));
-#if RANDR_12_INTERFACE
- if (pScreen)
- {
- rrScrPriv(pScreen);
- if (pScrPriv->rrCrtcSetGamma)
- ret = (*pScrPriv->rrCrtcSetGamma) (pScreen, crtc);
- }
-#endif
- return ret;
-}
-
-/*
- * Request current gamma back from the DDX (if possible).
- * This includes gamma size.
- */
-Bool
-RRCrtcGammaGet(RRCrtcPtr crtc)
-{
- Bool ret = TRUE;
-#if RANDR_12_INTERFACE
- ScreenPtr pScreen = crtc->pScreen;
-#endif
-
-#if RANDR_12_INTERFACE
- if (pScreen)
- {
- rrScrPriv(pScreen);
- if (pScrPriv->rrCrtcGetGamma)
- ret = (*pScrPriv->rrCrtcGetGamma) (pScreen, crtc);
- }
-#endif
- return ret;
-}
-
-/*
- * Notify the extension that the Crtc gamma has been changed
- * The driver calls this whenever it has changed the gamma values
- * in the RRCrtcRec
- */
-
-Bool
-RRCrtcGammaNotify (RRCrtcPtr crtc)
-{
- return TRUE; /* not much going on here */
-}
-
-/*
- * Compute overall scanout buffer requirements for the specified mode
- */
-void
-RRModeGetScanoutSize (RRModePtr mode, struct pixman_f_transform *transform,
- int *width, int *height)
-{
- BoxRec box;
-
- if (mode == NULL) {
- *width = 0;
- *height = 0;
- return;
- }
-
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = mode->mode.width;
- box.y2 = mode->mode.height;
-
- pixman_f_transform_bounds (transform, &box);
- *width = box.x2 - box.x1;
- *height = box.y2 - box.y1;
-}
-
-/**
- * Returns the width/height that the crtc scans out from the framebuffer
- */
-void
-RRCrtcGetScanoutSize(RRCrtcPtr crtc, int *width, int *height)
-{
- RRModeGetScanoutSize (crtc->mode, &crtc->f_transform, width, height);
-}
-
-/*
- * Set the size of the gamma table at server startup time
- */
-
-Bool
-RRCrtcGammaSetSize (RRCrtcPtr crtc,
- int size)
-{
- CARD16 *gamma;
-
- if (size == crtc->gammaSize)
- return TRUE;
- if (size)
- {
- gamma = malloc(size * 3 * sizeof (CARD16));
- if (!gamma)
- return FALSE;
- }
- else
- gamma = NULL;
- free(crtc->gammaRed);
- crtc->gammaRed = gamma;
- crtc->gammaGreen = gamma + size;
- crtc->gammaBlue = gamma + size*2;
- crtc->gammaSize = size;
- return TRUE;
-}
-
-/*
- * Set the pending CRTC transformation
- */
-
-int
-RRCrtcTransformSet (RRCrtcPtr crtc,
- PictTransformPtr transform,
- struct pixman_f_transform *f_transform,
- struct pixman_f_transform *f_inverse,
- char *filter_name,
- int filter_len,
- xFixed *params,
- int nparams)
-{
- PictFilterPtr filter = NULL;
- int width = 0, height = 0;
-
- if (!crtc->transforms)
- return BadValue;
-
- if (filter_len)
- {
- filter = PictureFindFilter (crtc->pScreen,
- filter_name,
- filter_len);
- if (!filter)
- return BadName;
- if (filter->ValidateParams)
- {
- if (!filter->ValidateParams (crtc->pScreen, filter->id,
- params, nparams, &width, &height))
- return BadMatch;
- }
- else {
- width = filter->width;
- height = filter->height;
- }
- }
- else
- {
- if (nparams)
- return BadMatch;
- }
- if (!RRTransformSetFilter (&crtc->client_pending_transform,
- filter, params, nparams, width, height))
- return BadAlloc;
-
- crtc->client_pending_transform.transform = *transform;
- crtc->client_pending_transform.f_transform = *f_transform;
- crtc->client_pending_transform.f_inverse = *f_inverse;
- return Success;
-}
-
-/*
- * Figure out whether the specific crtc_config can fit
- * within the screen_config
- */
-Bool
-RRScreenCoversCrtc(RRScreenConfigPtr screen_config,
- RRCrtcConfigPtr crtc_config,
- RRTransformPtr client_transform,
- XID *errorValue)
-{
- int source_width;
- int source_height;
- struct pixman_f_transform f_transform;
-
- RRTransformCompute (crtc_config->x, crtc_config->y,
- crtc_config->mode->mode.width, crtc_config->mode->mode.height,
- crtc_config->rotation,
- client_transform,
- &crtc_config->sprite_position_f_transform,
- &crtc_config->sprite_image_f_transform,
- NULL, &f_transform, NULL, NULL, NULL, NULL);
-
- RRModeGetScanoutSize (crtc_config->mode, &f_transform,
- &source_width, &source_height);
- if (crtc_config->x + source_width > screen_config->screen_pixmap_width) {
- if (errorValue)
- *errorValue = crtc_config->x;
- return FALSE;
- }
-
- if (crtc_config->y + source_height > screen_config->screen_pixmap_height) {
- if (errorValue)
- *errorValue = crtc_config->y;
- return FALSE;
- }
- return TRUE;
-}
-
-/*
- * Initialize crtc type
- */
-Bool
-RRCrtcInit (void)
-{
- RRCrtcType = CreateNewResourceType (RRCrtcDestroyResource, "CRTC");
- if (!RRCrtcType)
- return FALSE;
-
- return TRUE;
-}
-
-/*
- * Initialize crtc type error value
- */
-void
-RRCrtcInitErrorValue(void)
-{
- SetResourceTypeErrorValue(RRCrtcType, RRErrorBase + BadRRCrtc);
-}
-
-int
-ProcRRGetCrtcInfo (ClientPtr client)
-{
- REQUEST(xRRGetCrtcInfoReq);
- xRRGetCrtcInfoReply rep;
- RRCrtcPtr crtc;
- CARD8 *extra;
- unsigned long extraLen;
- ScreenPtr pScreen;
- rrScrPrivPtr pScrPriv;
- RRModePtr mode;
- RROutput *outputs;
- RROutput *possible;
- int i, j, k, n;
- int width, height;
- BoxRec panned_area;
-
- REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq);
- VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
-
- /* All crtcs must be associated with screens before client
- * requests are processed
- */
- pScreen = crtc->pScreen;
- pScrPriv = rrGetScrPriv(pScreen);
-
- mode = crtc->mode;
-
- rep.type = X_Reply;
- rep.status = RRSetConfigSuccess;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.timestamp = pScrPriv->lastSetTime.milliseconds;
- if (pScrPriv->rrGetPanning &&
- pScrPriv->rrGetPanning (pScreen, crtc, &panned_area, NULL, NULL) &&
- (panned_area.x2 > panned_area.x1) && (panned_area.y2 > panned_area.y1))
- {
- rep.x = panned_area.x1;
- rep.y = panned_area.y1;
- rep.width = panned_area.x2 - panned_area.x1;
- rep.height = panned_area.y2 - panned_area.y1;
- }
- else
- {
- RRCrtcGetScanoutSize (crtc, &width, &height);
- rep.x = crtc->x;
- rep.y = crtc->y;
- rep.width = width;
- rep.height = height;
- }
- rep.mode = mode ? mode->mode.id : 0;
- rep.rotation = crtc->rotation;
- rep.rotations = crtc->rotations;
- rep.nOutput = crtc->numOutputs;
- k = 0;
- for (i = 0; i < pScrPriv->numOutputs; i++)
- for (j = 0; j < pScrPriv->outputs[i]->numCrtcs; j++)
- if (pScrPriv->outputs[i]->crtcs[j] == crtc)
- k++;
- rep.nPossibleOutput = k;
-
- rep.length = rep.nOutput + rep.nPossibleOutput;
-
- extraLen = rep.length << 2;
- if (extraLen)
- {
- extra = malloc(extraLen);
- if (!extra)
- return BadAlloc;
- }
- else
- extra = NULL;
-
- outputs = (RROutput *) extra;
- possible = (RROutput *) (outputs + rep.nOutput);
-
- for (i = 0; i < crtc->numOutputs; i++)
- {
- outputs[i] = crtc->outputs[i]->id;
- if (client->swapped)
- swapl (&outputs[i], n);
- }
- k = 0;
- for (i = 0; i < pScrPriv->numOutputs; i++)
- for (j = 0; j < pScrPriv->outputs[i]->numCrtcs; j++)
- if (pScrPriv->outputs[i]->crtcs[j] == crtc)
- {
- possible[k] = pScrPriv->outputs[i]->id;
- if (client->swapped)
- swapl (&possible[k], n);
- k++;
- }
-
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.timestamp, n);
- swaps(&rep.x, n);
- swaps(&rep.y, n);
- swaps(&rep.width, n);
- swaps(&rep.height, n);
- swapl(&rep.mode, n);
- swaps(&rep.rotation, n);
- swaps(&rep.rotations, n);
- swaps(&rep.nOutput, n);
- swaps(&rep.nPossibleOutput, n);
- }
- WriteToClient(client, sizeof(xRRGetCrtcInfoReply), (char *)&rep);
- if (extraLen)
- {
- WriteToClient (client, extraLen, (char *) extra);
- free(extra);
- }
-
- return Success;
-}
-
-int
-ProcRRSetCrtcConfig (ClientPtr client)
-{
- REQUEST(xRRSetCrtcConfigReq);
- xRRSetCrtcConfigReply rep;
- ScreenPtr pScreen;
- rrScrPrivPtr pScrPriv;
- RRCrtcPtr crtc;
- RRModePtr mode;
- int numOutputs;
- RROutputPtr *outputs = NULL;
- RROutput *outputIds;
- TimeStamp configTime;
- TimeStamp time;
- Rotation rotation;
- int rc, i, j;
-
- REQUEST_AT_LEAST_SIZE(xRRSetCrtcConfigReq);
- numOutputs = (stuff->length - bytes_to_int32(SIZEOF (xRRSetCrtcConfigReq)));
-
- VERIFY_RR_CRTC(stuff->crtc, crtc, DixSetAttrAccess);
-
- if (stuff->mode == None)
- {
- mode = NULL;
- if (numOutputs > 0)
- return BadMatch;
- }
- else
- {
- VERIFY_RR_MODE(stuff->mode, mode, DixSetAttrAccess);
- if (numOutputs == 0)
- return BadMatch;
- }
- if (numOutputs)
- {
- outputs = malloc(numOutputs * sizeof (RROutputPtr));
- if (!outputs)
- return BadAlloc;
- }
- else
- outputs = NULL;
-
- outputIds = (RROutput *) (stuff + 1);
- for (i = 0; i < numOutputs; i++)
- {
- rc = dixLookupResourceByType((pointer *)(outputs + i), outputIds[i],
- RROutputType, client, DixSetAttrAccess);
- if (rc != Success)
- {
- free(outputs);
- return rc;
- }
- /* validate crtc for this output */
- for (j = 0; j < outputs[i]->numCrtcs; j++)
- if (outputs[i]->crtcs[j] == crtc)
- break;
- if (j == outputs[i]->numCrtcs)
- {
- free(outputs);
- return BadMatch;
- }
- /* validate mode for this output */
- for (j = 0; j < outputs[i]->numModes + outputs[i]->numUserModes; j++)
- {
- RRModePtr m = (j < outputs[i]->numModes ?
- outputs[i]->modes[j] :
- outputs[i]->userModes[j - outputs[i]->numModes]);
- if (m == mode)
- break;
- }
- if (j == outputs[i]->numModes + outputs[i]->numUserModes)
- {
- free(outputs);
- return BadMatch;
- }
- }
- /* validate clones */
- for (i = 0; i < numOutputs; i++)
- {
- for (j = 0; j < numOutputs; j++)
- {
- int k;
- if (i == j)
- continue;
- for (k = 0; k < outputs[i]->numClones; k++)
- {
- if (outputs[i]->clones[k] == outputs[j])
- break;
- }
- if (k == outputs[i]->numClones)
- {
- free(outputs);
- return BadMatch;
- }
- }
- }
-
- pScreen = crtc->pScreen;
- pScrPriv = rrGetScrPriv(pScreen);
-
- time = ClientTimeToServerTime(stuff->timestamp);
- configTime = ClientTimeToServerTime(stuff->configTimestamp);
-
- if (!pScrPriv)
- {
- time = currentTime;
- rep.status = RRSetConfigFailed;
- goto sendReply;
- }
-
- /*
- * Validate requested rotation
- */
- rotation = (Rotation) stuff->rotation;
-
- /* test the rotation bits only! */
- switch (rotation & 0xf) {
- case RR_Rotate_0:
- case RR_Rotate_90:
- case RR_Rotate_180:
- case RR_Rotate_270:
- break;
- default:
- /*
- * Invalid rotation
- */
- client->errorValue = stuff->rotation;
- free(outputs);
- return BadValue;
- }
-
- if (mode)
- {
- if ((~crtc->rotations) & rotation)
- {
- /*
- * requested rotation or reflection not supported by screen
- */
- client->errorValue = stuff->rotation;
- free(outputs);
- return BadMatch;
- }
-
-#ifdef RANDR_12_INTERFACE
- /*
- * Check screen size bounds if the DDX provides a 1.2 interface
- * for setting screen size. Else, assume the CrtcSet sets
- * the size along with the mode. If the driver supports transforms,
- * then it must allow crtcs to display a subset of the screen, so
- * only do this check for drivers without transform support.
- */
- if (pScrPriv->rrScreenSetSize && !crtc->transforms)
- {
- int source_width;
- int source_height;
- PictTransform transform;
- struct pixman_f_transform f_transform, f_inverse;
-
- RRTransformCompute (stuff->x, stuff->y,
- mode->mode.width, mode->mode.height,
- rotation,
- &crtc->client_pending_transform,
- &crtc->client_sprite_f_position_transform,
- &crtc->client_sprite_f_image_transform,
- &transform, &f_transform, &f_inverse, NULL, NULL, NULL);
-
- RRModeGetScanoutSize (mode, &f_transform,
- &source_width, &source_height);
- if (stuff->x + source_width > pScreen->width)
- {
- client->errorValue = stuff->x;
- free(outputs);
- return BadValue;
- }
-
- if (stuff->y + source_height > pScreen->height)
- {
- client->errorValue = stuff->y;
- free(outputs);
- return BadValue;
- }
- }
-#endif
- }
-
- if (!RRCrtcSet (crtc, mode, stuff->x, stuff->y,
- rotation, numOutputs, outputs, NULL))
- {
- rep.status = RRSetConfigFailed;
- goto sendReply;
- }
- rep.status = RRSetConfigSuccess;
- pScrPriv->lastSetTime = time;
-
-sendReply:
- free(outputs);
-
- rep.type = X_Reply;
- /* rep.status has already been filled in */
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.newTimestamp = pScrPriv->lastSetTime.milliseconds;
-
- if (client->swapped)
- {
- int n;
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.newTimestamp, n);
- }
- WriteToClient(client, sizeof(xRRSetCrtcConfigReply), (char *)&rep);
-
- return Success;
-}
-
-int
-ProcRRGetPanning (ClientPtr client)
-{
- REQUEST(xRRGetPanningReq);
- xRRGetPanningReply rep;
- RRCrtcPtr crtc;
- ScreenPtr pScreen;
- rrScrPrivPtr pScrPriv;
- BoxRec total;
- BoxRec tracking;
- INT16 border[4];
- int n;
-
- REQUEST_SIZE_MATCH(xRRGetPanningReq);
- VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
-
- /* All crtcs must be associated with screens before client
- * requests are processed
- */
- pScreen = crtc->pScreen;
- pScrPriv = rrGetScrPriv(pScreen);
-
- if (!pScrPriv)
- return RRErrorBase + BadRRCrtc;
-
- memset(&rep, 0, sizeof(rep));
- rep.type = X_Reply;
- rep.status = RRSetConfigSuccess;
- rep.sequenceNumber = client->sequence;
- rep.length = 1;
- rep.timestamp = pScrPriv->lastSetTime.milliseconds;
-
- if (pScrPriv->rrGetPanning &&
- pScrPriv->rrGetPanning (pScreen, crtc, &total, &tracking, border)) {
- rep.left = total.x1;
- rep.top = total.y1;
- rep.width = total.x2 - total.x1;
- rep.height = total.y2 - total.y1;
- rep.track_left = tracking.x1;
- rep.track_top = tracking.y1;
- rep.track_width = tracking.x2 - tracking.x1;
- rep.track_height = tracking.y2 - tracking.y1;
- rep.border_left = border[0];
- rep.border_top = border[1];
- rep.border_right = border[2];
- rep.border_bottom = border[3];
- }
-
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swaps(&rep.timestamp, n);
- swaps(&rep.left, n);
- swaps(&rep.top, n);
- swaps(&rep.width, n);
- swaps(&rep.height, n);
- swaps(&rep.track_left, n);
- swaps(&rep.track_top, n);
- swaps(&rep.track_width, n);
- swaps(&rep.track_height, n);
- swaps(&rep.border_left, n);
- swaps(&rep.border_top, n);
- swaps(&rep.border_right, n);
- swaps(&rep.border_bottom, n);
- }
- WriteToClient(client, sizeof(xRRGetPanningReply), (char *)&rep);
- return Success;
-}
-
-int
-ProcRRSetPanning (ClientPtr client)
-{
- REQUEST(xRRSetPanningReq);
- xRRSetPanningReply rep;
- RRCrtcPtr crtc;
- ScreenPtr pScreen;
- rrScrPrivPtr pScrPriv;
- TimeStamp time;
- BoxRec total;
- BoxRec tracking;
- INT16 border[4];
- int n;
-
- REQUEST_SIZE_MATCH(xRRSetPanningReq);
- VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
-
- /* All crtcs must be associated with screens before client
- * requests are processed
- */
- pScreen = crtc->pScreen;
- pScrPriv = rrGetScrPriv(pScreen);
-
- if (!pScrPriv) {
- time = currentTime;
- rep.status = RRSetConfigFailed;
- goto sendReply;
- }
-
- time = ClientTimeToServerTime(stuff->timestamp);
-
- if (!pScrPriv->rrGetPanning)
- return RRErrorBase + BadRRCrtc;
-
- total.x1 = stuff->left;
- total.y1 = stuff->top;
- total.x2 = total.x1 + stuff->width;
- total.y2 = total.y1 + stuff->height;
- tracking.x1 = stuff->track_left;
- tracking.y1 = stuff->track_top;
- tracking.x2 = tracking.x1 + stuff->track_width;
- tracking.y2 = tracking.y1 + stuff->track_height;
- border[0] = stuff->border_left;
- border[1] = stuff->border_top;
- border[2] = stuff->border_right;
- border[3] = stuff->border_bottom;
-
- if (! pScrPriv->rrSetPanning (pScreen, crtc, &total, &tracking, border))
- return BadMatch;
-
- pScrPriv->lastSetTime = time;
-
- rep.status = RRSetConfigSuccess;
-
-sendReply:
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.newTimestamp = pScrPriv->lastSetTime.milliseconds;
-
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swaps(&rep.newTimestamp, n);
- }
- WriteToClient(client, sizeof(xRRSetPanningReply), (char *)&rep);
- return Success;
-}
-
-int
-ProcRRGetCrtcGammaSize (ClientPtr client)
-{
- REQUEST(xRRGetCrtcGammaSizeReq);
- xRRGetCrtcGammaSizeReply reply;
- RRCrtcPtr crtc;
- int n;
-
- REQUEST_SIZE_MATCH(xRRGetCrtcGammaSizeReq);
- VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
-
- /* Gamma retrieval failed, any better error? */
- if (!RRCrtcGammaGet(crtc))
- return RRErrorBase + BadRRCrtc;
-
- reply.type = X_Reply;
- reply.sequenceNumber = client->sequence;
- reply.length = 0;
- reply.size = crtc->gammaSize;
- if (client->swapped) {
- swaps (&reply.sequenceNumber, n);
- swapl (&reply.length, n);
- swaps (&reply.size, n);
- }
- WriteToClient (client, sizeof (xRRGetCrtcGammaSizeReply), (char *) &reply);
- return Success;
-}
-
-int
-ProcRRGetCrtcGamma (ClientPtr client)
-{
- REQUEST(xRRGetCrtcGammaReq);
- xRRGetCrtcGammaReply reply;
- RRCrtcPtr crtc;
- int n;
- unsigned long len;
- char *extra = NULL;
-
- REQUEST_SIZE_MATCH(xRRGetCrtcGammaReq);
- VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
-
- /* Gamma retrieval failed, any better error? */
- if (!RRCrtcGammaGet(crtc))
- return RRErrorBase + BadRRCrtc;
-
- len = crtc->gammaSize * 3 * 2;
-
- if (crtc->gammaSize) {
- extra = malloc(len);
- if (!extra)
- return BadAlloc;
- }
-
- reply.type = X_Reply;
- reply.sequenceNumber = client->sequence;
- reply.length = bytes_to_int32(len);
- reply.size = crtc->gammaSize;
- if (client->swapped) {
- swaps (&reply.sequenceNumber, n);
- swapl (&reply.length, n);
- swaps (&reply.size, n);
- }
- WriteToClient (client, sizeof (xRRGetCrtcGammaReply), (char *) &reply);
- if (crtc->gammaSize)
- {
- memcpy(extra, crtc->gammaRed, len);
- client->pSwapReplyFunc = (ReplySwapPtr)CopySwap16Write;
- WriteSwappedDataToClient (client, len, extra);
- free(extra);
- }
- return Success;
-}
-
-int
-ProcRRSetCrtcGamma (ClientPtr client)
-{
- REQUEST(xRRSetCrtcGammaReq);
- RRCrtcPtr crtc;
- unsigned long len;
- CARD16 *red, *green, *blue;
-
- REQUEST_AT_LEAST_SIZE(xRRSetCrtcGammaReq);
- VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
-
- len = client->req_len - bytes_to_int32(sizeof (xRRSetCrtcGammaReq));
- if (len < (stuff->size * 3 + 1) >> 1)
- return BadLength;
-
- if (stuff->size != crtc->gammaSize)
- return BadMatch;
-
- red = (CARD16 *) (stuff + 1);
- green = red + crtc->gammaSize;
- blue = green + crtc->gammaSize;
-
- RRCrtcGammaSet (crtc, red, green, blue);
-
- return Success;
-}
-
-/* Version 1.3 additions */
-
-int
-ProcRRSetCrtcTransform (ClientPtr client)
-{
- REQUEST(xRRSetCrtcTransformReq);
- RRCrtcPtr crtc;
- PictTransform transform;
- struct pixman_f_transform f_transform, f_inverse;
- char *filter;
- int nbytes;
- xFixed *params;
- int nparams;
-
- REQUEST_AT_LEAST_SIZE(xRRSetCrtcTransformReq);
- VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
-
- PictTransform_from_xRenderTransform (&transform, &stuff->transform);
- pixman_f_transform_from_pixman_transform (&f_transform, &transform);
- if (!pixman_f_transform_invert (&f_inverse, &f_transform))
- return BadMatch;
-
- filter = (char *) (stuff + 1);
- nbytes = stuff->nbytesFilter;
- params = (xFixed *) (filter + pad_to_int32(nbytes));
- nparams = ((xFixed *) stuff + client->req_len) - params;
- if (nparams < 0)
- return BadLength;
-
- return RRCrtcTransformSet (crtc, &transform, &f_transform, &f_inverse,
- filter, nbytes, params, nparams);
-}
-
-
-#define CrtcTransformExtra (SIZEOF(xRRGetCrtcTransformReply) - 32)
-
-static int
-transform_filter_length (RRTransformPtr transform)
-{
- int nbytes, nparams;
-
- if (transform->filter == NULL)
- return 0;
- nbytes = strlen (transform->filter->name);
- nparams = transform->nparams;
- return pad_to_int32(nbytes) + (nparams * sizeof (xFixed));
-}
-
-static int
-transform_filter_encode (ClientPtr client, char *output,
- CARD16 *nbytesFilter,
- CARD16 *nparamsFilter,
- RRTransformPtr transform)
-{
- int nbytes, nparams;
- int n;
-
- if (transform->filter == NULL) {
- *nbytesFilter = 0;
- *nparamsFilter = 0;
- return 0;
- }
- nbytes = strlen (transform->filter->name);
- nparams = transform->nparams;
- *nbytesFilter = nbytes;
- *nparamsFilter = nparams;
- memcpy (output, transform->filter->name, nbytes);
- while ((nbytes & 3) != 0)
- output[nbytes++] = 0;
- memcpy (output + nbytes, transform->params, nparams * sizeof (xFixed));
- if (client->swapped) {
- swaps (nbytesFilter, n);
- swaps (nparamsFilter, n);
- SwapLongs ((CARD32 *) (output + nbytes), nparams);
- }
- nbytes += nparams * sizeof (xFixed);
- return nbytes;
-}
-
-static void
-transform_encode (ClientPtr client, xRenderTransform *wire, PictTransform *pict)
-{
- xRenderTransform_from_PictTransform (wire, pict);
- if (client->swapped)
- SwapLongs ((CARD32 *) wire, bytes_to_int32(sizeof(xRenderTransform)));
-}
-
-int
-ProcRRGetCrtcTransform (ClientPtr client)
-{
- REQUEST(xRRGetCrtcTransformReq);
- xRRGetCrtcTransformReply *reply;
- RRCrtcPtr crtc;
- int n, nextra;
- RRTransformPtr current, pending;
- char *extra;
-
- REQUEST_SIZE_MATCH (xRRGetCrtcTransformReq);
- VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
-
- pending = &crtc->client_pending_transform;
- current = &crtc->client_current_transform;
-
- nextra = (transform_filter_length (pending) +
- transform_filter_length (current));
-
- reply = malloc(sizeof (xRRGetCrtcTransformReply) + nextra);
- if (!reply)
- return BadAlloc;
-
- extra = (char *) (reply + 1);
- reply->type = X_Reply;
- reply->sequenceNumber = client->sequence;
- reply->length = bytes_to_int32(CrtcTransformExtra + nextra);
-
- reply->hasTransforms = crtc->transforms;
-
- transform_encode (client, &reply->pendingTransform, &pending->transform);
- extra += transform_filter_encode (client, extra,
- &reply->pendingNbytesFilter,
- &reply->pendingNparamsFilter,
- pending);
-
- transform_encode (client, &reply->currentTransform, &current->transform);
- extra += transform_filter_encode (client, extra,
- &reply->currentNbytesFilter,
- &reply->currentNparamsFilter,
- current);
-
- if (client->swapped) {
- swaps (&reply->sequenceNumber, n);
- swapl (&reply->length, n);
- }
- WriteToClient (client, sizeof (xRRGetCrtcTransformReply) + nextra, (char *) reply);
- free(reply);
- return Success;
-}
-
-static int
-RRConvertCrtcConfig(ClientPtr client, ScreenPtr screen,
- RRScreenConfigPtr screen_config,
- RRCrtcConfigPtr config, xRRCrtcConfig *x,
- RROutput *outputIds)
-{
- RRCrtcPtr crtc;
- RROutputPtr *outputs;
- rrScrPrivPtr scr_priv;
- RRModePtr mode;
- PixmapPtr pixmap;
- int rc, i, j;
- Rotation rotation;
-
- VERIFY_RR_CRTC(x->crtc, crtc, DixSetAttrAccess);
-
- if (x->mode == None)
- {
- mode = NULL;
- if (x->nOutput > 0)
- return BadMatch;
- }
- else
- {
- VERIFY_RR_MODE(x->mode, mode, DixSetAttrAccess);
- if (x->nOutput == 0)
- return BadMatch;
- }
- if (x->nOutput)
- {
- outputs = malloc(x->nOutput * sizeof (RROutputPtr));
- if (!outputs)
- return BadAlloc;
- }
- else
- outputs = NULL;
-
- if (x->pixmap == None)
- pixmap = NULL;
- else if (x->pixmap == RR_CurrentScanoutPixmap)
- pixmap = crtc->scanoutPixmap;
- else
- {
- rc = dixLookupResourceByType((pointer *) &pixmap, x->pixmap,
- RT_PIXMAP, client, DixWriteAccess);
- if (rc != Success) {
- free(outputs);
- return rc;
- }
- /* XXX check to make sure this is a scanout pixmap */
- }
-
- for (i = 0; i < x->nOutput; i++)
- {
- rc = dixLookupResourceByType((pointer *)(outputs + i), outputIds[i],
- RROutputType, client, DixSetAttrAccess);
- if (rc != Success)
- {
- free(outputs);
- return rc;
- }
- /* validate crtc for this output */
- for (j = 0; j < outputs[i]->numCrtcs; j++)
- if (outputs[i]->crtcs[j] == crtc)
- break;
- if (j == outputs[i]->numCrtcs)
- {
- free(outputs);
- return BadMatch;
- }
- /* validate mode for this output */
- for (j = 0; j < outputs[i]->numModes + outputs[i]->numUserModes; j++)
- {
- RRModePtr m = (j < outputs[i]->numModes ?
- outputs[i]->modes[j] :
- outputs[i]->userModes[j - outputs[i]->numModes]);
- if (m == mode)
- break;
- }
- if (j == outputs[i]->numModes + outputs[i]->numUserModes)
- {
- free(outputs);
- return BadMatch;
- }
- }
- /* validate clones */
- for (i = 0; i < x->nOutput; i++)
- {
- for (j = 0; j < x->nOutput; j++)
- {
- int k;
- if (i == j)
- continue;
- for (k = 0; k < outputs[i]->numClones; k++)
- {
- if (outputs[i]->clones[k] == outputs[j])
- break;
- }
- if (k == outputs[i]->numClones)
- {
- free(outputs);
- return BadMatch;
- }
- }
- }
-
- if (crtc->pScreen != screen)
- return BadMatch;
-
- scr_priv = rrGetScrPriv(screen);
-
- config->crtc = crtc;
- config->x = x->x;
- config->y = x->y;
- config->mode = mode;
- config->rotation = x->rotation;
- config->numOutputs = x->nOutput;
- config->outputs = outputs;
- PictTransform_from_xRenderTransform(&config->sprite_position_transform,
- &x->spritePositionTransform);
- PictTransform_from_xRenderTransform(&config->sprite_image_transform,
- &x->spriteImageTransform);
- pixman_f_transform_from_pixman_transform(&config->sprite_position_f_transform,
- &config->sprite_position_transform);
- pixman_f_transform_from_pixman_transform(&config->sprite_image_f_transform,
- &config->sprite_image_transform);
- config->pixmap = pixmap;
- config->pixmap_x = x->xPixmap;
- config->pixmap_y = x->yPixmap;
-
- /*
- * Validate requested rotation
- */
- rotation = (Rotation) x->rotation;
-
- /* test the rotation bits only! */
- switch (rotation & 0xf) {
- case RR_Rotate_0:
- case RR_Rotate_90:
- case RR_Rotate_180:
- case RR_Rotate_270:
- break;
- default:
- /*
- * Invalid rotation
- */
- client->errorValue = x->rotation;
- free(outputs);
- return BadValue;
- }
-
- if (mode)
- {
- if ((~crtc->rotations) & rotation)
- {
- /*
- * requested rotation or reflection not supported by screen
- */
- client->errorValue = x->rotation;
- free(outputs);
- return BadMatch;
- }
-
- /*
- * If scanning out from another pixmap, make sure the mode
- * fits
- */
- if (pixmap)
- {
- if (x->xPixmap + mode->mode.width > pixmap->drawable.width) {
- client->errorValue = x->xPixmap;
- free(outputs);
- return BadValue;
- }
- if (x->yPixmap + mode->mode.height > pixmap->drawable.height) {
- client->errorValue = x->yPixmap;
- free(outputs);
- return BadValue;
- }
- }
- /*
- * Check screen size bounds if the DDX provides a 1.2 interface
- * for setting screen size. Else, assume the CrtcSet sets
- * the size along with the mode. If the driver supports transforms,
- * then it must allow crtcs to display a subset of the screen, so
- * only do this check for drivers without transform support.
- */
- else if (scr_priv->rrScreenSetSize && !crtc->transforms)
- {
- if (!RRScreenCoversCrtc(screen_config, config,
- &crtc->client_pending_transform,
- &client->errorValue))
- {
- free(outputs);
- return BadValue;
- }
- }
- }
-
- return Success;
-}
-
-int
-ProcRRSetCrtcConfigs (ClientPtr client)
-{
- REQUEST(xRRSetCrtcConfigsReq);
- xRRSetCrtcConfigsReply rep;
- DrawablePtr drawable;
- ScreenPtr screen;
- rrScrPrivPtr scr_priv;
- xRRCrtcConfig *x_configs;
- RRScreenConfigRec screen_config;
- RRCrtcConfigPtr configs = NULL;
- RROutput *output_ids;
- int num_configs = 0;
- int rc, i;
- int extra_len;
- int num_output_ids;
-
- REQUEST_AT_LEAST_SIZE(xRRSetCrtcConfigsReq);
-
- extra_len = client->req_len - bytes_to_int32(sizeof(xRRSetCrtcConfigsReq));
-
- num_configs = stuff->nConfigs;
-
- /* Check request length against number of configs specified */
- if (num_configs * (sizeof (xRRCrtcConfig) >> 2) > extra_len)
- return BadLength;
-
- extra_len -= num_configs * (sizeof (xRRCrtcConfig) >> 2);
- x_configs = (xRRCrtcConfig *) (stuff + 1);
-
- /* Check remaining request length against number of outputs */
- num_output_ids = 0;
- for (i = 0; i < num_configs; i++)
- num_output_ids += x_configs[i].nOutput;
-
- if (extra_len != num_output_ids)
- return BadLength;
-
- rc = dixLookupDrawable(&drawable, stuff->drawable, client, 0, DixGetAttrAccess);
- if (rc != Success)
- return rc;
-
- screen = drawable->pScreen;
-
- scr_priv = rrGetScrPriv(screen);
-
- if (!scr_priv)
- {
- rep.status = RRSetConfigFailed;
- goto sendReply;
- }
-
- if (stuff->widthInMillimeters == 0 || stuff->heightInMillimeters == 0)
- {
- client->errorValue = 0;
- return BadValue;
- }
-
- if (stuff->screenPixmapWidth < scr_priv->minWidth ||
- scr_priv->maxWidth < stuff->screenPixmapWidth)
- {
- client->errorValue = stuff->screenPixmapWidth;
- return BadValue;
- }
- if (stuff->screenPixmapHeight < scr_priv->minHeight ||
- scr_priv->maxHeight < stuff->screenPixmapHeight)
- {
- client->errorValue = stuff->screenPixmapHeight;
- return BadValue;
- }
-
- screen_config.screen_pixmap_width = stuff->screenPixmapWidth;
- screen_config.screen_pixmap_height = stuff->screenPixmapHeight;
- screen_config.screen_width = stuff->screenWidth;
- screen_config.screen_height = stuff->screenHeight;
- screen_config.mm_width = stuff->widthInMillimeters;
- screen_config.mm_height = stuff->heightInMillimeters;
-
- output_ids = (RROutput *) (x_configs + num_configs);
-
- /*
- * Convert protocol crtc configurations into
- * server crtc configurations
- */
- configs = calloc(num_configs, sizeof (RRCrtcConfigRec));
- if (num_configs > 0 && configs == NULL)
- return BadAlloc;
- for (i = 0; i < num_configs; i++) {
- rc = RRConvertCrtcConfig(client, screen, &screen_config,
- &configs[i],
- &x_configs[i], output_ids);
- if (rc != Success) {
- rep.status = RRSetConfigFailed;
- goto sendReply;
- }
- output_ids += x_configs[i].nOutput;
- }
-
- if (num_configs &&
- !RRSetCrtcConfigs (screen, &screen_config, configs, num_configs))
- {
- rep.status = RRSetConfigFailed;
- goto sendReply;
- }
- rep.status = RRSetConfigSuccess;
- scr_priv->lastSetTime = currentTime;
-
-sendReply:
- RRFreeCrtcConfigs(configs, num_configs);
-
- rep.type = X_Reply;
- /* rep.status has already been filled in */
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
- if (client->swapped)
- {
- int n;
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- }
- WriteToClient(client, sizeof(xRRSetCrtcConfigsReply), (char *)&rep);
-
- return Success;
-}
+/*
+ * Copyright © 2006 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#include "randrstr.h"
+#include "swaprep.h"
+
+RESTYPE RRCrtcType;
+
+/*
+ * Notify the CRTC of some change
+ */
+void
+RRCrtcChanged (RRCrtcPtr crtc, Bool layoutChanged)
+{
+ ScreenPtr pScreen = crtc->pScreen;
+
+ crtc->changed = TRUE;
+ if (pScreen)
+ {
+ rrScrPriv(pScreen);
+
+ pScrPriv->changed = TRUE;
+ /*
+ * Send ConfigureNotify on any layout change
+ */
+ if (layoutChanged)
+ pScrPriv->layoutChanged = TRUE;
+ }
+}
+
+/*
+ * Create a CRTC
+ */
+RRCrtcPtr
+RRCrtcCreate (ScreenPtr pScreen, void *devPrivate)
+{
+ RRCrtcPtr crtc;
+ RRCrtcPtr *crtcs;
+ rrScrPrivPtr pScrPriv;
+
+ if (!RRInit())
+ return NULL;
+
+ pScrPriv = rrGetScrPriv(pScreen);
+
+ /* make space for the crtc pointer */
+ if (pScrPriv->numCrtcs)
+ crtcs = realloc(pScrPriv->crtcs,
+ (pScrPriv->numCrtcs + 1) * sizeof (RRCrtcPtr));
+ else
+ crtcs = malloc(sizeof (RRCrtcPtr));
+ if (!crtcs)
+ return FALSE;
+ pScrPriv->crtcs = crtcs;
+
+ crtc = calloc(1, sizeof (RRCrtcRec));
+ if (!crtc)
+ return NULL;
+ crtc->id = FakeClientID (0);
+ crtc->pScreen = pScreen;
+ crtc->mode = NULL;
+ crtc->x = 0;
+ crtc->y = 0;
+ crtc->rotation = RR_Rotate_0;
+ crtc->rotations = RR_Rotate_0;
+ crtc->outputs = NULL;
+ crtc->numOutputs = 0;
+ crtc->gammaSize = 0;
+ crtc->gammaRed = crtc->gammaBlue = crtc->gammaGreen = NULL;
+ crtc->changed = FALSE;
+ crtc->devPrivate = devPrivate;
+ RRTransformInit (&crtc->client_pending_transform);
+ RRTransformInit (&crtc->client_current_transform);
+ pixman_transform_init_identity (&crtc->transform);
+ pixman_f_transform_init_identity (&crtc->f_transform);
+ pixman_f_transform_init_identity (&crtc->f_inverse);
+
+ if (!AddResource (crtc->id, RRCrtcType, (pointer) crtc))
+ return NULL;
+
+ /* attach the screen and crtc together */
+ crtc->pScreen = pScreen;
+ pScrPriv->crtcs[pScrPriv->numCrtcs++] = crtc;
+
+ return crtc;
+}
+
+/*
+ * Set the allowed rotations on a CRTC
+ */
+void
+RRCrtcSetRotations (RRCrtcPtr crtc, Rotation rotations)
+{
+ crtc->rotations = rotations;
+}
+
+/*
+ * Set whether transforms are allowed on a CRTC
+ */
+void
+RRCrtcSetTransformSupport (RRCrtcPtr crtc, Bool transforms)
+{
+ crtc->transforms = transforms;
+}
+
+/*
+ * Notify the extension that the Crtc has been reconfigured,
+ * the driver calls this whenever it has updated the mode
+ */
+Bool
+RRCrtcNotify (RRCrtcPtr crtc,
+ RRModePtr mode,
+ int x,
+ int y,
+ Rotation rotation,
+ RRTransformPtr transform,
+ int numOutputs,
+ RROutputPtr *outputs)
+{
+ int i, j;
+
+ /*
+ * Check to see if any of the new outputs were
+ * not in the old list and mark them as changed
+ */
+ for (i = 0; i < numOutputs; i++)
+ {
+ for (j = 0; j < crtc->numOutputs; j++)
+ if (outputs[i] == crtc->outputs[j])
+ break;
+ if (j == crtc->numOutputs)
+ {
+ outputs[i]->crtc = crtc;
+ RROutputChanged (outputs[i], FALSE);
+ RRCrtcChanged (crtc, FALSE);
+ }
+ }
+ /*
+ * Check to see if any of the old outputs are
+ * not in the new list and mark them as changed
+ */
+ for (j = 0; j < crtc->numOutputs; j++)
+ {
+ for (i = 0; i < numOutputs; i++)
+ if (outputs[i] == crtc->outputs[j])
+ break;
+ if (i == numOutputs)
+ {
+ if (crtc->outputs[j]->crtc == crtc)
+ crtc->outputs[j]->crtc = NULL;
+ RROutputChanged (crtc->outputs[j], FALSE);
+ RRCrtcChanged (crtc, FALSE);
+ }
+ }
+ /*
+ * Reallocate the crtc output array if necessary
+ */
+ if (numOutputs != crtc->numOutputs)
+ {
+ RROutputPtr *newoutputs;
+
+ if (numOutputs)
+ {
+ if (crtc->numOutputs)
+ newoutputs = realloc(crtc->outputs,
+ numOutputs * sizeof (RROutputPtr));
+ else
+ newoutputs = malloc(numOutputs * sizeof (RROutputPtr));
+ if (!newoutputs)
+ return FALSE;
+ }
+ else
+ {
+ free(crtc->outputs);
+ newoutputs = NULL;
+ }
+ crtc->outputs = newoutputs;
+ crtc->numOutputs = numOutputs;
+ }
+ /*
+ * Copy the new list of outputs into the crtc
+ */
+ memcpy (crtc->outputs, outputs, numOutputs * sizeof (RROutputPtr));
+ /*
+ * Update remaining crtc fields
+ */
+ if (mode != crtc->mode)
+ {
+ if (crtc->mode)
+ RRModeDestroy (crtc->mode);
+ crtc->mode = mode;
+ if (mode != NULL)
+ mode->refcnt++;
+ RRCrtcChanged (crtc, TRUE);
+ }
+ if (x != crtc->x)
+ {
+ crtc->x = x;
+ RRCrtcChanged (crtc, TRUE);
+ }
+ if (y != crtc->y)
+ {
+ crtc->y = y;
+ RRCrtcChanged (crtc, TRUE);
+ }
+ if (rotation != crtc->rotation)
+ {
+ crtc->rotation = rotation;
+ RRCrtcChanged (crtc, TRUE);
+ }
+ if (!RRTransformEqual (transform, &crtc->client_current_transform)) {
+ RRTransformCopy (&crtc->client_current_transform, transform);
+ RRCrtcChanged (crtc, TRUE);
+ }
+ if (crtc->changed && mode)
+ {
+ RRTransformCompute (x, y,
+ mode->mode.width, mode->mode.height,
+ rotation,
+ &crtc->client_current_transform,
+ &crtc->transform, &crtc->f_transform,
+ &crtc->f_inverse);
+ }
+ return TRUE;
+}
+
+void
+RRDeliverCrtcEvent (ClientPtr client, WindowPtr pWin, RRCrtcPtr crtc)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ rrScrPriv (pScreen);
+ xRRCrtcChangeNotifyEvent ce;
+ RRModePtr mode = crtc->mode;
+
+ ce.type = RRNotify + RREventBase;
+ ce.subCode = RRNotify_CrtcChange;
+ ce.timestamp = pScrPriv->lastSetTime.milliseconds;
+ ce.window = pWin->drawable.id;
+ ce.crtc = crtc->id;
+ ce.rotation = crtc->rotation;
+ if (mode)
+ {
+ ce.mode = mode->mode.id;
+ ce.x = crtc->x;
+ ce.y = crtc->y;
+ ce.width = mode->mode.width;
+ ce.height = mode->mode.height;
+ }
+ else
+ {
+ ce.mode = None;
+ ce.x = 0;
+ ce.y = 0;
+ ce.width = 0;
+ ce.height = 0;
+ }
+ WriteEventsToClient (client, 1, (xEvent *) &ce);
+}
+
+static Bool
+RRCrtcPendingProperties (RRCrtcPtr crtc)
+{
+ ScreenPtr pScreen = crtc->pScreen;
+ rrScrPriv(pScreen);
+ int o;
+
+ for (o = 0; o < pScrPriv->numOutputs; o++)
+ {
+ RROutputPtr output = pScrPriv->outputs[o];
+ if (output->crtc == crtc && output->pendingProperties)
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/*
+ * Request that the Crtc be reconfigured
+ */
+Bool
+RRCrtcSet (RRCrtcPtr crtc,
+ RRModePtr mode,
+ int x,
+ int y,
+ Rotation rotation,
+ int numOutputs,
+ RROutputPtr *outputs)
+{
+ ScreenPtr pScreen = crtc->pScreen;
+ Bool ret = FALSE;
+ rrScrPriv(pScreen);
+
+ /* See if nothing changed */
+ if (crtc->mode == mode &&
+ crtc->x == x &&
+ crtc->y == y &&
+ crtc->rotation == rotation &&
+ crtc->numOutputs == numOutputs &&
+ !memcmp (crtc->outputs, outputs, numOutputs * sizeof (RROutputPtr)) &&
+ !RRCrtcPendingProperties (crtc) &&
+ !RRCrtcPendingTransform (crtc))
+ {
+ ret = TRUE;
+ }
+ else
+ {
+#if RANDR_12_INTERFACE
+ if (pScrPriv->rrCrtcSet)
+ {
+ ret = (*pScrPriv->rrCrtcSet) (pScreen, crtc, mode, x, y,
+ rotation, numOutputs, outputs);
+ }
+ else
+#endif
+ {
+#if RANDR_10_INTERFACE
+ if (pScrPriv->rrSetConfig)
+ {
+ RRScreenSize size;
+ RRScreenRate rate;
+
+ if (!mode)
+ {
+ RRCrtcNotify (crtc, NULL, x, y, rotation, NULL, 0, NULL);
+ ret = TRUE;
+ }
+ else
+ {
+ size.width = mode->mode.width;
+ size.height = mode->mode.height;
+ if (outputs[0]->mmWidth && outputs[0]->mmHeight)
+ {
+ size.mmWidth = outputs[0]->mmWidth;
+ size.mmHeight = outputs[0]->mmHeight;
+ }
+ else
+ {
+ size.mmWidth = pScreen->mmWidth;
+ size.mmHeight = pScreen->mmHeight;
+ }
+ size.nRates = 1;
+ rate.rate = RRVerticalRefresh (&mode->mode);
+ size.pRates = &rate;
+ ret = (*pScrPriv->rrSetConfig) (pScreen, rotation, rate.rate, &size);
+ /*
+ * Old 1.0 interface tied screen size to mode size
+ */
+ if (ret)
+ {
+ RRCrtcNotify (crtc, mode, x, y, rotation, NULL, 1, outputs);
+ RRScreenSizeNotify (pScreen);
+ }
+ }
+ }
+#endif
+ }
+ if (ret)
+ {
+ int o;
+ RRTellChanged (pScreen);
+
+ for (o = 0; o < numOutputs; o++)
+ RRPostPendingProperties (outputs[o]);
+ }
+ }
+ return ret;
+}
+
+/*
+ * Return crtc transform
+ */
+RRTransformPtr
+RRCrtcGetTransform (RRCrtcPtr crtc)
+{
+ RRTransformPtr transform = &crtc->client_pending_transform;
+
+ if (pixman_transform_is_identity (&transform->transform))
+ return NULL;
+ return transform;
+}
+
+/*
+ * Check whether the pending and current transforms are the same
+ */
+Bool
+RRCrtcPendingTransform (RRCrtcPtr crtc)
+{
+ return memcmp (&crtc->client_current_transform.transform,
+ &crtc->client_pending_transform.transform,
+ sizeof (PictTransform)) != 0;
+}
+
+/*
+ * Destroy a Crtc at shutdown
+ */
+void
+RRCrtcDestroy (RRCrtcPtr crtc)
+{
+ FreeResource (crtc->id, 0);
+}
+
+static int
+RRCrtcDestroyResource (pointer value, XID pid)
+{
+ RRCrtcPtr crtc = (RRCrtcPtr) value;
+ ScreenPtr pScreen = crtc->pScreen;
+
+ if (pScreen)
+ {
+ rrScrPriv(pScreen);
+ int i;
+
+ for (i = 0; i < pScrPriv->numCrtcs; i++)
+ {
+ if (pScrPriv->crtcs[i] == crtc)
+ {
+ memmove (pScrPriv->crtcs + i, pScrPriv->crtcs + i + 1,
+ (pScrPriv->numCrtcs - (i + 1)) * sizeof (RRCrtcPtr));
+ --pScrPriv->numCrtcs;
+ break;
+ }
+ }
+ }
+ free(crtc->gammaRed);
+ if (crtc->mode)
+ RRModeDestroy (crtc->mode);
+ free(crtc);
+ return 1;
+}
+
+/*
+ * Request that the Crtc gamma be changed
+ */
+
+Bool
+RRCrtcGammaSet (RRCrtcPtr crtc,
+ CARD16 *red,
+ CARD16 *green,
+ CARD16 *blue)
+{
+ Bool ret = TRUE;
+#if RANDR_12_INTERFACE
+ ScreenPtr pScreen = crtc->pScreen;
+#endif
+
+ memcpy (crtc->gammaRed, red, crtc->gammaSize * sizeof (CARD16));
+ memcpy (crtc->gammaGreen, green, crtc->gammaSize * sizeof (CARD16));
+ memcpy (crtc->gammaBlue, blue, crtc->gammaSize * sizeof (CARD16));
+#if RANDR_12_INTERFACE
+ if (pScreen)
+ {
+ rrScrPriv(pScreen);
+ if (pScrPriv->rrCrtcSetGamma)
+ ret = (*pScrPriv->rrCrtcSetGamma) (pScreen, crtc);
+ }
+#endif
+ return ret;
+}
+
+/*
+ * Request current gamma back from the DDX (if possible).
+ * This includes gamma size.
+ */
+Bool
+RRCrtcGammaGet(RRCrtcPtr crtc)
+{
+ Bool ret = TRUE;
+#if RANDR_12_INTERFACE
+ ScreenPtr pScreen = crtc->pScreen;
+#endif
+
+#if RANDR_12_INTERFACE
+ if (pScreen)
+ {
+ rrScrPriv(pScreen);
+ if (pScrPriv->rrCrtcGetGamma)
+ ret = (*pScrPriv->rrCrtcGetGamma) (pScreen, crtc);
+ }
+#endif
+ return ret;
+}
+
+/*
+ * Notify the extension that the Crtc gamma has been changed
+ * The driver calls this whenever it has changed the gamma values
+ * in the RRCrtcRec
+ */
+
+Bool
+RRCrtcGammaNotify (RRCrtcPtr crtc)
+{
+ return TRUE; /* not much going on here */
+}
+
+static void
+RRModeGetScanoutSize (RRModePtr mode, PictTransformPtr transform,
+ int *width, int *height)
+{
+ BoxRec box;
+
+ if (mode == NULL) {
+ *width = 0;
+ *height = 0;
+ return;
+ }
+
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = mode->mode.width;
+ box.y2 = mode->mode.height;
+
+ pixman_transform_bounds (transform, &box);
+ *width = box.x2 - box.x1;
+ *height = box.y2 - box.y1;
+}
+
+/**
+ * Returns the width/height that the crtc scans out from the framebuffer
+ */
+void
+RRCrtcGetScanoutSize(RRCrtcPtr crtc, int *width, int *height)
+{
+ return RRModeGetScanoutSize (crtc->mode, &crtc->transform, width, height);
+}
+
+/*
+ * Set the size of the gamma table at server startup time
+ */
+
+Bool
+RRCrtcGammaSetSize (RRCrtcPtr crtc,
+ int size)
+{
+ CARD16 *gamma;
+
+ if (size == crtc->gammaSize)
+ return TRUE;
+ if (size)
+ {
+ gamma = malloc(size * 3 * sizeof (CARD16));
+ if (!gamma)
+ return FALSE;
+ }
+ else
+ gamma = NULL;
+ free(crtc->gammaRed);
+ crtc->gammaRed = gamma;
+ crtc->gammaGreen = gamma + size;
+ crtc->gammaBlue = gamma + size*2;
+ crtc->gammaSize = size;
+ return TRUE;
+}
+
+/*
+ * Set the pending CRTC transformation
+ */
+
+int
+RRCrtcTransformSet (RRCrtcPtr crtc,
+ PictTransformPtr transform,
+ struct pixman_f_transform *f_transform,
+ struct pixman_f_transform *f_inverse,
+ char *filter_name,
+ int filter_len,
+ xFixed *params,
+ int nparams)
+{
+ PictFilterPtr filter = NULL;
+ int width = 0, height = 0;
+
+ if (!crtc->transforms)
+ return BadValue;
+
+ if (filter_len)
+ {
+ filter = PictureFindFilter (crtc->pScreen,
+ filter_name,
+ filter_len);
+ if (!filter)
+ return BadName;
+ if (filter->ValidateParams)
+ {
+ if (!filter->ValidateParams (crtc->pScreen, filter->id,
+ params, nparams, &width, &height))
+ return BadMatch;
+ }
+ else {
+ width = filter->width;
+ height = filter->height;
+ }
+ }
+ else
+ {
+ if (nparams)
+ return BadMatch;
+ }
+ if (!RRTransformSetFilter (&crtc->client_pending_transform,
+ filter, params, nparams, width, height))
+ return BadAlloc;
+
+ crtc->client_pending_transform.transform = *transform;
+ crtc->client_pending_transform.f_transform = *f_transform;
+ crtc->client_pending_transform.f_inverse = *f_inverse;
+ return Success;
+}
+
+/*
+ * Initialize crtc type
+ */
+Bool
+RRCrtcInit (void)
+{
+ RRCrtcType = CreateNewResourceType (RRCrtcDestroyResource, "CRTC");
+ if (!RRCrtcType)
+ return FALSE;
+
+ return TRUE;
+}
+
+/*
+ * Initialize crtc type error value
+ */
+void
+RRCrtcInitErrorValue(void)
+{
+ SetResourceTypeErrorValue(RRCrtcType, RRErrorBase + BadRRCrtc);
+}
+
+int
+ProcRRGetCrtcInfo (ClientPtr client)
+{
+ REQUEST(xRRGetCrtcInfoReq);
+ xRRGetCrtcInfoReply rep;
+ RRCrtcPtr crtc;
+ CARD8 *extra;
+ unsigned long extraLen;
+ ScreenPtr pScreen;
+ rrScrPrivPtr pScrPriv;
+ RRModePtr mode;
+ RROutput *outputs;
+ RROutput *possible;
+ int i, j, k, n;
+ int width, height;
+ BoxRec panned_area;
+
+ REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq);
+ VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
+
+ /* All crtcs must be associated with screens before client
+ * requests are processed
+ */
+ pScreen = crtc->pScreen;
+ pScrPriv = rrGetScrPriv(pScreen);
+
+ mode = crtc->mode;
+
+ rep.type = X_Reply;
+ rep.status = RRSetConfigSuccess;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.timestamp = pScrPriv->lastSetTime.milliseconds;
+ if (pScrPriv->rrGetPanning &&
+ pScrPriv->rrGetPanning (pScreen, crtc, &panned_area, NULL, NULL) &&
+ (panned_area.x2 > panned_area.x1) && (panned_area.y2 > panned_area.y1))
+ {
+ rep.x = panned_area.x1;
+ rep.y = panned_area.y1;
+ rep.width = panned_area.x2 - panned_area.x1;
+ rep.height = panned_area.y2 - panned_area.y1;
+ }
+ else
+ {
+ RRCrtcGetScanoutSize (crtc, &width, &height);
+ rep.x = crtc->x;
+ rep.y = crtc->y;
+ rep.width = width;
+ rep.height = height;
+ }
+ rep.mode = mode ? mode->mode.id : 0;
+ rep.rotation = crtc->rotation;
+ rep.rotations = crtc->rotations;
+ rep.nOutput = crtc->numOutputs;
+ k = 0;
+ for (i = 0; i < pScrPriv->numOutputs; i++)
+ for (j = 0; j < pScrPriv->outputs[i]->numCrtcs; j++)
+ if (pScrPriv->outputs[i]->crtcs[j] == crtc)
+ k++;
+ rep.nPossibleOutput = k;
+
+ rep.length = rep.nOutput + rep.nPossibleOutput;
+
+ extraLen = rep.length << 2;
+ if (extraLen)
+ {
+ extra = malloc(extraLen);
+ if (!extra)
+ return BadAlloc;
+ }
+ else
+ extra = NULL;
+
+ outputs = (RROutput *) extra;
+ possible = (RROutput *) (outputs + rep.nOutput);
+
+ for (i = 0; i < crtc->numOutputs; i++)
+ {
+ outputs[i] = crtc->outputs[i]->id;
+ if (client->swapped)
+ swapl (&outputs[i], n);
+ }
+ k = 0;
+ for (i = 0; i < pScrPriv->numOutputs; i++)
+ for (j = 0; j < pScrPriv->outputs[i]->numCrtcs; j++)
+ if (pScrPriv->outputs[i]->crtcs[j] == crtc)
+ {
+ possible[k] = pScrPriv->outputs[i]->id;
+ if (client->swapped)
+ swapl (&possible[k], n);
+ k++;
+ }
+
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.timestamp, n);
+ swaps(&rep.x, n);
+ swaps(&rep.y, n);
+ swaps(&rep.width, n);
+ swaps(&rep.height, n);
+ swapl(&rep.mode, n);
+ swaps(&rep.rotation, n);
+ swaps(&rep.rotations, n);
+ swaps(&rep.nOutput, n);
+ swaps(&rep.nPossibleOutput, n);
+ }
+ WriteToClient(client, sizeof(xRRGetCrtcInfoReply), (char *)&rep);
+ if (extraLen)
+ {
+ WriteToClient (client, extraLen, (char *) extra);
+ free(extra);
+ }
+
+ return Success;
+}
+
+int
+ProcRRSetCrtcConfig (ClientPtr client)
+{
+ REQUEST(xRRSetCrtcConfigReq);
+ xRRSetCrtcConfigReply rep;
+ ScreenPtr pScreen;
+ rrScrPrivPtr pScrPriv;
+ RRCrtcPtr crtc;
+ RRModePtr mode;
+ int numOutputs;
+ RROutputPtr *outputs = NULL;
+ RROutput *outputIds;
+ TimeStamp configTime;
+ TimeStamp time;
+ Rotation rotation;
+ int rc, i, j;
+
+ REQUEST_AT_LEAST_SIZE(xRRSetCrtcConfigReq);
+ numOutputs = (stuff->length - bytes_to_int32(SIZEOF (xRRSetCrtcConfigReq)));
+
+ VERIFY_RR_CRTC(stuff->crtc, crtc, DixSetAttrAccess);
+
+ if (stuff->mode == None)
+ {
+ mode = NULL;
+ if (numOutputs > 0)
+ return BadMatch;
+ }
+ else
+ {
+ VERIFY_RR_MODE(stuff->mode, mode, DixSetAttrAccess);
+ if (numOutputs == 0)
+ return BadMatch;
+ }
+ if (numOutputs)
+ {
+ outputs = malloc(numOutputs * sizeof (RROutputPtr));
+ if (!outputs)
+ return BadAlloc;
+ }
+ else
+ outputs = NULL;
+
+ outputIds = (RROutput *) (stuff + 1);
+ for (i = 0; i < numOutputs; i++)
+ {
+ rc = dixLookupResourceByType((pointer *)(outputs + i), outputIds[i],
+ RROutputType, client, DixSetAttrAccess);
+ if (rc != Success)
+ {
+ free(outputs);
+ return rc;
+ }
+ /* validate crtc for this output */
+ for (j = 0; j < outputs[i]->numCrtcs; j++)
+ if (outputs[i]->crtcs[j] == crtc)
+ break;
+ if (j == outputs[i]->numCrtcs)
+ {
+ free(outputs);
+ return BadMatch;
+ }
+ /* validate mode for this output */
+ for (j = 0; j < outputs[i]->numModes + outputs[i]->numUserModes; j++)
+ {
+ RRModePtr m = (j < outputs[i]->numModes ?
+ outputs[i]->modes[j] :
+ outputs[i]->userModes[j - outputs[i]->numModes]);
+ if (m == mode)
+ break;
+ }
+ if (j == outputs[i]->numModes + outputs[i]->numUserModes)
+ {
+ free(outputs);
+ return BadMatch;
+ }
+ }
+ /* validate clones */
+ for (i = 0; i < numOutputs; i++)
+ {
+ for (j = 0; j < numOutputs; j++)
+ {
+ int k;
+ if (i == j)
+ continue;
+ for (k = 0; k < outputs[i]->numClones; k++)
+ {
+ if (outputs[i]->clones[k] == outputs[j])
+ break;
+ }
+ if (k == outputs[i]->numClones)
+ {
+ free(outputs);
+ return BadMatch;
+ }
+ }
+ }
+
+ pScreen = crtc->pScreen;
+ pScrPriv = rrGetScrPriv(pScreen);
+
+ time = ClientTimeToServerTime(stuff->timestamp);
+ configTime = ClientTimeToServerTime(stuff->configTimestamp);
+
+ if (!pScrPriv)
+ {
+ time = currentTime;
+ rep.status = RRSetConfigFailed;
+ goto sendReply;
+ }
+
+ /*
+ * Validate requested rotation
+ */
+ rotation = (Rotation) stuff->rotation;
+
+ /* test the rotation bits only! */
+ switch (rotation & 0xf) {
+ case RR_Rotate_0:
+ case RR_Rotate_90:
+ case RR_Rotate_180:
+ case RR_Rotate_270:
+ break;
+ default:
+ /*
+ * Invalid rotation
+ */
+ client->errorValue = stuff->rotation;
+ free(outputs);
+ return BadValue;
+ }
+
+ if (mode)
+ {
+ if ((~crtc->rotations) & rotation)
+ {
+ /*
+ * requested rotation or reflection not supported by screen
+ */
+ client->errorValue = stuff->rotation;
+ free(outputs);
+ return BadMatch;
+ }
+
+#ifdef RANDR_12_INTERFACE
+ /*
+ * Check screen size bounds if the DDX provides a 1.2 interface
+ * for setting screen size. Else, assume the CrtcSet sets
+ * the size along with the mode. If the driver supports transforms,
+ * then it must allow crtcs to display a subset of the screen, so
+ * only do this check for drivers without transform support.
+ */
+ if (pScrPriv->rrScreenSetSize && !crtc->transforms)
+ {
+ int source_width;
+ int source_height;
+ PictTransform transform;
+ struct pixman_f_transform f_transform, f_inverse;
+
+ RRTransformCompute (stuff->x, stuff->y,
+ mode->mode.width, mode->mode.height,
+ rotation,
+ &crtc->client_pending_transform,
+ &transform, &f_transform, &f_inverse);
+
+ RRModeGetScanoutSize (mode, &transform, &source_width, &source_height);
+ if (stuff->x + source_width > pScreen->width)
+ {
+ client->errorValue = stuff->x;
+ free(outputs);
+ return BadValue;
+ }
+
+ if (stuff->y + source_height > pScreen->height)
+ {
+ client->errorValue = stuff->y;
+ free(outputs);
+ return BadValue;
+ }
+ }
+#endif
+ }
+
+ if (!RRCrtcSet (crtc, mode, stuff->x, stuff->y,
+ rotation, numOutputs, outputs))
+ {
+ rep.status = RRSetConfigFailed;
+ goto sendReply;
+ }
+ rep.status = RRSetConfigSuccess;
+ pScrPriv->lastSetTime = time;
+
+sendReply:
+ free(outputs);
+
+ rep.type = X_Reply;
+ /* rep.status has already been filled in */
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.newTimestamp = pScrPriv->lastSetTime.milliseconds;
+
+ if (client->swapped)
+ {
+ int n;
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.newTimestamp, n);
+ }
+ WriteToClient(client, sizeof(xRRSetCrtcConfigReply), (char *)&rep);
+
+ return Success;
+}
+
+int
+ProcRRGetPanning (ClientPtr client)
+{
+ REQUEST(xRRGetPanningReq);
+ xRRGetPanningReply rep;
+ RRCrtcPtr crtc;
+ ScreenPtr pScreen;
+ rrScrPrivPtr pScrPriv;
+ BoxRec total;
+ BoxRec tracking;
+ INT16 border[4];
+ int n;
+
+ REQUEST_SIZE_MATCH(xRRGetPanningReq);
+ VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
+
+ /* All crtcs must be associated with screens before client
+ * requests are processed
+ */
+ pScreen = crtc->pScreen;
+ pScrPriv = rrGetScrPriv(pScreen);
+
+ if (!pScrPriv)
+ return RRErrorBase + BadRRCrtc;
+
+ memset(&rep, 0, sizeof(rep));
+ rep.type = X_Reply;
+ rep.status = RRSetConfigSuccess;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 1;
+ rep.timestamp = pScrPriv->lastSetTime.milliseconds;
+
+ if (pScrPriv->rrGetPanning &&
+ pScrPriv->rrGetPanning (pScreen, crtc, &total, &tracking, border)) {
+ rep.left = total.x1;
+ rep.top = total.y1;
+ rep.width = total.x2 - total.x1;
+ rep.height = total.y2 - total.y1;
+ rep.track_left = tracking.x1;
+ rep.track_top = tracking.y1;
+ rep.track_width = tracking.x2 - tracking.x1;
+ rep.track_height = tracking.y2 - tracking.y1;
+ rep.border_left = border[0];
+ rep.border_top = border[1];
+ rep.border_right = border[2];
+ rep.border_bottom = border[3];
+ }
+
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swaps(&rep.timestamp, n);
+ swaps(&rep.left, n);
+ swaps(&rep.top, n);
+ swaps(&rep.width, n);
+ swaps(&rep.height, n);
+ swaps(&rep.track_left, n);
+ swaps(&rep.track_top, n);
+ swaps(&rep.track_width, n);
+ swaps(&rep.track_height, n);
+ swaps(&rep.border_left, n);
+ swaps(&rep.border_top, n);
+ swaps(&rep.border_right, n);
+ swaps(&rep.border_bottom, n);
+ }
+ WriteToClient(client, sizeof(xRRGetPanningReply), (char *)&rep);
+ return Success;
+}
+
+int
+ProcRRSetPanning (ClientPtr client)
+{
+ REQUEST(xRRSetPanningReq);
+ xRRSetPanningReply rep;
+ RRCrtcPtr crtc;
+ ScreenPtr pScreen;
+ rrScrPrivPtr pScrPriv;
+ TimeStamp time;
+ BoxRec total;
+ BoxRec tracking;
+ INT16 border[4];
+ int n;
+
+ REQUEST_SIZE_MATCH(xRRSetPanningReq);
+ VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
+
+ /* All crtcs must be associated with screens before client
+ * requests are processed
+ */
+ pScreen = crtc->pScreen;
+ pScrPriv = rrGetScrPriv(pScreen);
+
+ if (!pScrPriv) {
+ time = currentTime;
+ rep.status = RRSetConfigFailed;
+ goto sendReply;
+ }
+
+ time = ClientTimeToServerTime(stuff->timestamp);
+
+ if (!pScrPriv->rrGetPanning)
+ return RRErrorBase + BadRRCrtc;
+
+ total.x1 = stuff->left;
+ total.y1 = stuff->top;
+ total.x2 = total.x1 + stuff->width;
+ total.y2 = total.y1 + stuff->height;
+ tracking.x1 = stuff->track_left;
+ tracking.y1 = stuff->track_top;
+ tracking.x2 = tracking.x1 + stuff->track_width;
+ tracking.y2 = tracking.y1 + stuff->track_height;
+ border[0] = stuff->border_left;
+ border[1] = stuff->border_top;
+ border[2] = stuff->border_right;
+ border[3] = stuff->border_bottom;
+
+ if (! pScrPriv->rrSetPanning (pScreen, crtc, &total, &tracking, border))
+ return BadMatch;
+
+ pScrPriv->lastSetTime = time;
+
+ rep.status = RRSetConfigSuccess;
+
+sendReply:
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.newTimestamp = pScrPriv->lastSetTime.milliseconds;
+
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swaps(&rep.newTimestamp, n);
+ }
+ WriteToClient(client, sizeof(xRRSetPanningReply), (char *)&rep);
+ return Success;
+}
+
+int
+ProcRRGetCrtcGammaSize (ClientPtr client)
+{
+ REQUEST(xRRGetCrtcGammaSizeReq);
+ xRRGetCrtcGammaSizeReply reply;
+ RRCrtcPtr crtc;
+ int n;
+
+ REQUEST_SIZE_MATCH(xRRGetCrtcGammaSizeReq);
+ VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
+
+ /* Gamma retrieval failed, any better error? */
+ if (!RRCrtcGammaGet(crtc))
+ return RRErrorBase + BadRRCrtc;
+
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ reply.length = 0;
+ reply.size = crtc->gammaSize;
+ if (client->swapped) {
+ swaps (&reply.sequenceNumber, n);
+ swapl (&reply.length, n);
+ swaps (&reply.size, n);
+ }
+ WriteToClient (client, sizeof (xRRGetCrtcGammaSizeReply), (char *) &reply);
+ return Success;
+}
+
+int
+ProcRRGetCrtcGamma (ClientPtr client)
+{
+ REQUEST(xRRGetCrtcGammaReq);
+ xRRGetCrtcGammaReply reply;
+ RRCrtcPtr crtc;
+ int n;
+ unsigned long len;
+ char *extra = NULL;
+
+ REQUEST_SIZE_MATCH(xRRGetCrtcGammaReq);
+ VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
+
+ /* Gamma retrieval failed, any better error? */
+ if (!RRCrtcGammaGet(crtc))
+ return RRErrorBase + BadRRCrtc;
+
+ len = crtc->gammaSize * 3 * 2;
+
+ if (crtc->gammaSize) {
+ extra = malloc(len);
+ if (!extra)
+ return BadAlloc;
+ }
+
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ reply.length = bytes_to_int32(len);
+ reply.size = crtc->gammaSize;
+ if (client->swapped) {
+ swaps (&reply.sequenceNumber, n);
+ swapl (&reply.length, n);
+ swaps (&reply.size, n);
+ }
+ WriteToClient (client, sizeof (xRRGetCrtcGammaReply), (char *) &reply);
+ if (crtc->gammaSize)
+ {
+ memcpy(extra, crtc->gammaRed, len);
+ client->pSwapReplyFunc = (ReplySwapPtr)CopySwap16Write;
+ WriteSwappedDataToClient (client, len, extra);
+ free(extra);
+ }
+ return Success;
+}
+
+int
+ProcRRSetCrtcGamma (ClientPtr client)
+{
+ REQUEST(xRRSetCrtcGammaReq);
+ RRCrtcPtr crtc;
+ unsigned long len;
+ CARD16 *red, *green, *blue;
+
+ REQUEST_AT_LEAST_SIZE(xRRSetCrtcGammaReq);
+ VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
+
+ len = client->req_len - bytes_to_int32(sizeof (xRRSetCrtcGammaReq));
+ if (len < (stuff->size * 3 + 1) >> 1)
+ return BadLength;
+
+ if (stuff->size != crtc->gammaSize)
+ return BadMatch;
+
+ red = (CARD16 *) (stuff + 1);
+ green = red + crtc->gammaSize;
+ blue = green + crtc->gammaSize;
+
+ RRCrtcGammaSet (crtc, red, green, blue);
+
+ return Success;
+}
+
+/* Version 1.3 additions */
+
+int
+ProcRRSetCrtcTransform (ClientPtr client)
+{
+ REQUEST(xRRSetCrtcTransformReq);
+ RRCrtcPtr crtc;
+ PictTransform transform;
+ struct pixman_f_transform f_transform, f_inverse;
+ char *filter;
+ int nbytes;
+ xFixed *params;
+ int nparams;
+
+ REQUEST_AT_LEAST_SIZE(xRRSetCrtcTransformReq);
+ VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
+
+ PictTransform_from_xRenderTransform (&transform, &stuff->transform);
+ pixman_f_transform_from_pixman_transform (&f_transform, &transform);
+ if (!pixman_f_transform_invert (&f_inverse, &f_transform))
+ return BadMatch;
+
+ filter = (char *) (stuff + 1);
+ nbytes = stuff->nbytesFilter;
+ params = (xFixed *) (filter + pad_to_int32(nbytes));
+ nparams = ((xFixed *) stuff + client->req_len) - params;
+ if (nparams < 0)
+ return BadLength;
+
+ return RRCrtcTransformSet (crtc, &transform, &f_transform, &f_inverse,
+ filter, nbytes, params, nparams);
+}
+
+
+#define CrtcTransformExtra (SIZEOF(xRRGetCrtcTransformReply) - 32)
+
+static int
+transform_filter_length (RRTransformPtr transform)
+{
+ int nbytes, nparams;
+
+ if (transform->filter == NULL)
+ return 0;
+ nbytes = strlen (transform->filter->name);
+ nparams = transform->nparams;
+ return pad_to_int32(nbytes) + (nparams * sizeof (xFixed));
+}
+
+static int
+transform_filter_encode (ClientPtr client, char *output,
+ CARD16 *nbytesFilter,
+ CARD16 *nparamsFilter,
+ RRTransformPtr transform)
+{
+ int nbytes, nparams;
+ int n;
+
+ if (transform->filter == NULL) {
+ *nbytesFilter = 0;
+ *nparamsFilter = 0;
+ return 0;
+ }
+ nbytes = strlen (transform->filter->name);
+ nparams = transform->nparams;
+ *nbytesFilter = nbytes;
+ *nparamsFilter = nparams;
+ memcpy (output, transform->filter->name, nbytes);
+ while ((nbytes & 3) != 0)
+ output[nbytes++] = 0;
+ memcpy (output + nbytes, transform->params, nparams * sizeof (xFixed));
+ if (client->swapped) {
+ swaps (nbytesFilter, n);
+ swaps (nparamsFilter, n);
+ SwapLongs ((CARD32 *) (output + nbytes), nparams);
+ }
+ nbytes += nparams * sizeof (xFixed);
+ return nbytes;
+}
+
+static void
+transform_encode (ClientPtr client, xRenderTransform *wire, PictTransform *pict)
+{
+ xRenderTransform_from_PictTransform (wire, pict);
+ if (client->swapped)
+ SwapLongs ((CARD32 *) wire, bytes_to_int32(sizeof(xRenderTransform)));
+}
+
+int
+ProcRRGetCrtcTransform (ClientPtr client)
+{
+ REQUEST(xRRGetCrtcTransformReq);
+ xRRGetCrtcTransformReply *reply;
+ RRCrtcPtr crtc;
+ int n, nextra;
+ RRTransformPtr current, pending;
+ char *extra;
+
+ REQUEST_SIZE_MATCH (xRRGetCrtcTransformReq);
+ VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
+
+ pending = &crtc->client_pending_transform;
+ current = &crtc->client_current_transform;
+
+ nextra = (transform_filter_length (pending) +
+ transform_filter_length (current));
+
+ reply = malloc(sizeof (xRRGetCrtcTransformReply) + nextra);
+ if (!reply)
+ return BadAlloc;
+
+ extra = (char *) (reply + 1);
+ reply->type = X_Reply;
+ reply->sequenceNumber = client->sequence;
+ reply->length = bytes_to_int32(CrtcTransformExtra + nextra);
+
+ reply->hasTransforms = crtc->transforms;
+
+ transform_encode (client, &reply->pendingTransform, &pending->transform);
+ extra += transform_filter_encode (client, extra,
+ &reply->pendingNbytesFilter,
+ &reply->pendingNparamsFilter,
+ pending);
+
+ transform_encode (client, &reply->currentTransform, &current->transform);
+ extra += transform_filter_encode (client, extra,
+ &reply->currentNbytesFilter,
+ &reply->currentNparamsFilter,
+ current);
+
+ if (client->swapped) {
+ swaps (&reply->sequenceNumber, n);
+ swapl (&reply->length, n);
+ }
+ WriteToClient (client, sizeof (xRRGetCrtcTransformReply) + nextra, (char *) reply);
+ free(reply);
+ return Success;
+}
diff --git a/xorg-server/randr/rrdispatch.c b/xorg-server/randr/rrdispatch.c
index b9cbb5858..ac4d2acc1 100644
--- a/xorg-server/randr/rrdispatch.c
+++ b/xorg-server/randr/rrdispatch.c
@@ -1,234 +1,228 @@
-/*
- * Copyright © 2006 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting documentation, and
- * that the name of the copyright holders not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. The copyright holders make no representations
- * about the suitability of this software for any purpose. It is provided "as
- * is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
- * OF THIS SOFTWARE.
- */
-
-#include "randrstr.h"
-#include "protocol-versions.h"
-
-Bool
-RRClientKnowsRates (ClientPtr pClient)
-{
- rrClientPriv(pClient);
-
- return (pRRClient->major_version > 1 ||
- (pRRClient->major_version == 1 && pRRClient->minor_version >= 1));
-}
-
-static int
-ProcRRQueryVersion (ClientPtr client)
-{
- xRRQueryVersionReply rep = {0};
- register int n;
- REQUEST(xRRQueryVersionReq);
- rrClientPriv(client);
-
- REQUEST_SIZE_MATCH(xRRQueryVersionReq);
- pRRClient->major_version = stuff->majorVersion;
- pRRClient->minor_version = stuff->minorVersion;
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
- if ((stuff->majorVersion * 1000 + stuff->minorVersion) <
- (SERVER_RANDR_MAJOR_VERSION * 1000 + SERVER_RANDR_MINOR_VERSION))
- {
- rep.majorVersion = stuff->majorVersion;
- rep.minorVersion = stuff->minorVersion;
- } else
- {
- rep.majorVersion = SERVER_RANDR_MAJOR_VERSION;
- rep.minorVersion = SERVER_RANDR_MINOR_VERSION;
- }
-
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.majorVersion, n);
- swapl(&rep.minorVersion, n);
- }
- WriteToClient(client, sizeof(xRRQueryVersionReply), (char *)&rep);
- return Success;
-}
-
-static int
-ProcRRSelectInput (ClientPtr client)
-{
- REQUEST(xRRSelectInputReq);
- rrClientPriv(client);
- RRTimesPtr pTimes;
- WindowPtr pWin;
- RREventPtr pRREvent, *pHead;
- XID clientResource;
- int rc;
-
- REQUEST_SIZE_MATCH(xRRSelectInputReq);
- rc = dixLookupWindow(&pWin, stuff->window, client, DixReceiveAccess);
- if (rc != Success)
- return rc;
- rc = dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id,
- RREventType, client, DixWriteAccess);
- if (rc != Success && rc != BadValue)
- return rc;
-
- if (stuff->enable & (RRScreenChangeNotifyMask|
- RRCrtcChangeNotifyMask|
- RROutputChangeNotifyMask|
- RROutputPropertyNotifyMask))
- {
- ScreenPtr pScreen = pWin->drawable.pScreen;
- rrScrPriv (pScreen);
-
- pRREvent = NULL;
- if (pHead)
- {
- /* check for existing entry. */
- for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next)
- if (pRREvent->client == client)
- break;
- }
-
- if (!pRREvent)
- {
- /* build the entry */
- pRREvent = (RREventPtr) malloc(sizeof (RREventRec));
- if (!pRREvent)
- return BadAlloc;
- pRREvent->next = 0;
- pRREvent->client = client;
- pRREvent->window = pWin;
- pRREvent->mask = stuff->enable;
- /*
- * add a resource that will be deleted when
- * the client goes away
- */
- clientResource = FakeClientID (client->index);
- pRREvent->clientResource = clientResource;
- if (!AddResource (clientResource, RRClientType, (pointer)pRREvent))
- return BadAlloc;
- /*
- * create a resource to contain a pointer to the list
- * of clients selecting input. This must be indirect as
- * the list may be arbitrarily rearranged which cannot be
- * done through the resource database.
- */
- if (!pHead)
- {
- pHead = (RREventPtr *) malloc(sizeof (RREventPtr));
- if (!pHead ||
- !AddResource (pWin->drawable.id, RREventType, (pointer)pHead))
- {
- FreeResource (clientResource, RT_NONE);
- return BadAlloc;
- }
- *pHead = 0;
- }
- pRREvent->next = *pHead;
- *pHead = pRREvent;
- }
- /*
- * Now see if the client needs an event
- */
- if (pScrPriv && (pRREvent->mask & RRScreenChangeNotifyMask))
- {
- pTimes = &((RRTimesPtr) (pRRClient + 1))[pScreen->myNum];
- if (CompareTimeStamps (pTimes->setTime,
- pScrPriv->lastSetTime) != 0 ||
- CompareTimeStamps (pTimes->configTime,
- pScrPriv->lastConfigTime) != 0)
- {
- RRDeliverScreenEvent (client, pWin, pScreen);
- }
- }
- }
- else if (stuff->enable == 0)
- {
- /* delete the interest */
- if (pHead) {
- RREventPtr pNewRREvent = 0;
- for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next) {
- if (pRREvent->client == client)
- break;
- pNewRREvent = pRREvent;
- }
- if (pRREvent) {
- FreeResource (pRREvent->clientResource, RRClientType);
- if (pNewRREvent)
- pNewRREvent->next = pRREvent->next;
- else
- *pHead = pRREvent->next;
- free(pRREvent);
- }
- }
- }
- else
- {
- client->errorValue = stuff->enable;
- return BadValue;
- }
- return Success;
-}
-
-int (*ProcRandrVector[RRNumberRequests])(ClientPtr) = {
- ProcRRQueryVersion, /* 0 */
-/* we skip 1 to make old clients fail pretty immediately */
- NULL, /* 1 ProcRandrOldGetScreenInfo */
-/* V1.0 apps share the same set screen config request id */
- ProcRRSetScreenConfig, /* 2 */
- NULL, /* 3 ProcRandrOldScreenChangeSelectInput */
-/* 3 used to be ScreenChangeSelectInput; deprecated */
- ProcRRSelectInput, /* 4 */
- ProcRRGetScreenInfo, /* 5 */
-/* V1.2 additions */
- ProcRRGetScreenSizeRange, /* 6 */
- ProcRRSetScreenSize, /* 7 */
- ProcRRGetScreenResources, /* 8 */
- ProcRRGetOutputInfo, /* 9 */
- ProcRRListOutputProperties, /* 10 */
- ProcRRQueryOutputProperty, /* 11 */
- ProcRRConfigureOutputProperty, /* 12 */
- ProcRRChangeOutputProperty, /* 13 */
- ProcRRDeleteOutputProperty, /* 14 */
- ProcRRGetOutputProperty, /* 15 */
- ProcRRCreateMode, /* 16 */
- ProcRRDestroyMode, /* 17 */
- ProcRRAddOutputMode, /* 18 */
- ProcRRDeleteOutputMode, /* 19 */
- ProcRRGetCrtcInfo, /* 20 */
- ProcRRSetCrtcConfig, /* 21 */
- ProcRRGetCrtcGammaSize, /* 22 */
- ProcRRGetCrtcGamma, /* 23 */
- ProcRRSetCrtcGamma, /* 24 */
-/* V1.3 additions */
- ProcRRGetScreenResourcesCurrent, /* 25 */
- ProcRRSetCrtcTransform, /* 26 */
- ProcRRGetCrtcTransform, /* 27 */
- ProcRRGetPanning, /* 28 */
- ProcRRSetPanning, /* 29 */
- ProcRRSetOutputPrimary, /* 30 */
- ProcRRGetOutputPrimary, /* 31 */
-/* V1.4 additions */
- ProcRRQueryScanoutPixmaps, /* 32 */
- ProcRRCreateScanoutPixmap, /* 33 */
- ProcRRSetCrtcSpriteTransform,/* 34 */
- ProcRRGetCrtcSpriteTransform,/* 35 */
- ProcRRSetCrtcConfigs, /* 36 */
-};
-
+/*
+ * Copyright © 2006 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#include "randrstr.h"
+#include "protocol-versions.h"
+
+Bool
+RRClientKnowsRates (ClientPtr pClient)
+{
+ rrClientPriv(pClient);
+
+ return (pRRClient->major_version > 1 ||
+ (pRRClient->major_version == 1 && pRRClient->minor_version >= 1));
+}
+
+static int
+ProcRRQueryVersion (ClientPtr client)
+{
+ xRRQueryVersionReply rep = {0};
+ register int n;
+ REQUEST(xRRQueryVersionReq);
+ rrClientPriv(client);
+
+ REQUEST_SIZE_MATCH(xRRQueryVersionReq);
+ pRRClient->major_version = stuff->majorVersion;
+ pRRClient->minor_version = stuff->minorVersion;
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ if ((stuff->majorVersion * 1000 + stuff->minorVersion) <
+ (SERVER_RANDR_MAJOR_VERSION * 1000 + SERVER_RANDR_MINOR_VERSION))
+ {
+ rep.majorVersion = stuff->majorVersion;
+ rep.minorVersion = stuff->minorVersion;
+ } else
+ {
+ rep.majorVersion = SERVER_RANDR_MAJOR_VERSION;
+ rep.minorVersion = SERVER_RANDR_MINOR_VERSION;
+ }
+
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.majorVersion, n);
+ swapl(&rep.minorVersion, n);
+ }
+ WriteToClient(client, sizeof(xRRQueryVersionReply), (char *)&rep);
+ return Success;
+}
+
+static int
+ProcRRSelectInput (ClientPtr client)
+{
+ REQUEST(xRRSelectInputReq);
+ rrClientPriv(client);
+ RRTimesPtr pTimes;
+ WindowPtr pWin;
+ RREventPtr pRREvent, *pHead;
+ XID clientResource;
+ int rc;
+
+ REQUEST_SIZE_MATCH(xRRSelectInputReq);
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixReceiveAccess);
+ if (rc != Success)
+ return rc;
+ rc = dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id,
+ RREventType, client, DixWriteAccess);
+ if (rc != Success && rc != BadValue)
+ return rc;
+
+ if (stuff->enable & (RRScreenChangeNotifyMask|
+ RRCrtcChangeNotifyMask|
+ RROutputChangeNotifyMask|
+ RROutputPropertyNotifyMask))
+ {
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ rrScrPriv (pScreen);
+
+ pRREvent = NULL;
+ if (pHead)
+ {
+ /* check for existing entry. */
+ for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next)
+ if (pRREvent->client == client)
+ break;
+ }
+
+ if (!pRREvent)
+ {
+ /* build the entry */
+ pRREvent = (RREventPtr) malloc(sizeof (RREventRec));
+ if (!pRREvent)
+ return BadAlloc;
+ pRREvent->next = 0;
+ pRREvent->client = client;
+ pRREvent->window = pWin;
+ pRREvent->mask = stuff->enable;
+ /*
+ * add a resource that will be deleted when
+ * the client goes away
+ */
+ clientResource = FakeClientID (client->index);
+ pRREvent->clientResource = clientResource;
+ if (!AddResource (clientResource, RRClientType, (pointer)pRREvent))
+ return BadAlloc;
+ /*
+ * create a resource to contain a pointer to the list
+ * of clients selecting input. This must be indirect as
+ * the list may be arbitrarily rearranged which cannot be
+ * done through the resource database.
+ */
+ if (!pHead)
+ {
+ pHead = (RREventPtr *) malloc(sizeof (RREventPtr));
+ if (!pHead ||
+ !AddResource (pWin->drawable.id, RREventType, (pointer)pHead))
+ {
+ FreeResource (clientResource, RT_NONE);
+ return BadAlloc;
+ }
+ *pHead = 0;
+ }
+ pRREvent->next = *pHead;
+ *pHead = pRREvent;
+ }
+ /*
+ * Now see if the client needs an event
+ */
+ if (pScrPriv && (pRREvent->mask & RRScreenChangeNotifyMask))
+ {
+ pTimes = &((RRTimesPtr) (pRRClient + 1))[pScreen->myNum];
+ if (CompareTimeStamps (pTimes->setTime,
+ pScrPriv->lastSetTime) != 0 ||
+ CompareTimeStamps (pTimes->configTime,
+ pScrPriv->lastConfigTime) != 0)
+ {
+ RRDeliverScreenEvent (client, pWin, pScreen);
+ }
+ }
+ }
+ else if (stuff->enable == 0)
+ {
+ /* delete the interest */
+ if (pHead) {
+ RREventPtr pNewRREvent = 0;
+ for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next) {
+ if (pRREvent->client == client)
+ break;
+ pNewRREvent = pRREvent;
+ }
+ if (pRREvent) {
+ FreeResource (pRREvent->clientResource, RRClientType);
+ if (pNewRREvent)
+ pNewRREvent->next = pRREvent->next;
+ else
+ *pHead = pRREvent->next;
+ free(pRREvent);
+ }
+ }
+ }
+ else
+ {
+ client->errorValue = stuff->enable;
+ return BadValue;
+ }
+ return Success;
+}
+
+int (*ProcRandrVector[RRNumberRequests])(ClientPtr) = {
+ ProcRRQueryVersion, /* 0 */
+/* we skip 1 to make old clients fail pretty immediately */
+ NULL, /* 1 ProcRandrOldGetScreenInfo */
+/* V1.0 apps share the same set screen config request id */
+ ProcRRSetScreenConfig, /* 2 */
+ NULL, /* 3 ProcRandrOldScreenChangeSelectInput */
+/* 3 used to be ScreenChangeSelectInput; deprecated */
+ ProcRRSelectInput, /* 4 */
+ ProcRRGetScreenInfo, /* 5 */
+/* V1.2 additions */
+ ProcRRGetScreenSizeRange, /* 6 */
+ ProcRRSetScreenSize, /* 7 */
+ ProcRRGetScreenResources, /* 8 */
+ ProcRRGetOutputInfo, /* 9 */
+ ProcRRListOutputProperties, /* 10 */
+ ProcRRQueryOutputProperty, /* 11 */
+ ProcRRConfigureOutputProperty, /* 12 */
+ ProcRRChangeOutputProperty, /* 13 */
+ ProcRRDeleteOutputProperty, /* 14 */
+ ProcRRGetOutputProperty, /* 15 */
+ ProcRRCreateMode, /* 16 */
+ ProcRRDestroyMode, /* 17 */
+ ProcRRAddOutputMode, /* 18 */
+ ProcRRDeleteOutputMode, /* 19 */
+ ProcRRGetCrtcInfo, /* 20 */
+ ProcRRSetCrtcConfig, /* 21 */
+ ProcRRGetCrtcGammaSize, /* 22 */
+ ProcRRGetCrtcGamma, /* 23 */
+ ProcRRSetCrtcGamma, /* 24 */
+/* V1.3 additions */
+ ProcRRGetScreenResourcesCurrent, /* 25 */
+ ProcRRSetCrtcTransform, /* 26 */
+ ProcRRGetCrtcTransform, /* 27 */
+ ProcRRGetPanning, /* 28 */
+ ProcRRSetPanning, /* 29 */
+ ProcRRSetOutputPrimary, /* 30 */
+ ProcRRGetOutputPrimary, /* 31 */
+};
+
diff --git a/xorg-server/randr/rrinfo.c b/xorg-server/randr/rrinfo.c
index faac15afb..fdf372607 100644
--- a/xorg-server/randr/rrinfo.c
+++ b/xorg-server/randr/rrinfo.c
@@ -1,341 +1,341 @@
-/*
- * Copyright © 2006 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting documentation, and
- * that the name of the copyright holders not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. The copyright holders make no representations
- * about the suitability of this software for any purpose. It is provided "as
- * is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
- * OF THIS SOFTWARE.
- */
-
-#include "randrstr.h"
-
-#ifdef RANDR_10_INTERFACE
-static RRModePtr
-RROldModeAdd (RROutputPtr output, RRScreenSizePtr size, int refresh)
-{
- ScreenPtr pScreen = output->pScreen;
- rrScrPriv(pScreen);
- xRRModeInfo modeInfo;
- char name[100];
- RRModePtr mode;
- int i;
- RRModePtr *modes;
-
- memset (&modeInfo, '\0', sizeof (modeInfo));
- sprintf (name, "%dx%d", size->width, size->height);
-
- modeInfo.width = size->width;
- modeInfo.height = size->height;
- modeInfo.hTotal = size->width;
- modeInfo.vTotal = size->height;
- modeInfo.dotClock = ((CARD32) size->width * (CARD32) size->height *
- (CARD32) refresh);
- modeInfo.nameLength = strlen (name);
- mode = RRModeGet (&modeInfo, name);
- if (!mode)
- return NULL;
- for (i = 0; i < output->numModes; i++)
- if (output->modes[i] == mode)
- {
- RRModeDestroy (mode);
- return mode;
- }
-
- if (output->numModes)
- modes = realloc(output->modes,
- (output->numModes + 1) * sizeof (RRModePtr));
- else
- modes = malloc(sizeof (RRModePtr));
- if (!modes)
- {
- RRModeDestroy (mode);
- FreeResource (mode->mode.id, 0);
- return NULL;
- }
- modes[output->numModes++] = mode;
- output->modes = modes;
- output->changed = TRUE;
- pScrPriv->changed = TRUE;
- pScrPriv->configChanged = TRUE;
- return mode;
-}
-
-static void
-RRScanOldConfig (ScreenPtr pScreen, Rotation rotations)
-{
- rrScrPriv(pScreen);
- RROutputPtr output;
- RRCrtcPtr crtc;
- RRModePtr mode, newMode = NULL;
- int i;
- CARD16 minWidth = MAXSHORT, minHeight = MAXSHORT;
- CARD16 maxWidth = 0, maxHeight = 0;
-
- /*
- * First time through, create a crtc and output and hook
- * them together
- */
- if (pScrPriv->numOutputs == 0 &&
- pScrPriv->numCrtcs == 0)
- {
- crtc = RRCrtcCreate (pScreen, NULL);
- if (!crtc)
- return;
- output = RROutputCreate (pScreen, "default", 7, NULL);
- if (!output)
- return;
- RROutputSetCrtcs (output, &crtc, 1);
- RROutputSetConnection (output, RR_Connected);
- RROutputSetSubpixelOrder (output, PictureGetSubpixelOrder (pScreen));
- }
-
- output = pScrPriv->outputs[0];
- if (!output)
- return;
- crtc = pScrPriv->crtcs[0];
- if (!crtc)
- return;
-
- /* check rotations */
- if (rotations != crtc->rotations)
- {
- crtc->rotations = rotations;
- crtc->changed = TRUE;
- pScrPriv->changed = TRUE;
- }
-
- /* regenerate mode list */
- for (i = 0; i < pScrPriv->nSizes; i++)
- {
- RRScreenSizePtr size = &pScrPriv->pSizes[i];
- int r;
-
- if (size->nRates)
- {
- for (r = 0; r < size->nRates; r++)
- {
- mode = RROldModeAdd (output, size, size->pRates[r].rate);
- if (i == pScrPriv->size &&
- size->pRates[r].rate == pScrPriv->rate)
- {
- newMode = mode;
- }
- }
- free(size->pRates);
- }
- else
- {
- mode = RROldModeAdd (output, size, 0);
- if (i == pScrPriv->size)
- newMode = mode;
- }
- }
- if (pScrPriv->nSizes)
- free(pScrPriv->pSizes);
- pScrPriv->pSizes = NULL;
- pScrPriv->nSizes = 0;
-
- /* find size bounds */
- for (i = 0; i < output->numModes + output->numUserModes; i++)
- {
- RRModePtr mode = (i < output->numModes ?
- output->modes[i] :
- output->userModes[i-output->numModes]);
- CARD16 width = mode->mode.width;
- CARD16 height = mode->mode.height;
-
- if (width < minWidth) minWidth = width;
- if (width > maxWidth) maxWidth = width;
- if (height < minHeight) minHeight = height;
- if (height > maxHeight) maxHeight = height;
- }
-
- RRScreenSetSizeRange (pScreen, minWidth, minHeight, maxWidth, maxHeight);
-
- /* notice current mode */
- if (newMode)
- RRCrtcNotify (crtc, newMode, 0, 0, pScrPriv->rotation,
- NULL, 1, &output, NULL);
-}
-#endif
-
-/*
- * Poll the driver for changed information
- */
-Bool
-RRGetInfo (ScreenPtr pScreen, Bool force_query)
-{
- rrScrPriv (pScreen);
- Rotation rotations;
- int i;
-
- /* Return immediately if we don't need to re-query and we already have the
- * information.
- */
- if (!force_query) {
- if (pScrPriv->numCrtcs != 0 || pScrPriv->numOutputs != 0)
- return TRUE;
- }
-
- for (i = 0; i < pScrPriv->numOutputs; i++)
- pScrPriv->outputs[i]->changed = FALSE;
- for (i = 0; i < pScrPriv->numCrtcs; i++)
- pScrPriv->crtcs[i]->changed = FALSE;
-
- rotations = 0;
- pScrPriv->changed = FALSE;
- pScrPriv->configChanged = FALSE;
-
- if (!(*pScrPriv->rrGetInfo) (pScreen, &rotations))
- return FALSE;
-
-#if RANDR_10_INTERFACE
- if (pScrPriv->nSizes)
- RRScanOldConfig (pScreen, rotations);
-#endif
- RRTellChanged (pScreen);
- return TRUE;
-}
-
-/*
- * Register the range of sizes for the screen
- */
-void
-RRScreenSetSizeRange (ScreenPtr pScreen,
- CARD16 minWidth,
- CARD16 minHeight,
- CARD16 maxWidth,
- CARD16 maxHeight)
-{
- rrScrPriv (pScreen);
-
- if (!pScrPriv)
- return;
- if (pScrPriv->minWidth == minWidth && pScrPriv->minHeight == minHeight &&
- pScrPriv->maxWidth == maxWidth && pScrPriv->maxHeight == maxHeight)
- {
- return;
- }
-
- pScrPriv->minWidth = minWidth;
- pScrPriv->minHeight = minHeight;
- pScrPriv->maxWidth = maxWidth;
- pScrPriv->maxHeight = maxHeight;
- pScrPriv->changed = TRUE;
- pScrPriv->configChanged = TRUE;
-}
-
-#ifdef RANDR_10_INTERFACE
-static Bool
-RRScreenSizeMatches (RRScreenSizePtr a,
- RRScreenSizePtr b)
-{
- if (a->width != b->width)
- return FALSE;
- if (a->height != b->height)
- return FALSE;
- if (a->mmWidth != b->mmWidth)
- return FALSE;
- if (a->mmHeight != b->mmHeight)
- return FALSE;
- return TRUE;
-}
-
-RRScreenSizePtr
-RRRegisterSize (ScreenPtr pScreen,
- short width,
- short height,
- short mmWidth,
- short mmHeight)
-{
- rrScrPriv (pScreen);
- int i;
- RRScreenSize tmp;
- RRScreenSizePtr pNew;
-
- if (!pScrPriv)
- return 0;
-
- tmp.id = 0;
- tmp.width = width;
- tmp.height= height;
- tmp.mmWidth = mmWidth;
- tmp.mmHeight = mmHeight;
- tmp.pRates = 0;
- tmp.nRates = 0;
- for (i = 0; i < pScrPriv->nSizes; i++)
- if (RRScreenSizeMatches (&tmp, &pScrPriv->pSizes[i]))
- return &pScrPriv->pSizes[i];
- pNew = realloc(pScrPriv->pSizes,
- (pScrPriv->nSizes + 1) * sizeof (RRScreenSize));
- if (!pNew)
- return 0;
- pNew[pScrPriv->nSizes++] = tmp;
- pScrPriv->pSizes = pNew;
- return &pNew[pScrPriv->nSizes-1];
-}
-
-Bool RRRegisterRate (ScreenPtr pScreen,
- RRScreenSizePtr pSize,
- int rate)
-{
- rrScrPriv(pScreen);
- int i;
- RRScreenRatePtr pNew, pRate;
-
- if (!pScrPriv)
- return FALSE;
-
- for (i = 0; i < pSize->nRates; i++)
- if (pSize->pRates[i].rate == rate)
- return TRUE;
-
- pNew = realloc(pSize->pRates,
- (pSize->nRates + 1) * sizeof (RRScreenRate));
- if (!pNew)
- return FALSE;
- pRate = &pNew[pSize->nRates++];
- pRate->rate = rate;
- pSize->pRates = pNew;
- return TRUE;
-}
-
-Rotation
-RRGetRotation(ScreenPtr pScreen)
-{
- RROutputPtr output = RRFirstOutput (pScreen);
-
- if (!output)
- return RR_Rotate_0;
-
- return output->crtc->rotation;
-}
-
-void
-RRSetCurrentConfig (ScreenPtr pScreen,
- Rotation rotation,
- int rate,
- RRScreenSizePtr pSize)
-{
- rrScrPriv (pScreen);
-
- if (!pScrPriv)
- return;
- pScrPriv->size = pSize - pScrPriv->pSizes;
- pScrPriv->rotation = rotation;
- pScrPriv->rate = rate;
-}
-#endif
+/*
+ * Copyright © 2006 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#include "randrstr.h"
+
+#ifdef RANDR_10_INTERFACE
+static RRModePtr
+RROldModeAdd (RROutputPtr output, RRScreenSizePtr size, int refresh)
+{
+ ScreenPtr pScreen = output->pScreen;
+ rrScrPriv(pScreen);
+ xRRModeInfo modeInfo;
+ char name[100];
+ RRModePtr mode;
+ int i;
+ RRModePtr *modes;
+
+ memset (&modeInfo, '\0', sizeof (modeInfo));
+ sprintf (name, "%dx%d", size->width, size->height);
+
+ modeInfo.width = size->width;
+ modeInfo.height = size->height;
+ modeInfo.hTotal = size->width;
+ modeInfo.vTotal = size->height;
+ modeInfo.dotClock = ((CARD32) size->width * (CARD32) size->height *
+ (CARD32) refresh);
+ modeInfo.nameLength = strlen (name);
+ mode = RRModeGet (&modeInfo, name);
+ if (!mode)
+ return NULL;
+ for (i = 0; i < output->numModes; i++)
+ if (output->modes[i] == mode)
+ {
+ RRModeDestroy (mode);
+ return mode;
+ }
+
+ if (output->numModes)
+ modes = realloc(output->modes,
+ (output->numModes + 1) * sizeof (RRModePtr));
+ else
+ modes = malloc(sizeof (RRModePtr));
+ if (!modes)
+ {
+ RRModeDestroy (mode);
+ FreeResource (mode->mode.id, 0);
+ return NULL;
+ }
+ modes[output->numModes++] = mode;
+ output->modes = modes;
+ output->changed = TRUE;
+ pScrPriv->changed = TRUE;
+ pScrPriv->configChanged = TRUE;
+ return mode;
+}
+
+static void
+RRScanOldConfig (ScreenPtr pScreen, Rotation rotations)
+{
+ rrScrPriv(pScreen);
+ RROutputPtr output;
+ RRCrtcPtr crtc;
+ RRModePtr mode, newMode = NULL;
+ int i;
+ CARD16 minWidth = MAXSHORT, minHeight = MAXSHORT;
+ CARD16 maxWidth = 0, maxHeight = 0;
+
+ /*
+ * First time through, create a crtc and output and hook
+ * them together
+ */
+ if (pScrPriv->numOutputs == 0 &&
+ pScrPriv->numCrtcs == 0)
+ {
+ crtc = RRCrtcCreate (pScreen, NULL);
+ if (!crtc)
+ return;
+ output = RROutputCreate (pScreen, "default", 7, NULL);
+ if (!output)
+ return;
+ RROutputSetCrtcs (output, &crtc, 1);
+ RROutputSetConnection (output, RR_Connected);
+ RROutputSetSubpixelOrder (output, PictureGetSubpixelOrder (pScreen));
+ }
+
+ output = pScrPriv->outputs[0];
+ if (!output)
+ return;
+ crtc = pScrPriv->crtcs[0];
+ if (!crtc)
+ return;
+
+ /* check rotations */
+ if (rotations != crtc->rotations)
+ {
+ crtc->rotations = rotations;
+ crtc->changed = TRUE;
+ pScrPriv->changed = TRUE;
+ }
+
+ /* regenerate mode list */
+ for (i = 0; i < pScrPriv->nSizes; i++)
+ {
+ RRScreenSizePtr size = &pScrPriv->pSizes[i];
+ int r;
+
+ if (size->nRates)
+ {
+ for (r = 0; r < size->nRates; r++)
+ {
+ mode = RROldModeAdd (output, size, size->pRates[r].rate);
+ if (i == pScrPriv->size &&
+ size->pRates[r].rate == pScrPriv->rate)
+ {
+ newMode = mode;
+ }
+ }
+ free(size->pRates);
+ }
+ else
+ {
+ mode = RROldModeAdd (output, size, 0);
+ if (i == pScrPriv->size)
+ newMode = mode;
+ }
+ }
+ if (pScrPriv->nSizes)
+ free(pScrPriv->pSizes);
+ pScrPriv->pSizes = NULL;
+ pScrPriv->nSizes = 0;
+
+ /* find size bounds */
+ for (i = 0; i < output->numModes + output->numUserModes; i++)
+ {
+ RRModePtr mode = (i < output->numModes ?
+ output->modes[i] :
+ output->userModes[i-output->numModes]);
+ CARD16 width = mode->mode.width;
+ CARD16 height = mode->mode.height;
+
+ if (width < minWidth) minWidth = width;
+ if (width > maxWidth) maxWidth = width;
+ if (height < minHeight) minHeight = height;
+ if (height > maxHeight) maxHeight = height;
+ }
+
+ RRScreenSetSizeRange (pScreen, minWidth, minHeight, maxWidth, maxHeight);
+
+ /* notice current mode */
+ if (newMode)
+ RRCrtcNotify (crtc, newMode, 0, 0, pScrPriv->rotation,
+ NULL, 1, &output);
+}
+#endif
+
+/*
+ * Poll the driver for changed information
+ */
+Bool
+RRGetInfo (ScreenPtr pScreen, Bool force_query)
+{
+ rrScrPriv (pScreen);
+ Rotation rotations;
+ int i;
+
+ /* Return immediately if we don't need to re-query and we already have the
+ * information.
+ */
+ if (!force_query) {
+ if (pScrPriv->numCrtcs != 0 || pScrPriv->numOutputs != 0)
+ return TRUE;
+ }
+
+ for (i = 0; i < pScrPriv->numOutputs; i++)
+ pScrPriv->outputs[i]->changed = FALSE;
+ for (i = 0; i < pScrPriv->numCrtcs; i++)
+ pScrPriv->crtcs[i]->changed = FALSE;
+
+ rotations = 0;
+ pScrPriv->changed = FALSE;
+ pScrPriv->configChanged = FALSE;
+
+ if (!(*pScrPriv->rrGetInfo) (pScreen, &rotations))
+ return FALSE;
+
+#if RANDR_10_INTERFACE
+ if (pScrPriv->nSizes)
+ RRScanOldConfig (pScreen, rotations);
+#endif
+ RRTellChanged (pScreen);
+ return TRUE;
+}
+
+/*
+ * Register the range of sizes for the screen
+ */
+void
+RRScreenSetSizeRange (ScreenPtr pScreen,
+ CARD16 minWidth,
+ CARD16 minHeight,
+ CARD16 maxWidth,
+ CARD16 maxHeight)
+{
+ rrScrPriv (pScreen);
+
+ if (!pScrPriv)
+ return;
+ if (pScrPriv->minWidth == minWidth && pScrPriv->minHeight == minHeight &&
+ pScrPriv->maxWidth == maxWidth && pScrPriv->maxHeight == maxHeight)
+ {
+ return;
+ }
+
+ pScrPriv->minWidth = minWidth;
+ pScrPriv->minHeight = minHeight;
+ pScrPriv->maxWidth = maxWidth;
+ pScrPriv->maxHeight = maxHeight;
+ pScrPriv->changed = TRUE;
+ pScrPriv->configChanged = TRUE;
+}
+
+#ifdef RANDR_10_INTERFACE
+static Bool
+RRScreenSizeMatches (RRScreenSizePtr a,
+ RRScreenSizePtr b)
+{
+ if (a->width != b->width)
+ return FALSE;
+ if (a->height != b->height)
+ return FALSE;
+ if (a->mmWidth != b->mmWidth)
+ return FALSE;
+ if (a->mmHeight != b->mmHeight)
+ return FALSE;
+ return TRUE;
+}
+
+RRScreenSizePtr
+RRRegisterSize (ScreenPtr pScreen,
+ short width,
+ short height,
+ short mmWidth,
+ short mmHeight)
+{
+ rrScrPriv (pScreen);
+ int i;
+ RRScreenSize tmp;
+ RRScreenSizePtr pNew;
+
+ if (!pScrPriv)
+ return 0;
+
+ tmp.id = 0;
+ tmp.width = width;
+ tmp.height= height;
+ tmp.mmWidth = mmWidth;
+ tmp.mmHeight = mmHeight;
+ tmp.pRates = 0;
+ tmp.nRates = 0;
+ for (i = 0; i < pScrPriv->nSizes; i++)
+ if (RRScreenSizeMatches (&tmp, &pScrPriv->pSizes[i]))
+ return &pScrPriv->pSizes[i];
+ pNew = realloc(pScrPriv->pSizes,
+ (pScrPriv->nSizes + 1) * sizeof (RRScreenSize));
+ if (!pNew)
+ return 0;
+ pNew[pScrPriv->nSizes++] = tmp;
+ pScrPriv->pSizes = pNew;
+ return &pNew[pScrPriv->nSizes-1];
+}
+
+Bool RRRegisterRate (ScreenPtr pScreen,
+ RRScreenSizePtr pSize,
+ int rate)
+{
+ rrScrPriv(pScreen);
+ int i;
+ RRScreenRatePtr pNew, pRate;
+
+ if (!pScrPriv)
+ return FALSE;
+
+ for (i = 0; i < pSize->nRates; i++)
+ if (pSize->pRates[i].rate == rate)
+ return TRUE;
+
+ pNew = realloc(pSize->pRates,
+ (pSize->nRates + 1) * sizeof (RRScreenRate));
+ if (!pNew)
+ return FALSE;
+ pRate = &pNew[pSize->nRates++];
+ pRate->rate = rate;
+ pSize->pRates = pNew;
+ return TRUE;
+}
+
+Rotation
+RRGetRotation(ScreenPtr pScreen)
+{
+ RROutputPtr output = RRFirstOutput (pScreen);
+
+ if (!output)
+ return RR_Rotate_0;
+
+ return output->crtc->rotation;
+}
+
+void
+RRSetCurrentConfig (ScreenPtr pScreen,
+ Rotation rotation,
+ int rate,
+ RRScreenSizePtr pSize)
+{
+ rrScrPriv (pScreen);
+
+ if (!pScrPriv)
+ return;
+ pScrPriv->size = pSize - pScrPriv->pSizes;
+ pScrPriv->rotation = rotation;
+ pScrPriv->rate = rate;
+}
+#endif
diff --git a/xorg-server/randr/rrscreen.c b/xorg-server/randr/rrscreen.c
index 0efc62e87..1bc1a9ea1 100644
--- a/xorg-server/randr/rrscreen.c
+++ b/xorg-server/randr/rrscreen.c
@@ -168,8 +168,6 @@ Bool
RRScreenSizeSet (ScreenPtr pScreen,
CARD16 width,
CARD16 height,
- CARD16 pixWidth,
- CARD16 pixHeight,
CARD32 mmWidth,
CARD32 mmHeight)
{
@@ -180,7 +178,6 @@ RRScreenSizeSet (ScreenPtr pScreen,
{
return (*pScrPriv->rrScreenSetSize) (pScreen,
width, height,
- pixWidth, pixHeight,
mmWidth, mmHeight);
}
#endif
@@ -194,24 +191,6 @@ RRScreenSizeSet (ScreenPtr pScreen,
}
/*
- * Compute an RRScreenConfig from the current screen information
- */
-void
-RRScreenCurrentConfig(ScreenPtr screen,
- RRScreenConfigPtr screen_config)
-{
- PixmapPtr screen_pixmap = screen->GetScreenPixmap(screen);
- WindowPtr root = screen->root;
-
- screen_config->screen_pixmap_width = screen_pixmap->drawable.width;
- screen_config->screen_pixmap_height = screen_pixmap->drawable.height;
- screen_config->screen_width = root->drawable.width;
- screen_config->screen_height = root->drawable.height;
- screen_config->mm_width = screen->mmWidth;
- screen_config->mm_height = screen->mmHeight;
-}
-
-/*
* Retrieve valid screen size range
*/
int
@@ -321,7 +300,6 @@ ProcRRSetScreenSize (ClientPtr client)
}
if (!RRScreenSizeSet (pScreen,
stuff->width, stuff->height,
- stuff->width, stuff->height,
stuff->widthInMillimeters,
stuff->heightInMillimeters))
{
@@ -798,10 +776,8 @@ ProcRRSetScreenConfig (ClientPtr client)
}
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixWriteAccess);
- if (rc != Success) {
- client->errorValue = stuff->drawable;
+ if (rc != Success)
return rc;
- }
pScreen = pDraw->pScreen;
@@ -958,14 +934,14 @@ ProcRRSetScreenConfig (ClientPtr client)
for (c = 0; c < pScrPriv->numCrtcs; c++)
{
if (!RRCrtcSet (pScrPriv->crtcs[c], NULL, 0, 0, RR_Rotate_0,
- 0, NULL, NULL))
+ 0, NULL))
{
rep.status = RRSetConfigFailed;
/* XXX recover from failure */
goto sendReply;
}
}
- if (!RRScreenSizeSet (pScreen, width, height, width, height,
+ if (!RRScreenSizeSet (pScreen, width, height,
pScreen->mmWidth, pScreen->mmHeight))
{
rep.status = RRSetConfigFailed;
@@ -974,7 +950,7 @@ ProcRRSetScreenConfig (ClientPtr client)
}
}
- if (!RRCrtcSet (crtc, mode, 0, 0, stuff->rotation, 1, &output, NULL))
+ if (!RRCrtcSet (crtc, mode, 0, 0, stuff->rotation, 1, &output))
rep.status = RRSetConfigFailed;
else {
pScrPriv->lastSetTime = time;
diff --git a/xorg-server/randr/rrsdispatch.c b/xorg-server/randr/rrsdispatch.c
index 5c6978aa1..e16090a41 100644
--- a/xorg-server/randr/rrsdispatch.c
+++ b/xorg-server/randr/rrsdispatch.c
@@ -1,635 +1,503 @@
-/*
- * Copyright © 2006 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting documentation, and
- * that the name of the copyright holders not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. The copyright holders make no representations
- * about the suitability of this software for any purpose. It is provided "as
- * is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
- * OF THIS SOFTWARE.
- */
-
-#include "randrstr.h"
-
-static int
-SProcRRQueryVersion (ClientPtr client)
-{
- register int n;
- REQUEST(xRRQueryVersionReq);
-
- swaps(&stuff->length, n);
- swapl(&stuff->majorVersion, n);
- swapl(&stuff->minorVersion, n);
- return (*ProcRandrVector[stuff->randrReqType]) (client);
-}
-
-static int
-SProcRRGetScreenInfo (ClientPtr client)
-{
- register int n;
- REQUEST(xRRGetScreenInfoReq);
-
- swaps(&stuff->length, n);
- swapl(&stuff->window, n);
- return (*ProcRandrVector[stuff->randrReqType]) (client);
-}
-
-static int
-SProcRRSetScreenConfig (ClientPtr client)
-{
- register int n;
- REQUEST(xRRSetScreenConfigReq);
-
- if (RRClientKnowsRates (client))
- {
- REQUEST_SIZE_MATCH (xRRSetScreenConfigReq);
- swaps (&stuff->rate, n);
- }
- else
- {
- REQUEST_SIZE_MATCH (xRR1_0SetScreenConfigReq);
- }
-
- swaps(&stuff->length, n);
- swapl(&stuff->drawable, n);
- swapl(&stuff->timestamp, n);
- swaps(&stuff->sizeID, n);
- swaps(&stuff->rotation, n);
- return (*ProcRandrVector[stuff->randrReqType]) (client);
-}
-
-static int
-SProcRRSelectInput (ClientPtr client)
-{
- register int n;
- REQUEST(xRRSelectInputReq);
-
- swaps(&stuff->length, n);
- swapl(&stuff->window, n);
- swaps(&stuff->enable, n);
- return (*ProcRandrVector[stuff->randrReqType]) (client);
-}
-
-static int
-SProcRRGetScreenSizeRange (ClientPtr client)
-{
- int n;
- REQUEST(xRRGetScreenSizeRangeReq);
-
- REQUEST_SIZE_MATCH(xRRGetScreenSizeRangeReq);
- swaps(&stuff->length, n);
- swapl(&stuff->window, n);
- return (*ProcRandrVector[stuff->randrReqType]) (client);
-}
-
-static int
-SProcRRSetScreenSize (ClientPtr client)
-{
- int n;
- REQUEST(xRRSetScreenSizeReq);
-
- REQUEST_SIZE_MATCH(xRRSetScreenSizeReq);
- swaps(&stuff->length, n);
- swapl(&stuff->window, n);
- swaps(&stuff->width, n);
- swaps(&stuff->height, n);
- swapl(&stuff->widthInMillimeters, n);
- swapl(&stuff->heightInMillimeters, n);
- return (*ProcRandrVector[stuff->randrReqType]) (client);
-}
-
-static int
-SProcRRGetScreenResources (ClientPtr client)
-{
- int n;
- REQUEST(xRRGetScreenResourcesReq);
-
- REQUEST_SIZE_MATCH(xRRGetScreenResourcesReq);
- swaps(&stuff->length, n);
- swapl(&stuff->window, n);
- return (*ProcRandrVector[stuff->randrReqType]) (client);
-}
-
-static int
-SProcRRGetOutputInfo (ClientPtr client)
-{
- int n;
- REQUEST(xRRGetOutputInfoReq);
-
- REQUEST_SIZE_MATCH(xRRGetOutputInfoReq);
- swaps(&stuff->length, n);
- swapl(&stuff->output, n);
- swapl(&stuff->configTimestamp, n);
- return (*ProcRandrVector[stuff->randrReqType]) (client);
-}
-
-static int
-SProcRRListOutputProperties (ClientPtr client)
-{
- int n;
- REQUEST(xRRListOutputPropertiesReq);
-
- REQUEST_SIZE_MATCH(xRRListOutputPropertiesReq);
- swaps(&stuff->length, n);
- swapl(&stuff->output, n);
- return (*ProcRandrVector[stuff->randrReqType]) (client);
-}
-
-static int
-SProcRRQueryOutputProperty (ClientPtr client)
-{
- int n;
- REQUEST(xRRQueryOutputPropertyReq);
-
- REQUEST_SIZE_MATCH(xRRQueryOutputPropertyReq);
- swaps(&stuff->length, n);
- swapl(&stuff->output, n);
- swapl(&stuff->property, n);
- return (*ProcRandrVector[stuff->randrReqType]) (client);
-}
-
-static int
-SProcRRConfigureOutputProperty (ClientPtr client)
-{
- int n;
- REQUEST(xRRConfigureOutputPropertyReq);
-
- swaps(&stuff->length, n);
- swapl(&stuff->output, n);
- swapl(&stuff->property, n);
- SwapRestL(stuff);
- return (*ProcRandrVector[stuff->randrReqType]) (client);
-}
-
-static int
-SProcRRChangeOutputProperty (ClientPtr client)
-{
- int n;
- REQUEST(xRRChangeOutputPropertyReq);
-
- REQUEST_AT_LEAST_SIZE (xRRChangeOutputPropertyReq);
- swaps(&stuff->length, n);
- swapl(&stuff->output, n);
- swapl(&stuff->property, n);
- swapl(&stuff->type, n);
- swapl(&stuff->nUnits, n);
- switch(stuff->format) {
- case 8:
- break;
- case 16:
- SwapRestS(stuff);
- break;
- case 32:
- SwapRestL(stuff);
- break;
- default:
- client->errorValue = stuff->format;
- return BadValue;
- }
- return (*ProcRandrVector[stuff->randrReqType]) (client);
-}
-
-static int
-SProcRRDeleteOutputProperty (ClientPtr client)
-{
- int n;
- REQUEST(xRRDeleteOutputPropertyReq);
-
- REQUEST_SIZE_MATCH(xRRDeleteOutputPropertyReq);
- swaps(&stuff->length, n);
- swapl(&stuff->output, n);
- swapl(&stuff->property, n);
- return (*ProcRandrVector[stuff->randrReqType]) (client);
-}
-
-static int
-SProcRRGetOutputProperty (ClientPtr client)
-{
- int n;
- REQUEST(xRRGetOutputPropertyReq);
-
- REQUEST_SIZE_MATCH(xRRGetOutputPropertyReq);
- swaps(&stuff->length, n);
- swapl(&stuff->output, n);
- swapl(&stuff->property, n);
- swapl(&stuff->type, n);
- swapl(&stuff->longOffset, n);
- swapl(&stuff->longLength, n);
- return (*ProcRandrVector[stuff->randrReqType]) (client);
-}
-
-static int
-SProcRRCreateMode (ClientPtr client)
-{
- int n;
- xRRModeInfo *modeinfo;
- REQUEST(xRRCreateModeReq);
-
- REQUEST_AT_LEAST_SIZE(xRRCreateModeReq);
- swaps(&stuff->length, n);
- swapl(&stuff->window, n);
-
- modeinfo = &stuff->modeInfo;
- swapl(&modeinfo->id, n);
- swaps(&modeinfo->width, n);
- swaps(&modeinfo->height, n);
- swapl(&modeinfo->dotClock, n);
- swaps(&modeinfo->hSyncStart, n);
- swaps(&modeinfo->hSyncEnd, n);
- swaps(&modeinfo->hTotal, n);
- swaps(&modeinfo->vSyncStart, n);
- swaps(&modeinfo->vSyncEnd, n);
- swaps(&modeinfo->vTotal, n);
- swaps(&modeinfo->nameLength, n);
- swapl(&modeinfo->modeFlags, n);
- return (*ProcRandrVector[stuff->randrReqType]) (client);
-}
-
-static int
-SProcRRDestroyMode (ClientPtr client)
-{
- int n;
- REQUEST(xRRDestroyModeReq);
-
- REQUEST_SIZE_MATCH(xRRDestroyModeReq);
- swaps(&stuff->length, n);
- swapl(&stuff->mode, n);
- return (*ProcRandrVector[stuff->randrReqType]) (client);
-}
-
-static int
-SProcRRAddOutputMode (ClientPtr client)
-{
- int n;
- REQUEST(xRRAddOutputModeReq);
-
- REQUEST_SIZE_MATCH(xRRAddOutputModeReq);
- swaps(&stuff->length, n);
- swapl(&stuff->output, n);
- swapl(&stuff->mode, n);
- return (*ProcRandrVector[stuff->randrReqType]) (client);
-}
-
-static int
-SProcRRDeleteOutputMode (ClientPtr client)
-{
- int n;
- REQUEST(xRRDeleteOutputModeReq);
-
- REQUEST_SIZE_MATCH(xRRDeleteOutputModeReq);
- swaps(&stuff->length, n);
- swapl(&stuff->output, n);
- swapl(&stuff->mode, n);
- return (*ProcRandrVector[stuff->randrReqType]) (client);
-}
-
-static int
-SProcRRGetCrtcInfo (ClientPtr client)
-{
- int n;
- REQUEST(xRRGetCrtcInfoReq);
-
- REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq);
- swaps(&stuff->length, n);
- swapl(&stuff->crtc, n);
- swapl(&stuff->configTimestamp, n);
- return (*ProcRandrVector[stuff->randrReqType]) (client);
-}
-
-static int
-SProcRRSetCrtcConfig (ClientPtr client)
-{
- int n;
- REQUEST(xRRSetCrtcConfigReq);
-
- REQUEST_AT_LEAST_SIZE(xRRSetCrtcConfigReq);
- swaps(&stuff->length, n);
- swapl(&stuff->crtc, n);
- swapl(&stuff->timestamp, n);
- swapl(&stuff->configTimestamp, n);
- swaps(&stuff->x, n);
- swaps(&stuff->y, n);
- swapl(&stuff->mode, n);
- swaps(&stuff->rotation, n);
- SwapRestL(stuff);
- return (*ProcRandrVector[stuff->randrReqType]) (client);
-}
-
-static int
-SProcRRGetCrtcGammaSize (ClientPtr client)
-{
- int n;
- REQUEST(xRRGetCrtcGammaSizeReq);
-
- REQUEST_SIZE_MATCH(xRRGetCrtcGammaSizeReq);
- swaps(&stuff->length, n);
- swapl(&stuff->crtc, n);
- return (*ProcRandrVector[stuff->randrReqType]) (client);
-}
-
-static int
-SProcRRGetCrtcGamma (ClientPtr client)
-{
- int n;
- REQUEST(xRRGetCrtcGammaReq);
-
- REQUEST_SIZE_MATCH(xRRGetCrtcGammaReq);
- swaps(&stuff->length, n);
- swapl(&stuff->crtc, n);
- return (*ProcRandrVector[stuff->randrReqType]) (client);
-}
-
-static int
-SProcRRSetCrtcGamma (ClientPtr client)
-{
- int n;
- REQUEST(xRRSetCrtcGammaReq);
-
- REQUEST_AT_LEAST_SIZE(xRRSetCrtcGammaReq);
- swaps(&stuff->length, n);
- swapl(&stuff->crtc, n);
- swaps(&stuff->size, n);
- SwapRestS(stuff);
- return (*ProcRandrVector[stuff->randrReqType]) (client);
-}
-
-static int
-SProcRRSetCrtcTransform (ClientPtr client)
-{
- int n, nparams;
- char *filter;
- CARD32 *params;
- REQUEST(xRRSetCrtcTransformReq);
-
- REQUEST_AT_LEAST_SIZE(xRRSetCrtcTransformReq);
- swaps(&stuff->length, n);
- swapl(&stuff->crtc, n);
- SwapLongs((CARD32 *)&stuff->transform, bytes_to_int32(sizeof(xRenderTransform)));
- swaps(&stuff->nbytesFilter, n);
- filter = (char *)(stuff + 1);
- params = (CARD32 *) (filter + pad_to_int32(stuff->nbytesFilter));
- nparams = ((CARD32 *) stuff + client->req_len) - params;
- if (nparams < 0)
- return BadLength;
-
- SwapLongs(params, nparams);
- return (*ProcRandrVector[stuff->randrReqType]) (client);
-}
-
-static int
-SProcRRGetCrtcTransform (ClientPtr client)
-{
- int n;
- REQUEST(xRRGetCrtcTransformReq);
-
- REQUEST_SIZE_MATCH(xRRGetCrtcTransformReq);
- swaps(&stuff->length, n);
- swapl(&stuff->crtc, n);
- return (*ProcRandrVector[stuff->randrReqType]) (client);
-}
-
-static int
-SProcRRGetPanning (ClientPtr client)
-{
- int n;
- REQUEST(xRRGetPanningReq);
-
- REQUEST_SIZE_MATCH(xRRGetPanningReq);
- swaps(&stuff->length, n);
- swapl(&stuff->crtc, n);
- return (*ProcRandrVector[stuff->randrReqType]) (client);
-}
-
-static int
-SProcRRSetPanning (ClientPtr client)
-{
- int n;
- REQUEST(xRRSetPanningReq);
-
- REQUEST_SIZE_MATCH(xRRSetPanningReq);
- swaps(&stuff->length, n);
- swapl(&stuff->crtc, n);
- swapl(&stuff->timestamp, n);
- swaps(&stuff->left, n);
- swaps(&stuff->top, n);
- swaps(&stuff->width, n);
- swaps(&stuff->height, n);
- swaps(&stuff->track_left, n);
- swaps(&stuff->track_top, n);
- swaps(&stuff->track_width, n);
- swaps(&stuff->track_height, n);
- swaps(&stuff->border_left, n);
- swaps(&stuff->border_top, n);
- swaps(&stuff->border_right, n);
- swaps(&stuff->border_bottom, n);
- return (*ProcRandrVector[stuff->randrReqType]) (client);
-}
-
-static int
-SProcRRSetOutputPrimary (ClientPtr client)
-{
- int n;
- REQUEST(xRRSetOutputPrimaryReq);
-
- REQUEST_SIZE_MATCH(xRRSetOutputPrimaryReq);
- swaps(&stuff->length, n);
- swapl(&stuff->window, n);
- swapl(&stuff->output, n);
- return ProcRandrVector[stuff->randrReqType](client);
-}
-
-static int
-SProcRRGetOutputPrimary (ClientPtr client)
-{
- int n;
- REQUEST(xRRGetOutputPrimaryReq);
-
- REQUEST_SIZE_MATCH(xRRGetOutputPrimaryReq);
- swaps(&stuff->length, n);
- swapl(&stuff->window, n);
- return ProcRandrVector[stuff->randrReqType](client);
-}
-
-static int
-SProcRRQueryScanoutPixmaps (ClientPtr client)
-{
- int n;
- REQUEST(xRRQueryScanoutPixmapsReq);
-
- REQUEST_SIZE_MATCH(xRRQueryScanoutPixmapsReq);
- swaps(&stuff->length, n);
- swapl(&stuff->drawable, n);
- return ProcRandrVector[stuff->randrReqType](client);
-}
-
-static int
-SProcRRCreateScanoutPixmap (ClientPtr client)
-{
- int n;
- REQUEST(xRRCreateScanoutPixmapReq);
-
- REQUEST_SIZE_MATCH(xRRCreateScanoutPixmapReq);
- swaps(&stuff->length, n);
- swapl(&stuff->pid, n);
- swapl(&stuff->drawable, n);
- swaps(&stuff->width, n);
- swaps(&stuff->height, n);
- swapl(&stuff->format, n);
- swaps(&stuff->rotations, n);
- return ProcRandrVector[stuff->randrReqType](client);
-}
-
-static void
-swap_transform(xRenderTransform *t)
-{
- int n;
- swapl(&t->matrix11, n);
- swapl(&t->matrix12, n);
- swapl(&t->matrix13, n);
- swapl(&t->matrix21, n);
- swapl(&t->matrix22, n);
- swapl(&t->matrix23, n);
- swapl(&t->matrix31, n);
- swapl(&t->matrix32, n);
- swapl(&t->matrix33, n);
-}
-
-static int
-SProcRRSetCrtcSpriteTransform (ClientPtr client)
-{
- int n;
- REQUEST(xRRSetCrtcSpriteTransformReq);
-
- REQUEST_SIZE_MATCH(xRRSetCrtcSpriteTransformReq);
- swaps(&stuff->length, n);
- swapl(&stuff->crtc, n);
- swap_transform(&stuff->positionTransform);
- swap_transform(&stuff->imageTransform);
- return ProcRandrVector[stuff->randrReqType](client);
-}
-
-static int
-SProcRRGetCrtcSpriteTransform (ClientPtr client)
-{
- int n;
- REQUEST(xRRGetCrtcSpriteTransformReq);
-
- REQUEST_SIZE_MATCH(xRRGetCrtcSpriteTransformReq);
- swaps(&stuff->length, n);
- swapl(&stuff->crtc, n);
- return ProcRandrVector[stuff->randrReqType](client);
-}
-
-static int
-SProcRRSetCrtcConfigs (ClientPtr client)
-{
- int n;
- REQUEST(xRRSetCrtcConfigsReq);
- int c;
- int extra_len;
- int num_configs;
- int num_output_ids;
- xRRCrtcConfig *x_configs;
-
- REQUEST_AT_LEAST_SIZE(xRRSetCrtcConfigsReq);
- swaps(&stuff->length, n);
- swapl(&stuff->drawable, n);
- swaps(&stuff->screenPixmapWidth, n);
- swaps(&stuff->screenPixmapHeight, n);
- swaps(&stuff->screenWidth, n);
- swaps(&stuff->screenHeight, n);
- swapl(&stuff->widthInMillimeters, n);
- swapl(&stuff->heightInMillimeters, n);
- swaps(&stuff->nConfigs, n);
-
- extra_len = client->req_len - bytes_to_int32(sizeof(xRRSetCrtcConfigsReq));
-
- num_configs = stuff->nConfigs;
-
- /* Check request length against number of configs specified */
- if (num_configs * (sizeof (xRRCrtcConfig) >> 2) > extra_len)
- return BadLength;
-
- x_configs = (xRRCrtcConfig *) (stuff + 1);
- for (c = 0; c < num_configs; c++) {
- swapl(&x_configs->crtc, n);
- swaps(&x_configs->x, n);
- swaps(&x_configs->y, n);
- swapl(&x_configs->mode, n);
- swaps(&x_configs->rotation, n);
- swaps(&x_configs->nOutput, n);
- swap_transform(&x_configs->spritePositionTransform);
- swap_transform(&x_configs->spriteImageTransform);
- swapl(&x_configs->pixmap, n);
- swaps(&x_configs->xPixmap, n);
- swaps(&x_configs->yPixmap, n);
- x_configs++;
- }
-
- /* Let the other dispatch function deal with verifying that
- * the right number of output ids are present, just
- * swap whatever is here
- */
- num_output_ids = extra_len - (num_configs * (sizeof (xRRCrtcConfig)) >> 2);
- SwapLongs((CARD32 *) x_configs, num_output_ids);
-
- return ProcRandrVector[stuff->randrReqType](client);
-}
-
-int (*SProcRandrVector[RRNumberRequests])(ClientPtr) = {
- SProcRRQueryVersion, /* 0 */
-/* we skip 1 to make old clients fail pretty immediately */
- NULL, /* 1 SProcRandrOldGetScreenInfo */
-/* V1.0 apps share the same set screen config request id */
- SProcRRSetScreenConfig, /* 2 */
- NULL, /* 3 SProcRandrOldScreenChangeSelectInput */
-/* 3 used to be ScreenChangeSelectInput; deprecated */
- SProcRRSelectInput, /* 4 */
- SProcRRGetScreenInfo, /* 5 */
-/* V1.2 additions */
- SProcRRGetScreenSizeRange, /* 6 */
- SProcRRSetScreenSize, /* 7 */
- SProcRRGetScreenResources, /* 8 */
- SProcRRGetOutputInfo, /* 9 */
- SProcRRListOutputProperties,/* 10 */
- SProcRRQueryOutputProperty, /* 11 */
- SProcRRConfigureOutputProperty, /* 12 */
- SProcRRChangeOutputProperty,/* 13 */
- SProcRRDeleteOutputProperty,/* 14 */
- SProcRRGetOutputProperty, /* 15 */
- SProcRRCreateMode, /* 16 */
- SProcRRDestroyMode, /* 17 */
- SProcRRAddOutputMode, /* 18 */
- SProcRRDeleteOutputMode, /* 19 */
- SProcRRGetCrtcInfo, /* 20 */
- SProcRRSetCrtcConfig, /* 21 */
- SProcRRGetCrtcGammaSize, /* 22 */
- SProcRRGetCrtcGamma, /* 23 */
- SProcRRSetCrtcGamma, /* 24 */
-/* V1.3 additions */
- SProcRRGetScreenResources, /* 25 GetScreenResourcesCurrent */
- SProcRRSetCrtcTransform, /* 26 */
- SProcRRGetCrtcTransform, /* 27 */
- SProcRRGetPanning, /* 28 */
- SProcRRSetPanning, /* 29 */
- SProcRRSetOutputPrimary, /* 30 */
- SProcRRGetOutputPrimary, /* 31 */
-/* V1.4 additions */
- SProcRRQueryScanoutPixmaps, /* 32 */
- SProcRRCreateScanoutPixmap, /* 33 */
- SProcRRSetCrtcSpriteTransform,/* 34 */
- SProcRRGetCrtcSpriteTransform,/* 35 */
- SProcRRSetCrtcConfigs, /* 36 */
-};
-
+/*
+ * Copyright © 2006 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#include "randrstr.h"
+
+static int
+SProcRRQueryVersion (ClientPtr client)
+{
+ register int n;
+ REQUEST(xRRQueryVersionReq);
+
+ swaps(&stuff->length, n);
+ swapl(&stuff->majorVersion, n);
+ swapl(&stuff->minorVersion, n);
+ return (*ProcRandrVector[stuff->randrReqType]) (client);
+}
+
+static int
+SProcRRGetScreenInfo (ClientPtr client)
+{
+ register int n;
+ REQUEST(xRRGetScreenInfoReq);
+
+ swaps(&stuff->length, n);
+ swapl(&stuff->window, n);
+ return (*ProcRandrVector[stuff->randrReqType]) (client);
+}
+
+static int
+SProcRRSetScreenConfig (ClientPtr client)
+{
+ register int n;
+ REQUEST(xRRSetScreenConfigReq);
+
+ if (RRClientKnowsRates (client))
+ {
+ REQUEST_SIZE_MATCH (xRRSetScreenConfigReq);
+ swaps (&stuff->rate, n);
+ }
+ else
+ {
+ REQUEST_SIZE_MATCH (xRR1_0SetScreenConfigReq);
+ }
+
+ swaps(&stuff->length, n);
+ swapl(&stuff->drawable, n);
+ swapl(&stuff->timestamp, n);
+ swaps(&stuff->sizeID, n);
+ swaps(&stuff->rotation, n);
+ return (*ProcRandrVector[stuff->randrReqType]) (client);
+}
+
+static int
+SProcRRSelectInput (ClientPtr client)
+{
+ register int n;
+ REQUEST(xRRSelectInputReq);
+
+ swaps(&stuff->length, n);
+ swapl(&stuff->window, n);
+ swaps(&stuff->enable, n);
+ return (*ProcRandrVector[stuff->randrReqType]) (client);
+}
+
+static int
+SProcRRGetScreenSizeRange (ClientPtr client)
+{
+ int n;
+ REQUEST(xRRGetScreenSizeRangeReq);
+
+ REQUEST_SIZE_MATCH(xRRGetScreenSizeRangeReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->window, n);
+ return (*ProcRandrVector[stuff->randrReqType]) (client);
+}
+
+static int
+SProcRRSetScreenSize (ClientPtr client)
+{
+ int n;
+ REQUEST(xRRSetScreenSizeReq);
+
+ REQUEST_SIZE_MATCH(xRRSetScreenSizeReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->window, n);
+ swaps(&stuff->width, n);
+ swaps(&stuff->height, n);
+ swapl(&stuff->widthInMillimeters, n);
+ swapl(&stuff->heightInMillimeters, n);
+ return (*ProcRandrVector[stuff->randrReqType]) (client);
+}
+
+static int
+SProcRRGetScreenResources (ClientPtr client)
+{
+ int n;
+ REQUEST(xRRGetScreenResourcesReq);
+
+ REQUEST_SIZE_MATCH(xRRGetScreenResourcesReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->window, n);
+ return (*ProcRandrVector[stuff->randrReqType]) (client);
+}
+
+static int
+SProcRRGetOutputInfo (ClientPtr client)
+{
+ int n;
+ REQUEST(xRRGetOutputInfoReq);
+
+ REQUEST_SIZE_MATCH(xRRGetOutputInfoReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->output, n);
+ swapl(&stuff->configTimestamp, n);
+ return (*ProcRandrVector[stuff->randrReqType]) (client);
+}
+
+static int
+SProcRRListOutputProperties (ClientPtr client)
+{
+ int n;
+ REQUEST(xRRListOutputPropertiesReq);
+
+ REQUEST_SIZE_MATCH(xRRListOutputPropertiesReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->output, n);
+ return (*ProcRandrVector[stuff->randrReqType]) (client);
+}
+
+static int
+SProcRRQueryOutputProperty (ClientPtr client)
+{
+ int n;
+ REQUEST(xRRQueryOutputPropertyReq);
+
+ REQUEST_SIZE_MATCH(xRRQueryOutputPropertyReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->output, n);
+ swapl(&stuff->property, n);
+ return (*ProcRandrVector[stuff->randrReqType]) (client);
+}
+
+static int
+SProcRRConfigureOutputProperty (ClientPtr client)
+{
+ int n;
+ REQUEST(xRRConfigureOutputPropertyReq);
+
+ swaps(&stuff->length, n);
+ swapl(&stuff->output, n);
+ swapl(&stuff->property, n);
+ SwapRestL(stuff);
+ return (*ProcRandrVector[stuff->randrReqType]) (client);
+}
+
+static int
+SProcRRChangeOutputProperty (ClientPtr client)
+{
+ int n;
+ REQUEST(xRRChangeOutputPropertyReq);
+
+ REQUEST_AT_LEAST_SIZE (xRRChangeOutputPropertyReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->output, n);
+ swapl(&stuff->property, n);
+ swapl(&stuff->type, n);
+ swapl(&stuff->nUnits, n);
+ switch(stuff->format) {
+ case 8:
+ break;
+ case 16:
+ SwapRestS(stuff);
+ break;
+ case 32:
+ SwapRestL(stuff);
+ break;
+ default:
+ client->errorValue = stuff->format;
+ return BadValue;
+ }
+ return (*ProcRandrVector[stuff->randrReqType]) (client);
+}
+
+static int
+SProcRRDeleteOutputProperty (ClientPtr client)
+{
+ int n;
+ REQUEST(xRRDeleteOutputPropertyReq);
+
+ REQUEST_SIZE_MATCH(xRRDeleteOutputPropertyReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->output, n);
+ swapl(&stuff->property, n);
+ return (*ProcRandrVector[stuff->randrReqType]) (client);
+}
+
+static int
+SProcRRGetOutputProperty (ClientPtr client)
+{
+ int n;
+ REQUEST(xRRGetOutputPropertyReq);
+
+ REQUEST_SIZE_MATCH(xRRGetOutputPropertyReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->output, n);
+ swapl(&stuff->property, n);
+ swapl(&stuff->type, n);
+ swapl(&stuff->longOffset, n);
+ swapl(&stuff->longLength, n);
+ return (*ProcRandrVector[stuff->randrReqType]) (client);
+}
+
+static int
+SProcRRCreateMode (ClientPtr client)
+{
+ int n;
+ xRRModeInfo *modeinfo;
+ REQUEST(xRRCreateModeReq);
+
+ REQUEST_AT_LEAST_SIZE(xRRCreateModeReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->window, n);
+
+ modeinfo = &stuff->modeInfo;
+ swapl(&modeinfo->id, n);
+ swaps(&modeinfo->width, n);
+ swaps(&modeinfo->height, n);
+ swapl(&modeinfo->dotClock, n);
+ swaps(&modeinfo->hSyncStart, n);
+ swaps(&modeinfo->hSyncEnd, n);
+ swaps(&modeinfo->hTotal, n);
+ swaps(&modeinfo->vSyncStart, n);
+ swaps(&modeinfo->vSyncEnd, n);
+ swaps(&modeinfo->vTotal, n);
+ swaps(&modeinfo->nameLength, n);
+ swapl(&modeinfo->modeFlags, n);
+ return (*ProcRandrVector[stuff->randrReqType]) (client);
+}
+
+static int
+SProcRRDestroyMode (ClientPtr client)
+{
+ int n;
+ REQUEST(xRRDestroyModeReq);
+
+ REQUEST_SIZE_MATCH(xRRDestroyModeReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->mode, n);
+ return (*ProcRandrVector[stuff->randrReqType]) (client);
+}
+
+static int
+SProcRRAddOutputMode (ClientPtr client)
+{
+ int n;
+ REQUEST(xRRAddOutputModeReq);
+
+ REQUEST_SIZE_MATCH(xRRAddOutputModeReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->output, n);
+ swapl(&stuff->mode, n);
+ return (*ProcRandrVector[stuff->randrReqType]) (client);
+}
+
+static int
+SProcRRDeleteOutputMode (ClientPtr client)
+{
+ int n;
+ REQUEST(xRRDeleteOutputModeReq);
+
+ REQUEST_SIZE_MATCH(xRRDeleteOutputModeReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->output, n);
+ swapl(&stuff->mode, n);
+ return (*ProcRandrVector[stuff->randrReqType]) (client);
+}
+
+static int
+SProcRRGetCrtcInfo (ClientPtr client)
+{
+ int n;
+ REQUEST(xRRGetCrtcInfoReq);
+
+ REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->crtc, n);
+ swapl(&stuff->configTimestamp, n);
+ return (*ProcRandrVector[stuff->randrReqType]) (client);
+}
+
+static int
+SProcRRSetCrtcConfig (ClientPtr client)
+{
+ int n;
+ REQUEST(xRRSetCrtcConfigReq);
+
+ REQUEST_AT_LEAST_SIZE(xRRSetCrtcConfigReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->crtc, n);
+ swapl(&stuff->timestamp, n);
+ swapl(&stuff->configTimestamp, n);
+ swaps(&stuff->x, n);
+ swaps(&stuff->y, n);
+ swapl(&stuff->mode, n);
+ swaps(&stuff->rotation, n);
+ SwapRestL(stuff);
+ return (*ProcRandrVector[stuff->randrReqType]) (client);
+}
+
+static int
+SProcRRGetCrtcGammaSize (ClientPtr client)
+{
+ int n;
+ REQUEST(xRRGetCrtcGammaSizeReq);
+
+ REQUEST_SIZE_MATCH(xRRGetCrtcGammaSizeReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->crtc, n);
+ return (*ProcRandrVector[stuff->randrReqType]) (client);
+}
+
+static int
+SProcRRGetCrtcGamma (ClientPtr client)
+{
+ int n;
+ REQUEST(xRRGetCrtcGammaReq);
+
+ REQUEST_SIZE_MATCH(xRRGetCrtcGammaReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->crtc, n);
+ return (*ProcRandrVector[stuff->randrReqType]) (client);
+}
+
+static int
+SProcRRSetCrtcGamma (ClientPtr client)
+{
+ int n;
+ REQUEST(xRRSetCrtcGammaReq);
+
+ REQUEST_AT_LEAST_SIZE(xRRSetCrtcGammaReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->crtc, n);
+ swaps(&stuff->size, n);
+ SwapRestS(stuff);
+ return (*ProcRandrVector[stuff->randrReqType]) (client);
+}
+
+static int
+SProcRRSetCrtcTransform (ClientPtr client)
+{
+ int n, nparams;
+ char *filter;
+ CARD32 *params;
+ REQUEST(xRRSetCrtcTransformReq);
+
+ REQUEST_AT_LEAST_SIZE(xRRSetCrtcTransformReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->crtc, n);
+ SwapLongs((CARD32 *)&stuff->transform, bytes_to_int32(sizeof(xRenderTransform)));
+ swaps(&stuff->nbytesFilter, n);
+ filter = (char *)(stuff + 1);
+ params = (CARD32 *) (filter + pad_to_int32(stuff->nbytesFilter));
+ nparams = ((CARD32 *) stuff + client->req_len) - params;
+ if (nparams < 0)
+ return BadLength;
+
+ SwapLongs(params, nparams);
+ return (*ProcRandrVector[stuff->randrReqType]) (client);
+}
+
+static int
+SProcRRGetCrtcTransform (ClientPtr client)
+{
+ int n;
+ REQUEST(xRRGetCrtcTransformReq);
+
+ REQUEST_SIZE_MATCH(xRRGetCrtcTransformReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->crtc, n);
+ return (*ProcRandrVector[stuff->randrReqType]) (client);
+}
+
+static int
+SProcRRGetPanning (ClientPtr client)
+{
+ int n;
+ REQUEST(xRRGetPanningReq);
+
+ REQUEST_SIZE_MATCH(xRRGetPanningReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->crtc, n);
+ return (*ProcRandrVector[stuff->randrReqType]) (client);
+}
+
+static int
+SProcRRSetPanning (ClientPtr client)
+{
+ int n;
+ REQUEST(xRRSetPanningReq);
+
+ REQUEST_SIZE_MATCH(xRRSetPanningReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->crtc, n);
+ swapl(&stuff->timestamp, n);
+ swaps(&stuff->left, n);
+ swaps(&stuff->top, n);
+ swaps(&stuff->width, n);
+ swaps(&stuff->height, n);
+ swaps(&stuff->track_left, n);
+ swaps(&stuff->track_top, n);
+ swaps(&stuff->track_width, n);
+ swaps(&stuff->track_height, n);
+ swaps(&stuff->border_left, n);
+ swaps(&stuff->border_top, n);
+ swaps(&stuff->border_right, n);
+ swaps(&stuff->border_bottom, n);
+ return (*ProcRandrVector[stuff->randrReqType]) (client);
+}
+
+static int
+SProcRRSetOutputPrimary (ClientPtr client)
+{
+ int n;
+ REQUEST(xRRSetOutputPrimaryReq);
+
+ REQUEST_SIZE_MATCH(xRRSetOutputPrimaryReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->window, n);
+ swapl(&stuff->output, n);
+ return ProcRandrVector[stuff->randrReqType](client);
+}
+
+static int
+SProcRRGetOutputPrimary (ClientPtr client)
+{
+ int n;
+ REQUEST(xRRGetOutputPrimaryReq);
+
+ REQUEST_SIZE_MATCH(xRRGetOutputPrimaryReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->window, n);
+ return ProcRandrVector[stuff->randrReqType](client);
+}
+
+int (*SProcRandrVector[RRNumberRequests])(ClientPtr) = {
+ SProcRRQueryVersion, /* 0 */
+/* we skip 1 to make old clients fail pretty immediately */
+ NULL, /* 1 SProcRandrOldGetScreenInfo */
+/* V1.0 apps share the same set screen config request id */
+ SProcRRSetScreenConfig, /* 2 */
+ NULL, /* 3 SProcRandrOldScreenChangeSelectInput */
+/* 3 used to be ScreenChangeSelectInput; deprecated */
+ SProcRRSelectInput, /* 4 */
+ SProcRRGetScreenInfo, /* 5 */
+/* V1.2 additions */
+ SProcRRGetScreenSizeRange, /* 6 */
+ SProcRRSetScreenSize, /* 7 */
+ SProcRRGetScreenResources, /* 8 */
+ SProcRRGetOutputInfo, /* 9 */
+ SProcRRListOutputProperties,/* 10 */
+ SProcRRQueryOutputProperty, /* 11 */
+ SProcRRConfigureOutputProperty, /* 12 */
+ SProcRRChangeOutputProperty,/* 13 */
+ SProcRRDeleteOutputProperty,/* 14 */
+ SProcRRGetOutputProperty, /* 15 */
+ SProcRRCreateMode, /* 16 */
+ SProcRRDestroyMode, /* 17 */
+ SProcRRAddOutputMode, /* 18 */
+ SProcRRDeleteOutputMode, /* 19 */
+ SProcRRGetCrtcInfo, /* 20 */
+ SProcRRSetCrtcConfig, /* 21 */
+ SProcRRGetCrtcGammaSize, /* 22 */
+ SProcRRGetCrtcGamma, /* 23 */
+ SProcRRSetCrtcGamma, /* 24 */
+/* V1.3 additions */
+ SProcRRGetScreenResources, /* 25 GetScreenResourcesCurrent */
+ SProcRRSetCrtcTransform, /* 26 */
+ SProcRRGetCrtcTransform, /* 27 */
+ SProcRRGetPanning, /* 28 */
+ SProcRRSetPanning, /* 29 */
+ SProcRRSetOutputPrimary, /* 30 */
+ SProcRRGetOutputPrimary, /* 31 */
+};
+
diff --git a/xorg-server/randr/rrtransform.c b/xorg-server/randr/rrtransform.c
index f78d5f913..e1620498b 100644
--- a/xorg-server/randr/rrtransform.c
+++ b/xorg-server/randr/rrtransform.c
@@ -1,337 +1,283 @@
-/*
- * Copyright © 2007 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting documentation, and
- * that the name of the copyright holders not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. The copyright holders make no representations
- * about the suitability of this software for any purpose. It is provided "as
- * is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
- * OF THIS SOFTWARE.
- */
-
-#include "randrstr.h"
-#include "rrtransform.h"
-
-void
-RRTransformInit (RRTransformPtr transform)
-{
- pixman_transform_init_identity (&transform->transform);
- pixman_f_transform_init_identity (&transform->f_transform);
- pixman_f_transform_init_identity (&transform->f_inverse);
- transform->filter = NULL;
- transform->params = NULL;
- transform->nparams = 0;
-}
-
-void
-RRTransformFini (RRTransformPtr transform)
-{
- free(transform->params);
-}
-
-Bool
-RRTransformEqual (RRTransformPtr a, RRTransformPtr b)
-{
- if (a && pixman_transform_is_identity (&a->transform))
- a = NULL;
- if (b && pixman_transform_is_identity (&b->transform))
- b = NULL;
- if (a == NULL && b == NULL)
- return TRUE;
- if (a == NULL || b == NULL)
- return FALSE;
- if (memcmp (&a->transform, &b->transform, sizeof (a->transform)) != 0)
- return FALSE;
- if (a->filter != b->filter)
- return FALSE;
- if (a->nparams != b->nparams)
- return FALSE;
- if (memcmp (a->params, b->params, a->nparams * sizeof (xFixed)) != 0)
- return FALSE;
- return TRUE;
-}
-
-Bool
-RRTransformSetFilter (RRTransformPtr dst,
- PictFilterPtr filter,
- xFixed *params,
- int nparams,
- int width,
- int height)
-{
- xFixed *new_params;
-
- if (nparams)
- {
- new_params = malloc(nparams * sizeof (xFixed));
- if (!new_params)
- return FALSE;
- memcpy (new_params, params, nparams * sizeof (xFixed));
- }
- else
- new_params = NULL;
- free(dst->params);
- dst->filter = filter;
- dst->params = new_params;
- dst->nparams = nparams;
- dst->width = width;
- dst->height = height;
- return TRUE;
-}
-
-Bool
-RRTransformCopy (RRTransformPtr dst, RRTransformPtr src)
-{
- if (src && pixman_transform_is_identity (&src->transform))
- src = NULL;
-
- if (src)
- {
- if (!RRTransformSetFilter (dst, src->filter,
- src->params, src->nparams, src->width, src->height))
- return FALSE;
- dst->transform = src->transform;
- dst->f_transform = src->f_transform;
- dst->f_inverse = src->f_inverse;
- }
- else
- {
- if (!RRTransformSetFilter (dst, NULL, NULL, 0, 0, 0))
- return FALSE;
- pixman_transform_init_identity (&dst->transform);
- pixman_f_transform_init_identity (&dst->f_transform);
- pixman_f_transform_init_identity (&dst->f_inverse);
- }
- return TRUE;
-}
-
-#define F(x) IntToxFixed(x)
-
-static void
-RRTransformRescale(struct pixman_f_transform *f_transform, double limit)
-{
- double max = 0, v, scale;
- int i, j;
-
- for (j = 0; j < 3; j++)
- for (i = 0; i < 3; i++)
- if ((v = abs (f_transform->m[j][i])) > max)
- max = v;
- scale = limit / max;
- for (j = 0; j < 3; j++)
- for (i = 0; i < 3; i++)
- f_transform->m[j][i] *= scale;
-}
-
-#define EPSILON (1e-20)
-#define IS_F_SAME(a,b) (fabs((a)-(b)) < EPSILON)
-#define IS_F_ZERO(a) (fabs(a) < EPSILON)
-
-static Bool
-pict_f_transform_is_identity (const struct pixman_f_transform *t)
-{
- return (IS_F_SAME (t->m[0][0], t->m[1][1]) &&
- IS_F_SAME (t->m[0][0], t->m[2][2]) &&
- !IS_F_ZERO (t->m[0][0]) &&
- IS_F_ZERO (t->m[0][1]) &&
- IS_F_ZERO (t->m[0][2]) &&
- IS_F_ZERO (t->m[1][0]) &&
- IS_F_ZERO (t->m[1][2]) &&
- IS_F_ZERO (t->m[2][0]) &&
- IS_F_ZERO (t->m[2][1]));
-}
-
-/*
- * Compute the complete transformation matrix including
- * client-specified transform, rotation/reflection values and the crtc
- * offset.
- *
- * Return TRUE if the resulting transform is not a simple translation.
- */
-Bool
-RRTransformCompute (int x,
- int y,
- int width,
- int height,
- Rotation rotation,
- RRTransformPtr rr_transform,
- struct pixman_f_transform *sprite_position_transform,
- struct pixman_f_transform *sprite_image_transform,
-
- PictTransformPtr transform,
- struct pixman_f_transform *f_transform,
- struct pixman_f_transform *f_inverse,
- struct pixman_f_transform *f_fb_to_sprite,
- struct pixman_f_transform *f_sprite_to_image,
- Bool *sprite_transform_in_use)
-{
- PictTransform t_transform, inverse;
- struct pixman_f_transform tf_transform, tf_inverse;
- struct pixman_f_transform sf_position_transform, sf_image_transform;
- struct pixman_f_transform f_image_to_sprite;
- Bool overflow = FALSE;
- Bool ret = TRUE;
-
- if (!transform) transform = &t_transform;
- if (!f_transform) f_transform = &tf_transform;
- if (!f_inverse) f_inverse = &tf_inverse;
- if (!f_fb_to_sprite) f_fb_to_sprite = &sf_position_transform;
- if (!f_sprite_to_image) f_sprite_to_image = &sf_image_transform;
-
- /* invert the sprite image transform to have it go from dest to source */
- if (!pixman_f_transform_invert (&f_image_to_sprite, f_sprite_to_image))
- pixman_f_transform_init_identity(&f_image_to_sprite);
-
- pixman_transform_init_identity (transform);
- pixman_transform_init_identity (&inverse);
- pixman_f_transform_init_identity (f_transform);
- pixman_f_transform_init_identity (f_inverse);
- pixman_f_transform_init_identity (f_fb_to_sprite);
- pixman_f_transform_init_identity (f_sprite_to_image);
- if (rotation != RR_Rotate_0)
- {
- double f_rot_cos, f_rot_sin, f_rot_dx, f_rot_dy;
- double f_scale_x, f_scale_y, f_scale_dx, f_scale_dy;
- xFixed rot_cos, rot_sin, rot_dx, rot_dy;
- xFixed scale_x, scale_y, scale_dx, scale_dy;
-
- /* rotation */
- switch (rotation & 0xf) {
- default:
- case RR_Rotate_0:
- f_rot_cos = 1; f_rot_sin = 0;
- f_rot_dx = 0; f_rot_dy = 0;
- rot_cos = F ( 1); rot_sin = F ( 0);
- rot_dx = F ( 0); rot_dy = F ( 0);
- break;
- case RR_Rotate_90:
- f_rot_cos = 0; f_rot_sin = 1;
- f_rot_dx = height; f_rot_dy = 0;
- rot_cos = F ( 0); rot_sin = F ( 1);
- rot_dx = F ( height); rot_dy = F (0);
- break;
- case RR_Rotate_180:
- f_rot_cos = -1; f_rot_sin = 0;
- f_rot_dx = width; f_rot_dy = height;
- rot_cos = F (-1); rot_sin = F ( 0);
- rot_dx = F (width); rot_dy = F ( height);
- break;
- case RR_Rotate_270:
- f_rot_cos = 0; f_rot_sin = -1;
- f_rot_dx = 0; f_rot_dy = width;
- rot_cos = F ( 0); rot_sin = F (-1);
- rot_dx = F ( 0); rot_dy = F ( width);
- break;
- }
-
- pixman_transform_rotate (transform, &inverse, rot_cos, rot_sin);
- pixman_transform_translate (transform, &inverse, rot_dx, rot_dy);
- pixman_f_transform_rotate (f_transform, f_inverse, f_rot_cos, f_rot_sin);
- pixman_f_transform_translate (f_transform, f_inverse, f_rot_dx, f_rot_dy);
-
- /* reflection */
- f_scale_x = 1;
- f_scale_dx = 0;
- f_scale_y = 1;
- f_scale_dy = 0;
- scale_x = F (1);
- scale_dx = 0;
- scale_y = F (1);
- scale_dy = 0;
- if (rotation & RR_Reflect_X)
- {
- f_scale_x = -1;
- scale_x = F(-1);
- if (rotation & (RR_Rotate_0|RR_Rotate_180)) {
- f_scale_dx = width;
- scale_dx = F(width);
- } else {
- f_scale_dx = height;
- scale_dx = F(height);
- }
- }
- if (rotation & RR_Reflect_Y)
- {
- f_scale_y = -1;
- scale_y = F(-1);
- if (rotation & (RR_Rotate_0|RR_Rotate_180)) {
- f_scale_dy = height;
- scale_dy = F(height);
- } else {
- f_scale_dy = width;
- scale_dy = F(width);
- }
- }
-
- pixman_transform_scale (transform, &inverse, scale_x, scale_y);
- pixman_f_transform_scale (f_transform, f_inverse, f_scale_x, f_scale_y);
- pixman_transform_translate (transform, &inverse, scale_dx, scale_dy);
- pixman_f_transform_translate (f_transform, f_inverse, f_scale_dx, f_scale_dy);
- }
-
- /*
- * Sprite position is affected by the transform matrix,
- * but the image is not
- */
- pixman_f_transform_multiply(f_sprite_to_image,
- f_transform,
- &f_image_to_sprite);
-
- if (rr_transform)
- {
- if (!pixman_transform_multiply (transform, &rr_transform->transform, transform))
- overflow = TRUE;
- pixman_f_transform_multiply (f_transform, &rr_transform->f_transform, f_transform);
- pixman_f_transform_multiply (f_inverse, f_inverse, &rr_transform->f_inverse);
- }
-
- /*
- * Compute the class of the resulting transform
- */
- if (!overflow && pixman_transform_is_identity (transform))
- {
- pixman_transform_init_translate (transform, F ( x), F ( y));
-
- pixman_f_transform_init_translate (f_transform, x, y);
- pixman_f_transform_init_translate (f_inverse, -x, -y);
- ret = FALSE;
- }
- else
- {
- pixman_f_transform_translate (f_transform, f_inverse, x, y);
- if (!pixman_transform_translate (transform, &inverse, F(x), F(y)))
- overflow = TRUE;
- if (overflow)
- {
- struct pixman_f_transform f_scaled;
- f_scaled = *f_transform;
- RRTransformRescale(&f_scaled, 16384.0);
- pixman_transform_from_pixman_f_transform(transform, &f_scaled);
- }
- ret = TRUE;
- }
-
- /*
- * Sprite position is affected by the transform matrix,
- * but the image is not
- */
- pixman_f_transform_multiply(f_fb_to_sprite,
- f_inverse,
- sprite_position_transform);
- if (sprite_transform_in_use)
- *sprite_transform_in_use = ret || !pict_f_transform_is_identity(f_fb_to_sprite);
- return ret;
-}
-
-
+/*
+ * Copyright © 2007 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#include "randrstr.h"
+#include "rrtransform.h"
+
+void
+RRTransformInit (RRTransformPtr transform)
+{
+ pixman_transform_init_identity (&transform->transform);
+ pixman_f_transform_init_identity (&transform->f_transform);
+ pixman_f_transform_init_identity (&transform->f_inverse);
+ transform->filter = NULL;
+ transform->params = NULL;
+ transform->nparams = 0;
+}
+
+void
+RRTransformFini (RRTransformPtr transform)
+{
+ free(transform->params);
+}
+
+Bool
+RRTransformEqual (RRTransformPtr a, RRTransformPtr b)
+{
+ if (a && pixman_transform_is_identity (&a->transform))
+ a = NULL;
+ if (b && pixman_transform_is_identity (&b->transform))
+ b = NULL;
+ if (a == NULL && b == NULL)
+ return TRUE;
+ if (a == NULL || b == NULL)
+ return FALSE;
+ if (memcmp (&a->transform, &b->transform, sizeof (a->transform)) != 0)
+ return FALSE;
+ if (a->filter != b->filter)
+ return FALSE;
+ if (a->nparams != b->nparams)
+ return FALSE;
+ if (memcmp (a->params, b->params, a->nparams * sizeof (xFixed)) != 0)
+ return FALSE;
+ return TRUE;
+}
+
+Bool
+RRTransformSetFilter (RRTransformPtr dst,
+ PictFilterPtr filter,
+ xFixed *params,
+ int nparams,
+ int width,
+ int height)
+{
+ xFixed *new_params;
+
+ if (nparams)
+ {
+ new_params = malloc(nparams * sizeof (xFixed));
+ if (!new_params)
+ return FALSE;
+ memcpy (new_params, params, nparams * sizeof (xFixed));
+ }
+ else
+ new_params = NULL;
+ free(dst->params);
+ dst->filter = filter;
+ dst->params = new_params;
+ dst->nparams = nparams;
+ dst->width = width;
+ dst->height = height;
+ return TRUE;
+}
+
+Bool
+RRTransformCopy (RRTransformPtr dst, RRTransformPtr src)
+{
+ if (src && pixman_transform_is_identity (&src->transform))
+ src = NULL;
+
+ if (src)
+ {
+ if (!RRTransformSetFilter (dst, src->filter,
+ src->params, src->nparams, src->width, src->height))
+ return FALSE;
+ dst->transform = src->transform;
+ dst->f_transform = src->f_transform;
+ dst->f_inverse = src->f_inverse;
+ }
+ else
+ {
+ if (!RRTransformSetFilter (dst, NULL, NULL, 0, 0, 0))
+ return FALSE;
+ pixman_transform_init_identity (&dst->transform);
+ pixman_f_transform_init_identity (&dst->f_transform);
+ pixman_f_transform_init_identity (&dst->f_inverse);
+ }
+ return TRUE;
+}
+
+#define F(x) IntToxFixed(x)
+
+static void
+RRTransformRescale(struct pixman_f_transform *f_transform, double limit)
+{
+ double max = 0, v, scale;
+ int i, j;
+
+ for (j = 0; j < 3; j++)
+ for (i = 0; i < 3; i++)
+ if ((v = abs (f_transform->m[j][i])) > max)
+ max = v;
+ scale = limit / max;
+ for (j = 0; j < 3; j++)
+ for (i = 0; i < 3; i++)
+ f_transform->m[j][i] *= scale;
+}
+
+/*
+ * Compute the complete transformation matrix including
+ * client-specified transform, rotation/reflection values and the crtc
+ * offset.
+ *
+ * Return TRUE if the resulting transform is not a simple translation.
+ */
+Bool
+RRTransformCompute (int x,
+ int y,
+ int width,
+ int height,
+ Rotation rotation,
+ RRTransformPtr rr_transform,
+
+ PictTransformPtr transform,
+ struct pixman_f_transform *f_transform,
+ struct pixman_f_transform *f_inverse)
+{
+ PictTransform t_transform, inverse;
+ struct pixman_f_transform tf_transform, tf_inverse;
+ Bool overflow = FALSE;
+
+ if (!transform) transform = &t_transform;
+ if (!f_transform) f_transform = &tf_transform;
+ if (!f_inverse) f_inverse = &tf_inverse;
+
+ pixman_transform_init_identity (transform);
+ pixman_transform_init_identity (&inverse);
+ pixman_f_transform_init_identity (f_transform);
+ pixman_f_transform_init_identity (f_inverse);
+ if (rotation != RR_Rotate_0)
+ {
+ double f_rot_cos, f_rot_sin, f_rot_dx, f_rot_dy;
+ double f_scale_x, f_scale_y, f_scale_dx, f_scale_dy;
+ xFixed rot_cos, rot_sin, rot_dx, rot_dy;
+ xFixed scale_x, scale_y, scale_dx, scale_dy;
+
+ /* rotation */
+ switch (rotation & 0xf) {
+ default:
+ case RR_Rotate_0:
+ f_rot_cos = 1; f_rot_sin = 0;
+ f_rot_dx = 0; f_rot_dy = 0;
+ rot_cos = F ( 1); rot_sin = F ( 0);
+ rot_dx = F ( 0); rot_dy = F ( 0);
+ break;
+ case RR_Rotate_90:
+ f_rot_cos = 0; f_rot_sin = 1;
+ f_rot_dx = height; f_rot_dy = 0;
+ rot_cos = F ( 0); rot_sin = F ( 1);
+ rot_dx = F ( height); rot_dy = F (0);
+ break;
+ case RR_Rotate_180:
+ f_rot_cos = -1; f_rot_sin = 0;
+ f_rot_dx = width; f_rot_dy = height;
+ rot_cos = F (-1); rot_sin = F ( 0);
+ rot_dx = F (width); rot_dy = F ( height);
+ break;
+ case RR_Rotate_270:
+ f_rot_cos = 0; f_rot_sin = -1;
+ f_rot_dx = 0; f_rot_dy = width;
+ rot_cos = F ( 0); rot_sin = F (-1);
+ rot_dx = F ( 0); rot_dy = F ( width);
+ break;
+ }
+
+ pixman_transform_rotate (transform, &inverse, rot_cos, rot_sin);
+ pixman_transform_translate (transform, &inverse, rot_dx, rot_dy);
+ pixman_f_transform_rotate (f_transform, f_inverse, f_rot_cos, f_rot_sin);
+ pixman_f_transform_translate (f_transform, f_inverse, f_rot_dx, f_rot_dy);
+
+ /* reflection */
+ f_scale_x = 1;
+ f_scale_dx = 0;
+ f_scale_y = 1;
+ f_scale_dy = 0;
+ scale_x = F (1);
+ scale_dx = 0;
+ scale_y = F (1);
+ scale_dy = 0;
+ if (rotation & RR_Reflect_X)
+ {
+ f_scale_x = -1;
+ scale_x = F(-1);
+ if (rotation & (RR_Rotate_0|RR_Rotate_180)) {
+ f_scale_dx = width;
+ scale_dx = F(width);
+ } else {
+ f_scale_dx = height;
+ scale_dx = F(height);
+ }
+ }
+ if (rotation & RR_Reflect_Y)
+ {
+ f_scale_y = -1;
+ scale_y = F(-1);
+ if (rotation & (RR_Rotate_0|RR_Rotate_180)) {
+ f_scale_dy = height;
+ scale_dy = F(height);
+ } else {
+ f_scale_dy = width;
+ scale_dy = F(width);
+ }
+ }
+
+ pixman_transform_scale (transform, &inverse, scale_x, scale_y);
+ pixman_f_transform_scale (f_transform, f_inverse, f_scale_x, f_scale_y);
+ pixman_transform_translate (transform, &inverse, scale_dx, scale_dy);
+ pixman_f_transform_translate (f_transform, f_inverse, f_scale_dx, f_scale_dy);
+ }
+
+#ifdef RANDR_12_INTERFACE
+ if (rr_transform)
+ {
+ if (!pixman_transform_multiply (transform, &rr_transform->transform, transform))
+ overflow = TRUE;
+ pixman_f_transform_multiply (f_transform, &rr_transform->f_transform, f_transform);
+ pixman_f_transform_multiply (f_inverse, f_inverse, &rr_transform->f_inverse);
+ }
+#endif
+ /*
+ * Compute the class of the resulting transform
+ */
+ if (!overflow && pixman_transform_is_identity (transform))
+ {
+ pixman_transform_init_translate (transform, F ( x), F ( y));
+
+ pixman_f_transform_init_translate (f_transform, x, y);
+ pixman_f_transform_init_translate (f_inverse, -x, -y);
+ return FALSE;
+ }
+ else
+ {
+ pixman_f_transform_translate (f_transform, f_inverse, x, y);
+ if (!pixman_transform_translate (transform, &inverse, F(x), F(y)))
+ overflow = TRUE;
+ if (overflow)
+ {
+ struct pixman_f_transform f_scaled;
+ f_scaled = *f_transform;
+ RRTransformRescale(&f_scaled, 16384.0);
+ pixman_transform_from_pixman_f_transform(transform, &f_scaled);
+ }
+ return TRUE;
+ }
+}
diff --git a/xorg-server/randr/rrtransform.h b/xorg-server/randr/rrtransform.h
index eaced0d3e..561762dfe 100644
--- a/xorg-server/randr/rrtransform.h
+++ b/xorg-server/randr/rrtransform.h
@@ -1,86 +1,75 @@
-/*
- * Copyright © 2007 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting documentation, and
- * that the name of the copyright holders not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. The copyright holders make no representations
- * about the suitability of this software for any purpose. It is provided "as
- * is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
- * OF THIS SOFTWARE.
- */
-
-#ifndef _RRTRANSFORM_H_
-#define _RRTRANSFORM_H_
-
-#include <X11/extensions/randr.h>
-#include "picturestr.h"
-
-typedef struct _rrTransform RRTransformRec, *RRTransformPtr;
-
-struct _rrTransform {
- PictTransform transform;
- struct pict_f_transform f_transform;
- struct pict_f_transform f_inverse;
- PictFilterPtr filter;
- xFixed *params;
- int nparams;
- int width;
- int height;
-};
-
-extern _X_EXPORT void
-RRTransformInit (RRTransformPtr transform);
-
-extern _X_EXPORT void
-RRTransformFini (RRTransformPtr transform);
-
-extern _X_EXPORT Bool
-RRTransformEqual (RRTransformPtr a, RRTransformPtr b);
-
-extern _X_EXPORT Bool
-RRTransformSetFilter (RRTransformPtr dst,
- PictFilterPtr filter,
- xFixed *params,
- int nparams,
- int width,
- int height);
-
-extern _X_EXPORT Bool
-RRTransformCopy (RRTransformPtr dst, RRTransformPtr src);
-
-/*
- * Compute the complete transformation matrix including
- * client-specified transform, rotation/reflection values and the crtc
- * offset.
- *
- * Return TRUE if the resulting transform is not a simple translation.
- */
-extern _X_EXPORT Bool
-RRTransformCompute (int x,
- int y,
- int width,
- int height,
- Rotation rotation,
- RRTransformPtr rr_transform,
- struct pict_f_transform *sprite_position_transform,
- struct pict_f_transform *sprite_image_transform,
-
- PictTransformPtr transform,
- struct pict_f_transform *f_transform,
- struct pict_f_transform *f_inverse,
- struct pict_f_transform *f_fb_to_sprite,
- struct pict_f_transform *f_sprite_to_image,
- Bool *sprite_transform_in_use);
-
-#endif /* _RRTRANSFORM_H_ */
+/*
+ * Copyright © 2007 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifndef _RRTRANSFORM_H_
+#define _RRTRANSFORM_H_
+
+#include <X11/extensions/randr.h>
+#include "picturestr.h"
+
+typedef struct _rrTransform RRTransformRec, *RRTransformPtr;
+
+struct _rrTransform {
+ PictTransform transform;
+ struct pict_f_transform f_transform;
+ struct pict_f_transform f_inverse;
+ PictFilterPtr filter;
+ xFixed *params;
+ int nparams;
+ int width;
+ int height;
+};
+
+extern _X_EXPORT void
+RRTransformInit (RRTransformPtr transform);
+
+extern _X_EXPORT void
+RRTransformFini (RRTransformPtr transform);
+
+extern _X_EXPORT Bool
+RRTransformEqual (RRTransformPtr a, RRTransformPtr b);
+
+extern _X_EXPORT Bool
+RRTransformSetFilter (RRTransformPtr dst,
+ PictFilterPtr filter,
+ xFixed *params,
+ int nparams,
+ int width,
+ int height);
+
+extern _X_EXPORT Bool
+RRTransformCopy (RRTransformPtr dst, RRTransformPtr src);
+
+extern _X_EXPORT Bool
+RRTransformCompute (int x,
+ int y,
+ int width,
+ int height,
+ Rotation rotation,
+ RRTransformPtr rr_transform,
+
+ PictTransformPtr transform,
+ struct pict_f_transform *f_transform,
+ struct pict_f_transform *f_inverse);
+
+
+#endif /* _RRTRANSFORM_H_ */
diff --git a/xorg-server/record/record.c b/xorg-server/record/record.c
index 5e15c956a..facaebb02 100644
--- a/xorg-server/record/record.c
+++ b/xorg-server/record/record.c
@@ -1,2930 +1,2934 @@
-
-/*
-
-Copyright 1995, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-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 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall
-not be used in advertising or otherwise to promote the sale, use or
-other dealings in this Software without prior written authorization
-from The Open Group.
-
-Author: David P. Wiggins, The Open Group
-
-This work benefited from earlier work done by Martha Zimet of NCD
-and Jim Haggerty of Metheus.
-
-*/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "dixstruct.h"
-#include "extnsionst.h"
-#include <X11/extensions/recordproto.h>
-#include "set.h"
-#include "swaprep.h"
-#include "inputstr.h"
-#include "eventconvert.h"
-#include "scrnintstr.h"
-
-
-#include <stdio.h>
-#include <assert.h>
-
-#ifdef PANORAMIX
-#include "globals.h"
-#include "panoramiX.h"
-#include "panoramiXsrv.h"
-#include "cursor.h"
-#endif
-
-#include "protocol-versions.h"
-
-static RESTYPE RTContext; /* internal resource type for Record contexts */
-
-/* How many bytes of protocol data to buffer in a context. Don't set to less
- * than 32.
- */
-#define REPLY_BUF_SIZE 1024
-
-/* Record Context structure */
-
-typedef struct {
- XID id; /* resource id of context */
- ClientPtr pRecordingClient; /* client that has context enabled */
- struct _RecordClientsAndProtocolRec *pListOfRCAP; /* all registered info */
- ClientPtr pBufClient; /* client whose protocol is in replyBuffer*/
- unsigned int continuedReply:1; /* recording a reply that is split up? */
- char elemHeaders; /* element header flags (time/seq no.) */
- char bufCategory; /* category of protocol in replyBuffer */
- int numBufBytes; /* number of bytes in replyBuffer */
- char replyBuffer[REPLY_BUF_SIZE]; /* buffered recorded protocol */
-} RecordContextRec, *RecordContextPtr;
-
-/* RecordMinorOpRec - to hold minor opcode selections for extension requests
- * and replies
- */
-
-typedef union {
- int count; /* first element of array: how many "major" structs to follow */
- struct { /* rest of array elements are this */
- short first; /* first major opcode */
- short last; /* last major opcode */
- RecordSetPtr pMinOpSet; /* minor opcode set for above major range */
- } major;
-} RecordMinorOpRec, *RecordMinorOpPtr;
-
-
-/* RecordClientsAndProtocolRec, nicknamed RCAP - holds all the client and
- * protocol selections passed in a single CreateContext or RegisterClients.
- * Generally, a context will have one of these from the create and an
- * additional one for each RegisterClients. RCAPs are freed when all their
- * clients are unregistered.
- */
-
-typedef struct _RecordClientsAndProtocolRec {
- RecordContextPtr pContext; /* context that owns this RCAP */
- struct _RecordClientsAndProtocolRec *pNextRCAP; /* next RCAP on context */
- RecordSetPtr pRequestMajorOpSet; /* requests to record */
- RecordMinorOpPtr pRequestMinOpInfo; /* extension requests to record */
- RecordSetPtr pReplyMajorOpSet; /* replies to record */
- RecordMinorOpPtr pReplyMinOpInfo; /* extension replies to record */
- RecordSetPtr pDeviceEventSet; /* device events to record */
- RecordSetPtr pDeliveredEventSet; /* delivered events to record */
- RecordSetPtr pErrorSet; /* errors to record */
- XID * pClientIDs; /* array of clients to record */
- short numClients; /* number of clients in pClientIDs */
- short sizeClients; /* size of pClientIDs array */
- unsigned int clientStarted:1; /* record new client connections? */
- unsigned int clientDied:1; /* record client disconnections? */
- unsigned int clientIDsSeparatelyAllocated:1; /* pClientIDs malloced? */
-} RecordClientsAndProtocolRec, *RecordClientsAndProtocolPtr;
-
-/* how much bigger to make pRCAP->pClientIDs when reallocing */
-#define CLIENT_ARRAY_GROWTH_INCREMENT 4
-
-/* counts the total number of RCAPs belonging to enabled contexts. */
-static int numEnabledRCAPs;
-
-/* void VERIFY_CONTEXT(RecordContextPtr, XID, ClientPtr)
- * In the spirit of the VERIFY_* macros in dix.h, this macro fills in
- * the context pointer if the given ID is a valid Record Context, else it
- * returns an error.
- */
-#define VERIFY_CONTEXT(_pContext, _contextid, _client) { \
- int rc = dixLookupResourceByType((pointer *)&(_pContext), _contextid, \
- RTContext, _client, DixUseAccess); \
- if (rc != Success) \
- return rc; \
-}
-
-static int RecordDeleteContext(
- pointer /*value*/,
- XID /*id*/
-);
-
-void RecordExtensionInit(void);
-
-/***************************************************************************/
-
-/* client private stuff */
-
-/* To make declarations less obfuscated, have a typedef for a pointer to a
- * Proc function.
- */
-typedef int (*ProcFunctionPtr)(
- ClientPtr /*pClient*/
-);
-
-/* Record client private. Generally a client only has one of these if
- * any of its requests are being recorded.
- */
-typedef struct {
-/* ptr to client's proc vector before Record stuck its nose in */
- ProcFunctionPtr *originalVector;
-
-/* proc vector with pointers for recorded requests redirected to the
- * function RecordARequest
- */
- ProcFunctionPtr recordVector[256];
-} RecordClientPrivateRec, *RecordClientPrivatePtr;
-
-static DevPrivateKeyRec RecordClientPrivateKeyRec;
-#define RecordClientPrivateKey (&RecordClientPrivateKeyRec)
-
-/* RecordClientPrivatePtr RecordClientPrivate(ClientPtr)
- * gets the client private of the given client. Syntactic sugar.
- */
-#define RecordClientPrivate(_pClient) (RecordClientPrivatePtr) \
- dixLookupPrivate(&(_pClient)->devPrivates, RecordClientPrivateKey)
-
-
-/***************************************************************************/
-
-/* global list of all contexts */
-
-static RecordContextPtr *ppAllContexts;
-
-static int numContexts;/* number of contexts in ppAllContexts */
-
-/* number of currently enabled contexts. All enabled contexts are bunched
- * up at the front of the ppAllContexts array, from ppAllContexts[0] to
- * ppAllContexts[numEnabledContexts-1], to eliminate time spent skipping
- * past disabled contexts.
- */
-static int numEnabledContexts;
-
-/* RecordFindContextOnAllContexts
- *
- * Arguments:
- * pContext is the context to search for.
- *
- * Returns:
- * The index into the array ppAllContexts at which pContext is stored.
- * If pContext is not found in ppAllContexts, returns -1.
- *
- * Side Effects: none.
- */
-static int
-RecordFindContextOnAllContexts(RecordContextPtr pContext)
-{
- int i;
-
- assert(numContexts >= numEnabledContexts);
- for (i = 0; i < numContexts; i++)
- {
- if (ppAllContexts[i] == pContext)
- return i;
- }
- return -1;
-} /* RecordFindContextOnAllContexts */
-
-
-/***************************************************************************/
-
-/* RecordFlushReplyBuffer
- *
- * Arguments:
- * pContext is the context to flush.
- * data1 is a pointer to additional data, and len1 is its length in bytes.
- * data2 is a pointer to additional data, and len2 is its length in bytes.
- *
- * Returns: nothing.
- *
- * Side Effects:
- * If the context is enabled, any buffered (recorded) protocol is written
- * to the recording client, and the number of buffered bytes is set to
- * zero. If len1 is not zero, data1/len1 are then written to the
- * recording client, and similarly for data2/len2 (written after
- * data1/len1).
- */
-static void
-RecordFlushReplyBuffer(
- RecordContextPtr pContext,
- pointer data1,
- int len1,
- pointer data2,
- int len2
-)
-{
- if (!pContext->pRecordingClient || pContext->pRecordingClient->clientGone)
- return;
- if (pContext->numBufBytes)
- WriteToClient(pContext->pRecordingClient, pContext->numBufBytes,
- (char *)pContext->replyBuffer);
- pContext->numBufBytes = 0;
- if (len1)
- WriteToClient(pContext->pRecordingClient, len1, (char *)data1);
- if (len2)
- WriteToClient(pContext->pRecordingClient, len2, (char *)data2);
-} /* RecordFlushReplyBuffer */
-
-
-/* RecordAProtocolElement
- *
- * Arguments:
- * pContext is the context that is recording a protocol element.
- * pClient is the client whose protocol is being recorded. For
- * device events and EndOfData, pClient is NULL.
- * category is the category of the protocol element, as defined
- * by the RECORD spec.
- * data is a pointer to the protocol data, and datalen is its length
- * in bytes.
- * futurelen is the number of bytes that will be sent in subsequent
- * calls to this function to complete this protocol element.
- * In those subsequent calls, futurelen will be -1 to indicate
- * that the current data is a continuation of the same protocol
- * element.
- *
- * Returns: nothing.
- *
- * Side Effects:
- * The context may be flushed. The new protocol element will be
- * added to the context's protocol buffer with appropriate element
- * headers prepended (sequence number and timestamp). If the data
- * is continuation data (futurelen == -1), element headers won't
- * be added. If the protocol element and headers won't fit in
- * the context's buffer, it is sent directly to the recording
- * client (after any buffered data).
- */
-static void
-RecordAProtocolElement(RecordContextPtr pContext, ClientPtr pClient,
- int category, pointer data, int datalen, int futurelen)
-{
- CARD32 elemHeaderData[2];
- int numElemHeaders = 0;
- Bool recordingClientSwapped = pContext->pRecordingClient->swapped;
- int n;
- CARD32 serverTime = 0;
- Bool gotServerTime = FALSE;
- int replylen;
-
- if (futurelen >= 0)
- { /* start of new protocol element */
- xRecordEnableContextReply *pRep = (xRecordEnableContextReply *)
- pContext->replyBuffer;
- if (pContext->pBufClient != pClient ||
- pContext->bufCategory != category)
- {
- RecordFlushReplyBuffer(pContext, NULL, 0, NULL, 0);
- pContext->pBufClient = pClient;
- pContext->bufCategory = category;
- }
-
- if (!pContext->numBufBytes)
- {
- serverTime = GetTimeInMillis();
- gotServerTime = TRUE;
- pRep->type = X_Reply;
- pRep->category = category;
- pRep->sequenceNumber = pContext->pRecordingClient->sequence;
- pRep->length = 0;
- pRep->elementHeader = pContext->elemHeaders;
- pRep->serverTime = serverTime;
- if (pClient)
- {
- pRep->clientSwapped =
- (pClient->swapped != recordingClientSwapped);
- pRep->idBase = pClient->clientAsMask;
- pRep->recordedSequenceNumber = pClient->sequence;
- }
- else /* it's a device event, StartOfData, or EndOfData */
- {
- pRep->clientSwapped = (category != XRecordFromServer) &&
- recordingClientSwapped;
- pRep->idBase = 0;
- pRep->recordedSequenceNumber = 0;
- }
-
- if (recordingClientSwapped)
- {
- swaps(&pRep->sequenceNumber, n);
- swapl(&pRep->length, n);
- swapl(&pRep->idBase, n);
- swapl(&pRep->serverTime, n);
- swapl(&pRep->recordedSequenceNumber, n);
- }
- pContext->numBufBytes = SIZEOF(xRecordEnableContextReply);
- }
-
- /* generate element headers if needed */
-
- if ( ( (pContext->elemHeaders & XRecordFromClientTime)
- && category == XRecordFromClient)
- ||
- ( (pContext->elemHeaders & XRecordFromServerTime)
- && category == XRecordFromServer))
- {
- if (gotServerTime)
- elemHeaderData[numElemHeaders] = serverTime;
- else
- elemHeaderData[numElemHeaders] = GetTimeInMillis();
- if (recordingClientSwapped)
- swapl(&elemHeaderData[numElemHeaders], n);
- numElemHeaders++;
- }
-
- if ( (pContext->elemHeaders & XRecordFromClientSequence)
- &&
- (category == XRecordFromClient || category == XRecordClientDied))
- {
- elemHeaderData[numElemHeaders] = pClient->sequence;
- if (recordingClientSwapped)
- swapl(&elemHeaderData[numElemHeaders], n);
- numElemHeaders++;
- }
-
- /* adjust reply length */
-
- replylen = pRep->length;
- if (recordingClientSwapped) swapl(&replylen, n);
- replylen += numElemHeaders + bytes_to_int32(datalen) +
- bytes_to_int32(futurelen);
- if (recordingClientSwapped) swapl(&replylen, n);
- pRep->length = replylen;
- } /* end if not continued reply */
-
- numElemHeaders *= 4;
-
- /* if space available >= space needed, buffer the data */
-
- if (REPLY_BUF_SIZE - pContext->numBufBytes >= datalen + numElemHeaders)
- {
- if (numElemHeaders)
- {
- memcpy(pContext->replyBuffer + pContext->numBufBytes,
- elemHeaderData, numElemHeaders);
- pContext->numBufBytes += numElemHeaders;
- }
- if (datalen)
- {
- memcpy(pContext->replyBuffer + pContext->numBufBytes,
- data, datalen);
- pContext->numBufBytes += datalen;
- }
- }
- else
- RecordFlushReplyBuffer(pContext, (pointer)elemHeaderData,
- numElemHeaders, (pointer)data, datalen);
-
-} /* RecordAProtocolElement */
-
-
-/* RecordFindClientOnContext
- *
- * Arguments:
- * pContext is the context to search.
- * clientspec is the resource ID mask identifying the client to search
- * for, or XRecordFutureClients.
- * pposition is a pointer to an int, or NULL. See Returns.
- *
- * Returns:
- * The RCAP on which clientspec was found, or NULL if not found on
- * any RCAP on the given context.
- * If pposition was not NULL and the returned RCAP is not NULL,
- * *pposition will be set to the index into the returned the RCAP's
- * pClientIDs array that holds clientspec.
- *
- * Side Effects: none.
- */
-static RecordClientsAndProtocolPtr
-RecordFindClientOnContext(
- RecordContextPtr pContext,
- XID clientspec,
- int *pposition
-)
-{
- RecordClientsAndProtocolPtr pRCAP;
-
- for (pRCAP = pContext->pListOfRCAP; pRCAP; pRCAP = pRCAP->pNextRCAP)
- {
- int i;
- for (i = 0; i < pRCAP->numClients; i++)
- {
- if (pRCAP->pClientIDs[i] == clientspec)
- {
- if (pposition)
- *pposition = i;
- return pRCAP;
- }
- }
- }
- return NULL;
-} /* RecordFindClientOnContext */
-
-
-/* RecordABigRequest
- *
- * Arguments:
- * pContext is the recording context.
- * client is the client being recorded.
- * stuff is a pointer to the big request of client (see the Big Requests
- * extension for details.)
- *
- * Returns: nothing.
- *
- * Side Effects:
- * The big request is recorded with the correct length field re-inserted.
- *
- * Note: this function exists mainly to make RecordARequest smaller.
- */
-static void
-RecordABigRequest(RecordContextPtr pContext, ClientPtr client, xReq *stuff)
-{
- CARD32 bigLength;
- char n;
- int bytesLeft;
-
- /* note: client->req_len has been frobbed by ReadRequestFromClient
- * (os/io.c) to discount the extra 4 bytes taken by the extended length
- * field in a big request. The actual request length to record is
- * client->req_len + 1 (measured in CARD32s).
- */
-
- /* record the request header */
- bytesLeft = client->req_len << 2;
- RecordAProtocolElement(pContext, client, XRecordFromClient,
- (pointer)stuff, SIZEOF(xReq), bytesLeft);
-
- /* reinsert the extended length field that was squished out */
- bigLength = client->req_len + bytes_to_int32(sizeof(bigLength));
- if (client->swapped)
- swapl(&bigLength, n);
- RecordAProtocolElement(pContext, client, XRecordFromClient,
- (pointer)&bigLength, sizeof(bigLength), /* continuation */ -1);
- bytesLeft -= sizeof(bigLength);
-
- /* record the rest of the request after the length */
- RecordAProtocolElement(pContext, client, XRecordFromClient,
- (pointer)(stuff + 1), bytesLeft, /* continuation */ -1);
-} /* RecordABigRequest */
-
-
-/* RecordARequest
- *
- * Arguments:
- * client is a client that the server has dispatched a request to by
- * calling client->requestVector[request opcode] .
- * The request is in client->requestBuffer.
- *
- * Returns:
- * Whatever is returned by the "real" Proc function for this request.
- * The "real" Proc function is the function that was in
- * client->requestVector[request opcode] before it was replaced by
- * RecordARequest. (See the function RecordInstallHooks.)
- *
- * Side Effects:
- * The request is recorded by all contexts that have registered this
- * request for this client. The real Proc function is called.
- */
-static int
-RecordARequest(ClientPtr client)
-{
- RecordContextPtr pContext;
- RecordClientsAndProtocolPtr pRCAP;
- int i;
- RecordClientPrivatePtr pClientPriv;
- REQUEST(xReq);
- int majorop;
-
- majorop = stuff->reqType;
- for (i = 0; i < numEnabledContexts; i++)
- {
- pContext = ppAllContexts[i];
- pRCAP = RecordFindClientOnContext(pContext, client->clientAsMask,
- NULL);
- if (pRCAP && pRCAP->pRequestMajorOpSet &&
- RecordIsMemberOfSet(pRCAP->pRequestMajorOpSet, majorop))
- {
- if (majorop <= 127)
- { /* core request */
-
- if (stuff->length == 0)
- RecordABigRequest(pContext, client, stuff);
- else
- RecordAProtocolElement(pContext, client, XRecordFromClient,
- (pointer)stuff, client->req_len << 2, 0);
- }
- else /* extension, check minor opcode */
- {
- int minorop = MinorOpcodeOfRequest(client);
- int numMinOpInfo;
- RecordMinorOpPtr pMinorOpInfo = pRCAP->pRequestMinOpInfo;
-
- assert (pMinorOpInfo);
- numMinOpInfo = pMinorOpInfo->count;
- pMinorOpInfo++;
- assert (numMinOpInfo);
- for ( ; numMinOpInfo; numMinOpInfo--, pMinorOpInfo++)
- {
- if (majorop >= pMinorOpInfo->major.first &&
- majorop <= pMinorOpInfo->major.last &&
- RecordIsMemberOfSet(pMinorOpInfo->major.pMinOpSet,
- minorop))
- {
- if (stuff->length == 0)
- RecordABigRequest(pContext, client, stuff);
- else
- RecordAProtocolElement(pContext, client,
- XRecordFromClient, (pointer)stuff,
- client->req_len << 2, 0);
- break;
- }
- } /* end for each minor op info */
- } /* end extension request */
- } /* end this RCAP wants this major opcode */
- } /* end for each context */
- pClientPriv = RecordClientPrivate(client);
- assert(pClientPriv);
- return (* pClientPriv->originalVector[majorop])(client);
-} /* RecordARequest */
-
-/* RecordAReply
- *
- * Arguments:
- * pcbl is &ReplyCallback.
- * nulldata is NULL.
- * calldata is a pointer to a ReplyInfoRec (include/os.h)
- * which provides information about replies that are being sent
- * to clients.
- *
- * Returns: nothing.
- *
- * Side Effects:
- * The reply is recorded by all contexts that have registered this
- * reply type for this client. If more data belonging to the same
- * reply is expected, and if the reply is being recorded by any
- * context, pContext->continuedReply is set to 1.
- * If pContext->continuedReply was already 1 and this is the last
- * chunk of data belonging to this reply, it is set to 0.
- */
-static void
-RecordAReply(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
-{
- RecordContextPtr pContext;
- RecordClientsAndProtocolPtr pRCAP;
- int eci;
- int majorop;
- ReplyInfoRec *pri = (ReplyInfoRec *)calldata;
- ClientPtr client = pri->client;
- REQUEST(xReq);
-
- majorop = stuff->reqType;
- for (eci = 0; eci < numEnabledContexts; eci++)
- {
- pContext = ppAllContexts[eci];
- pRCAP = RecordFindClientOnContext(pContext, client->clientAsMask,
- NULL);
- if (pRCAP)
- {
- if (pContext->continuedReply)
- {
- RecordAProtocolElement(pContext, client, XRecordFromServer,
- (pointer)pri->replyData, pri->dataLenBytes, /* continuation */ -1);
- if (!pri->bytesRemaining)
- pContext->continuedReply = 0;
- }
- else if (pri->startOfReply && pRCAP->pReplyMajorOpSet &&
- RecordIsMemberOfSet(pRCAP->pReplyMajorOpSet, majorop))
- {
- if (majorop <= 127)
- { /* core reply */
- RecordAProtocolElement(pContext, client, XRecordFromServer,
- (pointer)pri->replyData, pri->dataLenBytes, pri->bytesRemaining);
- if (pri->bytesRemaining)
- pContext->continuedReply = 1;
- }
- else /* extension, check minor opcode */
- {
- int minorop = MinorOpcodeOfRequest(client);
- int numMinOpInfo;
- RecordMinorOpPtr pMinorOpInfo = pRCAP->pReplyMinOpInfo;
- assert (pMinorOpInfo);
- numMinOpInfo = pMinorOpInfo->count;
- pMinorOpInfo++;
- assert (numMinOpInfo);
- for ( ; numMinOpInfo; numMinOpInfo--, pMinorOpInfo++)
- {
- if (majorop >= pMinorOpInfo->major.first &&
- majorop <= pMinorOpInfo->major.last &&
- RecordIsMemberOfSet(pMinorOpInfo->major.pMinOpSet,
- minorop))
- {
- RecordAProtocolElement(pContext, client,
- XRecordFromServer, (pointer)pri->replyData,
- pri->dataLenBytes, pri->bytesRemaining);
- if (pri->bytesRemaining)
- pContext->continuedReply = 1;
- break;
- }
- } /* end for each minor op info */
- } /* end extension reply */
- } /* end continued reply vs. start of reply */
- } /* end client is registered on this context */
- } /* end for each context */
-} /* RecordAReply */
-
-
-/* RecordADeliveredEventOrError
- *
- * Arguments:
- * pcbl is &EventCallback.
- * nulldata is NULL.
- * calldata is a pointer to a EventInfoRec (include/dix.h)
- * which provides information about events that are being sent
- * to clients.
- *
- * Returns: nothing.
- *
- * Side Effects:
- * The event or error is recorded by all contexts that have registered
- * it for this client.
- */
-static void
-RecordADeliveredEventOrError(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
-{
- EventInfoRec *pei = (EventInfoRec *)calldata;
- RecordContextPtr pContext;
- RecordClientsAndProtocolPtr pRCAP;
- int eci; /* enabled context index */
- ClientPtr pClient = pei->client;
-
- for (eci = 0; eci < numEnabledContexts; eci++)
- {
- pContext = ppAllContexts[eci];
- pRCAP = RecordFindClientOnContext(pContext, pClient->clientAsMask,
- NULL);
- if (pRCAP && (pRCAP->pDeliveredEventSet || pRCAP->pErrorSet))
- {
- int ev; /* event index */
- xEvent *pev = pei->events;
- for (ev = 0; ev < pei->count; ev++, pev++)
- {
- int recordit = 0;
- if (pRCAP->pErrorSet)
- {
- recordit = RecordIsMemberOfSet(pRCAP->pErrorSet,
- ((xError *)(pev))->errorCode);
- }
- else if (pRCAP->pDeliveredEventSet)
- {
- recordit = RecordIsMemberOfSet(pRCAP->pDeliveredEventSet,
- pev->u.u.type & 0177);
- }
- if (recordit)
- {
- xEvent swappedEvent;
- xEvent *pEvToRecord = pev;
-
- if (pClient->swapped)
- {
- (*EventSwapVector[pev->u.u.type & 0177])
- (pev, &swappedEvent);
- pEvToRecord = &swappedEvent;
-
- }
- RecordAProtocolElement(pContext, pClient,
- XRecordFromServer, pEvToRecord, SIZEOF(xEvent), 0);
- }
- } /* end for each event */
- } /* end this client is on this context */
- } /* end for each enabled context */
-} /* RecordADeliveredEventOrError */
-
-
-static void
-RecordSendProtocolEvents(RecordClientsAndProtocolPtr pRCAP,
- RecordContextPtr pContext,
- xEvent* pev, int count)
-{
- int ev; /* event index */
-
- for (ev = 0; ev < count; ev++, pev++)
- {
- if (RecordIsMemberOfSet(pRCAP->pDeviceEventSet,
- pev->u.u.type & 0177))
- {
- xEvent swappedEvent;
- xEvent *pEvToRecord = pev;
-#ifdef PANORAMIX
- xEvent shiftedEvent;
-
- if (!noPanoramiXExtension &&
- (pev->u.u.type == MotionNotify ||
- pev->u.u.type == ButtonPress ||
- pev->u.u.type == ButtonRelease ||
- pev->u.u.type == KeyPress ||
- pev->u.u.type == KeyRelease)) {
- int scr = XineramaGetCursorScreen(inputInfo.pointer);
- memcpy(&shiftedEvent, pev, sizeof(xEvent));
- shiftedEvent.u.keyButtonPointer.rootX +=
- screenInfo.screens[scr]->x -
- screenInfo.screens[0]->x;
- shiftedEvent.u.keyButtonPointer.rootY +=
- screenInfo.screens[scr]->y -
- screenInfo.screens[0]->y;
- pEvToRecord = &shiftedEvent;
- }
-#endif /* PANORAMIX */
-
- if (pContext->pRecordingClient->swapped)
- {
- (*EventSwapVector[pEvToRecord->u.u.type & 0177])
- (pEvToRecord, &swappedEvent);
- pEvToRecord = &swappedEvent;
- }
-
- RecordAProtocolElement(pContext, NULL,
- XRecordFromServer, pEvToRecord, SIZEOF(xEvent), 0);
- /* make sure device events get flushed in the absence
- * of other client activity
- */
- SetCriticalOutputPending();
- }
- } /* end for each event */
-
-} /* RecordADeviceEvent */
-
-/* RecordADeviceEvent
- *
- * Arguments:
- * pcbl is &DeviceEventCallback.
- * nulldata is NULL.
- * calldata is a pointer to a DeviceEventInfoRec (include/dix.h)
- * which provides information about device events that occur.
- *
- * Returns: nothing.
- *
- * Side Effects:
- * The device event is recorded by all contexts that have registered
- * it for this client.
- */
-static void
-RecordADeviceEvent(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
-{
- DeviceEventInfoRec *pei = (DeviceEventInfoRec *)calldata;
- RecordContextPtr pContext;
- RecordClientsAndProtocolPtr pRCAP;
- int eci; /* enabled context index */
-
- for (eci = 0; eci < numEnabledContexts; eci++)
- {
- pContext = ppAllContexts[eci];
- for (pRCAP = pContext->pListOfRCAP; pRCAP; pRCAP = pRCAP->pNextRCAP)
- {
- if (pRCAP->pDeviceEventSet)
- {
- int count;
- xEvent *xi_events = NULL;
-
- /* TODO check return values */
- if (IsMaster(pei->device))
- {
- xEvent xE;
- EventToCore(pei->event, &xE);
- RecordSendProtocolEvents(pRCAP, pContext, &xE, 1);
- }
-
- EventToXI(pei->event, &xi_events, &count);
- RecordSendProtocolEvents(pRCAP, pContext, xi_events, count);
- free(xi_events);
- } /* end this RCAP selects device events */
- } /* end for each RCAP on this context */
- } /* end for each enabled context */
-}
-
-
-/* RecordFlushAllContexts
- *
- * Arguments:
- * pcbl is &FlushCallback.
- * nulldata and calldata are NULL.
- *
- * Returns: nothing.
- *
- * Side Effects:
- * All buffered reply data of all enabled contexts is written to
- * the recording clients.
- */
-static void
-RecordFlushAllContexts(
- CallbackListPtr *pcbl,
- pointer nulldata,
- pointer calldata
-)
-{
- int eci; /* enabled context index */
- RecordContextPtr pContext;
-
- for (eci = 0; eci < numEnabledContexts; eci++)
- {
- pContext = ppAllContexts[eci];
-
- /* In most cases we leave it to RecordFlushReplyBuffer to make
- * this check, but this function could be called very often, so we
- * check before calling hoping to save the function call cost
- * most of the time.
- */
- if (pContext->numBufBytes)
- RecordFlushReplyBuffer(ppAllContexts[eci], NULL, 0, NULL, 0);
- }
-} /* RecordFlushAllContexts */
-
-
-/* RecordInstallHooks
- *
- * Arguments:
- * pRCAP is an RCAP on an enabled or being-enabled context.
- * oneclient can be zero or the resource ID mask identifying a client.
- *
- * Returns: BadAlloc if a memory allocation error occurred, else Success.
- *
- * Side Effects:
- * Recording hooks needed by RCAP are installed.
- * If oneclient is zero, recording hooks needed for all clients and
- * protocol on the RCAP are installed. If oneclient is non-zero,
- * only those hooks needed for the specified client are installed.
- *
- * Client requestVectors may be altered. numEnabledRCAPs will be
- * incremented if oneclient == 0. Callbacks may be added to
- * various callback lists.
- */
-static int
-RecordInstallHooks(RecordClientsAndProtocolPtr pRCAP, XID oneclient)
-{
- int i = 0;
- XID client;
-
- if (oneclient)
- client = oneclient;
- else
- client = pRCAP->numClients ? pRCAP->pClientIDs[i++] : 0;
-
- while (client)
- {
- if (client != XRecordFutureClients)
- {
- if (pRCAP->pRequestMajorOpSet)
- {
- RecordSetIteratePtr pIter = NULL;
- RecordSetInterval interval;
- ClientPtr pClient = clients[CLIENT_ID(client)];
-
- if (pClient && !RecordClientPrivate(pClient))
- {
- RecordClientPrivatePtr pClientPriv;
- /* no Record proc vector; allocate one */
- pClientPriv = (RecordClientPrivatePtr)
- malloc(sizeof(RecordClientPrivateRec));
- if (!pClientPriv)
- return BadAlloc;
- /* copy old proc vector to new */
- memcpy(pClientPriv->recordVector, pClient->requestVector,
- sizeof (pClientPriv->recordVector));
- pClientPriv->originalVector = pClient->requestVector;
- dixSetPrivate(&pClient->devPrivates,
- RecordClientPrivateKey, pClientPriv);
- pClient->requestVector = pClientPriv->recordVector;
- }
- while ((pIter = RecordIterateSet(pRCAP->pRequestMajorOpSet,
- pIter, &interval)))
- {
- unsigned int j;
- for (j = interval.first; j <= interval.last; j++)
- pClient->requestVector[j] = RecordARequest;
- }
- }
- }
- if (oneclient)
- client = 0;
- else
- client = (i < pRCAP->numClients) ? pRCAP->pClientIDs[i++] : 0;
- }
-
- assert(numEnabledRCAPs >= 0);
- if (!oneclient && ++numEnabledRCAPs == 1)
- { /* we're enabling the first context */
- if (!AddCallback(&EventCallback, RecordADeliveredEventOrError, NULL))
- return BadAlloc;
- if (!AddCallback(&DeviceEventCallback, RecordADeviceEvent, NULL))
- return BadAlloc;
- if (!AddCallback(&ReplyCallback, RecordAReply, NULL))
- return BadAlloc;
- if (!AddCallback(&FlushCallback, RecordFlushAllContexts, NULL))
- return BadAlloc;
- /* Alternate context flushing scheme: delete the line above
- * and call RegisterBlockAndWakeupHandlers here passing
- * RecordFlushAllContexts. Is this any better?
- */
- }
- return Success;
-} /* RecordInstallHooks */
-
-
-/* RecordUninstallHooks
- *
- * Arguments:
- * pRCAP is an RCAP on an enabled or being-disabled context.
- * oneclient can be zero or the resource ID mask identifying a client.
- *
- * Returns: nothing.
- *
- * Side Effects:
- * Recording hooks needed by RCAP may be uninstalled.
- * If oneclient is zero, recording hooks needed for all clients and
- * protocol on the RCAP may be uninstalled. If oneclient is non-zero,
- * only those hooks needed for the specified client may be uninstalled.
- *
- * Client requestVectors may be altered. numEnabledRCAPs will be
- * decremented if oneclient == 0. Callbacks may be deleted from
- * various callback lists.
- */
-static void
-RecordUninstallHooks(RecordClientsAndProtocolPtr pRCAP, XID oneclient)
-{
- int i = 0;
- XID client;
-
- if (oneclient)
- client = oneclient;
- else
- client = pRCAP->numClients ? pRCAP->pClientIDs[i++] : 0;
-
- while (client)
- {
- if (client != XRecordFutureClients)
- {
- if (pRCAP->pRequestMajorOpSet)
- {
- ClientPtr pClient = clients[CLIENT_ID(client)];
- int c;
- Bool otherRCAPwantsProcVector = FALSE;
- RecordClientPrivatePtr pClientPriv = NULL;
-
- assert (pClient);
- pClientPriv = RecordClientPrivate(pClient);
- assert (pClientPriv);
- memcpy(pClientPriv->recordVector, pClientPriv->originalVector,
- sizeof (pClientPriv->recordVector));
-
- for (c = 0; c < numEnabledContexts; c++)
- {
- RecordClientsAndProtocolPtr pOtherRCAP;
- RecordContextPtr pContext = ppAllContexts[c];
-
- if (pContext == pRCAP->pContext) continue;
- pOtherRCAP = RecordFindClientOnContext(pContext, client,
- NULL);
- if (pOtherRCAP && pOtherRCAP->pRequestMajorOpSet)
- {
- RecordSetIteratePtr pIter = NULL;
- RecordSetInterval interval;
-
- otherRCAPwantsProcVector = TRUE;
- while ((pIter = RecordIterateSet(
- pOtherRCAP->pRequestMajorOpSet,
- pIter, &interval)))
- {
- unsigned int j;
- for (j = interval.first; j <= interval.last; j++)
- pClient->requestVector[j] = RecordARequest;
- }
- }
- }
- if (!otherRCAPwantsProcVector)
- { /* nobody needs it, so free it */
- pClient->requestVector = pClientPriv->originalVector;
- dixSetPrivate(&pClient->devPrivates,
- RecordClientPrivateKey, NULL);
- free(pClientPriv);
- }
- } /* end if this RCAP specifies any requests */
- } /* end if not future clients */
- if (oneclient)
- client = 0;
- else
- client = (i < pRCAP->numClients) ? pRCAP->pClientIDs[i++] : 0;
- }
-
- assert(numEnabledRCAPs >= 1);
- if (!oneclient && --numEnabledRCAPs == 0)
- { /* we're disabling the last context */
- DeleteCallback(&EventCallback, RecordADeliveredEventOrError, NULL);
- DeleteCallback(&DeviceEventCallback, RecordADeviceEvent, NULL);
- DeleteCallback(&ReplyCallback, RecordAReply, NULL);
- DeleteCallback(&FlushCallback, RecordFlushAllContexts, NULL);
- /* Alternate context flushing scheme: delete the line above
- * and call RemoveBlockAndWakeupHandlers here passing
- * RecordFlushAllContexts. Is this any better?
- */
- /* Having deleted the callback, call it one last time. -gildea */
- RecordFlushAllContexts(&FlushCallback, NULL, NULL);
- }
-} /* RecordUninstallHooks */
-
-
-/* RecordDeleteClientFromRCAP
- *
- * Arguments:
- * pRCAP is an RCAP to delete the client from.
- * position is the index into the array pRCAP->pClientIDs of the
- * client to delete.
- *
- * Returns: nothing.
- *
- * Side Effects:
- * Recording hooks needed by client will be uninstalled if the context
- * is enabled. The designated client will be removed from the
- * pRCAP->pClientIDs array. If it was the only client on the RCAP,
- * the RCAP is removed from the context and freed. (Invariant: RCAPs
- * have at least one client.)
- */
-static void
-RecordDeleteClientFromRCAP(RecordClientsAndProtocolPtr pRCAP, int position)
-{
- if (pRCAP->pContext->pRecordingClient)
- RecordUninstallHooks(pRCAP, pRCAP->pClientIDs[position]);
- if (position != pRCAP->numClients - 1)
- pRCAP->pClientIDs[position] = pRCAP->pClientIDs[pRCAP->numClients - 1];
- if (--pRCAP->numClients == 0)
- { /* no more clients; remove RCAP from context's list */
- RecordContextPtr pContext = pRCAP->pContext;
- if (pContext->pRecordingClient)
- RecordUninstallHooks(pRCAP, 0);
- if (pContext->pListOfRCAP == pRCAP)
- pContext->pListOfRCAP = pRCAP->pNextRCAP;
- else
- {
- RecordClientsAndProtocolPtr prevRCAP;
- for (prevRCAP = pContext->pListOfRCAP;
- prevRCAP->pNextRCAP != pRCAP;
- prevRCAP = prevRCAP->pNextRCAP)
- ;
- prevRCAP->pNextRCAP = pRCAP->pNextRCAP;
- }
- /* free the RCAP */
- if (pRCAP->clientIDsSeparatelyAllocated)
- free(pRCAP->pClientIDs);
- free(pRCAP);
- }
-} /* RecordDeleteClientFromRCAP */
-
-
-/* RecordAddClientToRCAP
- *
- * Arguments:
- * pRCAP is an RCAP to add the client to.
- * clientspec is the resource ID mask identifying a client, or
- * XRecordFutureClients.
- *
- * Returns: nothing.
- *
- * Side Effects:
- * Recording hooks needed by client will be installed if the context
- * is enabled. The designated client will be added to the
- * pRCAP->pClientIDs array, which may be realloced.
- * pRCAP->clientIDsSeparatelyAllocated may be set to 1 if there
- * is no more room to hold clients internal to the RCAP.
- */
-static void
-RecordAddClientToRCAP(RecordClientsAndProtocolPtr pRCAP, XID clientspec)
-{
- if (pRCAP->numClients == pRCAP->sizeClients)
- {
- if (pRCAP->clientIDsSeparatelyAllocated)
- {
- XID *pNewIDs = (XID *)realloc(pRCAP->pClientIDs,
- (pRCAP->sizeClients + CLIENT_ARRAY_GROWTH_INCREMENT) *
- sizeof(XID));
- if (!pNewIDs)
- return;
- pRCAP->pClientIDs = pNewIDs;
- pRCAP->sizeClients += CLIENT_ARRAY_GROWTH_INCREMENT;
- }
- else
- {
- XID *pNewIDs = (XID *)malloc((pRCAP->sizeClients +
- CLIENT_ARRAY_GROWTH_INCREMENT) * sizeof(XID));
- if (!pNewIDs)
- return;
- memcpy(pNewIDs, pRCAP->pClientIDs, pRCAP->numClients *sizeof(XID));
- pRCAP->pClientIDs = pNewIDs;
- pRCAP->sizeClients += CLIENT_ARRAY_GROWTH_INCREMENT;
- pRCAP->clientIDsSeparatelyAllocated = 1;
- }
- }
- pRCAP->pClientIDs[pRCAP->numClients++] = clientspec;
- if (pRCAP->pContext->pRecordingClient)
- RecordInstallHooks(pRCAP, clientspec);
-} /* RecordDeleteClientFromRCAP */
-
-
-/* RecordDeleteClientFromContext
- *
- * Arguments:
- * pContext is the context to delete from.
- * clientspec is the resource ID mask identifying a client, or
- * XRecordFutureClients.
- *
- * Returns: nothing.
- *
- * Side Effects:
- * If clientspec is on any RCAP of the context, it is deleted from that
- * RCAP. (A given clientspec can only be on one RCAP of a context.)
- */
-static void
-RecordDeleteClientFromContext(RecordContextPtr pContext, XID clientspec)
-{
- RecordClientsAndProtocolPtr pRCAP;
- int position;
-
- if ((pRCAP = RecordFindClientOnContext(pContext, clientspec, &position)))
- RecordDeleteClientFromRCAP(pRCAP, position);
-} /* RecordDeleteClientFromContext */
-
-
-/* RecordSanityCheckClientSpecifiers
- *
- * Arguments:
- * clientspecs is an array of alleged CLIENTSPECs passed by the client.
- * nspecs is the number of elements in clientspecs.
- * errorspec, if non-zero, is the resource id base of a client that
- * must not appear in clienspecs.
- *
- * Returns: BadMatch if any of the clientspecs are invalid, else Success.
- *
- * Side Effects: none.
- */
-static int
-RecordSanityCheckClientSpecifiers(ClientPtr client, XID *clientspecs, int nspecs, XID errorspec)
-{
- int i;
- int clientIndex;
- int rc;
- pointer value;
-
- for (i = 0; i < nspecs; i++)
- {
- if (clientspecs[i] == XRecordCurrentClients ||
- clientspecs[i] == XRecordFutureClients ||
- clientspecs[i] == XRecordAllClients)
- continue;
- if (errorspec && (CLIENT_BITS(clientspecs[i]) == errorspec) )
- return BadMatch;
- clientIndex = CLIENT_ID(clientspecs[i]);
- if (clientIndex && clients[clientIndex] &&
- clients[clientIndex]->clientState == ClientStateRunning)
- {
- if (clientspecs[i] == clients[clientIndex]->clientAsMask)
- continue;
- rc = dixLookupResourceByClass(&value, clientspecs[i], RC_ANY,
- client, DixGetAttrAccess);
- if (rc != Success)
- return rc;
- }
- else
- return BadMatch;
- }
- return Success;
-} /* RecordSanityCheckClientSpecifiers */
-
-
-/* RecordCanonicalizeClientSpecifiers
- *
- * Arguments:
- * pClientspecs is an array of CLIENTSPECs that have been sanity
- * checked.
- * pNumClientspecs is a pointer to the number of elements in pClientspecs.
- * excludespec, if non-zero, is the resource id base of a client that
- * should not be included in the expansion of XRecordAllClients or
- * XRecordCurrentClients.
- *
- * Returns:
- * A pointer to an array of CLIENTSPECs that is the same as the
- * passed array with the following modifications:
- * - all but the client id bits of resource IDs are stripped off.
- * - duplicates removed.
- * - XRecordAllClients expanded to a list of all currently connected
- * clients + XRecordFutureClients - excludespec (if non-zero)
- * - XRecordCurrentClients expanded to a list of all currently
- * connected clients - excludespec (if non-zero)
- * The returned array may be the passed array modified in place, or
- * it may be an malloc'ed array. The caller should keep a pointer to the
- * original array and free the returned array if it is different.
- *
- * *pNumClientspecs is set to the number of elements in the returned
- * array.
- *
- * Side Effects:
- * pClientspecs may be modified in place.
- */
-static XID *
-RecordCanonicalizeClientSpecifiers(XID *pClientspecs, int *pNumClientspecs, XID excludespec)
-{
- int i;
- int numClients = *pNumClientspecs;
-
- /* first pass strips off the resource index bits, leaving just the
- * client id bits. This makes searching for a particular client simpler
- * (and faster.)
- */
- for (i = 0; i < numClients; i++)
- {
- XID cs = pClientspecs[i];
- if (cs > XRecordAllClients)
- pClientspecs[i] = CLIENT_BITS(cs);
- }
-
- for (i = 0; i < numClients; i++)
- {
- if (pClientspecs[i] == XRecordAllClients ||
- pClientspecs[i] == XRecordCurrentClients)
- { /* expand All/Current */
- int j, nc;
- XID *pCanon = (XID *)malloc(sizeof(XID) * (currentMaxClients + 1));
- if (!pCanon) return NULL;
- for (nc = 0, j = 1; j < currentMaxClients; j++)
- {
- ClientPtr client = clients[j];
- if (client != NullClient &&
- client->clientState == ClientStateRunning &&
- client->clientAsMask != excludespec)
- {
- pCanon[nc++] = client->clientAsMask;
- }
- }
- if (pClientspecs[i] == XRecordAllClients)
- pCanon[nc++] = XRecordFutureClients;
- *pNumClientspecs = nc;
- return pCanon;
- }
- else /* not All or Current */
- {
- int j;
- for (j = i + 1; j < numClients; )
- {
- if (pClientspecs[i] == pClientspecs[j])
- {
- pClientspecs[j] = pClientspecs[--numClients];
- }
- else
- j++;
- }
- }
- } /* end for each clientspec */
- *pNumClientspecs = numClients;
- return pClientspecs;
-} /* RecordCanonicalizeClientSpecifiers */
-
-
-/****************************************************************************/
-
-/* stuff for RegisterClients */
-
-/* RecordPadAlign
- *
- * Arguments:
- * size is the number of bytes taken by an object.
- * align is a byte boundary (e.g. 4, 8)
- *
- * Returns:
- * the number of pad bytes to add at the end of an object of the
- * given size so that an object placed immediately behind it will
- * begin on an <align>-byte boundary.
- *
- * Side Effects: none.
- */
-static int
-RecordPadAlign(int size, int align)
-{
- return (align - (size & (align - 1))) & (align - 1);
-} /* RecordPadAlign */
-
-
-/* RecordSanityCheckRegisterClients
- *
- * Arguments:
- * pContext is the context being registered on.
- * client is the client that issued a RecordCreateContext or
- * RecordRegisterClients request.
- * stuff is a pointer to the request.
- *
- * Returns:
- * Any one of several possible error values if any of the request
- * arguments are invalid. Success if everything is OK.
- *
- * Side Effects: none.
- */
-static int
-RecordSanityCheckRegisterClients(RecordContextPtr pContext, ClientPtr client, xRecordRegisterClientsReq *stuff)
-{
- int err;
- xRecordRange *pRange;
- int i;
- XID recordingClient;
-
- if (((client->req_len << 2) - SIZEOF(xRecordRegisterClientsReq)) !=
- 4 * stuff->nClients + SIZEOF(xRecordRange) * stuff->nRanges)
- return BadLength;
-
- if (stuff->elementHeader &
- ~(XRecordFromClientSequence|XRecordFromClientTime|XRecordFromServerTime))
- {
- client->errorValue = stuff->elementHeader;
- return BadValue;
- }
-
- recordingClient = pContext->pRecordingClient ?
- pContext->pRecordingClient->clientAsMask : 0;
- err = RecordSanityCheckClientSpecifiers(client, (XID *)&stuff[1],
- stuff->nClients, recordingClient);
- if (err != Success) return err;
-
- pRange = (xRecordRange *)(((XID *)&stuff[1]) + stuff->nClients);
- for (i = 0; i < stuff->nRanges; i++, pRange++)
- {
- if (pRange->coreRequestsFirst > pRange->coreRequestsLast)
- {
- client->errorValue = pRange->coreRequestsFirst;
- return BadValue;
- }
- if (pRange->coreRepliesFirst > pRange->coreRepliesLast)
- {
- client->errorValue = pRange->coreRepliesFirst;
- return BadValue;
- }
- if ((pRange->extRequestsMajorFirst || pRange->extRequestsMajorLast) &&
- (pRange->extRequestsMajorFirst < 128 ||
- pRange->extRequestsMajorLast < 128 ||
- pRange->extRequestsMajorFirst > pRange->extRequestsMajorLast))
- {
- client->errorValue = pRange->extRequestsMajorFirst;
- return BadValue;
- }
- if (pRange->extRequestsMinorFirst > pRange->extRequestsMinorLast)
- {
- client->errorValue = pRange->extRequestsMinorFirst;
- return BadValue;
- }
- if ((pRange->extRepliesMajorFirst || pRange->extRepliesMajorLast) &&
- (pRange->extRepliesMajorFirst < 128 ||
- pRange->extRepliesMajorLast < 128 ||
- pRange->extRepliesMajorFirst > pRange->extRepliesMajorLast))
- {
- client->errorValue = pRange->extRepliesMajorFirst;
- return BadValue;
- }
- if (pRange->extRepliesMinorFirst > pRange->extRepliesMinorLast)
- {
- client->errorValue = pRange->extRepliesMinorFirst;
- return BadValue;
- }
- if ((pRange->deliveredEventsFirst || pRange->deliveredEventsLast) &&
- (pRange->deliveredEventsFirst < 2 ||
- pRange->deliveredEventsLast < 2 ||
- pRange->deliveredEventsFirst > pRange->deliveredEventsLast))
- {
- client->errorValue = pRange->deliveredEventsFirst;
- return BadValue;
- }
- if ((pRange->deviceEventsFirst || pRange->deviceEventsLast) &&
- (pRange->deviceEventsFirst < 2 ||
- pRange->deviceEventsLast < 2 ||
- pRange->deviceEventsFirst > pRange->deviceEventsLast))
- {
- client->errorValue = pRange->deviceEventsFirst;
- return BadValue;
- }
- if (pRange->errorsFirst > pRange->errorsLast)
- {
- client->errorValue = pRange->errorsFirst;
- return BadValue;
- }
- if (pRange->clientStarted != xFalse && pRange->clientStarted != xTrue)
- {
- client->errorValue = pRange->clientStarted;
- return BadValue;
- }
- if (pRange->clientDied != xFalse && pRange->clientDied != xTrue)
- {
- client->errorValue = pRange->clientDied;
- return BadValue;
- }
- } /* end for each range */
- return Success;
-} /* end RecordSanityCheckRegisterClients */
-
-/* This is a tactical structure used to gather information about all the sets
- * (RecordSetPtr) that need to be created for an RCAP in the process of
- * digesting a list of RECORDRANGEs (converting it to the internal
- * representation).
- */
-typedef struct
-{
- int nintervals; /* number of intervals in following array */
- RecordSetInterval *intervals; /* array of intervals for this set */
- int size; /* size of intevals array; >= nintervals */
- int align; /* alignment restriction for set */
- int offset; /* where to store set pointer rel. to start of RCAP */
- short first, last; /* if for extension, major opcode interval */
-} SetInfoRec, *SetInfoPtr;
-
-/* These constant are used to index into an array of SetInfoRec. */
-enum {REQ, /* set info for requests */
- REP, /* set info for replies */
- ERR, /* set info for errors */
- DEV, /* set info for device events */
- DLEV, /* set info for delivered events */
- PREDEFSETS}; /* number of predefined array entries */
-
-
-/* RecordAllocIntervals
- *
- * Arguments:
- * psi is a pointer to a SetInfoRec whose intervals pointer is NULL.
- * nIntervals is the desired size of the intervals array.
- *
- * Returns: BadAlloc if a memory allocation error occurred, else Success.
- *
- * Side Effects:
- * If Success is returned, psi->intervals is a pointer to size
- * RecordSetIntervals, all zeroed, and psi->size is set to size.
- */
-static int
-RecordAllocIntervals(SetInfoPtr psi, int nIntervals)
-{
- assert(!psi->intervals);
- psi->intervals = (RecordSetInterval *)
- malloc(nIntervals * sizeof(RecordSetInterval));
- if (!psi->intervals)
- return BadAlloc;
- memset(psi->intervals, 0, nIntervals * sizeof(RecordSetInterval));
- psi->size = nIntervals;
- return Success;
-} /* end RecordAllocIntervals */
-
-
-/* RecordConvertRangesToIntervals
- *
- * Arguments:
- * psi is a pointer to the SetInfoRec we are building.
- * pRanges is an array of xRecordRanges.
- * nRanges is the number of elements in pRanges.
- * byteoffset is the offset from the start of an xRecordRange of the
- * two bytes (1 for first, 1 for last) we are interested in.
- * pExtSetInfo, if non-NULL, indicates that the two bytes mentioned
- * above are followed by four bytes (2 for first, 2 for last)
- * representing a minor opcode range, and this information should be
- * stored in one of the SetInfoRecs starting at pExtSetInfo.
- * pnExtSetInfo is the number of elements in the pExtSetInfo array.
- *
- * Returns: BadAlloc if a memory allocation error occurred, else Success.
- *
- * Side Effects:
- * The slice of pRanges indicated by byteoffset is stored in psi.
- * If pExtSetInfo is non-NULL, minor opcode intervals are stored
- * in an existing SetInfoRec if the major opcode interval matches, else
- * they are stored in a new SetInfoRec, and *pnExtSetInfo is
- * increased accordingly.
- */
-static int
-RecordConvertRangesToIntervals(
- SetInfoPtr psi,
- xRecordRange *pRanges,
- int nRanges,
- int byteoffset,
- SetInfoPtr pExtSetInfo,
- int *pnExtSetInfo
-)
-{
- int i;
- CARD8 *pCARD8;
- int first, last;
- int err;
-
- for (i = 0; i < nRanges; i++, pRanges++)
- {
- pCARD8 = ((CARD8 *)pRanges) + byteoffset;
- first = pCARD8[0];
- last = pCARD8[1];
- if (first || last)
- {
- if (!psi->intervals)
- {
- err = RecordAllocIntervals(psi, 2 * (nRanges - i));
- if (err != Success)
- return err;
- }
- psi->intervals[psi->nintervals].first = first;
- psi->intervals[psi->nintervals].last = last;
- psi->nintervals++;
- assert(psi->nintervals <= psi->size);
- if (pExtSetInfo)
- {
- SetInfoPtr pesi = pExtSetInfo;
- CARD16 *pCARD16 = (CARD16 *)(pCARD8 + 2);
- int j;
-
- for (j = 0; j < *pnExtSetInfo; j++, pesi++)
- {
- if ( (first == pesi->first) && (last == pesi->last) )
- break;
- }
- if (j == *pnExtSetInfo)
- {
- err = RecordAllocIntervals(pesi, 2 * (nRanges - i));
- if (err != Success)
- return err;
- pesi->first = first;
- pesi->last = last;
- (*pnExtSetInfo)++;
- }
- pesi->intervals[pesi->nintervals].first = pCARD16[0];
- pesi->intervals[pesi->nintervals].last = pCARD16[1];
- pesi->nintervals++;
- assert(pesi->nintervals <= pesi->size);
- }
- }
- }
- return Success;
-} /* end RecordConvertRangesToIntervals */
-
-#define offset_of(_structure, _field) \
- ((char *)(& (_structure . _field)) - (char *)(&_structure))
-
-/* RecordRegisterClients
- *
- * Arguments:
- * pContext is the context on which to register the clients.
- * client is the client that issued the RecordCreateContext or
- * RecordRegisterClients request.
- * stuff is a pointer to the request.
- *
- * Returns:
- * Any one of several possible error values defined by the protocol.
- * Success if everything is OK.
- *
- * Side Effects:
- * If different element headers are specified, the context is flushed.
- * If any of the specified clients are already registered on the
- * context, they are first unregistered. A new RCAP is created to
- * hold the specified protocol and clients, and it is linked onto the
- * context. If the context is enabled, appropriate hooks are installed
- * to record the new clients and protocol.
- */
-static int
-RecordRegisterClients(RecordContextPtr pContext, ClientPtr client, xRecordRegisterClientsReq *stuff)
-{
- int err;
- int i;
- SetInfoPtr si;
- int maxSets;
- int nExtReqSets = 0;
- int nExtRepSets = 0;
- int extReqSetsOffset = 0;
- int extRepSetsOffset = 0;
- SetInfoPtr pExtReqSets, pExtRepSets;
- int clientListOffset;
- XID *pCanonClients;
- int clientStarted = 0, clientDied = 0;
- xRecordRange *pRanges, rr;
- int nClients;
- int sizeClients;
- int totRCAPsize;
- RecordClientsAndProtocolPtr pRCAP;
- int pad;
- XID recordingClient;
-
- /* do all sanity checking up front */
-
- err = RecordSanityCheckRegisterClients(pContext, client, stuff);
- if (err != Success)
- return err;
-
- /* if element headers changed, flush buffer */
-
- if (pContext->elemHeaders != stuff->elementHeader)
- {
- RecordFlushReplyBuffer(pContext, NULL, 0, NULL, 0);
- pContext->elemHeaders = stuff->elementHeader;
- }
-
- nClients = stuff->nClients;
- if (!nClients)
- /* if empty clients list, we're done. */
- return Success;
-
- recordingClient = pContext->pRecordingClient ?
- pContext->pRecordingClient->clientAsMask : 0;
- pCanonClients = RecordCanonicalizeClientSpecifiers((XID *)&stuff[1],
- &nClients, recordingClient);
- if (!pCanonClients)
- return BadAlloc;
-
- /* We may have to create as many as one set for each "predefined"
- * protocol types, plus one per range for extension reuests, plus one per
- * range for extension replies.
- */
- maxSets = PREDEFSETS + 2 * stuff->nRanges;
- si = (SetInfoPtr)malloc(sizeof(SetInfoRec) * maxSets);
- if (!si)
- {
- err = BadAlloc;
- goto bailout;
- }
- memset(si, 0, sizeof(SetInfoRec) * maxSets);
-
- /* theoretically you must do this because NULL may not be all-bits-zero */
- for (i = 0; i < maxSets; i++)
- si[i].intervals = NULL;
-
- pExtReqSets = si + PREDEFSETS;
- pExtRepSets = pExtReqSets + stuff->nRanges;
-
- pRanges = (xRecordRange *)(((XID *)&stuff[1]) + stuff->nClients);
-
- err = RecordConvertRangesToIntervals(&si[REQ], pRanges, stuff->nRanges,
- offset_of(rr, coreRequestsFirst), NULL, NULL);
- if (err != Success) goto bailout;
-
- err = RecordConvertRangesToIntervals(&si[REQ], pRanges, stuff->nRanges,
- offset_of(rr, extRequestsMajorFirst), pExtReqSets, &nExtReqSets);
- if (err != Success) goto bailout;
-
- err = RecordConvertRangesToIntervals(&si[REP], pRanges, stuff->nRanges,
- offset_of(rr, coreRepliesFirst), NULL, NULL);
- if (err != Success) goto bailout;
-
- err = RecordConvertRangesToIntervals(&si[REP], pRanges, stuff->nRanges,
- offset_of(rr, extRepliesMajorFirst), pExtRepSets, &nExtRepSets);
- if (err != Success) goto bailout;
-
- err = RecordConvertRangesToIntervals(&si[ERR], pRanges, stuff->nRanges,
- offset_of(rr, errorsFirst), NULL, NULL);
- if (err != Success) goto bailout;
-
- err = RecordConvertRangesToIntervals(&si[DLEV], pRanges, stuff->nRanges,
- offset_of(rr, deliveredEventsFirst), NULL, NULL);
- if (err != Success) goto bailout;
-
- err = RecordConvertRangesToIntervals(&si[DEV], pRanges, stuff->nRanges,
- offset_of(rr, deviceEventsFirst), NULL, NULL);
- if (err != Success) goto bailout;
-
- /* collect client-started and client-died */
-
- for (i = 0; i < stuff->nRanges; i++)
- {
- if (pRanges[i].clientStarted) clientStarted = TRUE;
- if (pRanges[i].clientDied) clientDied = TRUE;
- }
-
- /* We now have all the information collected to create all the sets,
- * and we can compute the total memory required for the RCAP.
- */
-
- totRCAPsize = sizeof(RecordClientsAndProtocolRec);
-
- /* leave a little room to grow before forcing a separate allocation */
- sizeClients = nClients + CLIENT_ARRAY_GROWTH_INCREMENT;
- pad = RecordPadAlign(totRCAPsize, sizeof(XID));
- clientListOffset = totRCAPsize + pad;
- totRCAPsize += pad + sizeClients * sizeof(XID);
-
- if (nExtReqSets)
- {
- pad = RecordPadAlign(totRCAPsize, sizeof(RecordSetPtr));
- extReqSetsOffset = totRCAPsize + pad;
- totRCAPsize += pad + (nExtReqSets + 1) * sizeof(RecordMinorOpRec);
- }
- if (nExtRepSets)
- {
- pad = RecordPadAlign(totRCAPsize, sizeof(RecordSetPtr));
- extRepSetsOffset = totRCAPsize + pad;
- totRCAPsize += pad + (nExtRepSets + 1) * sizeof(RecordMinorOpRec);
- }
-
- for (i = 0; i < maxSets; i++)
- {
- if (si[i].nintervals)
- {
- si[i].size = RecordSetMemoryRequirements(
- si[i].intervals, si[i].nintervals, &si[i].align);
- pad = RecordPadAlign(totRCAPsize, si[i].align);
- si[i].offset = pad + totRCAPsize;
- totRCAPsize += pad + si[i].size;
- }
- }
-
- /* allocate memory for the whole RCAP */
-
- pRCAP = (RecordClientsAndProtocolPtr)malloc(totRCAPsize);
- if (!pRCAP)
- {
- err = BadAlloc;
- goto bailout;
- }
-
- /* fill in the RCAP */
-
- pRCAP->pContext = pContext;
- pRCAP->pClientIDs = (XID *)((char *)pRCAP + clientListOffset);
- pRCAP->numClients = nClients;
- pRCAP->sizeClients = sizeClients;
- pRCAP->clientIDsSeparatelyAllocated = 0;
- for (i = 0; i < nClients; i++)
- {
- RecordDeleteClientFromContext(pContext, pCanonClients[i]);
- pRCAP->pClientIDs[i] = pCanonClients[i];
- }
-
- /* create all the sets */
-
- if (si[REQ].intervals)
- {
- pRCAP->pRequestMajorOpSet =
- RecordCreateSet(si[REQ].intervals, si[REQ].nintervals,
- (RecordSetPtr)((char *)pRCAP + si[REQ].offset), si[REQ].size);
- }
- else pRCAP->pRequestMajorOpSet = NULL;
-
- if (si[REP].intervals)
- {
- pRCAP->pReplyMajorOpSet =
- RecordCreateSet(si[REP].intervals, si[REP].nintervals,
- (RecordSetPtr)((char *)pRCAP + si[REP].offset), si[REP].size);
- }
- else pRCAP->pReplyMajorOpSet = NULL;
-
- if (si[ERR].intervals)
- {
- pRCAP->pErrorSet =
- RecordCreateSet(si[ERR].intervals, si[ERR].nintervals,
- (RecordSetPtr)((char *)pRCAP + si[ERR].offset), si[ERR].size);
- }
- else pRCAP->pErrorSet = NULL;
-
- if (si[DEV].intervals)
- {
- pRCAP->pDeviceEventSet =
- RecordCreateSet(si[DEV].intervals, si[DEV].nintervals,
- (RecordSetPtr)((char *)pRCAP + si[DEV].offset), si[DEV].size);
- }
- else pRCAP->pDeviceEventSet = NULL;
-
- if (si[DLEV].intervals)
- {
- pRCAP->pDeliveredEventSet =
- RecordCreateSet(si[DLEV].intervals, si[DLEV].nintervals,
- (RecordSetPtr)((char *)pRCAP + si[DLEV].offset), si[DLEV].size);
- }
- else pRCAP->pDeliveredEventSet = NULL;
-
- if (nExtReqSets)
- {
- pRCAP->pRequestMinOpInfo = (RecordMinorOpPtr)
- ((char *)pRCAP + extReqSetsOffset);
- pRCAP->pRequestMinOpInfo[0].count = nExtReqSets;
- for (i = 0; i < nExtReqSets; i++, pExtReqSets++)
- {
- pRCAP->pRequestMinOpInfo[i+1].major.first = pExtReqSets->first;
- pRCAP->pRequestMinOpInfo[i+1].major.last = pExtReqSets->last;
- pRCAP->pRequestMinOpInfo[i+1].major.pMinOpSet =
- RecordCreateSet(pExtReqSets->intervals,
- pExtReqSets->nintervals,
- (RecordSetPtr)((char *)pRCAP + pExtReqSets->offset),
- pExtReqSets->size);
- }
- }
- else pRCAP->pRequestMinOpInfo = NULL;
-
- if (nExtRepSets)
- {
- pRCAP->pReplyMinOpInfo = (RecordMinorOpPtr)
- ((char *)pRCAP + extRepSetsOffset);
- pRCAP->pReplyMinOpInfo[0].count = nExtRepSets;
- for (i = 0; i < nExtRepSets; i++, pExtRepSets++)
- {
- pRCAP->pReplyMinOpInfo[i+1].major.first = pExtRepSets->first;
- pRCAP->pReplyMinOpInfo[i+1].major.last = pExtRepSets->last;
- pRCAP->pReplyMinOpInfo[i+1].major.pMinOpSet =
- RecordCreateSet(pExtRepSets->intervals,
- pExtRepSets->nintervals,
- (RecordSetPtr)((char *)pRCAP + pExtRepSets->offset),
- pExtRepSets->size);
- }
- }
- else pRCAP->pReplyMinOpInfo = NULL;
-
- pRCAP->clientStarted = clientStarted;
- pRCAP->clientDied = clientDied;
-
- /* link the RCAP onto the context */
-
- pRCAP->pNextRCAP = pContext->pListOfRCAP;
- pContext->pListOfRCAP = pRCAP;
-
- if (pContext->pRecordingClient) /* context enabled */
- RecordInstallHooks(pRCAP, 0);
-
-bailout:
- if (si)
- {
- for (i = 0; i < maxSets; i++)
- free(si[i].intervals);
- free(si);
- }
- if (pCanonClients && pCanonClients != (XID *)&stuff[1])
- free(pCanonClients);
- return err;
-} /* RecordRegisterClients */
-
-
-/* Proc functions all take a client argument, execute the request in
- * client->requestBuffer, and return a protocol error status.
- */
-
-static int
-ProcRecordQueryVersion(ClientPtr client)
-{
- /* REQUEST(xRecordQueryVersionReq); */
- xRecordQueryVersionReply rep;
- int n;
-
- REQUEST_SIZE_MATCH(xRecordQueryVersionReq);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.majorVersion = SERVER_RECORD_MAJOR_VERSION;
- rep.minorVersion = SERVER_RECORD_MINOR_VERSION;
- if(client->swapped)
- {
- swaps(&rep.sequenceNumber, n);
- swaps(&rep.majorVersion, n);
- swaps(&rep.minorVersion, n);
- }
- (void)WriteToClient(client, sizeof(xRecordQueryVersionReply),
- (char *)&rep);
- return Success;
-} /* ProcRecordQueryVersion */
-
-
-static int
-ProcRecordCreateContext(ClientPtr client)
-{
- REQUEST(xRecordCreateContextReq);
- RecordContextPtr pContext;
- RecordContextPtr *ppNewAllContexts = NULL;
- int err = BadAlloc;
-
- REQUEST_AT_LEAST_SIZE(xRecordCreateContextReq);
- LEGAL_NEW_RESOURCE(stuff->context, client);
-
- pContext = (RecordContextPtr)malloc(sizeof(RecordContextRec));
- if (!pContext)
- goto bailout;
-
- /* make sure there is room in ppAllContexts to store the new context */
-
- ppNewAllContexts = (RecordContextPtr *)
- realloc(ppAllContexts, sizeof(RecordContextPtr) * (numContexts + 1));
- if (!ppNewAllContexts)
- goto bailout;
- ppAllContexts = ppNewAllContexts;
-
- pContext->id = stuff->context;
- pContext->pRecordingClient = NULL;
- pContext->pListOfRCAP = NULL;
- pContext->elemHeaders = 0;
- pContext->bufCategory = 0;
- pContext->numBufBytes = 0;
- pContext->pBufClient = NULL;
- pContext->continuedReply = 0;
-
- err = RecordRegisterClients(pContext, client,
- (xRecordRegisterClientsReq *)stuff);
- if (err != Success)
- goto bailout;
-
- if (AddResource(pContext->id, RTContext, pContext))
- {
- ppAllContexts[numContexts++] = pContext;
- return Success;
- }
- else
- {
- RecordDeleteContext((pointer)pContext, pContext->id);
- err = BadAlloc;
- }
-bailout:
- free(pContext);
- return err;
-} /* ProcRecordCreateContext */
-
-
-static int
-ProcRecordRegisterClients(ClientPtr client)
-{
- RecordContextPtr pContext;
- REQUEST(xRecordRegisterClientsReq);
-
- REQUEST_AT_LEAST_SIZE(xRecordRegisterClientsReq);
- VERIFY_CONTEXT(pContext, stuff->context, client);
-
- return RecordRegisterClients(pContext, client, stuff);
-} /* ProcRecordRegisterClients */
-
-
-static int
-ProcRecordUnregisterClients(ClientPtr client)
-{
- RecordContextPtr pContext;
- int err;
- REQUEST(xRecordUnregisterClientsReq);
- XID *pCanonClients;
- int nClients;
- int i;
-
- REQUEST_AT_LEAST_SIZE(xRecordUnregisterClientsReq);
- if ((client->req_len << 2) - SIZEOF(xRecordUnregisterClientsReq) !=
- 4 * stuff->nClients)
- return BadLength;
- VERIFY_CONTEXT(pContext, stuff->context, client);
- err = RecordSanityCheckClientSpecifiers(client, (XID *)&stuff[1],
- stuff->nClients, 0);
- if (err != Success)
- return err;
-
- nClients = stuff->nClients;
- pCanonClients = RecordCanonicalizeClientSpecifiers((XID *)&stuff[1],
- &nClients, 0);
- if (!pCanonClients)
- return BadAlloc;
-
- for (i = 0; i < nClients; i++)
- {
- RecordDeleteClientFromContext(pContext, pCanonClients[i]);
- }
- if (pCanonClients != (XID *)&stuff[1])
- free(pCanonClients);
- return Success;
-} /* ProcRecordUnregisterClients */
-
-
-/****************************************************************************/
-
-/* stuff for GetContext */
-
-/* This is a tactical structure used to hold the xRecordRanges as they are
- * being reconstituted from the sets in the RCAPs.
- */
-
-typedef struct {
- xRecordRange *pRanges; /* array of xRecordRanges for one RCAP */
- int size; /* number of elements in pRanges, >= nRanges */
- int nRanges; /* number of occupied element of pRanges */
-} GetContextRangeInfoRec, *GetContextRangeInfoPtr;
-
-
-/* RecordAllocRanges
- *
- * Arguments:
- * pri is a pointer to a GetContextRangeInfoRec to allocate for.
- * nRanges is the number of xRecordRanges desired for pri.
- *
- * Returns: BadAlloc if a memory allocation error occurred, else Success.
- *
- * Side Effects:
- * If Success is returned, pri->pRanges points to at least nRanges
- * ranges. pri->nRanges is set to nRanges. pri->size is the actual
- * number of ranges. Newly allocated ranges are zeroed.
- */
-static int
-RecordAllocRanges(GetContextRangeInfoPtr pri, int nRanges)
-{
- int newsize;
- xRecordRange *pNewRange;
-#define SZINCR 8
-
- newsize = max(pri->size + SZINCR, nRanges);
- pNewRange = (xRecordRange *)realloc(pri->pRanges,
- newsize * sizeof(xRecordRange));
- if (!pNewRange)
- return BadAlloc;
-
- pri->pRanges = pNewRange;
- pri->size = newsize;
- memset(&pri->pRanges[pri->size - SZINCR], 0, SZINCR * sizeof(xRecordRange));
- if (pri->nRanges < nRanges)
- pri->nRanges = nRanges;
- return Success;
-} /* RecordAllocRanges */
-
-
-/* RecordConvertSetToRanges
- *
- * Arguments:
- * pSet is the set to be converted.
- * pri is where the result should be stored.
- * byteoffset is the offset from the start of an xRecordRange of the
- * two vales (first, last) we are interested in.
- * card8 is TRUE if the vales are one byte each and FALSE if two bytes
- * each.
- * imax is the largest set value to store in pri->pRanges.
- * pStartIndex, if non-NULL, is the index of the first range in
- * pri->pRanges that should be stored to. If NULL,
- * start at index 0.
- *
- * Returns: BadAlloc if a memory allocation error occurred, else Success.
- *
- * Side Effects:
- * If Success is returned, the slice of pri->pRanges indicated by
- * byteoffset and card8 is filled in with the intervals from pSet.
- * if pStartIndex was non-NULL, *pStartIndex is filled in with one
- * more than the index of the last xRecordRange that was touched.
- */
-static int
-RecordConvertSetToRanges(
- RecordSetPtr pSet,
- GetContextRangeInfoPtr pri,
- int byteoffset,
- Bool card8,
- unsigned int imax,
- int *pStartIndex
-)
-{
- int nRanges;
- RecordSetIteratePtr pIter = NULL;
- RecordSetInterval interval;
- CARD8 *pCARD8;
- CARD16 *pCARD16;
- int err;
-
- if (!pSet)
- return Success;
-
- nRanges = pStartIndex ? *pStartIndex : 0;
- while ((pIter = RecordIterateSet(pSet, pIter, &interval)))
- {
- if (interval.first > imax) break;
- if (interval.last > imax) interval.last = imax;
- nRanges++;
- if (nRanges > pri->size)
- {
- err = RecordAllocRanges(pri, nRanges);
- if (err != Success)
- return err;
- }
- else
- pri->nRanges = max(pri->nRanges, nRanges);
- if (card8)
- {
- pCARD8 = ((CARD8 *)&pri->pRanges[nRanges-1]) + byteoffset;
- *pCARD8++ = interval.first;
- *pCARD8 = interval.last;
- }
- else
- {
- pCARD16 = (CARD16 *)
- (((char *)&pri->pRanges[nRanges-1]) + byteoffset);
- *pCARD16++ = interval.first;
- *pCARD16 = interval.last;
- }
- }
- if (pStartIndex)
- *pStartIndex = nRanges;
- return Success;
-} /* RecordConvertSetToRanges */
-
-
-/* RecordConvertMinorOpInfoToRanges
- *
- * Arguments:
- * pMinOpInfo is the minor opcode info to convert to xRecordRanges.
- * pri is where the result should be stored.
- * byteoffset is the offset from the start of an xRecordRange of the
- * four vales (CARD8 major_first, CARD8 major_last,
- * CARD16 minor_first, CARD16 minor_last) we are going to store.
- *
- * Returns: BadAlloc if a memory allocation error occurred, else Success.
- *
- * Side Effects:
- * If Success is returned, the slice of pri->pRanges indicated by
- * byteoffset is filled in with the information from pMinOpInfo.
- */
-static int
-RecordConvertMinorOpInfoToRanges(
- RecordMinorOpPtr pMinOpInfo,
- GetContextRangeInfoPtr pri,
- int byteoffset
-)
-{
- int nsets;
- int start;
- int i;
- int err;
-
- if (!pMinOpInfo)
- return Success;
-
- nsets = pMinOpInfo->count;
- pMinOpInfo++;
- start = 0;
- for (i = 0; i < nsets; i++)
- {
- int j, s;
- s = start;
- err = RecordConvertSetToRanges(pMinOpInfo[i].major.pMinOpSet, pri,
- byteoffset + 2, FALSE, 65535, &start);
- if (err != Success) return err;
- for (j = s; j < start; j++)
- {
- CARD8 *pCARD8 = ((CARD8 *)&pri->pRanges[j]) + byteoffset;
- *pCARD8++ = pMinOpInfo[i].major.first;
- *pCARD8 = pMinOpInfo[i].major.last;
- }
- }
- return Success;
-} /* RecordConvertMinorOpInfoToRanges */
-
-
-/* RecordSwapRanges
- *
- * Arguments:
- * pRanges is an array of xRecordRanges.
- * nRanges is the number of elements in pRanges.
- *
- * Returns: nothing.
- *
- * Side Effects:
- * The 16 bit fields of each xRecordRange are byte swapped.
- */
-static void
-RecordSwapRanges(xRecordRange *pRanges, int nRanges)
-{
- int i;
- register char n;
- for (i = 0; i < nRanges; i++, pRanges++)
- {
- swaps(&pRanges->extRequestsMinorFirst, n);
- swaps(&pRanges->extRequestsMinorLast, n);
- swaps(&pRanges->extRepliesMinorFirst, n);
- swaps(&pRanges->extRepliesMinorLast, n);
- }
-} /* RecordSwapRanges */
-
-
-static int
-ProcRecordGetContext(ClientPtr client)
-{
- RecordContextPtr pContext;
- REQUEST(xRecordGetContextReq);
- xRecordGetContextReply rep;
- int n;
- RecordClientsAndProtocolPtr pRCAP;
- int nRCAPs = 0;
- GetContextRangeInfoPtr pRangeInfo;
- GetContextRangeInfoPtr pri;
- int i;
- int err;
-
- REQUEST_SIZE_MATCH(xRecordGetContextReq);
- VERIFY_CONTEXT(pContext, stuff->context, client);
-
- /* how many RCAPs are there on this context? */
-
- for (pRCAP = pContext->pListOfRCAP; pRCAP; pRCAP = pRCAP->pNextRCAP)
- nRCAPs++;
-
- /* allocate and initialize space for record range info */
-
- pRangeInfo = (GetContextRangeInfoPtr)malloc(
- nRCAPs * sizeof(GetContextRangeInfoRec));
- if (!pRangeInfo && nRCAPs > 0)
- return BadAlloc;
- for (i = 0; i < nRCAPs; i++)
- {
- pRangeInfo[i].pRanges = NULL;
- pRangeInfo[i].size = 0;
- pRangeInfo[i].nRanges = 0;
- }
-
- /* convert the RCAP (internal) representation of the recorded protocol
- * to the wire protocol (external) representation, storing the information
- * for the ith RCAP in pri[i]
- */
-
- for (pRCAP = pContext->pListOfRCAP, pri = pRangeInfo;
- pRCAP;
- pRCAP = pRCAP->pNextRCAP, pri++)
- {
- xRecordRange rr;
-
- err = RecordConvertSetToRanges(pRCAP->pRequestMajorOpSet, pri,
- offset_of(rr, coreRequestsFirst), TRUE, 127, NULL);
- if (err != Success) goto bailout;
-
- err = RecordConvertSetToRanges(pRCAP->pReplyMajorOpSet, pri,
- offset_of(rr, coreRepliesFirst), TRUE, 127, NULL);
- if (err != Success) goto bailout;
-
- err = RecordConvertSetToRanges(pRCAP->pDeliveredEventSet, pri,
- offset_of(rr, deliveredEventsFirst), TRUE, 255, NULL);
- if (err != Success) goto bailout;
-
- err = RecordConvertSetToRanges(pRCAP->pDeviceEventSet, pri,
- offset_of(rr, deviceEventsFirst), TRUE, 255, NULL);
- if (err != Success) goto bailout;
-
- err = RecordConvertSetToRanges(pRCAP->pErrorSet, pri,
- offset_of(rr, errorsFirst), TRUE, 255, NULL);
- if (err != Success) goto bailout;
-
- err = RecordConvertMinorOpInfoToRanges(pRCAP->pRequestMinOpInfo,
- pri, offset_of(rr, extRequestsMajorFirst));
- if (err != Success) goto bailout;
-
- err = RecordConvertMinorOpInfoToRanges(pRCAP->pReplyMinOpInfo,
- pri, offset_of(rr, extRepliesMajorFirst));
- if (err != Success) goto bailout;
-
- if (pRCAP->clientStarted || pRCAP->clientDied)
- {
- if (pri->nRanges == 0)
- RecordAllocRanges(pri, 1);
- pri->pRanges[0].clientStarted = pRCAP->clientStarted;
- pri->pRanges[0].clientDied = pRCAP->clientDied;
- }
- }
-
- /* calculate number of clients and reply length */
-
- rep.nClients = 0;
- rep.length = 0;
- for (pRCAP = pContext->pListOfRCAP, pri = pRangeInfo;
- pRCAP;
- pRCAP = pRCAP->pNextRCAP, pri++)
- {
- rep.nClients += pRCAP->numClients;
- rep.length += pRCAP->numClients *
- ( bytes_to_int32(sizeof(xRecordClientInfo)) +
- pri->nRanges * bytes_to_int32(sizeof(xRecordRange)));
- }
-
- /* write the reply header */
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.enabled = pContext->pRecordingClient != NULL;
- rep.elementHeader = pContext->elemHeaders;
- if(client->swapped)
- {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.nClients, n);
- }
- (void)WriteToClient(client, sizeof(xRecordGetContextReply),
- (char *)&rep);
-
- /* write all the CLIENT_INFOs */
-
- for (pRCAP = pContext->pListOfRCAP, pri = pRangeInfo;
- pRCAP;
- pRCAP = pRCAP->pNextRCAP, pri++)
- {
- xRecordClientInfo rci;
- rci.nRanges = pri->nRanges;
- if (client->swapped)
- {
- swapl(&rci.nRanges, n);
- RecordSwapRanges(pri->pRanges, pri->nRanges);
- }
- for (i = 0; i < pRCAP->numClients; i++)
- {
- rci.clientResource = pRCAP->pClientIDs[i];
- if (client->swapped) swapl(&rci.clientResource, n);
- WriteToClient(client, sizeof(xRecordClientInfo), (char *)&rci);
- WriteToClient(client, sizeof(xRecordRange) * pri->nRanges,
- (char *)pri->pRanges);
- }
- }
- err = Success;
-
-bailout:
- for (i = 0; i < nRCAPs; i++)
- {
- free(pRangeInfo[i].pRanges);
- }
- free(pRangeInfo);
- return err;
-} /* ProcRecordGetContext */
-
-
-static int
-ProcRecordEnableContext(ClientPtr client)
-{
- RecordContextPtr pContext;
- REQUEST(xRecordEnableContextReq);
- int i;
- RecordClientsAndProtocolPtr pRCAP;
-
- REQUEST_SIZE_MATCH(xRecordGetContextReq);
- VERIFY_CONTEXT(pContext, stuff->context, client);
- if (pContext->pRecordingClient)
- return BadMatch; /* already enabled */
-
- /* install record hooks for each RCAP */
-
- for (pRCAP = pContext->pListOfRCAP; pRCAP; pRCAP = pRCAP->pNextRCAP)
- {
- int err = RecordInstallHooks(pRCAP, 0);
- if (err != Success)
- { /* undo the previous installs */
- RecordClientsAndProtocolPtr pUninstallRCAP;
- for (pUninstallRCAP = pContext->pListOfRCAP;
- pUninstallRCAP != pRCAP;
- pUninstallRCAP = pUninstallRCAP->pNextRCAP)
- {
- RecordUninstallHooks(pUninstallRCAP, 0);
- }
- return err;
- }
- }
-
- /* Disallow further request processing on this connection until
- * the context is disabled.
- */
- IgnoreClient(client);
- pContext->pRecordingClient = client;
-
- /* Don't allow the data connection to record itself; unregister it. */
- RecordDeleteClientFromContext(pContext,
- pContext->pRecordingClient->clientAsMask);
-
- /* move the newly enabled context to the front part of ppAllContexts,
- * where all the enabled contexts are
- */
- i = RecordFindContextOnAllContexts(pContext);
- assert(i >= numEnabledContexts);
- if (i != numEnabledContexts)
- {
- ppAllContexts[i] = ppAllContexts[numEnabledContexts];
- ppAllContexts[numEnabledContexts] = pContext;
- }
-
- ++numEnabledContexts;
- assert(numEnabledContexts > 0);
-
- /* send StartOfData */
- RecordAProtocolElement(pContext, NULL, XRecordStartOfData, NULL, 0, 0);
- RecordFlushReplyBuffer(pContext, NULL, 0, NULL, 0);
- return Success;
-} /* ProcRecordEnableContext */
-
-
-/* RecordDisableContext
- *
- * Arguments:
- * pContext is the context to disable.
- * nRanges is the number of elements in pRanges.
- *
- * Returns: nothing.
- *
- * Side Effects:
- * If the context was enabled, it is disabled. An EndOfData
- * message is sent to the recording client. Recording hooks for
- * this context are uninstalled. The context is moved to the
- * rear part of the ppAllContexts array. numEnabledContexts is
- * decremented. Request processing for the formerly recording client
- * is resumed.
- */
-static void
-RecordDisableContext(RecordContextPtr pContext)
-{
- RecordClientsAndProtocolPtr pRCAP;
- int i;
-
- if (!pContext->pRecordingClient) return;
- if (!pContext->pRecordingClient->clientGone)
- {
- RecordAProtocolElement(pContext, NULL, XRecordEndOfData, NULL, 0, 0);
- RecordFlushReplyBuffer(pContext, NULL, 0, NULL, 0);
- /* Re-enable request processing on this connection. */
- AttendClient(pContext->pRecordingClient);
- }
-
- for (pRCAP = pContext->pListOfRCAP; pRCAP; pRCAP = pRCAP->pNextRCAP)
- {
- RecordUninstallHooks(pRCAP, 0);
- }
-
- pContext->pRecordingClient = NULL;
-
- /* move the newly disabled context to the rear part of ppAllContexts,
- * where all the disabled contexts are
- */
- i = RecordFindContextOnAllContexts(pContext);
- assert( (i != -1) && (i < numEnabledContexts) );
- if (i != (numEnabledContexts - 1) )
- {
- ppAllContexts[i] = ppAllContexts[numEnabledContexts-1];
- ppAllContexts[numEnabledContexts-1] = pContext;
- }
- --numEnabledContexts;
- assert(numEnabledContexts >= 0);
-} /* RecordDisableContext */
-
-
-static int
-ProcRecordDisableContext(ClientPtr client)
-{
- RecordContextPtr pContext;
- REQUEST(xRecordDisableContextReq);
-
- REQUEST_SIZE_MATCH(xRecordDisableContextReq);
- VERIFY_CONTEXT(pContext, stuff->context, client);
- RecordDisableContext(pContext);
- return Success;
-} /* ProcRecordDisableContext */
-
-
-/* RecordDeleteContext
- *
- * Arguments:
- * value is the context to delete.
- * id is its resource ID.
- *
- * Returns: Success.
- *
- * Side Effects:
- * Disables the context, frees all associated memory, and removes
- * it from the ppAllContexts array.
- */
-static int
-RecordDeleteContext(pointer value, XID id)
-{
- int i;
- RecordContextPtr pContext = (RecordContextPtr)value;
- RecordClientsAndProtocolPtr pRCAP;
-
- RecordDisableContext(pContext);
-
- /* Remove all the clients from all the RCAPs.
- * As a result, the RCAPs will be freed.
- */
-
- while ((pRCAP = pContext->pListOfRCAP))
- {
- int numClients = pRCAP->numClients;
- /* when the last client is deleted, the RCAP will go away. */
- while(numClients--)
- {
- RecordDeleteClientFromRCAP(pRCAP, numClients);
- }
- }
-
- /* remove context from AllContexts list */
-
- if (-1 != (i = RecordFindContextOnAllContexts(pContext)))
- {
- ppAllContexts[i] = ppAllContexts[numContexts - 1];
- if (--numContexts == 0)
- {
- free(ppAllContexts);
- ppAllContexts = NULL;
- }
- }
- free(pContext);
-
- return Success;
-} /* RecordDeleteContext */
-
-
-static int
-ProcRecordFreeContext(ClientPtr client)
-{
- RecordContextPtr pContext;
- REQUEST(xRecordFreeContextReq);
-
- REQUEST_SIZE_MATCH(xRecordFreeContextReq);
- VERIFY_CONTEXT(pContext, stuff->context, client);
- FreeResource(stuff->context, RT_NONE);
- return Success;
-} /* ProcRecordFreeContext */
-
-
-static int
-ProcRecordDispatch(ClientPtr client)
-{
- REQUEST(xReq);
-
- switch (stuff->data)
- {
- case X_RecordQueryVersion:
- return ProcRecordQueryVersion(client);
- case X_RecordCreateContext:
- return ProcRecordCreateContext(client);
- case X_RecordRegisterClients:
- return ProcRecordRegisterClients(client);
- case X_RecordUnregisterClients:
- return ProcRecordUnregisterClients(client);
- case X_RecordGetContext:
- return ProcRecordGetContext(client);
- case X_RecordEnableContext:
- return ProcRecordEnableContext(client);
- case X_RecordDisableContext:
- return ProcRecordDisableContext(client);
- case X_RecordFreeContext:
- return ProcRecordFreeContext(client);
- default:
- return BadRequest;
- }
-} /* ProcRecordDispatch */
-
-
-static int
-SProcRecordQueryVersion(ClientPtr client)
-{
- REQUEST(xRecordQueryVersionReq);
- register char n;
-
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xRecordQueryVersionReq);
- swaps(&stuff->majorVersion, n);
- swaps(&stuff->minorVersion,n);
- return ProcRecordQueryVersion(client);
-} /* SProcRecordQueryVersion */
-
-
-static int
-SwapCreateRegister(xRecordRegisterClientsReq *stuff)
-{
- register char n;
- int i;
- XID *pClientID;
-
- swapl(&stuff->context, n);
- swapl(&stuff->nClients, n);
- swapl(&stuff->nRanges, n);
- pClientID = (XID *)&stuff[1];
- if (stuff->nClients > stuff->length - bytes_to_int32(sz_xRecordRegisterClientsReq))
- return BadLength;
- for (i = 0; i < stuff->nClients; i++, pClientID++)
- {
- swapl(pClientID, n);
- }
- if (stuff->nRanges > stuff->length - bytes_to_int32(sz_xRecordRegisterClientsReq)
- - stuff->nClients)
- return BadLength;
- RecordSwapRanges((xRecordRange *)pClientID, stuff->nRanges);
- return Success;
-} /* SwapCreateRegister */
-
-
-static int
-SProcRecordCreateContext(ClientPtr client)
-{
- REQUEST(xRecordCreateContextReq);
- int status;
- register char n;
-
- swaps(&stuff->length, n);
- REQUEST_AT_LEAST_SIZE(xRecordCreateContextReq);
- if ((status = SwapCreateRegister((pointer)stuff)) != Success)
- return status;
- return ProcRecordCreateContext(client);
-} /* SProcRecordCreateContext */
-
-
-static int
-SProcRecordRegisterClients(ClientPtr client)
-{
- REQUEST(xRecordRegisterClientsReq);
- int status;
- register char n;
-
- swaps(&stuff->length, n);
- REQUEST_AT_LEAST_SIZE(xRecordRegisterClientsReq);
- if ((status = SwapCreateRegister((pointer)stuff)) != Success)
- return status;
- return ProcRecordRegisterClients(client);
-} /* SProcRecordRegisterClients */
-
-
-static int
-SProcRecordUnregisterClients(ClientPtr client)
-{
- REQUEST(xRecordUnregisterClientsReq);
- register char n;
-
- swaps(&stuff->length, n);
- REQUEST_AT_LEAST_SIZE(xRecordUnregisterClientsReq);
- swapl(&stuff->context, n);
- swapl(&stuff->nClients, n);
- SwapRestL(stuff);
- return ProcRecordUnregisterClients(client);
-} /* SProcRecordUnregisterClients */
-
-
-static int
-SProcRecordGetContext(ClientPtr client)
-{
- REQUEST(xRecordGetContextReq);
- register char n;
-
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xRecordGetContextReq);
- swapl(&stuff->context, n);
- return ProcRecordGetContext(client);
-} /* SProcRecordGetContext */
-
-static int
-SProcRecordEnableContext(ClientPtr client)
-{
- REQUEST(xRecordEnableContextReq);
- register char n;
-
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xRecordEnableContextReq);
- swapl(&stuff->context, n);
- return ProcRecordEnableContext(client);
-} /* SProcRecordEnableContext */
-
-
-static int
-SProcRecordDisableContext(ClientPtr client)
-{
- REQUEST(xRecordDisableContextReq);
- register char n;
-
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xRecordDisableContextReq);
- swapl(&stuff->context, n);
- return ProcRecordDisableContext(client);
-} /* SProcRecordDisableContext */
-
-
-static int
-SProcRecordFreeContext(ClientPtr client)
-{
- REQUEST(xRecordFreeContextReq);
- register char n;
-
- swaps(&stuff->length, n);
- REQUEST_SIZE_MATCH(xRecordFreeContextReq);
- swapl(&stuff->context, n);
- return ProcRecordFreeContext(client);
-} /* SProcRecordFreeContext */
-
-
-static int
-SProcRecordDispatch(ClientPtr client)
-{
- REQUEST(xReq);
-
- switch (stuff->data)
- {
- case X_RecordQueryVersion:
- return SProcRecordQueryVersion(client);
- case X_RecordCreateContext:
- return SProcRecordCreateContext(client);
- case X_RecordRegisterClients:
- return SProcRecordRegisterClients(client);
- case X_RecordUnregisterClients:
- return SProcRecordUnregisterClients(client);
- case X_RecordGetContext:
- return SProcRecordGetContext(client);
- case X_RecordEnableContext:
- return SProcRecordEnableContext(client);
- case X_RecordDisableContext:
- return SProcRecordDisableContext(client);
- case X_RecordFreeContext:
- return SProcRecordFreeContext(client);
- default:
- return BadRequest;
- }
-} /* SProcRecordDispatch */
-
-/* RecordConnectionSetupInfo
- *
- * Arguments:
- * pContext is an enabled context that specifies recording of
- * connection setup info.
- * pci holds the connection setup info.
- *
- * Returns: nothing.
- *
- * Side Effects:
- * The connection setup info is sent to the recording client.
- */
-static void
-RecordConnectionSetupInfo(RecordContextPtr pContext, NewClientInfoRec *pci)
-{
- int prefixsize = SIZEOF(xConnSetupPrefix);
- int restsize = pci->prefix->length * 4;
-
- if (pci->client->swapped)
- {
- char *pConnSetup = (char *)malloc(prefixsize + restsize);
- if (!pConnSetup)
- return;
- SwapConnSetupPrefix(pci->prefix, (xConnSetupPrefix*)pConnSetup);
- SwapConnSetupInfo((char*)pci->setup, (char*)(pConnSetup + prefixsize));
- RecordAProtocolElement(pContext, pci->client, XRecordClientStarted,
- (pointer)pConnSetup, prefixsize + restsize, 0);
- free(pConnSetup);
- }
- else
- {
- /* don't alloc and copy as in the swapped case; just send the
- * data in two pieces
- */
- RecordAProtocolElement(pContext, pci->client, XRecordClientStarted,
- (pointer)pci->prefix, prefixsize, restsize);
- RecordAProtocolElement(pContext, pci->client, XRecordClientStarted,
- (pointer)pci->setup, restsize, /* continuation */ -1);
- }
-} /* RecordConnectionSetupInfo */
-
-
-/* RecordDeleteContext
- *
- * Arguments:
- * pcbl is &ClientStateCallback.
- * nullata is NULL.
- * calldata is a pointer to a NewClientInfoRec (include/dixstruct.h)
- * which contains information about client state changes.
- *
- * Returns: nothing.
- *
- * Side Effects:
- * If a new client has connected and any contexts have specified
- * XRecordFutureClients, the new client is registered on those contexts.
- * If any of those contexts specify recording of the connection setup
- * info, it is recorded.
- *
- * If an existing client has disconnected, it is deleted from any
- * contexts that it was registered on. If any of those contexts
- * specified XRecordClientDied, they record a ClientDied protocol element.
- * If the disconnectiong client happened to be the data connection of an
- * enabled context, the context is disabled.
- */
-
-static void
-RecordAClientStateChange(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
-{
- NewClientInfoRec *pci = (NewClientInfoRec *)calldata;
- int i;
- ClientPtr pClient = pci->client;
- RecordContextPtr *ppAllContextsCopy = NULL;
- int numContextsCopy = 0;
-
- switch (pClient->clientState)
- {
- case ClientStateRunning: /* new client */
- for (i = 0; i < numContexts; i++)
- {
- RecordClientsAndProtocolPtr pRCAP;
- RecordContextPtr pContext = ppAllContexts[i];
-
- if ((pRCAP = RecordFindClientOnContext(pContext,
- XRecordFutureClients, NULL)))
- {
- RecordAddClientToRCAP(pRCAP, pClient->clientAsMask);
- if (pContext->pRecordingClient && pRCAP->clientStarted)
- RecordConnectionSetupInfo(pContext, pci);
- }
- }
- break;
-
- case ClientStateGone:
- case ClientStateRetained: /* client disconnected */
-
- /* RecordDisableContext modifies contents of ppAllContexts. */
- numContextsCopy = numContexts;
- ppAllContextsCopy = malloc(numContextsCopy * sizeof(RecordContextPtr));
- assert(ppAllContextsCopy);
- memcpy(ppAllContextsCopy, ppAllContexts, numContextsCopy * sizeof(RecordContextPtr));
-
- for (i = 0; i < numContextsCopy; i++)
- {
- RecordClientsAndProtocolPtr pRCAP;
- RecordContextPtr pContext = ppAllContextsCopy[i];
- int pos;
-
- if (pContext->pRecordingClient == pClient)
- RecordDisableContext(pContext);
- if ((pRCAP = RecordFindClientOnContext(pContext,
- pClient->clientAsMask, &pos)))
- {
- if (pContext->pRecordingClient && pRCAP->clientDied)
- RecordAProtocolElement(pContext, pClient,
- XRecordClientDied, NULL, 0, 0);
- RecordDeleteClientFromRCAP(pRCAP, pos);
- }
- }
-
- free(ppAllContextsCopy);
- break;
-
- default:
- break;
- } /* end switch on client state */
-} /* RecordAClientStateChange */
-
-
-/* RecordCloseDown
- *
- * Arguments:
- * extEntry is the extension information for RECORD.
- *
- * Returns: nothing.
- *
- * Side Effects:
- * Performs any cleanup needed by RECORD at server shutdown time.
- *
- */
-static void
-RecordCloseDown(ExtensionEntry *extEntry)
-{
- DeleteCallback(&ClientStateCallback, RecordAClientStateChange, NULL);
-} /* RecordCloseDown */
-
-
-/* RecordExtensionInit
- *
- * Arguments: none.
- *
- * Returns: nothing.
- *
- * Side Effects:
- * Enables the RECORD extension if possible.
- */
-void
-RecordExtensionInit(void)
-{
- ExtensionEntry *extentry;
-
- RTContext = CreateNewResourceType(RecordDeleteContext, "RecordContext");
- if (!RTContext)
- return;
-
- if (!dixRegisterPrivateKey(RecordClientPrivateKey, PRIVATE_CLIENT, 0))
- return;
-
- ppAllContexts = NULL;
- numContexts = numEnabledContexts = numEnabledRCAPs = 0;
-
- if (!AddCallback(&ClientStateCallback, RecordAClientStateChange, NULL))
- return;
-
- extentry = AddExtension(RECORD_NAME, RecordNumEvents, RecordNumErrors,
- ProcRecordDispatch, SProcRecordDispatch,
- RecordCloseDown, StandardMinorOpcode);
- if (!extentry)
- {
- DeleteCallback(&ClientStateCallback, RecordAClientStateChange, NULL);
- return;
- }
- SetResourceTypeErrorValue(RTContext, extentry->errorBase + XRecordBadContext);
-
-} /* RecordExtensionInit */
-
+
+/*
+
+Copyright 1995, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+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 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+Author: David P. Wiggins, The Open Group
+
+This work benefited from earlier work done by Martha Zimet of NCD
+and Jim Haggerty of Metheus.
+
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "dixstruct.h"
+#include "extnsionst.h"
+#include <X11/extensions/recordproto.h>
+#include "set.h"
+#include "swaprep.h"
+#include "inputstr.h"
+#include "eventconvert.h"
+#include "scrnintstr.h"
+
+
+#include <stdio.h>
+#include <assert.h>
+
+#ifdef PANORAMIX
+#include "globals.h"
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+#include "cursor.h"
+#endif
+
+#include "protocol-versions.h"
+
+static RESTYPE RTContext; /* internal resource type for Record contexts */
+
+/* How many bytes of protocol data to buffer in a context. Don't set to less
+ * than 32.
+ */
+#define REPLY_BUF_SIZE 1024
+
+/* Record Context structure */
+
+typedef struct {
+ XID id; /* resource id of context */
+ ClientPtr pRecordingClient; /* client that has context enabled */
+ struct _RecordClientsAndProtocolRec *pListOfRCAP; /* all registered info */
+ ClientPtr pBufClient; /* client whose protocol is in replyBuffer*/
+ unsigned int continuedReply:1; /* recording a reply that is split up? */
+ char elemHeaders; /* element header flags (time/seq no.) */
+ char bufCategory; /* category of protocol in replyBuffer */
+ int numBufBytes; /* number of bytes in replyBuffer */
+ char replyBuffer[REPLY_BUF_SIZE]; /* buffered recorded protocol */
+ int inFlush; /* are we inside RecordFlushReplyBuffer */
+} RecordContextRec, *RecordContextPtr;
+
+/* RecordMinorOpRec - to hold minor opcode selections for extension requests
+ * and replies
+ */
+
+typedef union {
+ int count; /* first element of array: how many "major" structs to follow */
+ struct { /* rest of array elements are this */
+ short first; /* first major opcode */
+ short last; /* last major opcode */
+ RecordSetPtr pMinOpSet; /* minor opcode set for above major range */
+ } major;
+} RecordMinorOpRec, *RecordMinorOpPtr;
+
+
+/* RecordClientsAndProtocolRec, nicknamed RCAP - holds all the client and
+ * protocol selections passed in a single CreateContext or RegisterClients.
+ * Generally, a context will have one of these from the create and an
+ * additional one for each RegisterClients. RCAPs are freed when all their
+ * clients are unregistered.
+ */
+
+typedef struct _RecordClientsAndProtocolRec {
+ RecordContextPtr pContext; /* context that owns this RCAP */
+ struct _RecordClientsAndProtocolRec *pNextRCAP; /* next RCAP on context */
+ RecordSetPtr pRequestMajorOpSet; /* requests to record */
+ RecordMinorOpPtr pRequestMinOpInfo; /* extension requests to record */
+ RecordSetPtr pReplyMajorOpSet; /* replies to record */
+ RecordMinorOpPtr pReplyMinOpInfo; /* extension replies to record */
+ RecordSetPtr pDeviceEventSet; /* device events to record */
+ RecordSetPtr pDeliveredEventSet; /* delivered events to record */
+ RecordSetPtr pErrorSet; /* errors to record */
+ XID * pClientIDs; /* array of clients to record */
+ short numClients; /* number of clients in pClientIDs */
+ short sizeClients; /* size of pClientIDs array */
+ unsigned int clientStarted:1; /* record new client connections? */
+ unsigned int clientDied:1; /* record client disconnections? */
+ unsigned int clientIDsSeparatelyAllocated:1; /* pClientIDs malloced? */
+} RecordClientsAndProtocolRec, *RecordClientsAndProtocolPtr;
+
+/* how much bigger to make pRCAP->pClientIDs when reallocing */
+#define CLIENT_ARRAY_GROWTH_INCREMENT 4
+
+/* counts the total number of RCAPs belonging to enabled contexts. */
+static int numEnabledRCAPs;
+
+/* void VERIFY_CONTEXT(RecordContextPtr, XID, ClientPtr)
+ * In the spirit of the VERIFY_* macros in dix.h, this macro fills in
+ * the context pointer if the given ID is a valid Record Context, else it
+ * returns an error.
+ */
+#define VERIFY_CONTEXT(_pContext, _contextid, _client) { \
+ int rc = dixLookupResourceByType((pointer *)&(_pContext), _contextid, \
+ RTContext, _client, DixUseAccess); \
+ if (rc != Success) \
+ return rc; \
+}
+
+static int RecordDeleteContext(
+ pointer /*value*/,
+ XID /*id*/
+);
+
+void RecordExtensionInit(void);
+
+/***************************************************************************/
+
+/* client private stuff */
+
+/* To make declarations less obfuscated, have a typedef for a pointer to a
+ * Proc function.
+ */
+typedef int (*ProcFunctionPtr)(
+ ClientPtr /*pClient*/
+);
+
+/* Record client private. Generally a client only has one of these if
+ * any of its requests are being recorded.
+ */
+typedef struct {
+/* ptr to client's proc vector before Record stuck its nose in */
+ ProcFunctionPtr *originalVector;
+
+/* proc vector with pointers for recorded requests redirected to the
+ * function RecordARequest
+ */
+ ProcFunctionPtr recordVector[256];
+} RecordClientPrivateRec, *RecordClientPrivatePtr;
+
+static DevPrivateKeyRec RecordClientPrivateKeyRec;
+#define RecordClientPrivateKey (&RecordClientPrivateKeyRec)
+
+/* RecordClientPrivatePtr RecordClientPrivate(ClientPtr)
+ * gets the client private of the given client. Syntactic sugar.
+ */
+#define RecordClientPrivate(_pClient) (RecordClientPrivatePtr) \
+ dixLookupPrivate(&(_pClient)->devPrivates, RecordClientPrivateKey)
+
+
+/***************************************************************************/
+
+/* global list of all contexts */
+
+static RecordContextPtr *ppAllContexts;
+
+static int numContexts;/* number of contexts in ppAllContexts */
+
+/* number of currently enabled contexts. All enabled contexts are bunched
+ * up at the front of the ppAllContexts array, from ppAllContexts[0] to
+ * ppAllContexts[numEnabledContexts-1], to eliminate time spent skipping
+ * past disabled contexts.
+ */
+static int numEnabledContexts;
+
+/* RecordFindContextOnAllContexts
+ *
+ * Arguments:
+ * pContext is the context to search for.
+ *
+ * Returns:
+ * The index into the array ppAllContexts at which pContext is stored.
+ * If pContext is not found in ppAllContexts, returns -1.
+ *
+ * Side Effects: none.
+ */
+static int
+RecordFindContextOnAllContexts(RecordContextPtr pContext)
+{
+ int i;
+
+ assert(numContexts >= numEnabledContexts);
+ for (i = 0; i < numContexts; i++)
+ {
+ if (ppAllContexts[i] == pContext)
+ return i;
+ }
+ return -1;
+} /* RecordFindContextOnAllContexts */
+
+
+/***************************************************************************/
+
+/* RecordFlushReplyBuffer
+ *
+ * Arguments:
+ * pContext is the context to flush.
+ * data1 is a pointer to additional data, and len1 is its length in bytes.
+ * data2 is a pointer to additional data, and len2 is its length in bytes.
+ *
+ * Returns: nothing.
+ *
+ * Side Effects:
+ * If the context is enabled, any buffered (recorded) protocol is written
+ * to the recording client, and the number of buffered bytes is set to
+ * zero. If len1 is not zero, data1/len1 are then written to the
+ * recording client, and similarly for data2/len2 (written after
+ * data1/len1).
+ */
+static void
+RecordFlushReplyBuffer(
+ RecordContextPtr pContext,
+ pointer data1,
+ int len1,
+ pointer data2,
+ int len2
+)
+{
+ if (!pContext->pRecordingClient || pContext->pRecordingClient->clientGone || pContext->inFlush)
+ return;
+ ++pContext->inFlush;
+ if (pContext->numBufBytes)
+ WriteToClient(pContext->pRecordingClient, pContext->numBufBytes,
+ (char *)pContext->replyBuffer);
+ pContext->numBufBytes = 0;
+ if (len1)
+ WriteToClient(pContext->pRecordingClient, len1, (char *)data1);
+ if (len2)
+ WriteToClient(pContext->pRecordingClient, len2, (char *)data2);
+ --pContext->inFlush;
+} /* RecordFlushReplyBuffer */
+
+
+/* RecordAProtocolElement
+ *
+ * Arguments:
+ * pContext is the context that is recording a protocol element.
+ * pClient is the client whose protocol is being recorded. For
+ * device events and EndOfData, pClient is NULL.
+ * category is the category of the protocol element, as defined
+ * by the RECORD spec.
+ * data is a pointer to the protocol data, and datalen is its length
+ * in bytes.
+ * futurelen is the number of bytes that will be sent in subsequent
+ * calls to this function to complete this protocol element.
+ * In those subsequent calls, futurelen will be -1 to indicate
+ * that the current data is a continuation of the same protocol
+ * element.
+ *
+ * Returns: nothing.
+ *
+ * Side Effects:
+ * The context may be flushed. The new protocol element will be
+ * added to the context's protocol buffer with appropriate element
+ * headers prepended (sequence number and timestamp). If the data
+ * is continuation data (futurelen == -1), element headers won't
+ * be added. If the protocol element and headers won't fit in
+ * the context's buffer, it is sent directly to the recording
+ * client (after any buffered data).
+ */
+static void
+RecordAProtocolElement(RecordContextPtr pContext, ClientPtr pClient,
+ int category, pointer data, int datalen, int futurelen)
+{
+ CARD32 elemHeaderData[2];
+ int numElemHeaders = 0;
+ Bool recordingClientSwapped = pContext->pRecordingClient->swapped;
+ int n;
+ CARD32 serverTime = 0;
+ Bool gotServerTime = FALSE;
+ int replylen;
+
+ if (futurelen >= 0)
+ { /* start of new protocol element */
+ xRecordEnableContextReply *pRep = (xRecordEnableContextReply *)
+ pContext->replyBuffer;
+ if (pContext->pBufClient != pClient ||
+ pContext->bufCategory != category)
+ {
+ RecordFlushReplyBuffer(pContext, NULL, 0, NULL, 0);
+ pContext->pBufClient = pClient;
+ pContext->bufCategory = category;
+ }
+
+ if (!pContext->numBufBytes)
+ {
+ serverTime = GetTimeInMillis();
+ gotServerTime = TRUE;
+ pRep->type = X_Reply;
+ pRep->category = category;
+ pRep->sequenceNumber = pContext->pRecordingClient->sequence;
+ pRep->length = 0;
+ pRep->elementHeader = pContext->elemHeaders;
+ pRep->serverTime = serverTime;
+ if (pClient)
+ {
+ pRep->clientSwapped =
+ (pClient->swapped != recordingClientSwapped);
+ pRep->idBase = pClient->clientAsMask;
+ pRep->recordedSequenceNumber = pClient->sequence;
+ }
+ else /* it's a device event, StartOfData, or EndOfData */
+ {
+ pRep->clientSwapped = (category != XRecordFromServer) &&
+ recordingClientSwapped;
+ pRep->idBase = 0;
+ pRep->recordedSequenceNumber = 0;
+ }
+
+ if (recordingClientSwapped)
+ {
+ swaps(&pRep->sequenceNumber, n);
+ swapl(&pRep->length, n);
+ swapl(&pRep->idBase, n);
+ swapl(&pRep->serverTime, n);
+ swapl(&pRep->recordedSequenceNumber, n);
+ }
+ pContext->numBufBytes = SIZEOF(xRecordEnableContextReply);
+ }
+
+ /* generate element headers if needed */
+
+ if ( ( (pContext->elemHeaders & XRecordFromClientTime)
+ && category == XRecordFromClient)
+ ||
+ ( (pContext->elemHeaders & XRecordFromServerTime)
+ && category == XRecordFromServer))
+ {
+ if (gotServerTime)
+ elemHeaderData[numElemHeaders] = serverTime;
+ else
+ elemHeaderData[numElemHeaders] = GetTimeInMillis();
+ if (recordingClientSwapped)
+ swapl(&elemHeaderData[numElemHeaders], n);
+ numElemHeaders++;
+ }
+
+ if ( (pContext->elemHeaders & XRecordFromClientSequence)
+ &&
+ (category == XRecordFromClient || category == XRecordClientDied))
+ {
+ elemHeaderData[numElemHeaders] = pClient->sequence;
+ if (recordingClientSwapped)
+ swapl(&elemHeaderData[numElemHeaders], n);
+ numElemHeaders++;
+ }
+
+ /* adjust reply length */
+
+ replylen = pRep->length;
+ if (recordingClientSwapped) swapl(&replylen, n);
+ replylen += numElemHeaders + bytes_to_int32(datalen) +
+ bytes_to_int32(futurelen);
+ if (recordingClientSwapped) swapl(&replylen, n);
+ pRep->length = replylen;
+ } /* end if not continued reply */
+
+ numElemHeaders *= 4;
+
+ /* if space available >= space needed, buffer the data */
+
+ if (REPLY_BUF_SIZE - pContext->numBufBytes >= datalen + numElemHeaders)
+ {
+ if (numElemHeaders)
+ {
+ memcpy(pContext->replyBuffer + pContext->numBufBytes,
+ elemHeaderData, numElemHeaders);
+ pContext->numBufBytes += numElemHeaders;
+ }
+ if (datalen)
+ {
+ memcpy(pContext->replyBuffer + pContext->numBufBytes,
+ data, datalen);
+ pContext->numBufBytes += datalen;
+ }
+ }
+ else
+ RecordFlushReplyBuffer(pContext, (pointer)elemHeaderData,
+ numElemHeaders, (pointer)data, datalen);
+
+} /* RecordAProtocolElement */
+
+
+/* RecordFindClientOnContext
+ *
+ * Arguments:
+ * pContext is the context to search.
+ * clientspec is the resource ID mask identifying the client to search
+ * for, or XRecordFutureClients.
+ * pposition is a pointer to an int, or NULL. See Returns.
+ *
+ * Returns:
+ * The RCAP on which clientspec was found, or NULL if not found on
+ * any RCAP on the given context.
+ * If pposition was not NULL and the returned RCAP is not NULL,
+ * *pposition will be set to the index into the returned the RCAP's
+ * pClientIDs array that holds clientspec.
+ *
+ * Side Effects: none.
+ */
+static RecordClientsAndProtocolPtr
+RecordFindClientOnContext(
+ RecordContextPtr pContext,
+ XID clientspec,
+ int *pposition
+)
+{
+ RecordClientsAndProtocolPtr pRCAP;
+
+ for (pRCAP = pContext->pListOfRCAP; pRCAP; pRCAP = pRCAP->pNextRCAP)
+ {
+ int i;
+ for (i = 0; i < pRCAP->numClients; i++)
+ {
+ if (pRCAP->pClientIDs[i] == clientspec)
+ {
+ if (pposition)
+ *pposition = i;
+ return pRCAP;
+ }
+ }
+ }
+ return NULL;
+} /* RecordFindClientOnContext */
+
+
+/* RecordABigRequest
+ *
+ * Arguments:
+ * pContext is the recording context.
+ * client is the client being recorded.
+ * stuff is a pointer to the big request of client (see the Big Requests
+ * extension for details.)
+ *
+ * Returns: nothing.
+ *
+ * Side Effects:
+ * The big request is recorded with the correct length field re-inserted.
+ *
+ * Note: this function exists mainly to make RecordARequest smaller.
+ */
+static void
+RecordABigRequest(RecordContextPtr pContext, ClientPtr client, xReq *stuff)
+{
+ CARD32 bigLength;
+ char n;
+ int bytesLeft;
+
+ /* note: client->req_len has been frobbed by ReadRequestFromClient
+ * (os/io.c) to discount the extra 4 bytes taken by the extended length
+ * field in a big request. The actual request length to record is
+ * client->req_len + 1 (measured in CARD32s).
+ */
+
+ /* record the request header */
+ bytesLeft = client->req_len << 2;
+ RecordAProtocolElement(pContext, client, XRecordFromClient,
+ (pointer)stuff, SIZEOF(xReq), bytesLeft);
+
+ /* reinsert the extended length field that was squished out */
+ bigLength = client->req_len + bytes_to_int32(sizeof(bigLength));
+ if (client->swapped)
+ swapl(&bigLength, n);
+ RecordAProtocolElement(pContext, client, XRecordFromClient,
+ (pointer)&bigLength, sizeof(bigLength), /* continuation */ -1);
+ bytesLeft -= sizeof(bigLength);
+
+ /* record the rest of the request after the length */
+ RecordAProtocolElement(pContext, client, XRecordFromClient,
+ (pointer)(stuff + 1), bytesLeft, /* continuation */ -1);
+} /* RecordABigRequest */
+
+
+/* RecordARequest
+ *
+ * Arguments:
+ * client is a client that the server has dispatched a request to by
+ * calling client->requestVector[request opcode] .
+ * The request is in client->requestBuffer.
+ *
+ * Returns:
+ * Whatever is returned by the "real" Proc function for this request.
+ * The "real" Proc function is the function that was in
+ * client->requestVector[request opcode] before it was replaced by
+ * RecordARequest. (See the function RecordInstallHooks.)
+ *
+ * Side Effects:
+ * The request is recorded by all contexts that have registered this
+ * request for this client. The real Proc function is called.
+ */
+static int
+RecordARequest(ClientPtr client)
+{
+ RecordContextPtr pContext;
+ RecordClientsAndProtocolPtr pRCAP;
+ int i;
+ RecordClientPrivatePtr pClientPriv;
+ REQUEST(xReq);
+ int majorop;
+
+ majorop = stuff->reqType;
+ for (i = 0; i < numEnabledContexts; i++)
+ {
+ pContext = ppAllContexts[i];
+ pRCAP = RecordFindClientOnContext(pContext, client->clientAsMask,
+ NULL);
+ if (pRCAP && pRCAP->pRequestMajorOpSet &&
+ RecordIsMemberOfSet(pRCAP->pRequestMajorOpSet, majorop))
+ {
+ if (majorop <= 127)
+ { /* core request */
+
+ if (stuff->length == 0)
+ RecordABigRequest(pContext, client, stuff);
+ else
+ RecordAProtocolElement(pContext, client, XRecordFromClient,
+ (pointer)stuff, client->req_len << 2, 0);
+ }
+ else /* extension, check minor opcode */
+ {
+ int minorop = MinorOpcodeOfRequest(client);
+ int numMinOpInfo;
+ RecordMinorOpPtr pMinorOpInfo = pRCAP->pRequestMinOpInfo;
+
+ assert (pMinorOpInfo);
+ numMinOpInfo = pMinorOpInfo->count;
+ pMinorOpInfo++;
+ assert (numMinOpInfo);
+ for ( ; numMinOpInfo; numMinOpInfo--, pMinorOpInfo++)
+ {
+ if (majorop >= pMinorOpInfo->major.first &&
+ majorop <= pMinorOpInfo->major.last &&
+ RecordIsMemberOfSet(pMinorOpInfo->major.pMinOpSet,
+ minorop))
+ {
+ if (stuff->length == 0)
+ RecordABigRequest(pContext, client, stuff);
+ else
+ RecordAProtocolElement(pContext, client,
+ XRecordFromClient, (pointer)stuff,
+ client->req_len << 2, 0);
+ break;
+ }
+ } /* end for each minor op info */
+ } /* end extension request */
+ } /* end this RCAP wants this major opcode */
+ } /* end for each context */
+ pClientPriv = RecordClientPrivate(client);
+ assert(pClientPriv);
+ return (* pClientPriv->originalVector[majorop])(client);
+} /* RecordARequest */
+
+/* RecordAReply
+ *
+ * Arguments:
+ * pcbl is &ReplyCallback.
+ * nulldata is NULL.
+ * calldata is a pointer to a ReplyInfoRec (include/os.h)
+ * which provides information about replies that are being sent
+ * to clients.
+ *
+ * Returns: nothing.
+ *
+ * Side Effects:
+ * The reply is recorded by all contexts that have registered this
+ * reply type for this client. If more data belonging to the same
+ * reply is expected, and if the reply is being recorded by any
+ * context, pContext->continuedReply is set to 1.
+ * If pContext->continuedReply was already 1 and this is the last
+ * chunk of data belonging to this reply, it is set to 0.
+ */
+static void
+RecordAReply(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
+{
+ RecordContextPtr pContext;
+ RecordClientsAndProtocolPtr pRCAP;
+ int eci;
+ int majorop;
+ ReplyInfoRec *pri = (ReplyInfoRec *)calldata;
+ ClientPtr client = pri->client;
+ REQUEST(xReq);
+
+ majorop = stuff->reqType;
+ for (eci = 0; eci < numEnabledContexts; eci++)
+ {
+ pContext = ppAllContexts[eci];
+ pRCAP = RecordFindClientOnContext(pContext, client->clientAsMask,
+ NULL);
+ if (pRCAP)
+ {
+ if (pContext->continuedReply)
+ {
+ RecordAProtocolElement(pContext, client, XRecordFromServer,
+ (pointer)pri->replyData, pri->dataLenBytes, /* continuation */ -1);
+ if (!pri->bytesRemaining)
+ pContext->continuedReply = 0;
+ }
+ else if (pri->startOfReply && pRCAP->pReplyMajorOpSet &&
+ RecordIsMemberOfSet(pRCAP->pReplyMajorOpSet, majorop))
+ {
+ if (majorop <= 127)
+ { /* core reply */
+ RecordAProtocolElement(pContext, client, XRecordFromServer,
+ (pointer)pri->replyData, pri->dataLenBytes, pri->bytesRemaining);
+ if (pri->bytesRemaining)
+ pContext->continuedReply = 1;
+ }
+ else /* extension, check minor opcode */
+ {
+ int minorop = MinorOpcodeOfRequest(client);
+ int numMinOpInfo;
+ RecordMinorOpPtr pMinorOpInfo = pRCAP->pReplyMinOpInfo;
+ assert (pMinorOpInfo);
+ numMinOpInfo = pMinorOpInfo->count;
+ pMinorOpInfo++;
+ assert (numMinOpInfo);
+ for ( ; numMinOpInfo; numMinOpInfo--, pMinorOpInfo++)
+ {
+ if (majorop >= pMinorOpInfo->major.first &&
+ majorop <= pMinorOpInfo->major.last &&
+ RecordIsMemberOfSet(pMinorOpInfo->major.pMinOpSet,
+ minorop))
+ {
+ RecordAProtocolElement(pContext, client,
+ XRecordFromServer, (pointer)pri->replyData,
+ pri->dataLenBytes, pri->bytesRemaining);
+ if (pri->bytesRemaining)
+ pContext->continuedReply = 1;
+ break;
+ }
+ } /* end for each minor op info */
+ } /* end extension reply */
+ } /* end continued reply vs. start of reply */
+ } /* end client is registered on this context */
+ } /* end for each context */
+} /* RecordAReply */
+
+
+/* RecordADeliveredEventOrError
+ *
+ * Arguments:
+ * pcbl is &EventCallback.
+ * nulldata is NULL.
+ * calldata is a pointer to a EventInfoRec (include/dix.h)
+ * which provides information about events that are being sent
+ * to clients.
+ *
+ * Returns: nothing.
+ *
+ * Side Effects:
+ * The event or error is recorded by all contexts that have registered
+ * it for this client.
+ */
+static void
+RecordADeliveredEventOrError(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
+{
+ EventInfoRec *pei = (EventInfoRec *)calldata;
+ RecordContextPtr pContext;
+ RecordClientsAndProtocolPtr pRCAP;
+ int eci; /* enabled context index */
+ ClientPtr pClient = pei->client;
+
+ for (eci = 0; eci < numEnabledContexts; eci++)
+ {
+ pContext = ppAllContexts[eci];
+ pRCAP = RecordFindClientOnContext(pContext, pClient->clientAsMask,
+ NULL);
+ if (pRCAP && (pRCAP->pDeliveredEventSet || pRCAP->pErrorSet))
+ {
+ int ev; /* event index */
+ xEvent *pev = pei->events;
+ for (ev = 0; ev < pei->count; ev++, pev++)
+ {
+ int recordit = 0;
+ if (pRCAP->pErrorSet)
+ {
+ recordit = RecordIsMemberOfSet(pRCAP->pErrorSet,
+ ((xError *)(pev))->errorCode);
+ }
+ else if (pRCAP->pDeliveredEventSet)
+ {
+ recordit = RecordIsMemberOfSet(pRCAP->pDeliveredEventSet,
+ pev->u.u.type & 0177);
+ }
+ if (recordit)
+ {
+ xEvent swappedEvent;
+ xEvent *pEvToRecord = pev;
+
+ if (pClient->swapped)
+ {
+ (*EventSwapVector[pev->u.u.type & 0177])
+ (pev, &swappedEvent);
+ pEvToRecord = &swappedEvent;
+
+ }
+ RecordAProtocolElement(pContext, pClient,
+ XRecordFromServer, pEvToRecord, SIZEOF(xEvent), 0);
+ }
+ } /* end for each event */
+ } /* end this client is on this context */
+ } /* end for each enabled context */
+} /* RecordADeliveredEventOrError */
+
+
+static void
+RecordSendProtocolEvents(RecordClientsAndProtocolPtr pRCAP,
+ RecordContextPtr pContext,
+ xEvent* pev, int count)
+{
+ int ev; /* event index */
+
+ for (ev = 0; ev < count; ev++, pev++)
+ {
+ if (RecordIsMemberOfSet(pRCAP->pDeviceEventSet,
+ pev->u.u.type & 0177))
+ {
+ xEvent swappedEvent;
+ xEvent *pEvToRecord = pev;
+#ifdef PANORAMIX
+ xEvent shiftedEvent;
+
+ if (!noPanoramiXExtension &&
+ (pev->u.u.type == MotionNotify ||
+ pev->u.u.type == ButtonPress ||
+ pev->u.u.type == ButtonRelease ||
+ pev->u.u.type == KeyPress ||
+ pev->u.u.type == KeyRelease)) {
+ int scr = XineramaGetCursorScreen(inputInfo.pointer);
+ memcpy(&shiftedEvent, pev, sizeof(xEvent));
+ shiftedEvent.u.keyButtonPointer.rootX +=
+ screenInfo.screens[scr]->x -
+ screenInfo.screens[0]->x;
+ shiftedEvent.u.keyButtonPointer.rootY +=
+ screenInfo.screens[scr]->y -
+ screenInfo.screens[0]->y;
+ pEvToRecord = &shiftedEvent;
+ }
+#endif /* PANORAMIX */
+
+ if (pContext->pRecordingClient->swapped)
+ {
+ (*EventSwapVector[pEvToRecord->u.u.type & 0177])
+ (pEvToRecord, &swappedEvent);
+ pEvToRecord = &swappedEvent;
+ }
+
+ RecordAProtocolElement(pContext, NULL,
+ XRecordFromServer, pEvToRecord, SIZEOF(xEvent), 0);
+ /* make sure device events get flushed in the absence
+ * of other client activity
+ */
+ SetCriticalOutputPending();
+ }
+ } /* end for each event */
+
+} /* RecordADeviceEvent */
+
+/* RecordADeviceEvent
+ *
+ * Arguments:
+ * pcbl is &DeviceEventCallback.
+ * nulldata is NULL.
+ * calldata is a pointer to a DeviceEventInfoRec (include/dix.h)
+ * which provides information about device events that occur.
+ *
+ * Returns: nothing.
+ *
+ * Side Effects:
+ * The device event is recorded by all contexts that have registered
+ * it for this client.
+ */
+static void
+RecordADeviceEvent(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
+{
+ DeviceEventInfoRec *pei = (DeviceEventInfoRec *)calldata;
+ RecordContextPtr pContext;
+ RecordClientsAndProtocolPtr pRCAP;
+ int eci; /* enabled context index */
+
+ for (eci = 0; eci < numEnabledContexts; eci++)
+ {
+ pContext = ppAllContexts[eci];
+ for (pRCAP = pContext->pListOfRCAP; pRCAP; pRCAP = pRCAP->pNextRCAP)
+ {
+ if (pRCAP->pDeviceEventSet)
+ {
+ int count;
+ xEvent *xi_events = NULL;
+
+ /* TODO check return values */
+ if (IsMaster(pei->device))
+ {
+ xEvent xE;
+ EventToCore(pei->event, &xE);
+ RecordSendProtocolEvents(pRCAP, pContext, &xE, 1);
+ }
+
+ EventToXI(pei->event, &xi_events, &count);
+ RecordSendProtocolEvents(pRCAP, pContext, xi_events, count);
+ free(xi_events);
+ } /* end this RCAP selects device events */
+ } /* end for each RCAP on this context */
+ } /* end for each enabled context */
+}
+
+
+/* RecordFlushAllContexts
+ *
+ * Arguments:
+ * pcbl is &FlushCallback.
+ * nulldata and calldata are NULL.
+ *
+ * Returns: nothing.
+ *
+ * Side Effects:
+ * All buffered reply data of all enabled contexts is written to
+ * the recording clients.
+ */
+static void
+RecordFlushAllContexts(
+ CallbackListPtr *pcbl,
+ pointer nulldata,
+ pointer calldata
+)
+{
+ int eci; /* enabled context index */
+ RecordContextPtr pContext;
+
+ for (eci = 0; eci < numEnabledContexts; eci++)
+ {
+ pContext = ppAllContexts[eci];
+
+ /* In most cases we leave it to RecordFlushReplyBuffer to make
+ * this check, but this function could be called very often, so we
+ * check before calling hoping to save the function call cost
+ * most of the time.
+ */
+ if (pContext->numBufBytes)
+ RecordFlushReplyBuffer(ppAllContexts[eci], NULL, 0, NULL, 0);
+ }
+} /* RecordFlushAllContexts */
+
+
+/* RecordInstallHooks
+ *
+ * Arguments:
+ * pRCAP is an RCAP on an enabled or being-enabled context.
+ * oneclient can be zero or the resource ID mask identifying a client.
+ *
+ * Returns: BadAlloc if a memory allocation error occurred, else Success.
+ *
+ * Side Effects:
+ * Recording hooks needed by RCAP are installed.
+ * If oneclient is zero, recording hooks needed for all clients and
+ * protocol on the RCAP are installed. If oneclient is non-zero,
+ * only those hooks needed for the specified client are installed.
+ *
+ * Client requestVectors may be altered. numEnabledRCAPs will be
+ * incremented if oneclient == 0. Callbacks may be added to
+ * various callback lists.
+ */
+static int
+RecordInstallHooks(RecordClientsAndProtocolPtr pRCAP, XID oneclient)
+{
+ int i = 0;
+ XID client;
+
+ if (oneclient)
+ client = oneclient;
+ else
+ client = pRCAP->numClients ? pRCAP->pClientIDs[i++] : 0;
+
+ while (client)
+ {
+ if (client != XRecordFutureClients)
+ {
+ if (pRCAP->pRequestMajorOpSet)
+ {
+ RecordSetIteratePtr pIter = NULL;
+ RecordSetInterval interval;
+ ClientPtr pClient = clients[CLIENT_ID(client)];
+
+ if (pClient && !RecordClientPrivate(pClient))
+ {
+ RecordClientPrivatePtr pClientPriv;
+ /* no Record proc vector; allocate one */
+ pClientPriv = (RecordClientPrivatePtr)
+ malloc(sizeof(RecordClientPrivateRec));
+ if (!pClientPriv)
+ return BadAlloc;
+ /* copy old proc vector to new */
+ memcpy(pClientPriv->recordVector, pClient->requestVector,
+ sizeof (pClientPriv->recordVector));
+ pClientPriv->originalVector = pClient->requestVector;
+ dixSetPrivate(&pClient->devPrivates,
+ RecordClientPrivateKey, pClientPriv);
+ pClient->requestVector = pClientPriv->recordVector;
+ }
+ while ((pIter = RecordIterateSet(pRCAP->pRequestMajorOpSet,
+ pIter, &interval)))
+ {
+ unsigned int j;
+ for (j = interval.first; j <= interval.last; j++)
+ pClient->requestVector[j] = RecordARequest;
+ }
+ }
+ }
+ if (oneclient)
+ client = 0;
+ else
+ client = (i < pRCAP->numClients) ? pRCAP->pClientIDs[i++] : 0;
+ }
+
+ assert(numEnabledRCAPs >= 0);
+ if (!oneclient && ++numEnabledRCAPs == 1)
+ { /* we're enabling the first context */
+ if (!AddCallback(&EventCallback, RecordADeliveredEventOrError, NULL))
+ return BadAlloc;
+ if (!AddCallback(&DeviceEventCallback, RecordADeviceEvent, NULL))
+ return BadAlloc;
+ if (!AddCallback(&ReplyCallback, RecordAReply, NULL))
+ return BadAlloc;
+ if (!AddCallback(&FlushCallback, RecordFlushAllContexts, NULL))
+ return BadAlloc;
+ /* Alternate context flushing scheme: delete the line above
+ * and call RegisterBlockAndWakeupHandlers here passing
+ * RecordFlushAllContexts. Is this any better?
+ */
+ }
+ return Success;
+} /* RecordInstallHooks */
+
+
+/* RecordUninstallHooks
+ *
+ * Arguments:
+ * pRCAP is an RCAP on an enabled or being-disabled context.
+ * oneclient can be zero or the resource ID mask identifying a client.
+ *
+ * Returns: nothing.
+ *
+ * Side Effects:
+ * Recording hooks needed by RCAP may be uninstalled.
+ * If oneclient is zero, recording hooks needed for all clients and
+ * protocol on the RCAP may be uninstalled. If oneclient is non-zero,
+ * only those hooks needed for the specified client may be uninstalled.
+ *
+ * Client requestVectors may be altered. numEnabledRCAPs will be
+ * decremented if oneclient == 0. Callbacks may be deleted from
+ * various callback lists.
+ */
+static void
+RecordUninstallHooks(RecordClientsAndProtocolPtr pRCAP, XID oneclient)
+{
+ int i = 0;
+ XID client;
+
+ if (oneclient)
+ client = oneclient;
+ else
+ client = pRCAP->numClients ? pRCAP->pClientIDs[i++] : 0;
+
+ while (client)
+ {
+ if (client != XRecordFutureClients)
+ {
+ if (pRCAP->pRequestMajorOpSet)
+ {
+ ClientPtr pClient = clients[CLIENT_ID(client)];
+ int c;
+ Bool otherRCAPwantsProcVector = FALSE;
+ RecordClientPrivatePtr pClientPriv = NULL;
+
+ assert (pClient);
+ pClientPriv = RecordClientPrivate(pClient);
+ assert (pClientPriv);
+ memcpy(pClientPriv->recordVector, pClientPriv->originalVector,
+ sizeof (pClientPriv->recordVector));
+
+ for (c = 0; c < numEnabledContexts; c++)
+ {
+ RecordClientsAndProtocolPtr pOtherRCAP;
+ RecordContextPtr pContext = ppAllContexts[c];
+
+ if (pContext == pRCAP->pContext) continue;
+ pOtherRCAP = RecordFindClientOnContext(pContext, client,
+ NULL);
+ if (pOtherRCAP && pOtherRCAP->pRequestMajorOpSet)
+ {
+ RecordSetIteratePtr pIter = NULL;
+ RecordSetInterval interval;
+
+ otherRCAPwantsProcVector = TRUE;
+ while ((pIter = RecordIterateSet(
+ pOtherRCAP->pRequestMajorOpSet,
+ pIter, &interval)))
+ {
+ unsigned int j;
+ for (j = interval.first; j <= interval.last; j++)
+ pClient->requestVector[j] = RecordARequest;
+ }
+ }
+ }
+ if (!otherRCAPwantsProcVector)
+ { /* nobody needs it, so free it */
+ pClient->requestVector = pClientPriv->originalVector;
+ dixSetPrivate(&pClient->devPrivates,
+ RecordClientPrivateKey, NULL);
+ free(pClientPriv);
+ }
+ } /* end if this RCAP specifies any requests */
+ } /* end if not future clients */
+ if (oneclient)
+ client = 0;
+ else
+ client = (i < pRCAP->numClients) ? pRCAP->pClientIDs[i++] : 0;
+ }
+
+ assert(numEnabledRCAPs >= 1);
+ if (!oneclient && --numEnabledRCAPs == 0)
+ { /* we're disabling the last context */
+ DeleteCallback(&EventCallback, RecordADeliveredEventOrError, NULL);
+ DeleteCallback(&DeviceEventCallback, RecordADeviceEvent, NULL);
+ DeleteCallback(&ReplyCallback, RecordAReply, NULL);
+ DeleteCallback(&FlushCallback, RecordFlushAllContexts, NULL);
+ /* Alternate context flushing scheme: delete the line above
+ * and call RemoveBlockAndWakeupHandlers here passing
+ * RecordFlushAllContexts. Is this any better?
+ */
+ /* Having deleted the callback, call it one last time. -gildea */
+ RecordFlushAllContexts(&FlushCallback, NULL, NULL);
+ }
+} /* RecordUninstallHooks */
+
+
+/* RecordDeleteClientFromRCAP
+ *
+ * Arguments:
+ * pRCAP is an RCAP to delete the client from.
+ * position is the index into the array pRCAP->pClientIDs of the
+ * client to delete.
+ *
+ * Returns: nothing.
+ *
+ * Side Effects:
+ * Recording hooks needed by client will be uninstalled if the context
+ * is enabled. The designated client will be removed from the
+ * pRCAP->pClientIDs array. If it was the only client on the RCAP,
+ * the RCAP is removed from the context and freed. (Invariant: RCAPs
+ * have at least one client.)
+ */
+static void
+RecordDeleteClientFromRCAP(RecordClientsAndProtocolPtr pRCAP, int position)
+{
+ if (pRCAP->pContext->pRecordingClient)
+ RecordUninstallHooks(pRCAP, pRCAP->pClientIDs[position]);
+ if (position != pRCAP->numClients - 1)
+ pRCAP->pClientIDs[position] = pRCAP->pClientIDs[pRCAP->numClients - 1];
+ if (--pRCAP->numClients == 0)
+ { /* no more clients; remove RCAP from context's list */
+ RecordContextPtr pContext = pRCAP->pContext;
+ if (pContext->pRecordingClient)
+ RecordUninstallHooks(pRCAP, 0);
+ if (pContext->pListOfRCAP == pRCAP)
+ pContext->pListOfRCAP = pRCAP->pNextRCAP;
+ else
+ {
+ RecordClientsAndProtocolPtr prevRCAP;
+ for (prevRCAP = pContext->pListOfRCAP;
+ prevRCAP->pNextRCAP != pRCAP;
+ prevRCAP = prevRCAP->pNextRCAP)
+ ;
+ prevRCAP->pNextRCAP = pRCAP->pNextRCAP;
+ }
+ /* free the RCAP */
+ if (pRCAP->clientIDsSeparatelyAllocated)
+ free(pRCAP->pClientIDs);
+ free(pRCAP);
+ }
+} /* RecordDeleteClientFromRCAP */
+
+
+/* RecordAddClientToRCAP
+ *
+ * Arguments:
+ * pRCAP is an RCAP to add the client to.
+ * clientspec is the resource ID mask identifying a client, or
+ * XRecordFutureClients.
+ *
+ * Returns: nothing.
+ *
+ * Side Effects:
+ * Recording hooks needed by client will be installed if the context
+ * is enabled. The designated client will be added to the
+ * pRCAP->pClientIDs array, which may be realloced.
+ * pRCAP->clientIDsSeparatelyAllocated may be set to 1 if there
+ * is no more room to hold clients internal to the RCAP.
+ */
+static void
+RecordAddClientToRCAP(RecordClientsAndProtocolPtr pRCAP, XID clientspec)
+{
+ if (pRCAP->numClients == pRCAP->sizeClients)
+ {
+ if (pRCAP->clientIDsSeparatelyAllocated)
+ {
+ XID *pNewIDs = (XID *)realloc(pRCAP->pClientIDs,
+ (pRCAP->sizeClients + CLIENT_ARRAY_GROWTH_INCREMENT) *
+ sizeof(XID));
+ if (!pNewIDs)
+ return;
+ pRCAP->pClientIDs = pNewIDs;
+ pRCAP->sizeClients += CLIENT_ARRAY_GROWTH_INCREMENT;
+ }
+ else
+ {
+ XID *pNewIDs = (XID *)malloc((pRCAP->sizeClients +
+ CLIENT_ARRAY_GROWTH_INCREMENT) * sizeof(XID));
+ if (!pNewIDs)
+ return;
+ memcpy(pNewIDs, pRCAP->pClientIDs, pRCAP->numClients *sizeof(XID));
+ pRCAP->pClientIDs = pNewIDs;
+ pRCAP->sizeClients += CLIENT_ARRAY_GROWTH_INCREMENT;
+ pRCAP->clientIDsSeparatelyAllocated = 1;
+ }
+ }
+ pRCAP->pClientIDs[pRCAP->numClients++] = clientspec;
+ if (pRCAP->pContext->pRecordingClient)
+ RecordInstallHooks(pRCAP, clientspec);
+} /* RecordDeleteClientFromRCAP */
+
+
+/* RecordDeleteClientFromContext
+ *
+ * Arguments:
+ * pContext is the context to delete from.
+ * clientspec is the resource ID mask identifying a client, or
+ * XRecordFutureClients.
+ *
+ * Returns: nothing.
+ *
+ * Side Effects:
+ * If clientspec is on any RCAP of the context, it is deleted from that
+ * RCAP. (A given clientspec can only be on one RCAP of a context.)
+ */
+static void
+RecordDeleteClientFromContext(RecordContextPtr pContext, XID clientspec)
+{
+ RecordClientsAndProtocolPtr pRCAP;
+ int position;
+
+ if ((pRCAP = RecordFindClientOnContext(pContext, clientspec, &position)))
+ RecordDeleteClientFromRCAP(pRCAP, position);
+} /* RecordDeleteClientFromContext */
+
+
+/* RecordSanityCheckClientSpecifiers
+ *
+ * Arguments:
+ * clientspecs is an array of alleged CLIENTSPECs passed by the client.
+ * nspecs is the number of elements in clientspecs.
+ * errorspec, if non-zero, is the resource id base of a client that
+ * must not appear in clienspecs.
+ *
+ * Returns: BadMatch if any of the clientspecs are invalid, else Success.
+ *
+ * Side Effects: none.
+ */
+static int
+RecordSanityCheckClientSpecifiers(ClientPtr client, XID *clientspecs, int nspecs, XID errorspec)
+{
+ int i;
+ int clientIndex;
+ int rc;
+ pointer value;
+
+ for (i = 0; i < nspecs; i++)
+ {
+ if (clientspecs[i] == XRecordCurrentClients ||
+ clientspecs[i] == XRecordFutureClients ||
+ clientspecs[i] == XRecordAllClients)
+ continue;
+ if (errorspec && (CLIENT_BITS(clientspecs[i]) == errorspec) )
+ return BadMatch;
+ clientIndex = CLIENT_ID(clientspecs[i]);
+ if (clientIndex && clients[clientIndex] &&
+ clients[clientIndex]->clientState == ClientStateRunning)
+ {
+ if (clientspecs[i] == clients[clientIndex]->clientAsMask)
+ continue;
+ rc = dixLookupResourceByClass(&value, clientspecs[i], RC_ANY,
+ client, DixGetAttrAccess);
+ if (rc != Success)
+ return rc;
+ }
+ else
+ return BadMatch;
+ }
+ return Success;
+} /* RecordSanityCheckClientSpecifiers */
+
+
+/* RecordCanonicalizeClientSpecifiers
+ *
+ * Arguments:
+ * pClientspecs is an array of CLIENTSPECs that have been sanity
+ * checked.
+ * pNumClientspecs is a pointer to the number of elements in pClientspecs.
+ * excludespec, if non-zero, is the resource id base of a client that
+ * should not be included in the expansion of XRecordAllClients or
+ * XRecordCurrentClients.
+ *
+ * Returns:
+ * A pointer to an array of CLIENTSPECs that is the same as the
+ * passed array with the following modifications:
+ * - all but the client id bits of resource IDs are stripped off.
+ * - duplicates removed.
+ * - XRecordAllClients expanded to a list of all currently connected
+ * clients + XRecordFutureClients - excludespec (if non-zero)
+ * - XRecordCurrentClients expanded to a list of all currently
+ * connected clients - excludespec (if non-zero)
+ * The returned array may be the passed array modified in place, or
+ * it may be an malloc'ed array. The caller should keep a pointer to the
+ * original array and free the returned array if it is different.
+ *
+ * *pNumClientspecs is set to the number of elements in the returned
+ * array.
+ *
+ * Side Effects:
+ * pClientspecs may be modified in place.
+ */
+static XID *
+RecordCanonicalizeClientSpecifiers(XID *pClientspecs, int *pNumClientspecs, XID excludespec)
+{
+ int i;
+ int numClients = *pNumClientspecs;
+
+ /* first pass strips off the resource index bits, leaving just the
+ * client id bits. This makes searching for a particular client simpler
+ * (and faster.)
+ */
+ for (i = 0; i < numClients; i++)
+ {
+ XID cs = pClientspecs[i];
+ if (cs > XRecordAllClients)
+ pClientspecs[i] = CLIENT_BITS(cs);
+ }
+
+ for (i = 0; i < numClients; i++)
+ {
+ if (pClientspecs[i] == XRecordAllClients ||
+ pClientspecs[i] == XRecordCurrentClients)
+ { /* expand All/Current */
+ int j, nc;
+ XID *pCanon = (XID *)malloc(sizeof(XID) * (currentMaxClients + 1));
+ if (!pCanon) return NULL;
+ for (nc = 0, j = 1; j < currentMaxClients; j++)
+ {
+ ClientPtr client = clients[j];
+ if (client != NullClient &&
+ client->clientState == ClientStateRunning &&
+ client->clientAsMask != excludespec)
+ {
+ pCanon[nc++] = client->clientAsMask;
+ }
+ }
+ if (pClientspecs[i] == XRecordAllClients)
+ pCanon[nc++] = XRecordFutureClients;
+ *pNumClientspecs = nc;
+ return pCanon;
+ }
+ else /* not All or Current */
+ {
+ int j;
+ for (j = i + 1; j < numClients; )
+ {
+ if (pClientspecs[i] == pClientspecs[j])
+ {
+ pClientspecs[j] = pClientspecs[--numClients];
+ }
+ else
+ j++;
+ }
+ }
+ } /* end for each clientspec */
+ *pNumClientspecs = numClients;
+ return pClientspecs;
+} /* RecordCanonicalizeClientSpecifiers */
+
+
+/****************************************************************************/
+
+/* stuff for RegisterClients */
+
+/* RecordPadAlign
+ *
+ * Arguments:
+ * size is the number of bytes taken by an object.
+ * align is a byte boundary (e.g. 4, 8)
+ *
+ * Returns:
+ * the number of pad bytes to add at the end of an object of the
+ * given size so that an object placed immediately behind it will
+ * begin on an <align>-byte boundary.
+ *
+ * Side Effects: none.
+ */
+static int
+RecordPadAlign(int size, int align)
+{
+ return (align - (size & (align - 1))) & (align - 1);
+} /* RecordPadAlign */
+
+
+/* RecordSanityCheckRegisterClients
+ *
+ * Arguments:
+ * pContext is the context being registered on.
+ * client is the client that issued a RecordCreateContext or
+ * RecordRegisterClients request.
+ * stuff is a pointer to the request.
+ *
+ * Returns:
+ * Any one of several possible error values if any of the request
+ * arguments are invalid. Success if everything is OK.
+ *
+ * Side Effects: none.
+ */
+static int
+RecordSanityCheckRegisterClients(RecordContextPtr pContext, ClientPtr client, xRecordRegisterClientsReq *stuff)
+{
+ int err;
+ xRecordRange *pRange;
+ int i;
+ XID recordingClient;
+
+ if (((client->req_len << 2) - SIZEOF(xRecordRegisterClientsReq)) !=
+ 4 * stuff->nClients + SIZEOF(xRecordRange) * stuff->nRanges)
+ return BadLength;
+
+ if (stuff->elementHeader &
+ ~(XRecordFromClientSequence|XRecordFromClientTime|XRecordFromServerTime))
+ {
+ client->errorValue = stuff->elementHeader;
+ return BadValue;
+ }
+
+ recordingClient = pContext->pRecordingClient ?
+ pContext->pRecordingClient->clientAsMask : 0;
+ err = RecordSanityCheckClientSpecifiers(client, (XID *)&stuff[1],
+ stuff->nClients, recordingClient);
+ if (err != Success) return err;
+
+ pRange = (xRecordRange *)(((XID *)&stuff[1]) + stuff->nClients);
+ for (i = 0; i < stuff->nRanges; i++, pRange++)
+ {
+ if (pRange->coreRequestsFirst > pRange->coreRequestsLast)
+ {
+ client->errorValue = pRange->coreRequestsFirst;
+ return BadValue;
+ }
+ if (pRange->coreRepliesFirst > pRange->coreRepliesLast)
+ {
+ client->errorValue = pRange->coreRepliesFirst;
+ return BadValue;
+ }
+ if ((pRange->extRequestsMajorFirst || pRange->extRequestsMajorLast) &&
+ (pRange->extRequestsMajorFirst < 128 ||
+ pRange->extRequestsMajorLast < 128 ||
+ pRange->extRequestsMajorFirst > pRange->extRequestsMajorLast))
+ {
+ client->errorValue = pRange->extRequestsMajorFirst;
+ return BadValue;
+ }
+ if (pRange->extRequestsMinorFirst > pRange->extRequestsMinorLast)
+ {
+ client->errorValue = pRange->extRequestsMinorFirst;
+ return BadValue;
+ }
+ if ((pRange->extRepliesMajorFirst || pRange->extRepliesMajorLast) &&
+ (pRange->extRepliesMajorFirst < 128 ||
+ pRange->extRepliesMajorLast < 128 ||
+ pRange->extRepliesMajorFirst > pRange->extRepliesMajorLast))
+ {
+ client->errorValue = pRange->extRepliesMajorFirst;
+ return BadValue;
+ }
+ if (pRange->extRepliesMinorFirst > pRange->extRepliesMinorLast)
+ {
+ client->errorValue = pRange->extRepliesMinorFirst;
+ return BadValue;
+ }
+ if ((pRange->deliveredEventsFirst || pRange->deliveredEventsLast) &&
+ (pRange->deliveredEventsFirst < 2 ||
+ pRange->deliveredEventsLast < 2 ||
+ pRange->deliveredEventsFirst > pRange->deliveredEventsLast))
+ {
+ client->errorValue = pRange->deliveredEventsFirst;
+ return BadValue;
+ }
+ if ((pRange->deviceEventsFirst || pRange->deviceEventsLast) &&
+ (pRange->deviceEventsFirst < 2 ||
+ pRange->deviceEventsLast < 2 ||
+ pRange->deviceEventsFirst > pRange->deviceEventsLast))
+ {
+ client->errorValue = pRange->deviceEventsFirst;
+ return BadValue;
+ }
+ if (pRange->errorsFirst > pRange->errorsLast)
+ {
+ client->errorValue = pRange->errorsFirst;
+ return BadValue;
+ }
+ if (pRange->clientStarted != xFalse && pRange->clientStarted != xTrue)
+ {
+ client->errorValue = pRange->clientStarted;
+ return BadValue;
+ }
+ if (pRange->clientDied != xFalse && pRange->clientDied != xTrue)
+ {
+ client->errorValue = pRange->clientDied;
+ return BadValue;
+ }
+ } /* end for each range */
+ return Success;
+} /* end RecordSanityCheckRegisterClients */
+
+/* This is a tactical structure used to gather information about all the sets
+ * (RecordSetPtr) that need to be created for an RCAP in the process of
+ * digesting a list of RECORDRANGEs (converting it to the internal
+ * representation).
+ */
+typedef struct
+{
+ int nintervals; /* number of intervals in following array */
+ RecordSetInterval *intervals; /* array of intervals for this set */
+ int size; /* size of intevals array; >= nintervals */
+ int align; /* alignment restriction for set */
+ int offset; /* where to store set pointer rel. to start of RCAP */
+ short first, last; /* if for extension, major opcode interval */
+} SetInfoRec, *SetInfoPtr;
+
+/* These constant are used to index into an array of SetInfoRec. */
+enum {REQ, /* set info for requests */
+ REP, /* set info for replies */
+ ERR, /* set info for errors */
+ DEV, /* set info for device events */
+ DLEV, /* set info for delivered events */
+ PREDEFSETS}; /* number of predefined array entries */
+
+
+/* RecordAllocIntervals
+ *
+ * Arguments:
+ * psi is a pointer to a SetInfoRec whose intervals pointer is NULL.
+ * nIntervals is the desired size of the intervals array.
+ *
+ * Returns: BadAlloc if a memory allocation error occurred, else Success.
+ *
+ * Side Effects:
+ * If Success is returned, psi->intervals is a pointer to size
+ * RecordSetIntervals, all zeroed, and psi->size is set to size.
+ */
+static int
+RecordAllocIntervals(SetInfoPtr psi, int nIntervals)
+{
+ assert(!psi->intervals);
+ psi->intervals = (RecordSetInterval *)
+ malloc(nIntervals * sizeof(RecordSetInterval));
+ if (!psi->intervals)
+ return BadAlloc;
+ memset(psi->intervals, 0, nIntervals * sizeof(RecordSetInterval));
+ psi->size = nIntervals;
+ return Success;
+} /* end RecordAllocIntervals */
+
+
+/* RecordConvertRangesToIntervals
+ *
+ * Arguments:
+ * psi is a pointer to the SetInfoRec we are building.
+ * pRanges is an array of xRecordRanges.
+ * nRanges is the number of elements in pRanges.
+ * byteoffset is the offset from the start of an xRecordRange of the
+ * two bytes (1 for first, 1 for last) we are interested in.
+ * pExtSetInfo, if non-NULL, indicates that the two bytes mentioned
+ * above are followed by four bytes (2 for first, 2 for last)
+ * representing a minor opcode range, and this information should be
+ * stored in one of the SetInfoRecs starting at pExtSetInfo.
+ * pnExtSetInfo is the number of elements in the pExtSetInfo array.
+ *
+ * Returns: BadAlloc if a memory allocation error occurred, else Success.
+ *
+ * Side Effects:
+ * The slice of pRanges indicated by byteoffset is stored in psi.
+ * If pExtSetInfo is non-NULL, minor opcode intervals are stored
+ * in an existing SetInfoRec if the major opcode interval matches, else
+ * they are stored in a new SetInfoRec, and *pnExtSetInfo is
+ * increased accordingly.
+ */
+static int
+RecordConvertRangesToIntervals(
+ SetInfoPtr psi,
+ xRecordRange *pRanges,
+ int nRanges,
+ int byteoffset,
+ SetInfoPtr pExtSetInfo,
+ int *pnExtSetInfo
+)
+{
+ int i;
+ CARD8 *pCARD8;
+ int first, last;
+ int err;
+
+ for (i = 0; i < nRanges; i++, pRanges++)
+ {
+ pCARD8 = ((CARD8 *)pRanges) + byteoffset;
+ first = pCARD8[0];
+ last = pCARD8[1];
+ if (first || last)
+ {
+ if (!psi->intervals)
+ {
+ err = RecordAllocIntervals(psi, 2 * (nRanges - i));
+ if (err != Success)
+ return err;
+ }
+ psi->intervals[psi->nintervals].first = first;
+ psi->intervals[psi->nintervals].last = last;
+ psi->nintervals++;
+ assert(psi->nintervals <= psi->size);
+ if (pExtSetInfo)
+ {
+ SetInfoPtr pesi = pExtSetInfo;
+ CARD16 *pCARD16 = (CARD16 *)(pCARD8 + 2);
+ int j;
+
+ for (j = 0; j < *pnExtSetInfo; j++, pesi++)
+ {
+ if ( (first == pesi->first) && (last == pesi->last) )
+ break;
+ }
+ if (j == *pnExtSetInfo)
+ {
+ err = RecordAllocIntervals(pesi, 2 * (nRanges - i));
+ if (err != Success)
+ return err;
+ pesi->first = first;
+ pesi->last = last;
+ (*pnExtSetInfo)++;
+ }
+ pesi->intervals[pesi->nintervals].first = pCARD16[0];
+ pesi->intervals[pesi->nintervals].last = pCARD16[1];
+ pesi->nintervals++;
+ assert(pesi->nintervals <= pesi->size);
+ }
+ }
+ }
+ return Success;
+} /* end RecordConvertRangesToIntervals */
+
+#define offset_of(_structure, _field) \
+ ((char *)(& (_structure . _field)) - (char *)(&_structure))
+
+/* RecordRegisterClients
+ *
+ * Arguments:
+ * pContext is the context on which to register the clients.
+ * client is the client that issued the RecordCreateContext or
+ * RecordRegisterClients request.
+ * stuff is a pointer to the request.
+ *
+ * Returns:
+ * Any one of several possible error values defined by the protocol.
+ * Success if everything is OK.
+ *
+ * Side Effects:
+ * If different element headers are specified, the context is flushed.
+ * If any of the specified clients are already registered on the
+ * context, they are first unregistered. A new RCAP is created to
+ * hold the specified protocol and clients, and it is linked onto the
+ * context. If the context is enabled, appropriate hooks are installed
+ * to record the new clients and protocol.
+ */
+static int
+RecordRegisterClients(RecordContextPtr pContext, ClientPtr client, xRecordRegisterClientsReq *stuff)
+{
+ int err;
+ int i;
+ SetInfoPtr si;
+ int maxSets;
+ int nExtReqSets = 0;
+ int nExtRepSets = 0;
+ int extReqSetsOffset = 0;
+ int extRepSetsOffset = 0;
+ SetInfoPtr pExtReqSets, pExtRepSets;
+ int clientListOffset;
+ XID *pCanonClients;
+ int clientStarted = 0, clientDied = 0;
+ xRecordRange *pRanges, rr;
+ int nClients;
+ int sizeClients;
+ int totRCAPsize;
+ RecordClientsAndProtocolPtr pRCAP;
+ int pad;
+ XID recordingClient;
+
+ /* do all sanity checking up front */
+
+ err = RecordSanityCheckRegisterClients(pContext, client, stuff);
+ if (err != Success)
+ return err;
+
+ /* if element headers changed, flush buffer */
+
+ if (pContext->elemHeaders != stuff->elementHeader)
+ {
+ RecordFlushReplyBuffer(pContext, NULL, 0, NULL, 0);
+ pContext->elemHeaders = stuff->elementHeader;
+ }
+
+ nClients = stuff->nClients;
+ if (!nClients)
+ /* if empty clients list, we're done. */
+ return Success;
+
+ recordingClient = pContext->pRecordingClient ?
+ pContext->pRecordingClient->clientAsMask : 0;
+ pCanonClients = RecordCanonicalizeClientSpecifiers((XID *)&stuff[1],
+ &nClients, recordingClient);
+ if (!pCanonClients)
+ return BadAlloc;
+
+ /* We may have to create as many as one set for each "predefined"
+ * protocol types, plus one per range for extension reuests, plus one per
+ * range for extension replies.
+ */
+ maxSets = PREDEFSETS + 2 * stuff->nRanges;
+ si = (SetInfoPtr)malloc(sizeof(SetInfoRec) * maxSets);
+ if (!si)
+ {
+ err = BadAlloc;
+ goto bailout;
+ }
+ memset(si, 0, sizeof(SetInfoRec) * maxSets);
+
+ /* theoretically you must do this because NULL may not be all-bits-zero */
+ for (i = 0; i < maxSets; i++)
+ si[i].intervals = NULL;
+
+ pExtReqSets = si + PREDEFSETS;
+ pExtRepSets = pExtReqSets + stuff->nRanges;
+
+ pRanges = (xRecordRange *)(((XID *)&stuff[1]) + stuff->nClients);
+
+ err = RecordConvertRangesToIntervals(&si[REQ], pRanges, stuff->nRanges,
+ offset_of(rr, coreRequestsFirst), NULL, NULL);
+ if (err != Success) goto bailout;
+
+ err = RecordConvertRangesToIntervals(&si[REQ], pRanges, stuff->nRanges,
+ offset_of(rr, extRequestsMajorFirst), pExtReqSets, &nExtReqSets);
+ if (err != Success) goto bailout;
+
+ err = RecordConvertRangesToIntervals(&si[REP], pRanges, stuff->nRanges,
+ offset_of(rr, coreRepliesFirst), NULL, NULL);
+ if (err != Success) goto bailout;
+
+ err = RecordConvertRangesToIntervals(&si[REP], pRanges, stuff->nRanges,
+ offset_of(rr, extRepliesMajorFirst), pExtRepSets, &nExtRepSets);
+ if (err != Success) goto bailout;
+
+ err = RecordConvertRangesToIntervals(&si[ERR], pRanges, stuff->nRanges,
+ offset_of(rr, errorsFirst), NULL, NULL);
+ if (err != Success) goto bailout;
+
+ err = RecordConvertRangesToIntervals(&si[DLEV], pRanges, stuff->nRanges,
+ offset_of(rr, deliveredEventsFirst), NULL, NULL);
+ if (err != Success) goto bailout;
+
+ err = RecordConvertRangesToIntervals(&si[DEV], pRanges, stuff->nRanges,
+ offset_of(rr, deviceEventsFirst), NULL, NULL);
+ if (err != Success) goto bailout;
+
+ /* collect client-started and client-died */
+
+ for (i = 0; i < stuff->nRanges; i++)
+ {
+ if (pRanges[i].clientStarted) clientStarted = TRUE;
+ if (pRanges[i].clientDied) clientDied = TRUE;
+ }
+
+ /* We now have all the information collected to create all the sets,
+ * and we can compute the total memory required for the RCAP.
+ */
+
+ totRCAPsize = sizeof(RecordClientsAndProtocolRec);
+
+ /* leave a little room to grow before forcing a separate allocation */
+ sizeClients = nClients + CLIENT_ARRAY_GROWTH_INCREMENT;
+ pad = RecordPadAlign(totRCAPsize, sizeof(XID));
+ clientListOffset = totRCAPsize + pad;
+ totRCAPsize += pad + sizeClients * sizeof(XID);
+
+ if (nExtReqSets)
+ {
+ pad = RecordPadAlign(totRCAPsize, sizeof(RecordSetPtr));
+ extReqSetsOffset = totRCAPsize + pad;
+ totRCAPsize += pad + (nExtReqSets + 1) * sizeof(RecordMinorOpRec);
+ }
+ if (nExtRepSets)
+ {
+ pad = RecordPadAlign(totRCAPsize, sizeof(RecordSetPtr));
+ extRepSetsOffset = totRCAPsize + pad;
+ totRCAPsize += pad + (nExtRepSets + 1) * sizeof(RecordMinorOpRec);
+ }
+
+ for (i = 0; i < maxSets; i++)
+ {
+ if (si[i].nintervals)
+ {
+ si[i].size = RecordSetMemoryRequirements(
+ si[i].intervals, si[i].nintervals, &si[i].align);
+ pad = RecordPadAlign(totRCAPsize, si[i].align);
+ si[i].offset = pad + totRCAPsize;
+ totRCAPsize += pad + si[i].size;
+ }
+ }
+
+ /* allocate memory for the whole RCAP */
+
+ pRCAP = (RecordClientsAndProtocolPtr)malloc(totRCAPsize);
+ if (!pRCAP)
+ {
+ err = BadAlloc;
+ goto bailout;
+ }
+
+ /* fill in the RCAP */
+
+ pRCAP->pContext = pContext;
+ pRCAP->pClientIDs = (XID *)((char *)pRCAP + clientListOffset);
+ pRCAP->numClients = nClients;
+ pRCAP->sizeClients = sizeClients;
+ pRCAP->clientIDsSeparatelyAllocated = 0;
+ for (i = 0; i < nClients; i++)
+ {
+ RecordDeleteClientFromContext(pContext, pCanonClients[i]);
+ pRCAP->pClientIDs[i] = pCanonClients[i];
+ }
+
+ /* create all the sets */
+
+ if (si[REQ].intervals)
+ {
+ pRCAP->pRequestMajorOpSet =
+ RecordCreateSet(si[REQ].intervals, si[REQ].nintervals,
+ (RecordSetPtr)((char *)pRCAP + si[REQ].offset), si[REQ].size);
+ }
+ else pRCAP->pRequestMajorOpSet = NULL;
+
+ if (si[REP].intervals)
+ {
+ pRCAP->pReplyMajorOpSet =
+ RecordCreateSet(si[REP].intervals, si[REP].nintervals,
+ (RecordSetPtr)((char *)pRCAP + si[REP].offset), si[REP].size);
+ }
+ else pRCAP->pReplyMajorOpSet = NULL;
+
+ if (si[ERR].intervals)
+ {
+ pRCAP->pErrorSet =
+ RecordCreateSet(si[ERR].intervals, si[ERR].nintervals,
+ (RecordSetPtr)((char *)pRCAP + si[ERR].offset), si[ERR].size);
+ }
+ else pRCAP->pErrorSet = NULL;
+
+ if (si[DEV].intervals)
+ {
+ pRCAP->pDeviceEventSet =
+ RecordCreateSet(si[DEV].intervals, si[DEV].nintervals,
+ (RecordSetPtr)((char *)pRCAP + si[DEV].offset), si[DEV].size);
+ }
+ else pRCAP->pDeviceEventSet = NULL;
+
+ if (si[DLEV].intervals)
+ {
+ pRCAP->pDeliveredEventSet =
+ RecordCreateSet(si[DLEV].intervals, si[DLEV].nintervals,
+ (RecordSetPtr)((char *)pRCAP + si[DLEV].offset), si[DLEV].size);
+ }
+ else pRCAP->pDeliveredEventSet = NULL;
+
+ if (nExtReqSets)
+ {
+ pRCAP->pRequestMinOpInfo = (RecordMinorOpPtr)
+ ((char *)pRCAP + extReqSetsOffset);
+ pRCAP->pRequestMinOpInfo[0].count = nExtReqSets;
+ for (i = 0; i < nExtReqSets; i++, pExtReqSets++)
+ {
+ pRCAP->pRequestMinOpInfo[i+1].major.first = pExtReqSets->first;
+ pRCAP->pRequestMinOpInfo[i+1].major.last = pExtReqSets->last;
+ pRCAP->pRequestMinOpInfo[i+1].major.pMinOpSet =
+ RecordCreateSet(pExtReqSets->intervals,
+ pExtReqSets->nintervals,
+ (RecordSetPtr)((char *)pRCAP + pExtReqSets->offset),
+ pExtReqSets->size);
+ }
+ }
+ else pRCAP->pRequestMinOpInfo = NULL;
+
+ if (nExtRepSets)
+ {
+ pRCAP->pReplyMinOpInfo = (RecordMinorOpPtr)
+ ((char *)pRCAP + extRepSetsOffset);
+ pRCAP->pReplyMinOpInfo[0].count = nExtRepSets;
+ for (i = 0; i < nExtRepSets; i++, pExtRepSets++)
+ {
+ pRCAP->pReplyMinOpInfo[i+1].major.first = pExtRepSets->first;
+ pRCAP->pReplyMinOpInfo[i+1].major.last = pExtRepSets->last;
+ pRCAP->pReplyMinOpInfo[i+1].major.pMinOpSet =
+ RecordCreateSet(pExtRepSets->intervals,
+ pExtRepSets->nintervals,
+ (RecordSetPtr)((char *)pRCAP + pExtRepSets->offset),
+ pExtRepSets->size);
+ }
+ }
+ else pRCAP->pReplyMinOpInfo = NULL;
+
+ pRCAP->clientStarted = clientStarted;
+ pRCAP->clientDied = clientDied;
+
+ /* link the RCAP onto the context */
+
+ pRCAP->pNextRCAP = pContext->pListOfRCAP;
+ pContext->pListOfRCAP = pRCAP;
+
+ if (pContext->pRecordingClient) /* context enabled */
+ RecordInstallHooks(pRCAP, 0);
+
+bailout:
+ if (si)
+ {
+ for (i = 0; i < maxSets; i++)
+ free(si[i].intervals);
+ free(si);
+ }
+ if (pCanonClients && pCanonClients != (XID *)&stuff[1])
+ free(pCanonClients);
+ return err;
+} /* RecordRegisterClients */
+
+
+/* Proc functions all take a client argument, execute the request in
+ * client->requestBuffer, and return a protocol error status.
+ */
+
+static int
+ProcRecordQueryVersion(ClientPtr client)
+{
+ /* REQUEST(xRecordQueryVersionReq); */
+ xRecordQueryVersionReply rep;
+ int n;
+
+ REQUEST_SIZE_MATCH(xRecordQueryVersionReq);
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.majorVersion = SERVER_RECORD_MAJOR_VERSION;
+ rep.minorVersion = SERVER_RECORD_MINOR_VERSION;
+ if(client->swapped)
+ {
+ swaps(&rep.sequenceNumber, n);
+ swaps(&rep.majorVersion, n);
+ swaps(&rep.minorVersion, n);
+ }
+ (void)WriteToClient(client, sizeof(xRecordQueryVersionReply),
+ (char *)&rep);
+ return Success;
+} /* ProcRecordQueryVersion */
+
+
+static int
+ProcRecordCreateContext(ClientPtr client)
+{
+ REQUEST(xRecordCreateContextReq);
+ RecordContextPtr pContext;
+ RecordContextPtr *ppNewAllContexts = NULL;
+ int err = BadAlloc;
+
+ REQUEST_AT_LEAST_SIZE(xRecordCreateContextReq);
+ LEGAL_NEW_RESOURCE(stuff->context, client);
+
+ pContext = (RecordContextPtr)malloc(sizeof(RecordContextRec));
+ if (!pContext)
+ goto bailout;
+
+ /* make sure there is room in ppAllContexts to store the new context */
+
+ ppNewAllContexts = (RecordContextPtr *)
+ realloc(ppAllContexts, sizeof(RecordContextPtr) * (numContexts + 1));
+ if (!ppNewAllContexts)
+ goto bailout;
+ ppAllContexts = ppNewAllContexts;
+
+ pContext->id = stuff->context;
+ pContext->pRecordingClient = NULL;
+ pContext->pListOfRCAP = NULL;
+ pContext->elemHeaders = 0;
+ pContext->bufCategory = 0;
+ pContext->numBufBytes = 0;
+ pContext->pBufClient = NULL;
+ pContext->continuedReply = 0;
+ pContext->inFlush = 0;
+
+ err = RecordRegisterClients(pContext, client,
+ (xRecordRegisterClientsReq *)stuff);
+ if (err != Success)
+ goto bailout;
+
+ if (AddResource(pContext->id, RTContext, pContext))
+ {
+ ppAllContexts[numContexts++] = pContext;
+ return Success;
+ }
+ else
+ {
+ RecordDeleteContext((pointer)pContext, pContext->id);
+ err = BadAlloc;
+ }
+bailout:
+ free(pContext);
+ return err;
+} /* ProcRecordCreateContext */
+
+
+static int
+ProcRecordRegisterClients(ClientPtr client)
+{
+ RecordContextPtr pContext;
+ REQUEST(xRecordRegisterClientsReq);
+
+ REQUEST_AT_LEAST_SIZE(xRecordRegisterClientsReq);
+ VERIFY_CONTEXT(pContext, stuff->context, client);
+
+ return RecordRegisterClients(pContext, client, stuff);
+} /* ProcRecordRegisterClients */
+
+
+static int
+ProcRecordUnregisterClients(ClientPtr client)
+{
+ RecordContextPtr pContext;
+ int err;
+ REQUEST(xRecordUnregisterClientsReq);
+ XID *pCanonClients;
+ int nClients;
+ int i;
+
+ REQUEST_AT_LEAST_SIZE(xRecordUnregisterClientsReq);
+ if ((client->req_len << 2) - SIZEOF(xRecordUnregisterClientsReq) !=
+ 4 * stuff->nClients)
+ return BadLength;
+ VERIFY_CONTEXT(pContext, stuff->context, client);
+ err = RecordSanityCheckClientSpecifiers(client, (XID *)&stuff[1],
+ stuff->nClients, 0);
+ if (err != Success)
+ return err;
+
+ nClients = stuff->nClients;
+ pCanonClients = RecordCanonicalizeClientSpecifiers((XID *)&stuff[1],
+ &nClients, 0);
+ if (!pCanonClients)
+ return BadAlloc;
+
+ for (i = 0; i < nClients; i++)
+ {
+ RecordDeleteClientFromContext(pContext, pCanonClients[i]);
+ }
+ if (pCanonClients != (XID *)&stuff[1])
+ free(pCanonClients);
+ return Success;
+} /* ProcRecordUnregisterClients */
+
+
+/****************************************************************************/
+
+/* stuff for GetContext */
+
+/* This is a tactical structure used to hold the xRecordRanges as they are
+ * being reconstituted from the sets in the RCAPs.
+ */
+
+typedef struct {
+ xRecordRange *pRanges; /* array of xRecordRanges for one RCAP */
+ int size; /* number of elements in pRanges, >= nRanges */
+ int nRanges; /* number of occupied element of pRanges */
+} GetContextRangeInfoRec, *GetContextRangeInfoPtr;
+
+
+/* RecordAllocRanges
+ *
+ * Arguments:
+ * pri is a pointer to a GetContextRangeInfoRec to allocate for.
+ * nRanges is the number of xRecordRanges desired for pri.
+ *
+ * Returns: BadAlloc if a memory allocation error occurred, else Success.
+ *
+ * Side Effects:
+ * If Success is returned, pri->pRanges points to at least nRanges
+ * ranges. pri->nRanges is set to nRanges. pri->size is the actual
+ * number of ranges. Newly allocated ranges are zeroed.
+ */
+static int
+RecordAllocRanges(GetContextRangeInfoPtr pri, int nRanges)
+{
+ int newsize;
+ xRecordRange *pNewRange;
+#define SZINCR 8
+
+ newsize = max(pri->size + SZINCR, nRanges);
+ pNewRange = (xRecordRange *)realloc(pri->pRanges,
+ newsize * sizeof(xRecordRange));
+ if (!pNewRange)
+ return BadAlloc;
+
+ pri->pRanges = pNewRange;
+ pri->size = newsize;
+ memset(&pri->pRanges[pri->size - SZINCR], 0, SZINCR * sizeof(xRecordRange));
+ if (pri->nRanges < nRanges)
+ pri->nRanges = nRanges;
+ return Success;
+} /* RecordAllocRanges */
+
+
+/* RecordConvertSetToRanges
+ *
+ * Arguments:
+ * pSet is the set to be converted.
+ * pri is where the result should be stored.
+ * byteoffset is the offset from the start of an xRecordRange of the
+ * two vales (first, last) we are interested in.
+ * card8 is TRUE if the vales are one byte each and FALSE if two bytes
+ * each.
+ * imax is the largest set value to store in pri->pRanges.
+ * pStartIndex, if non-NULL, is the index of the first range in
+ * pri->pRanges that should be stored to. If NULL,
+ * start at index 0.
+ *
+ * Returns: BadAlloc if a memory allocation error occurred, else Success.
+ *
+ * Side Effects:
+ * If Success is returned, the slice of pri->pRanges indicated by
+ * byteoffset and card8 is filled in with the intervals from pSet.
+ * if pStartIndex was non-NULL, *pStartIndex is filled in with one
+ * more than the index of the last xRecordRange that was touched.
+ */
+static int
+RecordConvertSetToRanges(
+ RecordSetPtr pSet,
+ GetContextRangeInfoPtr pri,
+ int byteoffset,
+ Bool card8,
+ unsigned int imax,
+ int *pStartIndex
+)
+{
+ int nRanges;
+ RecordSetIteratePtr pIter = NULL;
+ RecordSetInterval interval;
+ CARD8 *pCARD8;
+ CARD16 *pCARD16;
+ int err;
+
+ if (!pSet)
+ return Success;
+
+ nRanges = pStartIndex ? *pStartIndex : 0;
+ while ((pIter = RecordIterateSet(pSet, pIter, &interval)))
+ {
+ if (interval.first > imax) break;
+ if (interval.last > imax) interval.last = imax;
+ nRanges++;
+ if (nRanges > pri->size)
+ {
+ err = RecordAllocRanges(pri, nRanges);
+ if (err != Success)
+ return err;
+ }
+ else
+ pri->nRanges = max(pri->nRanges, nRanges);
+ if (card8)
+ {
+ pCARD8 = ((CARD8 *)&pri->pRanges[nRanges-1]) + byteoffset;
+ *pCARD8++ = interval.first;
+ *pCARD8 = interval.last;
+ }
+ else
+ {
+ pCARD16 = (CARD16 *)
+ (((char *)&pri->pRanges[nRanges-1]) + byteoffset);
+ *pCARD16++ = interval.first;
+ *pCARD16 = interval.last;
+ }
+ }
+ if (pStartIndex)
+ *pStartIndex = nRanges;
+ return Success;
+} /* RecordConvertSetToRanges */
+
+
+/* RecordConvertMinorOpInfoToRanges
+ *
+ * Arguments:
+ * pMinOpInfo is the minor opcode info to convert to xRecordRanges.
+ * pri is where the result should be stored.
+ * byteoffset is the offset from the start of an xRecordRange of the
+ * four vales (CARD8 major_first, CARD8 major_last,
+ * CARD16 minor_first, CARD16 minor_last) we are going to store.
+ *
+ * Returns: BadAlloc if a memory allocation error occurred, else Success.
+ *
+ * Side Effects:
+ * If Success is returned, the slice of pri->pRanges indicated by
+ * byteoffset is filled in with the information from pMinOpInfo.
+ */
+static int
+RecordConvertMinorOpInfoToRanges(
+ RecordMinorOpPtr pMinOpInfo,
+ GetContextRangeInfoPtr pri,
+ int byteoffset
+)
+{
+ int nsets;
+ int start;
+ int i;
+ int err;
+
+ if (!pMinOpInfo)
+ return Success;
+
+ nsets = pMinOpInfo->count;
+ pMinOpInfo++;
+ start = 0;
+ for (i = 0; i < nsets; i++)
+ {
+ int j, s;
+ s = start;
+ err = RecordConvertSetToRanges(pMinOpInfo[i].major.pMinOpSet, pri,
+ byteoffset + 2, FALSE, 65535, &start);
+ if (err != Success) return err;
+ for (j = s; j < start; j++)
+ {
+ CARD8 *pCARD8 = ((CARD8 *)&pri->pRanges[j]) + byteoffset;
+ *pCARD8++ = pMinOpInfo[i].major.first;
+ *pCARD8 = pMinOpInfo[i].major.last;
+ }
+ }
+ return Success;
+} /* RecordConvertMinorOpInfoToRanges */
+
+
+/* RecordSwapRanges
+ *
+ * Arguments:
+ * pRanges is an array of xRecordRanges.
+ * nRanges is the number of elements in pRanges.
+ *
+ * Returns: nothing.
+ *
+ * Side Effects:
+ * The 16 bit fields of each xRecordRange are byte swapped.
+ */
+static void
+RecordSwapRanges(xRecordRange *pRanges, int nRanges)
+{
+ int i;
+ register char n;
+ for (i = 0; i < nRanges; i++, pRanges++)
+ {
+ swaps(&pRanges->extRequestsMinorFirst, n);
+ swaps(&pRanges->extRequestsMinorLast, n);
+ swaps(&pRanges->extRepliesMinorFirst, n);
+ swaps(&pRanges->extRepliesMinorLast, n);
+ }
+} /* RecordSwapRanges */
+
+
+static int
+ProcRecordGetContext(ClientPtr client)
+{
+ RecordContextPtr pContext;
+ REQUEST(xRecordGetContextReq);
+ xRecordGetContextReply rep;
+ int n;
+ RecordClientsAndProtocolPtr pRCAP;
+ int nRCAPs = 0;
+ GetContextRangeInfoPtr pRangeInfo;
+ GetContextRangeInfoPtr pri;
+ int i;
+ int err;
+
+ REQUEST_SIZE_MATCH(xRecordGetContextReq);
+ VERIFY_CONTEXT(pContext, stuff->context, client);
+
+ /* how many RCAPs are there on this context? */
+
+ for (pRCAP = pContext->pListOfRCAP; pRCAP; pRCAP = pRCAP->pNextRCAP)
+ nRCAPs++;
+
+ /* allocate and initialize space for record range info */
+
+ pRangeInfo = (GetContextRangeInfoPtr)malloc(
+ nRCAPs * sizeof(GetContextRangeInfoRec));
+ if (!pRangeInfo && nRCAPs > 0)
+ return BadAlloc;
+ for (i = 0; i < nRCAPs; i++)
+ {
+ pRangeInfo[i].pRanges = NULL;
+ pRangeInfo[i].size = 0;
+ pRangeInfo[i].nRanges = 0;
+ }
+
+ /* convert the RCAP (internal) representation of the recorded protocol
+ * to the wire protocol (external) representation, storing the information
+ * for the ith RCAP in pri[i]
+ */
+
+ for (pRCAP = pContext->pListOfRCAP, pri = pRangeInfo;
+ pRCAP;
+ pRCAP = pRCAP->pNextRCAP, pri++)
+ {
+ xRecordRange rr;
+
+ err = RecordConvertSetToRanges(pRCAP->pRequestMajorOpSet, pri,
+ offset_of(rr, coreRequestsFirst), TRUE, 127, NULL);
+ if (err != Success) goto bailout;
+
+ err = RecordConvertSetToRanges(pRCAP->pReplyMajorOpSet, pri,
+ offset_of(rr, coreRepliesFirst), TRUE, 127, NULL);
+ if (err != Success) goto bailout;
+
+ err = RecordConvertSetToRanges(pRCAP->pDeliveredEventSet, pri,
+ offset_of(rr, deliveredEventsFirst), TRUE, 255, NULL);
+ if (err != Success) goto bailout;
+
+ err = RecordConvertSetToRanges(pRCAP->pDeviceEventSet, pri,
+ offset_of(rr, deviceEventsFirst), TRUE, 255, NULL);
+ if (err != Success) goto bailout;
+
+ err = RecordConvertSetToRanges(pRCAP->pErrorSet, pri,
+ offset_of(rr, errorsFirst), TRUE, 255, NULL);
+ if (err != Success) goto bailout;
+
+ err = RecordConvertMinorOpInfoToRanges(pRCAP->pRequestMinOpInfo,
+ pri, offset_of(rr, extRequestsMajorFirst));
+ if (err != Success) goto bailout;
+
+ err = RecordConvertMinorOpInfoToRanges(pRCAP->pReplyMinOpInfo,
+ pri, offset_of(rr, extRepliesMajorFirst));
+ if (err != Success) goto bailout;
+
+ if (pRCAP->clientStarted || pRCAP->clientDied)
+ {
+ if (pri->nRanges == 0)
+ RecordAllocRanges(pri, 1);
+ pri->pRanges[0].clientStarted = pRCAP->clientStarted;
+ pri->pRanges[0].clientDied = pRCAP->clientDied;
+ }
+ }
+
+ /* calculate number of clients and reply length */
+
+ rep.nClients = 0;
+ rep.length = 0;
+ for (pRCAP = pContext->pListOfRCAP, pri = pRangeInfo;
+ pRCAP;
+ pRCAP = pRCAP->pNextRCAP, pri++)
+ {
+ rep.nClients += pRCAP->numClients;
+ rep.length += pRCAP->numClients *
+ ( bytes_to_int32(sizeof(xRecordClientInfo)) +
+ pri->nRanges * bytes_to_int32(sizeof(xRecordRange)));
+ }
+
+ /* write the reply header */
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.enabled = pContext->pRecordingClient != NULL;
+ rep.elementHeader = pContext->elemHeaders;
+ if(client->swapped)
+ {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.nClients, n);
+ }
+ (void)WriteToClient(client, sizeof(xRecordGetContextReply),
+ (char *)&rep);
+
+ /* write all the CLIENT_INFOs */
+
+ for (pRCAP = pContext->pListOfRCAP, pri = pRangeInfo;
+ pRCAP;
+ pRCAP = pRCAP->pNextRCAP, pri++)
+ {
+ xRecordClientInfo rci;
+ rci.nRanges = pri->nRanges;
+ if (client->swapped)
+ {
+ swapl(&rci.nRanges, n);
+ RecordSwapRanges(pri->pRanges, pri->nRanges);
+ }
+ for (i = 0; i < pRCAP->numClients; i++)
+ {
+ rci.clientResource = pRCAP->pClientIDs[i];
+ if (client->swapped) swapl(&rci.clientResource, n);
+ WriteToClient(client, sizeof(xRecordClientInfo), (char *)&rci);
+ WriteToClient(client, sizeof(xRecordRange) * pri->nRanges,
+ (char *)pri->pRanges);
+ }
+ }
+ err = Success;
+
+bailout:
+ for (i = 0; i < nRCAPs; i++)
+ {
+ free(pRangeInfo[i].pRanges);
+ }
+ free(pRangeInfo);
+ return err;
+} /* ProcRecordGetContext */
+
+
+static int
+ProcRecordEnableContext(ClientPtr client)
+{
+ RecordContextPtr pContext;
+ REQUEST(xRecordEnableContextReq);
+ int i;
+ RecordClientsAndProtocolPtr pRCAP;
+
+ REQUEST_SIZE_MATCH(xRecordGetContextReq);
+ VERIFY_CONTEXT(pContext, stuff->context, client);
+ if (pContext->pRecordingClient)
+ return BadMatch; /* already enabled */
+
+ /* install record hooks for each RCAP */
+
+ for (pRCAP = pContext->pListOfRCAP; pRCAP; pRCAP = pRCAP->pNextRCAP)
+ {
+ int err = RecordInstallHooks(pRCAP, 0);
+ if (err != Success)
+ { /* undo the previous installs */
+ RecordClientsAndProtocolPtr pUninstallRCAP;
+ for (pUninstallRCAP = pContext->pListOfRCAP;
+ pUninstallRCAP != pRCAP;
+ pUninstallRCAP = pUninstallRCAP->pNextRCAP)
+ {
+ RecordUninstallHooks(pUninstallRCAP, 0);
+ }
+ return err;
+ }
+ }
+
+ /* Disallow further request processing on this connection until
+ * the context is disabled.
+ */
+ IgnoreClient(client);
+ pContext->pRecordingClient = client;
+
+ /* Don't allow the data connection to record itself; unregister it. */
+ RecordDeleteClientFromContext(pContext,
+ pContext->pRecordingClient->clientAsMask);
+
+ /* move the newly enabled context to the front part of ppAllContexts,
+ * where all the enabled contexts are
+ */
+ i = RecordFindContextOnAllContexts(pContext);
+ assert(i >= numEnabledContexts);
+ if (i != numEnabledContexts)
+ {
+ ppAllContexts[i] = ppAllContexts[numEnabledContexts];
+ ppAllContexts[numEnabledContexts] = pContext;
+ }
+
+ ++numEnabledContexts;
+ assert(numEnabledContexts > 0);
+
+ /* send StartOfData */
+ RecordAProtocolElement(pContext, NULL, XRecordStartOfData, NULL, 0, 0);
+ RecordFlushReplyBuffer(pContext, NULL, 0, NULL, 0);
+ return Success;
+} /* ProcRecordEnableContext */
+
+
+/* RecordDisableContext
+ *
+ * Arguments:
+ * pContext is the context to disable.
+ * nRanges is the number of elements in pRanges.
+ *
+ * Returns: nothing.
+ *
+ * Side Effects:
+ * If the context was enabled, it is disabled. An EndOfData
+ * message is sent to the recording client. Recording hooks for
+ * this context are uninstalled. The context is moved to the
+ * rear part of the ppAllContexts array. numEnabledContexts is
+ * decremented. Request processing for the formerly recording client
+ * is resumed.
+ */
+static void
+RecordDisableContext(RecordContextPtr pContext)
+{
+ RecordClientsAndProtocolPtr pRCAP;
+ int i;
+
+ if (!pContext->pRecordingClient) return;
+ if (!pContext->pRecordingClient->clientGone)
+ {
+ RecordAProtocolElement(pContext, NULL, XRecordEndOfData, NULL, 0, 0);
+ RecordFlushReplyBuffer(pContext, NULL, 0, NULL, 0);
+ /* Re-enable request processing on this connection. */
+ AttendClient(pContext->pRecordingClient);
+ }
+
+ for (pRCAP = pContext->pListOfRCAP; pRCAP; pRCAP = pRCAP->pNextRCAP)
+ {
+ RecordUninstallHooks(pRCAP, 0);
+ }
+
+ pContext->pRecordingClient = NULL;
+
+ /* move the newly disabled context to the rear part of ppAllContexts,
+ * where all the disabled contexts are
+ */
+ i = RecordFindContextOnAllContexts(pContext);
+ assert( (i != -1) && (i < numEnabledContexts) );
+ if (i != (numEnabledContexts - 1) )
+ {
+ ppAllContexts[i] = ppAllContexts[numEnabledContexts-1];
+ ppAllContexts[numEnabledContexts-1] = pContext;
+ }
+ --numEnabledContexts;
+ assert(numEnabledContexts >= 0);
+} /* RecordDisableContext */
+
+
+static int
+ProcRecordDisableContext(ClientPtr client)
+{
+ RecordContextPtr pContext;
+ REQUEST(xRecordDisableContextReq);
+
+ REQUEST_SIZE_MATCH(xRecordDisableContextReq);
+ VERIFY_CONTEXT(pContext, stuff->context, client);
+ RecordDisableContext(pContext);
+ return Success;
+} /* ProcRecordDisableContext */
+
+
+/* RecordDeleteContext
+ *
+ * Arguments:
+ * value is the context to delete.
+ * id is its resource ID.
+ *
+ * Returns: Success.
+ *
+ * Side Effects:
+ * Disables the context, frees all associated memory, and removes
+ * it from the ppAllContexts array.
+ */
+static int
+RecordDeleteContext(pointer value, XID id)
+{
+ int i;
+ RecordContextPtr pContext = (RecordContextPtr)value;
+ RecordClientsAndProtocolPtr pRCAP;
+
+ RecordDisableContext(pContext);
+
+ /* Remove all the clients from all the RCAPs.
+ * As a result, the RCAPs will be freed.
+ */
+
+ while ((pRCAP = pContext->pListOfRCAP))
+ {
+ int numClients = pRCAP->numClients;
+ /* when the last client is deleted, the RCAP will go away. */
+ while(numClients--)
+ {
+ RecordDeleteClientFromRCAP(pRCAP, numClients);
+ }
+ }
+
+ /* remove context from AllContexts list */
+
+ if (-1 != (i = RecordFindContextOnAllContexts(pContext)))
+ {
+ ppAllContexts[i] = ppAllContexts[numContexts - 1];
+ if (--numContexts == 0)
+ {
+ free(ppAllContexts);
+ ppAllContexts = NULL;
+ }
+ }
+ free(pContext);
+
+ return Success;
+} /* RecordDeleteContext */
+
+
+static int
+ProcRecordFreeContext(ClientPtr client)
+{
+ RecordContextPtr pContext;
+ REQUEST(xRecordFreeContextReq);
+
+ REQUEST_SIZE_MATCH(xRecordFreeContextReq);
+ VERIFY_CONTEXT(pContext, stuff->context, client);
+ FreeResource(stuff->context, RT_NONE);
+ return Success;
+} /* ProcRecordFreeContext */
+
+
+static int
+ProcRecordDispatch(ClientPtr client)
+{
+ REQUEST(xReq);
+
+ switch (stuff->data)
+ {
+ case X_RecordQueryVersion:
+ return ProcRecordQueryVersion(client);
+ case X_RecordCreateContext:
+ return ProcRecordCreateContext(client);
+ case X_RecordRegisterClients:
+ return ProcRecordRegisterClients(client);
+ case X_RecordUnregisterClients:
+ return ProcRecordUnregisterClients(client);
+ case X_RecordGetContext:
+ return ProcRecordGetContext(client);
+ case X_RecordEnableContext:
+ return ProcRecordEnableContext(client);
+ case X_RecordDisableContext:
+ return ProcRecordDisableContext(client);
+ case X_RecordFreeContext:
+ return ProcRecordFreeContext(client);
+ default:
+ return BadRequest;
+ }
+} /* ProcRecordDispatch */
+
+
+static int
+SProcRecordQueryVersion(ClientPtr client)
+{
+ REQUEST(xRecordQueryVersionReq);
+ register char n;
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xRecordQueryVersionReq);
+ swaps(&stuff->majorVersion, n);
+ swaps(&stuff->minorVersion,n);
+ return ProcRecordQueryVersion(client);
+} /* SProcRecordQueryVersion */
+
+
+static int
+SwapCreateRegister(xRecordRegisterClientsReq *stuff)
+{
+ register char n;
+ int i;
+ XID *pClientID;
+
+ swapl(&stuff->context, n);
+ swapl(&stuff->nClients, n);
+ swapl(&stuff->nRanges, n);
+ pClientID = (XID *)&stuff[1];
+ if (stuff->nClients > stuff->length - bytes_to_int32(sz_xRecordRegisterClientsReq))
+ return BadLength;
+ for (i = 0; i < stuff->nClients; i++, pClientID++)
+ {
+ swapl(pClientID, n);
+ }
+ if (stuff->nRanges > stuff->length - bytes_to_int32(sz_xRecordRegisterClientsReq)
+ - stuff->nClients)
+ return BadLength;
+ RecordSwapRanges((xRecordRange *)pClientID, stuff->nRanges);
+ return Success;
+} /* SwapCreateRegister */
+
+
+static int
+SProcRecordCreateContext(ClientPtr client)
+{
+ REQUEST(xRecordCreateContextReq);
+ int status;
+ register char n;
+
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xRecordCreateContextReq);
+ if ((status = SwapCreateRegister((pointer)stuff)) != Success)
+ return status;
+ return ProcRecordCreateContext(client);
+} /* SProcRecordCreateContext */
+
+
+static int
+SProcRecordRegisterClients(ClientPtr client)
+{
+ REQUEST(xRecordRegisterClientsReq);
+ int status;
+ register char n;
+
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xRecordRegisterClientsReq);
+ if ((status = SwapCreateRegister((pointer)stuff)) != Success)
+ return status;
+ return ProcRecordRegisterClients(client);
+} /* SProcRecordRegisterClients */
+
+
+static int
+SProcRecordUnregisterClients(ClientPtr client)
+{
+ REQUEST(xRecordUnregisterClientsReq);
+ register char n;
+
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xRecordUnregisterClientsReq);
+ swapl(&stuff->context, n);
+ swapl(&stuff->nClients, n);
+ SwapRestL(stuff);
+ return ProcRecordUnregisterClients(client);
+} /* SProcRecordUnregisterClients */
+
+
+static int
+SProcRecordGetContext(ClientPtr client)
+{
+ REQUEST(xRecordGetContextReq);
+ register char n;
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xRecordGetContextReq);
+ swapl(&stuff->context, n);
+ return ProcRecordGetContext(client);
+} /* SProcRecordGetContext */
+
+static int
+SProcRecordEnableContext(ClientPtr client)
+{
+ REQUEST(xRecordEnableContextReq);
+ register char n;
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xRecordEnableContextReq);
+ swapl(&stuff->context, n);
+ return ProcRecordEnableContext(client);
+} /* SProcRecordEnableContext */
+
+
+static int
+SProcRecordDisableContext(ClientPtr client)
+{
+ REQUEST(xRecordDisableContextReq);
+ register char n;
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xRecordDisableContextReq);
+ swapl(&stuff->context, n);
+ return ProcRecordDisableContext(client);
+} /* SProcRecordDisableContext */
+
+
+static int
+SProcRecordFreeContext(ClientPtr client)
+{
+ REQUEST(xRecordFreeContextReq);
+ register char n;
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xRecordFreeContextReq);
+ swapl(&stuff->context, n);
+ return ProcRecordFreeContext(client);
+} /* SProcRecordFreeContext */
+
+
+static int
+SProcRecordDispatch(ClientPtr client)
+{
+ REQUEST(xReq);
+
+ switch (stuff->data)
+ {
+ case X_RecordQueryVersion:
+ return SProcRecordQueryVersion(client);
+ case X_RecordCreateContext:
+ return SProcRecordCreateContext(client);
+ case X_RecordRegisterClients:
+ return SProcRecordRegisterClients(client);
+ case X_RecordUnregisterClients:
+ return SProcRecordUnregisterClients(client);
+ case X_RecordGetContext:
+ return SProcRecordGetContext(client);
+ case X_RecordEnableContext:
+ return SProcRecordEnableContext(client);
+ case X_RecordDisableContext:
+ return SProcRecordDisableContext(client);
+ case X_RecordFreeContext:
+ return SProcRecordFreeContext(client);
+ default:
+ return BadRequest;
+ }
+} /* SProcRecordDispatch */
+
+/* RecordConnectionSetupInfo
+ *
+ * Arguments:
+ * pContext is an enabled context that specifies recording of
+ * connection setup info.
+ * pci holds the connection setup info.
+ *
+ * Returns: nothing.
+ *
+ * Side Effects:
+ * The connection setup info is sent to the recording client.
+ */
+static void
+RecordConnectionSetupInfo(RecordContextPtr pContext, NewClientInfoRec *pci)
+{
+ int prefixsize = SIZEOF(xConnSetupPrefix);
+ int restsize = pci->prefix->length * 4;
+
+ if (pci->client->swapped)
+ {
+ char *pConnSetup = (char *)malloc(prefixsize + restsize);
+ if (!pConnSetup)
+ return;
+ SwapConnSetupPrefix(pci->prefix, (xConnSetupPrefix*)pConnSetup);
+ SwapConnSetupInfo((char*)pci->setup, (char*)(pConnSetup + prefixsize));
+ RecordAProtocolElement(pContext, pci->client, XRecordClientStarted,
+ (pointer)pConnSetup, prefixsize + restsize, 0);
+ free(pConnSetup);
+ }
+ else
+ {
+ /* don't alloc and copy as in the swapped case; just send the
+ * data in two pieces
+ */
+ RecordAProtocolElement(pContext, pci->client, XRecordClientStarted,
+ (pointer)pci->prefix, prefixsize, restsize);
+ RecordAProtocolElement(pContext, pci->client, XRecordClientStarted,
+ (pointer)pci->setup, restsize, /* continuation */ -1);
+ }
+} /* RecordConnectionSetupInfo */
+
+
+/* RecordDeleteContext
+ *
+ * Arguments:
+ * pcbl is &ClientStateCallback.
+ * nullata is NULL.
+ * calldata is a pointer to a NewClientInfoRec (include/dixstruct.h)
+ * which contains information about client state changes.
+ *
+ * Returns: nothing.
+ *
+ * Side Effects:
+ * If a new client has connected and any contexts have specified
+ * XRecordFutureClients, the new client is registered on those contexts.
+ * If any of those contexts specify recording of the connection setup
+ * info, it is recorded.
+ *
+ * If an existing client has disconnected, it is deleted from any
+ * contexts that it was registered on. If any of those contexts
+ * specified XRecordClientDied, they record a ClientDied protocol element.
+ * If the disconnectiong client happened to be the data connection of an
+ * enabled context, the context is disabled.
+ */
+
+static void
+RecordAClientStateChange(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
+{
+ NewClientInfoRec *pci = (NewClientInfoRec *)calldata;
+ int i;
+ ClientPtr pClient = pci->client;
+ RecordContextPtr *ppAllContextsCopy = NULL;
+ int numContextsCopy = 0;
+
+ switch (pClient->clientState)
+ {
+ case ClientStateRunning: /* new client */
+ for (i = 0; i < numContexts; i++)
+ {
+ RecordClientsAndProtocolPtr pRCAP;
+ RecordContextPtr pContext = ppAllContexts[i];
+
+ if ((pRCAP = RecordFindClientOnContext(pContext,
+ XRecordFutureClients, NULL)))
+ {
+ RecordAddClientToRCAP(pRCAP, pClient->clientAsMask);
+ if (pContext->pRecordingClient && pRCAP->clientStarted)
+ RecordConnectionSetupInfo(pContext, pci);
+ }
+ }
+ break;
+
+ case ClientStateGone:
+ case ClientStateRetained: /* client disconnected */
+
+ /* RecordDisableContext modifies contents of ppAllContexts. */
+ numContextsCopy = numContexts;
+ ppAllContextsCopy = malloc(numContextsCopy * sizeof(RecordContextPtr));
+ assert(ppAllContextsCopy);
+ memcpy(ppAllContextsCopy, ppAllContexts, numContextsCopy * sizeof(RecordContextPtr));
+
+ for (i = 0; i < numContextsCopy; i++)
+ {
+ RecordClientsAndProtocolPtr pRCAP;
+ RecordContextPtr pContext = ppAllContextsCopy[i];
+ int pos;
+
+ if (pContext->pRecordingClient == pClient)
+ RecordDisableContext(pContext);
+ if ((pRCAP = RecordFindClientOnContext(pContext,
+ pClient->clientAsMask, &pos)))
+ {
+ if (pContext->pRecordingClient && pRCAP->clientDied)
+ RecordAProtocolElement(pContext, pClient,
+ XRecordClientDied, NULL, 0, 0);
+ RecordDeleteClientFromRCAP(pRCAP, pos);
+ }
+ }
+
+ free(ppAllContextsCopy);
+ break;
+
+ default:
+ break;
+ } /* end switch on client state */
+} /* RecordAClientStateChange */
+
+
+/* RecordCloseDown
+ *
+ * Arguments:
+ * extEntry is the extension information for RECORD.
+ *
+ * Returns: nothing.
+ *
+ * Side Effects:
+ * Performs any cleanup needed by RECORD at server shutdown time.
+ *
+ */
+static void
+RecordCloseDown(ExtensionEntry *extEntry)
+{
+ DeleteCallback(&ClientStateCallback, RecordAClientStateChange, NULL);
+} /* RecordCloseDown */
+
+
+/* RecordExtensionInit
+ *
+ * Arguments: none.
+ *
+ * Returns: nothing.
+ *
+ * Side Effects:
+ * Enables the RECORD extension if possible.
+ */
+void
+RecordExtensionInit(void)
+{
+ ExtensionEntry *extentry;
+
+ RTContext = CreateNewResourceType(RecordDeleteContext, "RecordContext");
+ if (!RTContext)
+ return;
+
+ if (!dixRegisterPrivateKey(RecordClientPrivateKey, PRIVATE_CLIENT, 0))
+ return;
+
+ ppAllContexts = NULL;
+ numContexts = numEnabledContexts = numEnabledRCAPs = 0;
+
+ if (!AddCallback(&ClientStateCallback, RecordAClientStateChange, NULL))
+ return;
+
+ extentry = AddExtension(RECORD_NAME, RecordNumEvents, RecordNumErrors,
+ ProcRecordDispatch, SProcRecordDispatch,
+ RecordCloseDown, StandardMinorOpcode);
+ if (!extentry)
+ {
+ DeleteCallback(&ClientStateCallback, RecordAClientStateChange, NULL);
+ return;
+ }
+ SetResourceTypeErrorValue(RTContext, extentry->errorBase + XRecordBadContext);
+
+} /* RecordExtensionInit */
+
diff --git a/xorg-server/xkeyboard-config/rules/base.ml_s.part b/xorg-server/xkeyboard-config/rules/base.ml_s.part
index 22bf49a92..5d3b46d61 100644
--- a/xorg-server/xkeyboard-config/rules/base.ml_s.part
+++ b/xorg-server/xkeyboard-config/rules/base.ml_s.part
@@ -1,42 +1,41 @@
- ataritt $nonlatin = xfree68_vndr/ataritt(us)+%l%(v):2
- ataritt * = xfree68_vndr/ataritt(us)+%l%(v)
- amiga $nonlatin = xfree68_vndr/amiga(usa1)+%l%(v):2
- amiga * = xfree68_vndr/amiga(usa1)+%l%(v)
- classmate us = pc+%l(classmate)
- empty * = empty(basic)
- * empty = empty(basic)
- sun4 $nonlatin = latin+sun_vndr/us(type4)+%l%(v):2
- sun4 * = latin+sun_vndr/us(type4)+%l%(v)
- sun5 $nonlatin = latin+sun_vndr/us(type5)+%l%(v):2
- sun5 * = latin+sun_vndr/us(type5)+%l%(v)
- sun6 us = pc+sun_vndr/us(type6)
- sun6 en_US = pc+sun_vndr/us(type6)+iso9995-3(basic)
- sun6 $sun_t6_custom = pc+sun_vndr/us(type6)+sun_vndr/%l%(v)
- sun6 * = pc+sun_vndr/us(type6)+%l%(v)
- sun6euro us = pc+sun_vndr/us(type6)
- sun6euro en_US = pc+sun_vndr/us(type6)+iso9995-3(basic)
- sun6euro $sun_t6_custom = pc+sun_vndr/us(type6)+sun_vndr/%l%(v)
- sun6euro * = pc+sun_vndr/us(type6)+%l%(v)
- pc98 nec_vndr/jp = nec_vndr/jp(pc98)
- macintosh_old us = macintosh_vndr/us(oldmac)
- macintosh_old en_US = macintosh_vndr/us(oldmac)
- macintosh_old $macvendorlayouts = macintosh_vndr/us(oldmac)+macintosh_vndr/%l%(v)
- macintosh_old $nonlatin = macintosh_vndr/us(oldmac)+%l%(v):2
- macintosh_old * = macintosh_vndr/us(oldmac)+%l%(v)
- applealu_jis jp = macintosh_vndr/apple(alukbd)+macintosh_vndr/jp(usmac)+macintosh_vndr/jp(mac):2
- applealu_jis * = macintosh_vndr/apple(alukbd)+%l%(v)+macintosh_vndr/jp(mac):2
- $applealu $macvendorlayouts = macintosh_vndr/apple(alukbd)+macintosh_vndr/%l%(v)
- $applealu * = macintosh_vndr/apple(alukbd)+%l%(v)
- $macs en_US = pc+macintosh_vndr/us(extended)
- $macs $macvendorlayouts = pc+macintosh_vndr/%l%(v)
- nokiarx44 * = nokia_vndr/rx-44(%l)
- nokiarx51 cz(qwerty) = nokia_vndr/rx-51(common)+nokia_vndr/rx-51(cz_qwerty)
- nokiarx51 * = nokia_vndr/rx-51(common)+nokia_vndr/rx-51(%l%_v)
- nokiasu8w * = nokia_vndr/su-8w(%l)
- olpc $olpclayouts = olpc+%l%(m)
- olpc * = olpc+%l%(v)
- $thinkpads br = pc+br(thinkpad)
- htcdream $htcdreamlayouts = %l(htcdream)
- * $nonlatin = pc+us+%l%(v):2
- * * = pc+%l%(v)
- htcdream us de it = %l(htcdream)
+ ataritt $nonlatin = xfree68_vndr/ataritt(us)+%l%(v):2
+ ataritt * = xfree68_vndr/ataritt(us)+%l%(v)
+ amiga $nonlatin = xfree68_vndr/amiga(usa1)+%l%(v):2
+ amiga * = xfree68_vndr/amiga(usa1)+%l%(v)
+ classmate us = pc+%l(classmate)
+ empty * = empty(basic)
+ * empty = empty(basic)
+ sun4 $nonlatin = latin+sun_vndr/us(type4)+%l%(v):2
+ sun4 * = latin+sun_vndr/us(type4)+%l%(v)
+ sun5 $nonlatin = latin+sun_vndr/us(type5)+%l%(v):2
+ sun5 * = latin+sun_vndr/us(type5)+%l%(v)
+ sun6 us = pc+sun_vndr/us(type6)
+ sun6 en_US = pc+sun_vndr/us(type6)+iso9995-3(basic)
+ sun6 $sun_t6_custom = pc+sun_vndr/us(type6)+sun_vndr/%l%(v)
+ sun6 * = pc+sun_vndr/us(type6)+%l%(v)
+ sun6euro us = pc+sun_vndr/us(type6)
+ sun6euro en_US = pc+sun_vndr/us(type6)+iso9995-3(basic)
+ sun6euro $sun_t6_custom = pc+sun_vndr/us(type6)+sun_vndr/%l%(v)
+ sun6euro * = pc+sun_vndr/us(type6)+%l%(v)
+ pc98 nec_vndr/jp = nec_vndr/jp(pc98)
+ macintosh_old us = macintosh_vndr/us(oldmac)
+ macintosh_old en_US = macintosh_vndr/us(oldmac)
+ macintosh_old $macvendorlayouts = macintosh_vndr/us(oldmac)+macintosh_vndr/%l%(v)
+ macintosh_old $nonlatin = macintosh_vndr/us(oldmac)+%l%(v):2
+ macintosh_old * = macintosh_vndr/us(oldmac)+%l%(v)
+ applealu_jis jp = macintosh_vndr/apple(alukbd)+macintosh_vndr/jp(usmac)+macintosh_vndr/jp(mac):2
+ applealu_jis * = macintosh_vndr/apple(alukbd)+%l%(v)+macintosh_vndr/jp(mac):2
+ $applealu $macvendorlayouts = macintosh_vndr/apple(alukbd)+macintosh_vndr/%l%(v)
+ $applealu * = macintosh_vndr/apple(alukbd)+%l%(v)
+ $macs en_US = pc+macintosh_vndr/us(extended)
+ $macs $macvendorlayouts = pc+macintosh_vndr/%l%(v)
+ nokiarx44 * = nokia_vndr/rx-44(%l)
+ nokiarx51 cz(qwerty) = nokia_vndr/rx-51(common)+nokia_vndr/rx-51(cz_qwerty)
+ nokiarx51 * = nokia_vndr/rx-51(common)+nokia_vndr/rx-51(%l%_v)
+ nokiasu8w * = nokia_vndr/su-8w(%l)
+ olpc $olpclayouts = olpc+%l%(m)
+ olpc * = olpc+%l%(v)
+ $thinkpads br = pc+br(thinkpad)
+ htcdream $htcdreamlayouts = %l(htcdream)
+ * $nonlatin = pc+us+%l%(v):2
+ * * = pc+%l%(v)